Skip to content

Commit

Permalink
core/entry: Respect syscall number rewrites
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
KAGA-KOKO committed Aug 21, 2020
1 parent 9123e3a commit d88d59b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/entry/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ static long syscall_trace_enter(struct pt_regs *regs, long syscall,

syscall_enter_audit(regs, syscall);

return ret ? : syscall;
/* The above might have changed the syscall number */
return ret ? : syscall_get_nr(current, regs);
}

noinstr long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall)
Expand Down

0 comments on commit d88d59b

Please sign in to comment.