OpenCloudOS-Kernel/kernel/entry
André Rösti 4da4630810 entry: Respect changes to system call number by trace_sys_enter()
[ Upstream commit fb13b11d53875e28e7fbf0c26b288e4ea676aa9f ]

When a probe is registered at the trace_sys_enter() tracepoint, and that
probe changes the system call number, the old system call still gets
executed.  This worked correctly until commit b6ec413461 ("core/entry:
Report syscall correctly for trace and audit"), which removed the
re-evaluation of the syscall number after the trace point.

Restore the original semantics by re-evaluating the system call number
after trace_sys_enter().

The performance impact of this re-evaluation is minimal because it only
takes place when a trace point is active, and compared to the actual trace
point overhead the read from a cache hot variable is negligible.

Fixes: b6ec413461 ("core/entry: Report syscall correctly for trace and audit")
Signed-off-by: André Rösti <an.roesti@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20240311211704.7262-1-an.roesti@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-03 15:28:50 +02:00
..
Makefile kernel: Implement selective syscall userspace redirection 2020-12-02 15:07:56 +01:00
common.c entry: Respect changes to system call number by trace_sys_enter() 2024-04-03 15:28:50 +02:00
common.h kernel: Implement selective syscall userspace redirection 2020-12-02 15:07:56 +01:00
kvm.c entry/kvm: Exit to user mode when TIF_NOTIFY_SIGNAL is set 2022-06-07 11:19:00 -04:00
syscall_user_dispatch.c ptrace: Provide set/get interface for syscall user dispatch 2023-04-16 14:23:07 +02:00