Skip to content

Commit

Permalink
riscv: return -ENOSYS for syscall -1
Browse files Browse the repository at this point in the history
commit cf7b2ae upstream.

Properly return -ENOSYS for syscall -1 instead of leaving the return value
uninitialized.  This fixes the strace teststuite.

Fixes: 5340627 ("riscv: add support for SECCOMP and SECCOMP_FILTER")
Cc: [email protected]
Signed-off-by: Andreas Schwab <[email protected]>
Reviewed-by: Tycho Andersen <[email protected]>
Signed-off-by: Palmer Dabbelt <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
andreas-schwab authored and gregkh committed Jan 19, 2021
1 parent eae7b19 commit 7c4ced3
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions arch/riscv/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7c4ced3

Please sign in to comment.