lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a0e11216-71b0-447f-beab-351d024810fb@linux.dev>
Date: Thu, 28 Aug 2025 13:47:01 +0800
From: Yanteng Si <si.yanteng@...ux.dev>
To: Wentao Guan <guanwentao@...ontech.com>, chenhuacai@...nel.org
Cc: kernel@...0n.name, xry111@...111.site, linux-kernel@...r.kernel.org,
 loongarch@...ts.linux.dev, zhanjun@...ontech.com
Subject: Re: [PATCH] Loongarch: entry: fix syscall_get_arguments() VS
 no-bultin-memcpy

在 8/26/25 7:32 PM, Wentao Guan 写道:
> Loongarch use -fno-builtin-memcpy in Makefile,
> so cause a extra memcpy in syscall hot path:
> 
> syscall_enter_audit
> ->syscall_get_arguments->memcpy(__memcpy_fast)
> ->audit_syscall_entry
> 
> Just avoid memcpy() altogether and write the copying of args from regs
> manually, which shows 5% multi core score up in UnixBench syscall.
5%? Awesome!
> 
> Signed-off-by: Wentao Guan <guanwentao@...ontech.com>
Reviewed-by: Yanteng Si <siyanteng@...oftware.com.cn>

Thanks,
Yanteng
> ---
>   arch/loongarch/include/asm/syscall.h | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/loongarch/include/asm/syscall.h b/arch/loongarch/include/asm/syscall.h
> index 81d2733f7b94..171af2edd569 100644
> --- a/arch/loongarch/include/asm/syscall.h
> +++ b/arch/loongarch/include/asm/syscall.h
> @@ -65,7 +65,11 @@ static inline void syscall_get_arguments(struct task_struct *task,
>   					 unsigned long *args)
>   {
>   	args[0] = regs->orig_a0;
> -	memcpy(&args[1], &regs->regs[5], 5 * sizeof(long));
> +	args[1] = regs->regs[5];
> +	args[2] = regs->regs[6];
> +	args[3] = regs->regs[7];
> +	args[4] = regs->regs[8];
> +	args[5] = regs->regs[9];
>   }
>   
>   static inline void syscall_set_arguments(struct task_struct *task,


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ