summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@kernel.org>2026-07-07 21:06:44 +0200
committerThomas Gleixner <tglx@kernel.org>2026-07-12 12:38:02 +0200
commit622f04e97415e62bd2ab61f7a27e7a296e8467b7 (patch)
treeff5b7e699be07de45c55256279d8e92702ec15ef /include/linux
parent7ba2ba74713c83408cc942b60dd869ab2c34c84f (diff)
ptrace, treewide: Rename ptrace_report_syscall_entry() to ptrace_report_syscall_permit_entry()
The return value of that function is boolean and tells the caller whether to permit the syscall processing or not. Rename the function so the purpose is clear and make the return type bool. 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: Radu Rendec <radu@rendec.net> Reviewed-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com> Acked-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Magnus Lindholm <linmag7@gmail.com> Link: https://patch.msgid.link/20260707190254.280015701@kernel.org
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/entry-common.h25
-rw-r--r--include/linux/ptrace.h13
2 files changed, 18 insertions, 20 deletions
diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
index 99c49a402a9a..07d97def7dcb 100644
--- a/include/linux/entry-common.h
+++ b/include/linux/entry-common.h
@@ -39,21 +39,22 @@
SYSCALL_WORK_SYSCALL_EXIT_TRAP)
/**
- * arch_ptrace_report_syscall_entry - Architecture specific ptrace_report_syscall_entry() wrapper
+ * arch_ptrace_report_syscall_permit_entry - Architecture specific wrapper for
+ * ptrace_report_syscall_permit_entry()
* @regs: Pointer to the register state at syscall entry
*
- * Invoked from syscall_trace_enter() to wrap ptrace_report_syscall_entry().
+ * Invoked from syscall_trace_enter() to wrap ptrace_report_syscall_permit_entry().
*
- * This allows architecture specific ptrace_report_syscall_entry()
+ * This allows architecture specific ptrace_report_syscall_permit_entry()
* implementations. If not defined by the architecture this falls back to
- * to ptrace_report_syscall_entry().
+ * to ptrace_report_syscall_permit_entry().
*/
-static __always_inline int arch_ptrace_report_syscall_entry(struct pt_regs *regs);
+static __always_inline bool arch_ptrace_report_syscall_permit_entry(struct pt_regs *regs);
-#ifndef arch_ptrace_report_syscall_entry
-static __always_inline int arch_ptrace_report_syscall_entry(struct pt_regs *regs)
+#ifndef arch_ptrace_report_syscall_permit_entry
+static __always_inline bool arch_ptrace_report_syscall_permit_entry(struct pt_regs *regs)
{
- return ptrace_report_syscall_entry(regs);
+ return ptrace_report_syscall_permit_entry(regs);
}
#endif
@@ -73,8 +74,6 @@ static inline void syscall_enter_audit(struct pt_regs *regs, long syscall)
static __always_inline long syscall_trace_enter(struct pt_regs *regs, unsigned long work,
long syscall)
{
- long ret = 0;
-
/*
* Handle Syscall User Dispatch. This must comes first, since
* the ABI here can be something that doesn't make sense for
@@ -95,8 +94,8 @@ static __always_inline long syscall_trace_enter(struct pt_regs *regs, unsigned l
/* Handle ptrace */
if (work & (SYSCALL_WORK_SYSCALL_TRACE | SYSCALL_WORK_SYSCALL_EMU)) {
- ret = arch_ptrace_report_syscall_entry(regs);
- if (ret || (work & SYSCALL_WORK_SYSCALL_EMU))
+ if (!arch_ptrace_report_syscall_permit_entry(regs) ||
+ (work & SYSCALL_WORK_SYSCALL_EMU))
return -1L;
}
@@ -137,7 +136,7 @@ static __always_inline long syscall_trace_enter(struct pt_regs *regs, unsigned l
* It handles the following work items:
*
* 1) syscall_work flag dependent invocations of
- * ptrace_report_syscall_entry(), __seccomp_permit_syscall(), trace_sys_enter()
+ * ptrace_report_syscall_permit_entry(), __seccomp_permit_syscall(), trace_sys_enter()
* 2) Invocation of audit_syscall_entry()
*/
static __always_inline long syscall_enter_from_user_mode_work(struct pt_regs *regs, long syscall)
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index ef314f7a9ecc..2839d5c8eaa0 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -405,13 +405,13 @@ extern void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oa
/*
* ptrace report for syscall entry and exit looks identical.
*/
-static inline int ptrace_report_syscall(unsigned long message)
+static inline bool ptrace_report_syscall(unsigned long message)
{
int ptrace = current->ptrace;
int signr;
if (!(ptrace & PT_PTRACED))
- return 0;
+ return true;
signr = ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0),
message);
@@ -424,11 +424,11 @@ static inline int ptrace_report_syscall(unsigned long message)
if (signr)
send_sig(signr, current, 1);
- return fatal_signal_pending(current);
+ return !fatal_signal_pending(current);
}
/**
- * ptrace_report_syscall_entry - task is about to attempt a system call
+ * ptrace_report_syscall_permit_entry - task is about to attempt a system call
* @regs: user register state of current task
*
* This will be called if %SYSCALL_WORK_SYSCALL_TRACE or
@@ -438,7 +438,7 @@ static inline int ptrace_report_syscall(unsigned long message)
* call number and arguments to be tried. It is safe to block here,
* preventing the system call from beginning.
*
- * Returns zero normally, or nonzero if the calling arch code should abort
+ * Returns True normally, or False if the calling architecture code should abort
* the system call. That must prevent normal entry so no system call is
* made. If @task ever returns to user mode after this, its register state
* is unspecified, but should be something harmless like an %ENOSYS error
@@ -447,8 +447,7 @@ static inline int ptrace_report_syscall(unsigned long message)
*
* Called without locks, just after entering kernel mode.
*/
-static inline __must_check int ptrace_report_syscall_entry(
- struct pt_regs *regs)
+static inline __must_check bool ptrace_report_syscall_permit_entry(struct pt_regs *regs)
{
return ptrace_report_syscall(PTRACE_EVENTMSG_SYSCALL_ENTRY);
}