aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-03-23 14:17:37 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2024-03-23 14:17:37 -0700
commit976b029d06607f98f4156d8690d447ea8ed61c84 (patch)
tree389f036711f7764ffeeaaf18b10cc29356285874
parent484193fecd2b6349a6fd1554d306aec646ae1a6a (diff)
parentfb13b11d53875e28e7fbf0c26b288e4ea676aa9f (diff)
downloadlinux-976b029d06607f98f4156d8690d447ea8ed61c84.tar.gz
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()
-rw-r--r--kernel/entry/common.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/entry/common.c b/kernel/entry/common.c
index 88cb3c88aaa5c6..90843cc3858806 100644
--- a/kernel/entry/common.c
+++ b/kernel/entry/common.c
@@ -57,8 +57,14 @@ long syscall_trace_enter(struct pt_regs *regs, long syscall,
/* Either of the above might have changed the syscall number */
syscall = syscall_get_nr(current, regs);
- if (unlikely(work & SYSCALL_WORK_SYSCALL_TRACEPOINT))
+ if (unlikely(work & SYSCALL_WORK_SYSCALL_TRACEPOINT)) {
trace_sys_enter(regs, syscall);
+ /*
+ * Probes or BPF hooks in the tracepoint may have changed the
+ * system call number as well.
+ */
+ syscall = syscall_get_nr(current, regs);
+ }
syscall_enter_audit(regs, syscall);