Skip to content
Commit 84557cd6 authored by Celeste Liu's avatar Celeste Liu Committed by Greg Kroah-Hartman
Browse files

riscv: entry: always initialize regs->a0 to -ENOSYS

[ Upstream commit 61119394631f219e23ce98bcc3eb993a64a8ea64 ]

Otherwise when the tracer changes syscall number to -1, the kernel fails
to initialize a0 with -ENOSYS and subsequently fails to return the error
code of the failed syscall to userspace. For example, it will break
strace syscall tampering.

Fixes: 52449c17

 ("riscv: entry: set a0 = -ENOSYS only when syscall != -1")
Reported-by: default avatar"Dmitry V. Levin" <ldv@strace.io>
Reviewed-by: default avatarBjörn Töpel <bjorn@rivosinc.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarCeleste Liu <CoelacanthusHex@gmail.com>
Link: https://lore.kernel.org/r/20240627142338.5114-2-CoelacanthusHex@gmail.com
Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent e84f4400
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment