Unverified Commit cf7b2ae4 authored by Andreas Schwab's avatar Andreas Schwab Committed by Palmer Dabbelt
Browse files

riscv: return -ENOSYS for syscall -1



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

Fixes: 5340627e ("riscv: add support for SECCOMP and SECCOMP_FILTER")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarAndreas Schwab <schwab@suse.de>
Reviewed-by: default avatarTycho Andersen <tycho@tycho.pizza>
Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
parent e71ba945
Loading
Loading
Loading
Loading
+1 −8
Original line number Original line Diff line number Diff line
@@ -186,14 +186,7 @@ check_syscall_nr:
	 * Syscall number held in a7.
	 * Syscall number held in a7.
	 * If syscall number is above allowed value, redirect to ni_syscall.
	 * If syscall number is above allowed value, redirect to ni_syscall.
	 */
	 */
	bge a7, t0, 1f
	bgeu 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
	/* Call syscall */
	/* Call syscall */
	la s0, sys_call_table
	la s0, sys_call_table
	slli t0, a7, RISCV_LGPTR
	slli t0, a7, RISCV_LGPTR