summaryrefslogtreecommitdiffstats
path: root/arch/blackfin
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-02-12 07:24:34 +0000
committerMike Frysinger <vapier@gentoo.org>2010-03-09 00:30:51 -0500
commit9e228ee9eae97b533d3b3133f76478c70dbd4294 (patch)
tree401bac08d031de57e8353e83663cb51515c905dd /arch/blackfin
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>
Diffstat (limited to 'arch/blackfin')
-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 0a9e458d0f7..6c20044c7f4 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -626,13 +626,6 @@ ENTRY(_system_call)
p0 = [sp + PT_ORIG_P0];
#endif /* CONFIG_IPIPE */
- /* Check the System Call */
- r7 = __NR_syscall;
- /* System call number is passed in P0 */
- r6 = p0;
- cc = r6 < r7;
- if ! cc jump .Lbadsys;
-
/* are we tracing syscalls?*/
r7 = sp;
r6.l = lo(ALIGN_PAGE_MASK);
@@ -645,6 +638,12 @@ ENTRY(_system_call)
CC = BITTST(r7,TIF_SINGLESTEP);
if CC JUMP _sys_trace;
+ /* Make sure the system call # is valid */
+ p4 = __NR_syscall;
+ /* System call number is passed in P0 */
+ cc = p4 <= p0;
+ if cc jump .Lbadsys;
+
/* Execute the appropriate system call */
p4 = p0;
@@ -741,9 +740,14 @@ _sys_trace:
r0 = sp;
pseudo_long_call _syscall_trace_enter, p5;
- /* Execute the appropriate system call */
-
+ /* Make sure the system call # is valid */
p4 = [SP + PT_P0];
+ p3 = __NR_syscall;
+ cc = p3 <= p4;
+ r0 = -ENOSYS;
+ if cc jump .Lsys_trace_badsys;
+
+ /* Execute the appropriate system call */
p5.l = _sys_call_table;
p5.h = _sys_call_table;
p5 = p5 + (p4 << 2);
@@ -761,6 +765,7 @@ _sys_trace:
SP += -12;
call (p5);
SP += 24;
+.Lsys_trace_badsys:
[sp + PT_R0] = r0;
r0 = sp;