Skip to content

Commit 976b029

Browse files
committed
Merge tag 'core-entry-2024-03-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core entry fix from Thomas Gleixner: "A single fix for the generic entry code: The trace_sys_enter() tracepoint can modify the syscall number via kprobes or BPF in pt_regs, but that requires that the syscall number is re-evaluted from pt_regs after the tracepoint. A seccomp fix in that area removed the re-evaluation so the change does not take effect as the code just uses the locally cached number. Restore the original behaviour by re-evaluating the syscall number after the tracepoint" * tag 'core-entry-2024-03-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: entry: Respect changes to system call number by trace_sys_enter()
2 parents 484193f + fb13b11 commit 976b029

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

kernel/entry/common.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,14 @@ long syscall_trace_enter(struct pt_regs *regs, long syscall,
5757
/* Either of the above might have changed the syscall number */
5858
syscall = syscall_get_nr(current, regs);
5959

60-
if (unlikely(work & SYSCALL_WORK_SYSCALL_TRACEPOINT))
60+
if (unlikely(work & SYSCALL_WORK_SYSCALL_TRACEPOINT)) {
6161
trace_sys_enter(regs, syscall);
62+
/*
63+
* Probes or BPF hooks in the tracepoint may have changed the
64+
* system call number as well.
65+
*/
66+
syscall = syscall_get_nr(current, regs);
67+
}
6268

6369
syscall_enter_audit(regs, syscall);
6470

0 commit comments

Comments
 (0)