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>] [day] [month] [year] [list]
Message-Id: <20250826113225.406238-1-guanwentao@uniontech.com>
Date: Tue, 26 Aug 2025 19:32:25 +0800
From: Wentao Guan <guanwentao@...ontech.com>
To: chenhuacai@...nel.org
Cc: kernel@...0n.name,
	xry111@...111.site,
	linux-kernel@...r.kernel.org,
	loongarch@...ts.linux.dev,
	zhanjun@...ontech.com,
	Wentao Guan <guanwentao@...ontech.com>
Subject: [PATCH] Loongarch: entry: fix syscall_get_arguments() VS no-bultin-memcpy

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.

Signed-off-by: Wentao Guan <guanwentao@...ontech.com>
---
 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,
-- 
2.20.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ