Skip to content

Commit d88d59b

Browse files
committed
core/entry: Respect syscall number rewrites
The transcript of the x86 entry code to the generic version failed to reload the syscall number from ptregs after ptrace and seccomp have run, which both can modify the syscall number in ptregs. It returns the original syscall number instead which is obviously not the right thing to do. Reload the syscall number to fix that. Fixes: 142781e ("entry: Provide generic syscall entry functionality") Reported-by: Kyle Huey <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Kyle Huey <[email protected]> Tested-by: Kees Cook <[email protected]> Acked-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9123e3a commit d88d59b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/entry/common.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ static long syscall_trace_enter(struct pt_regs *regs, long syscall,
6565

6666
syscall_enter_audit(regs, syscall);
6767

68-
return ret ? : syscall;
68+
/* The above might have changed the syscall number */
69+
return ret ? : syscall_get_nr(current, regs);
6970
}
7071

7172
noinstr long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall)

0 commit comments

Comments
 (0)