[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251222114737.1334364-8-ruanjinjie@huawei.com>
Date: Mon, 22 Dec 2025 19:47:28 +0800
From: Jinjie Ruan <ruanjinjie@...wei.com>
To: <catalin.marinas@....com>, <will@...nel.org>, <oleg@...hat.com>,
<tglx@...utronix.de>, <peterz@...radead.org>, <luto@...nel.org>,
<shuah@...nel.org>, <kees@...nel.org>, <wad@...omium.org>,
<ruanjinjie@...wei.com>, <kevin.brodsky@....com>, <macro@...am.me.uk>,
<charlie@...osinc.com>, <akpm@...ux-foundation.org>, <ldv@...ace.io>,
<anshuman.khandual@....com>, <mark.rutland@....com>, <thuth@...hat.com>,
<song@...nel.org>, <ryan.roberts@....com>, <ada.coupriediaz@....com>,
<broonie@...nel.org>, <liqiang01@...inos.cn>, <pengcan@...inos.cn>,
<kmal@...k.li>, <dvyukov@...gle.com>, <richard.weiyang@...il.com>,
<reddybalavignesh9979@...il.com>, <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linux-kselftest@...r.kernel.org>
Subject: [PATCH v10 07/16] arm64/ptrace: Not check _TIF_SECCOMP/SYSCALL_EMU for syscall_exit_work()
As syscall_exit_work() do not handle seccomp, so not check _TIF_SECCOMP
for syscall_exit_work().
And as the man manual of PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP
said, "For PTRACE_SYSEMU, continue and stop on entry to the next system
call, which will not be executed. For PTRACE_SYSEMU_SINGLESTEP, do the same
but also singlestep if not a system call.". So only the syscall entry need
to be reported for SYSCALL_EMU, so not check _TIF_SYSCALL_EMU for
syscall_exit_work().
After this, audit_syscall_exit() and report_syscall_exit() will
no longer be called if only SECCOMP and/or SYSCALL_EMU is set.
And remove has_syscall_work() by the way as currently it is only used in
el0_svc_common().
This is another preparation for moving arm64 over to the generic
entry code.
Linkļ¼https://man7.org/linux/man-pages/man2/ptrace.2.html
Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
---
arch/arm64/include/asm/syscall.h | 5 -----
arch/arm64/include/asm/thread_info.h | 3 +++
arch/arm64/kernel/ptrace.c | 2 +-
arch/arm64/kernel/syscall.c | 2 +-
4 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
index b86b2ffa16ef..7746c8f0e045 100644
--- a/arch/arm64/include/asm/syscall.h
+++ b/arch/arm64/include/asm/syscall.h
@@ -120,11 +120,6 @@ static inline int syscall_get_arch(struct task_struct *task)
return AUDIT_ARCH_AARCH64;
}
-static inline bool has_syscall_work(unsigned long flags)
-{
- return unlikely(flags & _TIF_SYSCALL_WORK);
-}
-
int syscall_trace_enter(struct pt_regs *regs, long syscall, unsigned long flags);
void syscall_exit_to_user_mode_work_prepare(struct pt_regs *regs);
diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h
index 24fcd6adaa33..ef1462b9b00b 100644
--- a/arch/arm64/include/asm/thread_info.h
+++ b/arch/arm64/include/asm/thread_info.h
@@ -110,6 +110,9 @@ void arch_setup_new_exec(void);
_TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \
_TIF_SYSCALL_EMU)
+#define _TIF_SYSCALL_EXIT_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
+ _TIF_SYSCALL_TRACEPOINT)
+
#ifdef CONFIG_SHADOW_CALL_STACK
#define INIT_SCS \
.scs_base = init_shadow_call_stack, \
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 95f8ea21680a..ec818940114e 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -2457,7 +2457,7 @@ void syscall_exit_to_user_mode_work_prepare(struct pt_regs *regs)
rseq_syscall(regs);
- if (has_syscall_work(flags) || flags & _TIF_SINGLESTEP)
+ if (unlikely(flags & _TIF_SYSCALL_EXIT_WORK) || flags & _TIF_SINGLESTEP)
syscall_exit_work(regs, flags);
}
diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c
index 76c9c6fc1b30..80b7fd67492e 100644
--- a/arch/arm64/kernel/syscall.c
+++ b/arch/arm64/kernel/syscall.c
@@ -101,7 +101,7 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr,
return;
}
- if (has_syscall_work(flags)) {
+ if (unlikely(flags & _TIF_SYSCALL_WORK)) {
/*
* The de-facto standard way to skip a system call using ptrace
* is to set the system call to -1 (NO_SYSCALL) and set x0 to a
--
2.34.1
Powered by blists - more mailing lists