[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e76df471-1346-459a-9f24-fa053d7dcbe8@csgroup.eu>
Date: Tue, 28 Jan 2025 16:13:52 +0100
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: "Dmitry V. Levin" <ldv@...ace.io>, Oleg Nesterov <oleg@...hat.com>
Cc: Alexey Gladkov <legion@...nel.org>, Charlie Jenkins
<charlie@...osinc.com>, Eugene Syromyatnikov <evgsyr@...il.com>,
Mike Frysinger <vapier@...too.org>, Renzo Davoli <renzo@...unibo.it>,
Davide Berardi <berardi.dav@...il.com>, strace-devel@...ts.strace.io,
Vineet Gupta <vgupta@...nel.org>, Russell King <linux@...linux.org.uk>,
Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>,
Brian Cain <bcain@...cinc.com>, Huacai Chen <chenhuacai@...nel.org>,
WANG Xuerui <kernel@...0n.name>, Geert Uytterhoeven <geert@...ux-m68k.org>,
Michal Simek <monstr@...str.eu>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Dinh Nguyen <dinguyen@...nel.org>, Jonas Bonn <jonas@...thpole.se>,
Stefan Kristiansson <stefan.kristiansson@...nalahti.fi>,
Stafford Horne <shorne@...il.com>,
"James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
Helge Deller <deller@....de>, Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>, Naveen N Rao <naveen@...nel.org>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Paul Walmsley <paul.walmsley@...ive.com>, Palmer Dabbelt
<palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>,
Heiko Carstens <hca@...ux.ibm.com>, Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>,
Yoshinori Sato <ysato@...rs.sourceforge.jp>, Rich Felker <dalias@...c.org>,
John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>,
"David S. Miller" <davem@...emloft.net>,
Andreas Larsson <andreas@...sler.com>, Richard Weinberger <richard@....at>,
Anton Ivanov <anton.ivanov@...bridgegreys.com>,
Johannes Berg <johannes@...solutions.net>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Chris Zankel <chris@...kel.net>, Max Filippov <jcmvbkbc@...il.com>,
Arnd Bergmann <arnd@...db.de>, linux-snps-arc@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-hexagon@...r.kernel.org, loongarch@...ts.linux.dev,
linux-m68k@...ts.linux-m68k.org, linux-mips@...r.kernel.org,
linux-openrisc@...r.kernel.org, linux-parisc@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, linux-riscv@...ts.infradead.org,
linux-s390@...r.kernel.org, linux-sh@...r.kernel.org,
sparclinux@...r.kernel.org, linux-um@...ts.infradead.org,
linux-arch@...r.kernel.org
Subject: Re: [PATCH v3 3/6] syscall.h: introduce syscall_set_nr()
Le 28/01/2025 à 10:16, Dmitry V. Levin a écrit :
> Similar to syscall_set_arguments() that complements
> syscall_get_arguments(), introduce syscall_set_nr()
> that complements syscall_get_nr().
>
> syscall_set_nr() is going to be needed along with
> syscall_set_arguments() on all HAVE_ARCH_TRACEHOOK
> architectures to implement PTRACE_SET_SYSCALL_INFO API.
>
> Signed-off-by: Dmitry V. Levin <ldv@...ace.io>
> Tested-by: Charlie Jenkins <charlie@...osinc.com>
> Reviewed-by: Charlie Jenkins <charlie@...osinc.com>
> ---
> arch/arc/include/asm/syscall.h | 11 +++++++++++
> arch/arm/include/asm/syscall.h | 24 ++++++++++++++++++++++++
> arch/arm64/include/asm/syscall.h | 16 ++++++++++++++++
> arch/hexagon/include/asm/syscall.h | 7 +++++++
> arch/loongarch/include/asm/syscall.h | 7 +++++++
> arch/m68k/include/asm/syscall.h | 7 +++++++
> arch/microblaze/include/asm/syscall.h | 7 +++++++
> arch/mips/include/asm/syscall.h | 14 ++++++++++++++
> arch/nios2/include/asm/syscall.h | 5 +++++
> arch/openrisc/include/asm/syscall.h | 6 ++++++
> arch/parisc/include/asm/syscall.h | 7 +++++++
> arch/powerpc/include/asm/syscall.h | 10 ++++++++++
> arch/riscv/include/asm/syscall.h | 7 +++++++
> arch/s390/include/asm/syscall.h | 12 ++++++++++++
> arch/sh/include/asm/syscall_32.h | 12 ++++++++++++
> arch/sparc/include/asm/syscall.h | 12 ++++++++++++
> arch/um/include/asm/syscall-generic.h | 5 +++++
> arch/x86/include/asm/syscall.h | 7 +++++++
> arch/xtensa/include/asm/syscall.h | 7 +++++++
> include/asm-generic/syscall.h | 14 ++++++++++++++
> 20 files changed, 197 insertions(+)
>
> diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
> index 76020b66286b..712daa90e643 100644
> --- a/arch/arm64/include/asm/syscall.h
> +++ b/arch/arm64/include/asm/syscall.h
> @@ -61,6 +61,22 @@ static inline void syscall_set_return_value(struct task_struct *task,
> regs->regs[0] = val;
> }
>
> +static inline void syscall_set_nr(struct task_struct *task,
> + struct pt_regs *regs,
> + int nr)
> +{
> + regs->syscallno = nr;
> + if (nr == -1) {
> + /*
> + * When the syscall number is set to -1, the syscall will be
> + * skipped. In this case the syscall return value has to be
> + * set explicitly, otherwise the first syscall argument is
> + * returned as the syscall return value.
> + */
> + syscall_set_return_value(task, regs, -ENOSYS, 0);
> + }
> +}
> +
> #define SYSCALL_MAX_ARGS 6
>
> static inline void syscall_get_arguments(struct task_struct *task,
> diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
> index 521f279e6b33..7505dcfed247 100644
> --- a/arch/powerpc/include/asm/syscall.h
> +++ b/arch/powerpc/include/asm/syscall.h
> @@ -39,6 +39,16 @@ static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
> return -1;
> }
>
> +static inline void syscall_set_nr(struct task_struct *task, struct pt_regs *regs, int nr)
> +{
> + /*
> + * Unlike syscall_get_nr(), syscall_set_nr() can be called only when
> + * the target task is stopped for tracing on entering syscall, so
> + * there is no need to have the same check syscall_get_nr() has.
> + */
> + regs->gpr[0] = nr;
Doesn't the same as for ARM64 apply here as well ?
> +}
> +
> static inline void syscall_rollback(struct task_struct *task,
> struct pt_regs *regs)
> {
Powered by blists - more mailing lists