]> git.hungrycats.org Git - linux/commit
entry: Respect changes to system call number by trace_sys_enter()
authorAndré Rösti <an.roesti@gmail.com>
Mon, 11 Mar 2024 21:17:04 +0000 (21:17 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:11:43 +0000 (15:11 +0200)
commit6b8c3523e47740bbbdc87c20008cd5352ffdb5b2
tree438ee5c6fa122c32ad3f8cc4086dd5e94096fca4
parent9f7ddc222cae8254e93d5c169a8ae11a49d912a7
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 b6ec41346103 ("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: b6ec41346103 ("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>
kernel/entry/common.c