lkml.org 
[lkml]   [2022]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 04/13] ptrace: Remove arch_syscall_{enter,exit}_tracehook
    These functions are alwasy one-to-one wrappers around
    ptrace_report_syscall_entry and ptrace_report_syscall_exit.
    So directly call the functions they are wrapping instead.

    Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
    ---
    include/linux/entry-common.h | 43 ++----------------------------------
    kernel/entry/common.c | 4 ++--
    2 files changed, 4 insertions(+), 43 deletions(-)

    diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
    index a670e9fba7a9..9efbdda61f7a 100644
    --- a/include/linux/entry-common.h
    +++ b/include/linux/entry-common.h
    @@ -79,26 +79,6 @@ static __always_inline void arch_check_user_regs(struct pt_regs *regs);
    static __always_inline void arch_check_user_regs(struct pt_regs *regs) {}
    #endif

    -/**
    - * arch_syscall_enter_tracehook - Wrapper around tracehook_report_syscall_entry()
    - * @regs: Pointer to currents pt_regs
    - *
    - * Returns: 0 on success or an error code to skip the syscall.
    - *
    - * Defaults to tracehook_report_syscall_entry(). Can be replaced by
    - * architecture specific code.
    - *
    - * Invoked from syscall_enter_from_user_mode()
    - */
    -static inline __must_check int arch_syscall_enter_tracehook(struct pt_regs *regs);
    -
    -#ifndef arch_syscall_enter_tracehook
    -static inline __must_check int arch_syscall_enter_tracehook(struct pt_regs *regs)
    -{
    - return ptrace_report_syscall_entry(regs);
    -}
    -#endif
    -
    /**
    * enter_from_user_mode - Establish state when coming from user mode
    *
    @@ -157,7 +137,7 @@ void syscall_enter_from_user_mode_prepare(struct pt_regs *regs);
    * It handles the following work items:
    *
    * 1) syscall_work flag dependent invocations of
    - * arch_syscall_enter_tracehook(), __secure_computing(), trace_sys_enter()
    + * ptrace_report_syscall_entry(), __secure_computing(), trace_sys_enter()
    * 2) Invocation of audit_syscall_entry()
    */
    long syscall_enter_from_user_mode_work(struct pt_regs *regs, long syscall);
    @@ -279,25 +259,6 @@ static __always_inline void arch_exit_to_user_mode(void) { }
    */
    void arch_do_signal_or_restart(struct pt_regs *regs, bool has_signal);

    -/**
    - * arch_syscall_exit_tracehook - Wrapper around tracehook_report_syscall_exit()
    - * @regs: Pointer to currents pt_regs
    - * @step: Indicator for single step
    - *
    - * Defaults to tracehook_report_syscall_exit(). Can be replaced by
    - * architecture specific code.
    - *
    - * Invoked from syscall_exit_to_user_mode()
    - */
    -static inline void arch_syscall_exit_tracehook(struct pt_regs *regs, bool step);
    -
    -#ifndef arch_syscall_exit_tracehook
    -static inline void arch_syscall_exit_tracehook(struct pt_regs *regs, bool step)
    -{
    - ptrace_report_syscall_exit(regs, step);
    -}
    -#endif
    -
    /**
    * exit_to_user_mode - Fixup state when exiting to user mode
    *
    @@ -347,7 +308,7 @@ void syscall_exit_to_user_mode_work(struct pt_regs *regs);
    * - rseq syscall exit
    * - audit
    * - syscall tracing
    - * - tracehook (single stepping)
    + * - ptrace (single stepping)
    *
    * 2) Preparatory work
    * - Exit to user mode loop (common TIF handling). Invokes
    diff --git a/kernel/entry/common.c b/kernel/entry/common.c
    index f52e57c4d6d8..f0b1daa1e8da 100644
    --- a/kernel/entry/common.c
    +++ b/kernel/entry/common.c
    @@ -59,7 +59,7 @@ static long syscall_trace_enter(struct pt_regs *regs, long syscall,

    /* Handle ptrace */
    if (work & (SYSCALL_WORK_SYSCALL_TRACE | SYSCALL_WORK_SYSCALL_EMU)) {
    - ret = arch_syscall_enter_tracehook(regs);
    + ret = ptrace_report_syscall_entry(regs);
    if (ret || (work & SYSCALL_WORK_SYSCALL_EMU))
    return -1L;
    }
    @@ -253,7 +253,7 @@ static void syscall_exit_work(struct pt_regs *regs, unsigned long work)

    step = report_single_step(work);
    if (step || work & SYSCALL_WORK_SYSCALL_TRACE)
    - arch_syscall_exit_tracehook(regs, step);
    + ptrace_report_syscall_exit(regs, step);
    }

    /*
    --
    2.29.2
    \
     
     \ /
      Last update: 2022-03-09 17:45    [W:4.282 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site