aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-02-12 02:24:34 -0500
committerMike Frysinger <vapier@gentoo.org>2010-03-09 00:30:51 -0500
commit9e228ee9eae97b533d3b3133f76478c70dbd4294 (patch)
tree401bac08d031de57e8353e83663cb51515c905dd
parent600482c13d3d3612d71f39d8aaec47f63aafa801 (diff)
Blackfin: check for bad syscalls after tracing it
We want to report all system calls (even invalid ones) to the tracing layers, so check the NR only after we've notified. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--arch/blackfin/mach-common/entry.S23
1 files changed, 14 insertions, 9 deletions
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index 0a9e458d0f7e..6c20044c7f4c 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -626,13 +626,6 @@ ENTRY(_system_call)
626 p0 = [sp + PT_ORIG_P0]; 626 p0 = [sp + PT_ORIG_P0];
627#endif /* CONFIG_IPIPE */ 627#endif /* CONFIG_IPIPE */
628 628
629 /* Check the System Call */
630 r7 = __NR_syscall;
631 /* System call number is passed in P0 */
632 r6 = p0;
633 cc = r6 < r7;
634 if ! cc jump .Lbadsys;
635
636 /* are we tracing syscalls?*/ 629 /* are we tracing syscalls?*/
637 r7 = sp; 630 r7 = sp;
638 r6.l = lo(ALIGN_PAGE_MASK); 631 r6.l = lo(ALIGN_PAGE_MASK);
@@ -645,6 +638,12 @@ ENTRY(_system_call)
645 CC = BITTST(r7,TIF_SINGLESTEP); 638 CC = BITTST(r7,TIF_SINGLESTEP);
646 if CC JUMP _sys_trace; 639 if CC JUMP _sys_trace;
647 640
641 /* Make sure the system call # is valid */
642 p4 = __NR_syscall;
643 /* System call number is passed in P0 */
644 cc = p4 <= p0;
645 if cc jump .Lbadsys;
646
648 /* Execute the appropriate system call */ 647 /* Execute the appropriate system call */
649 648
650 p4 = p0; 649 p4 = p0;
@@ -741,9 +740,14 @@ _sys_trace:
741 r0 = sp; 740 r0 = sp;
742 pseudo_long_call _syscall_trace_enter, p5; 741 pseudo_long_call _syscall_trace_enter, p5;
743 742
744 /* Execute the appropriate system call */ 743 /* Make sure the system call # is valid */
745
746 p4 = [SP + PT_P0]; 744 p4 = [SP + PT_P0];
745 p3 = __NR_syscall;
746 cc = p3 <= p4;
747 r0 = -ENOSYS;
748 if cc jump .Lsys_trace_badsys;
749
750 /* Execute the appropriate system call */
747 p5.l = _sys_call_table; 751 p5.l = _sys_call_table;
748 p5.h = _sys_call_table; 752 p5.h = _sys_call_table;
749 p5 = p5 + (p4 << 2); 753 p5 = p5 + (p4 << 2);
@@ -761,6 +765,7 @@ _sys_trace:
761 SP += -12; 765 SP += -12;
762 call (p5); 766 call (p5);
763 SP += 24; 767 SP += 24;
768.Lsys_trace_badsys:
764 [sp + PT_R0] = r0; 769 [sp + PT_R0] = r0;
765 770
766 r0 = sp; 771 r0 = sp;