From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 181E431354B; Mon, 24 Nov 2025 15:23:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763997792; cv=none; b=F79O86yVvU3hCxm/tvZESaysn3cPSpeApnrS+ipwl7tlI7EK52GZgyAxKMcrCvb6vtmW6427MIKKFEn2y/wSKzF/4qiLKnRbNM0IEyux/VDS73XF0tkHFJ3fUOPVh58KVRZdYps6XtWyjJWptPJbCdVQubURqy4v5dEBvypbAUg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763997792; c=relaxed/simple; bh=dwWoae4wa4SIvMvPE5ESyCV6t+69Zbvk5VgClXWEPC4=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=l8uokYZokagu+h4aQmHJQ3la72kHa4SgxQN1d0DlRcd7dwu/MWxGkOb6rM9PRpYlCeERqNzVO8/LvI/e6yMn+XifKyq+T4+XTyMBq/AwuH2yaM/rAMBiAfTKlUEyaMp5tRIqFHEWiT1qVIWy++PcrAI+T6AkvtWSoyiaLoho01s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6F081497; Mon, 24 Nov 2025 07:23:01 -0800 (PST) Received: from [10.57.40.218] (unknown [10.57.40.218]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 02BE23F73B; Mon, 24 Nov 2025 07:23:03 -0800 (PST) Message-ID: <247aa84f-0550-42d9-8d65-615297e78a74@arm.com> Date: Mon, 24 Nov 2025 16:23:01 +0100 Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 08/11] entry: Add arch_ptrace_report_syscall_entry/exit() To: Jinjie Ruan , catalin.marinas@arm.com, will@kernel.org, oleg@redhat.com, tglx@linutronix.de, peterz@infradead.org, luto@kernel.org, shuah@kernel.org, kees@kernel.org, wad@chromium.org, akpm@linux-foundation.org, ldv@strace.io, macro@orcam.me.uk, deller@gmx.de, mark.rutland@arm.com, song@kernel.org, mbenes@suse.cz, ryan.roberts@arm.com, ada.coupriediaz@arm.com, anshuman.khandual@arm.com, broonie@kernel.org, pengcan@kylinos.cn, dvyukov@google.com, kmal@cock.li, lihongbo22@huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20251117133048.53182-1-ruanjinjie@huawei.com> <20251117133048.53182-9-ruanjinjie@huawei.com> <55e1345f-94d7-41a9-8f0a-694fd56f63ed@arm.com> <8489ee0d-8b9c-080a-04a0-b299549e86cf@huawei.com> Content-Language: en-GB From: Kevin Brodsky In-Reply-To: <8489ee0d-8b9c-080a-04a0-b299549e86cf@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 24/11/2025 10:34, Jinjie Ruan wrote: > > On 2025/11/19 1:13, Kevin Brodsky wrote: >> On 17/11/2025 14:30, Jinjie Ruan wrote: >>> [...] >>> >>> diff --git a/kernel/entry/syscall-common.c b/kernel/entry/syscall-common.c >>> index 66e6ba7fa80c..27310e611567 100644 >>> --- a/kernel/entry/syscall-common.c >>> +++ b/kernel/entry/syscall-common.c >>> @@ -17,6 +17,25 @@ static inline void syscall_enter_audit(struct pt_regs *regs, long syscall) >>> } >>> } >>> >>> +/** >>> + * arch_ptrace_report_syscall_entry - Architecture specific >>> + * ptrace_report_syscall_entry(). >>> + * >>> + * Invoked from syscall_trace_enter() to wrap ptrace_report_syscall_entry(). >>> + * Defaults to ptrace_report_syscall_entry. >>> + * >>> + * The main purpose is to support arch-specific ptrace_report_syscall_entry() >>> + * implementation. >>> + */ >>> +static __always_inline int arch_ptrace_report_syscall_entry(struct pt_regs *regs); >>> + >>> +#ifndef arch_ptrace_report_syscall_entry >>> +static __always_inline int arch_ptrace_report_syscall_entry(struct pt_regs *regs) >>> +{ >>> + return ptrace_report_syscall_entry(regs); >> I saw that Thomas suggested this approach on v4, and it makes sense to >> me, but I find the naming surprising. If an architecture does need extra >> handling, then the generic function should never be called from generic >> code. So it seems to me that the more logical change would be: >> >> * Rename: ptrace_report_syscall_entry -> __ptrace_report_syscall_entry >> * Introduce ptrace_report_syscall_entry(), defaults to >> __ptrace_report_syscall_entry() > If ptrace_report_syscall_entry() is defined in linux/ptrace.h, and an > architecture also needs to redefine this function, but the > architecture's own must include , > the function will end up being defined twice and cause a "duplicate > definition" compile error. There's plenty of arch-defined functions in already. __ptrace_report_syscall_entry() should be defined inside an #ifndef and architectures can define their own implementation in , like force_successful_syscall_return() for instance. - Kevin >> All this would be done in , where it clearly belongs. >> The __ prefix makes it clear that the generic function is not the main >> interface. Even better, no need to change any caller with that approach. >> >> - Kevin >> >>> [...]