mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
entry: Remove syscall_enter_from_user_mode()
All architecture use either:
nr = syscall_enter_from_user_mode_randomize_stack(regs, nr);
or
enter_from_user_mode_randomize_stack(regs);
nr = syscall_enter_from_user_mode_work(regs, nr);
Remove the now unused function.
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Tested-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
Reviewed-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
Link: https://patch.msgid.link/20260707190254.132654198@kernel.org
This commit is contained in:
@@ -68,7 +68,7 @@ invoked from low-level assembly code looks like this:
|
||||
noinstr void syscall(struct pt_regs *regs, int nr)
|
||||
{
|
||||
arch_syscall_enter(regs);
|
||||
nr = syscall_enter_from_user_mode(regs, nr);
|
||||
nr = syscall_enter_from_user_mode_randomize_stack(regs, nr);
|
||||
|
||||
instrumentation_begin();
|
||||
if (!invoke_syscall(regs, nr) && nr != -1)
|
||||
@@ -78,12 +78,14 @@ invoked from low-level assembly code looks like this:
|
||||
syscall_exit_to_user_mode(regs);
|
||||
}
|
||||
|
||||
syscall_enter_from_user_mode() first invokes enter_from_user_mode() which
|
||||
establishes state in the following order:
|
||||
syscall_enter_from_user_mode_randomize_stack() first invokes
|
||||
enter_from_user_mode_randomize_stack() which establishes state in the
|
||||
following order:
|
||||
|
||||
* Lockdep
|
||||
* RCU / Context tracking
|
||||
* Tracing
|
||||
* Apply stack randomization
|
||||
|
||||
and then invokes the various entry work functions like ptrace, seccomp, audit,
|
||||
syscall tracing, etc. After all that is done, the instrumentable invoke_syscall
|
||||
@@ -99,10 +101,11 @@ transition in the reverse order:
|
||||
* RCU / Context tracking
|
||||
* Lockdep
|
||||
|
||||
syscall_enter_from_user_mode() and syscall_exit_to_user_mode() are also
|
||||
available as fine grained subfunctions in cases where the architecture code
|
||||
has to do extra work between the various steps. In such cases it has to
|
||||
ensure that enter_from_user_mode() is called first on entry and
|
||||
syscall_enter_from_user_mode_randomize_stack() and
|
||||
syscall_exit_to_user_mode() are also available as fine grained subfunctions
|
||||
in cases where the architecture code has to do extra work between the
|
||||
various steps. In such cases it has to ensure that
|
||||
enter_from_user_mode_randomize_stack() is called first on entry and
|
||||
exit_to_user_mode() is called last on exit.
|
||||
|
||||
Do not nest syscalls. Nested syscalls will cause RCU and/or context tracking
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SYSCALL_WORK flags handled in syscall_enter_from_user_mode()
|
||||
* SYSCALL_WORK flags handled in syscall_enter_from_user_mode_work()
|
||||
*/
|
||||
#define SYSCALL_WORK_ENTER (SYSCALL_WORK_SECCOMP | \
|
||||
SYSCALL_WORK_SYSCALL_TRACEPOINT | \
|
||||
@@ -205,42 +205,10 @@ do { \
|
||||
_ret; \
|
||||
})
|
||||
|
||||
/**
|
||||
* syscall_enter_from_user_mode - Establish state and check and handle work
|
||||
* before invoking a syscall
|
||||
* @regs: Pointer to currents pt_regs
|
||||
* @syscall: The syscall number
|
||||
*
|
||||
* Invoked from architecture specific syscall entry code with interrupts
|
||||
* disabled. The calling code has to be non-instrumentable. When the
|
||||
* function returns all state is correct, interrupts are enabled and the
|
||||
* subsequent functions can be instrumented.
|
||||
*
|
||||
* This is the combination of enter_from_user_mode() and
|
||||
* syscall_enter_from_user_mode_work() to be used when there is no
|
||||
* architecture specific work to be done between the two.
|
||||
*
|
||||
* Returns: The original or a modified syscall number. See
|
||||
* syscall_enter_from_user_mode_work() for further explanation.
|
||||
*/
|
||||
static __always_inline long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall)
|
||||
{
|
||||
long ret;
|
||||
|
||||
enter_from_user_mode(regs);
|
||||
|
||||
instrumentation_begin();
|
||||
local_irq_enable();
|
||||
ret = syscall_enter_from_user_mode_work(regs, syscall);
|
||||
instrumentation_end();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* If SYSCALL_EMU is set, then the only reason to report is when
|
||||
* SINGLESTEP is set (i.e. PTRACE_SYSEMU_SINGLESTEP). This syscall
|
||||
* instruction has been already reported in syscall_enter_from_user_mode().
|
||||
* If SYSCALL_EMU is set, then the only reason to report is when SINGLESTEP is
|
||||
* set (i.e. PTRACE_SYSEMU_SINGLESTEP). This syscall instruction has been
|
||||
* already reported in syscall_enter_from_user_mode_work().
|
||||
*/
|
||||
static __always_inline bool report_single_step(unsigned long work)
|
||||
{
|
||||
|
||||
@@ -49,9 +49,9 @@
|
||||
* Defaults to an empty implementation. Can be replaced by architecture
|
||||
* specific code.
|
||||
*
|
||||
* Invoked from syscall_enter_from_user_mode() in the non-instrumentable
|
||||
* section. Use __always_inline so the compiler cannot push it out of line
|
||||
* and make it instrumentable.
|
||||
* Invoked from enter_from_user_mode() in the non-instrumentable section. Use
|
||||
* __always_inline so the compiler cannot push it out of line and make it
|
||||
* instrumentable.
|
||||
*/
|
||||
static __always_inline void arch_enter_from_user_mode(struct pt_regs *regs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user