Commit c323bae0 authored by Markos Chandras's avatar Markos Chandras Committed by Kamal Mostafa

MIPS: Fix seccomp syscall argument for MIPS64

commit 9f161439 upstream.

Commit 4c21b8fd ("MIPS: seccomp: Handle indirect system calls (o32)")
fixed indirect system calls on O32 but it also introduced a bug for MIPS64
where it erroneously modified the v0 (syscall) register with the assumption
that the sycall offset hasn't been taken into consideration. This breaks
seccomp on MIPS64 n64 and n32 ABIs. We fix this by replacing the addition
with a move instruction.

Fixes: 4c21b8fd ("MIPS: seccomp: Handle indirect system calls (o32)")
Reviewed-by: default avatarJames Hogan <james.hogan@imgtec.com>
Signed-off-by: default avatarMarkos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/10951/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 54cd766f
...@@ -80,7 +80,7 @@ syscall_trace_entry: ...@@ -80,7 +80,7 @@ syscall_trace_entry:
SAVE_STATIC SAVE_STATIC
move s0, t2 move s0, t2
move a0, sp move a0, sp
daddiu a1, v0, __NR_64_Linux move a1, v0
jal syscall_trace_enter jal syscall_trace_enter
bltz v0, 2f # seccomp failed? Skip syscall bltz v0, 2f # seccomp failed? Skip syscall
......
...@@ -72,7 +72,7 @@ n32_syscall_trace_entry: ...@@ -72,7 +72,7 @@ n32_syscall_trace_entry:
SAVE_STATIC SAVE_STATIC
move s0, t2 move s0, t2
move a0, sp move a0, sp
daddiu a1, v0, __NR_N32_Linux move a1, v0
jal syscall_trace_enter jal syscall_trace_enter
bltz v0, 2f # seccomp failed? Skip syscall bltz v0, 2f # seccomp failed? Skip syscall
......
Markdown is supported
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