riscv: return -ENOSYS for syscall -1
authorAndreas Schwab <schwab@suse.de>
Mon, 21 Dec 2020 22:52:00 +0000 (23:52 +0100)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Fri, 8 Jan 2021 02:01:34 +0000 (18:01 -0800)
Properly return -ENOSYS for syscall -1 instead of leaving the return value
uninitialized.  This fixes the strace teststuite.

Fixes: 5340627e3fe0 ("riscv: add support for SECCOMP and SECCOMP_FILTER")
Cc: stable@vger.kernel.org
Signed-off-by: Andreas Schwab <schwab@suse.de>
Reviewed-by: Tycho Andersen <tycho@tycho.pizza>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/kernel/entry.S

index 524d918..d077630 100644 (file)
@@ -186,14 +186,7 @@ check_syscall_nr:
         * Syscall number held in a7.
         * If syscall number is above allowed value, redirect to ni_syscall.
         */
-       bge a7, t0, 1f
-       /*
-        * Check if syscall is rejected by tracer, i.e., a7 == -1.
-        * If yes, we pretend it was executed.
-        */
-       li t1, -1
-       beq a7, t1, ret_from_syscall_rejected
-       blt a7, t1, 1f
+       bgeu a7, t0, 1f
        /* Call syscall */
        la s0, sys_call_table
        slli t0, a7, RISCV_LGPTR