MIPS: kernel: scalls: Skip the syscall if denied by the seccomp filter
authorMarkos Chandras <markos.chandras@imgtec.com>
Wed, 22 Jan 2014 14:40:02 +0000 (14:40 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 26 Mar 2014 22:09:08 +0000 (23:09 +0100)
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6399/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/scall32-o32.S
arch/mips/kernel/scall64-64.S
arch/mips/kernel/scall64-n32.S
arch/mips/kernel/scall64-o32.S

index a5b14f48e1af805af4aaff1b4d6f17fff0beffe9..1789a801802ee2c5a1e992f6fcaecbb98840a1fa 100644 (file)
@@ -120,6 +120,8 @@ syscall_trace_entry:
        move    a0, sp
        jal     syscall_trace_enter
 
+       bltz    v0, 2f                  # seccomp failed? Skip syscall
+
        move    t0, s0
        RESTORE_STATIC
        lw      a0, PT_R4(sp)           # Restore argument registers
@@ -138,7 +140,7 @@ syscall_trace_entry:
        sw      t1, PT_R0(sp)           # save it for syscall restarting
 1:     sw      v0, PT_R2(sp)           # result
 
-       j       syscall_exit
+2:     j       syscall_exit
 
 /* ------------------------------------------------------------------------ */
 
index b56e254beb15b6bb91078b43e1c13b4ea5b83bd3..7f5d88be6b9e0fc9f9dda616c115a297ff5bd75f 100644 (file)
@@ -82,6 +82,8 @@ syscall_trace_entry:
        move    a0, sp
        jal     syscall_trace_enter
 
+       bltz    v0, 2f                  # seccomp failed? Skip syscall
+
        move    t0, s0
        RESTORE_STATIC
        ld      a0, PT_R4(sp)           # Restore argument registers
@@ -102,7 +104,7 @@ syscall_trace_entry:
        sd      t1, PT_R0(sp)           # save it for syscall restarting
 1:     sd      v0, PT_R2(sp)           # result
 
-       j       syscall_exit
+2:     j       syscall_exit
 
 illegal_syscall:
        /* This also isn't a 64-bit syscall, throw an error.  */
index f7e5b72cf481256103919641267714e6c9e59742..b6e15861bd1ba4bcc6b5f6318f7476a5f8c63dec 100644 (file)
@@ -74,6 +74,8 @@ n32_syscall_trace_entry:
        move    a0, sp
        jal     syscall_trace_enter
 
+       bltz    v0, 2f                  # seccomp failed? Skip syscall
+
        move    t0, s0
        RESTORE_STATIC
        ld      a0, PT_R4(sp)           # Restore argument registers
@@ -94,7 +96,7 @@ n32_syscall_trace_entry:
        sd      t1, PT_R0(sp)           # save it for syscall restarting
 1:     sd      v0, PT_R2(sp)           # result
 
-       j       syscall_exit
+2:     j       syscall_exit
 
 not_n32_scall:
        /* This is not an n32 compatibility syscall, pass it on to
index 6788727d91af1f79da1af76fbb0e7c3cc99ec600..67dc022f682602447908db4498b6b204ffc2f7b3 100644 (file)
@@ -114,6 +114,8 @@ trace_a_syscall:
        move    a0, sp
        jal     syscall_trace_enter
 
+       bltz    v0, 2f                  # seccomp failed? Skip syscall
+
        move    t0, s0
        RESTORE_STATIC
        ld      a0, PT_R4(sp)           # Restore argument registers
@@ -136,7 +138,7 @@ trace_a_syscall:
        sd      t1, PT_R0(sp)           # save it for syscall restarting
 1:     sd      v0, PT_R2(sp)           # result
 
-       j       syscall_exit
+2:     j       syscall_exit
 
 /* ------------------------------------------------------------------------ */