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: <EE51449BC2104F82+20250320102314.2062639-1-wangyuli@uniontech.com>
Date: Thu, 20 Mar 2025 18:23:14 +0800
From: WangYuli <wangyuli@...ontech.com>
To: chenhuacai@...nel.org,
	kernel@...0n.name
Cc: wangyuli@...ontech.com,
	guanwentao@...ontech.com,
	wentao@...ontech.com,
	loongarch@...ts.linux.dev,
	linux-kernel@...r.kernel.org,
	zhangqing@...ngson.cn,
	zhoubinbin@...ngson.cn,
	lihui@...ngson.cn,
	rdunlap@...radead.org,
	chenhuacai@...ngson.cn,
	zhanjun@...ontech.com,
	niecheng1@...ontech.com
Subject: [PATCH] LoongArch: KGDB: Do not inline arch_kgdb_breakpoint()

The arch_kgdb_breakpoint() function defines the kgdb_breakinst
symbol using inline assembly.

There's a potential issue where the compiler might inline
arch_kgdb_breakpoint(), which would then define the kgdb_breakinst
symbol multiple times, leading to a linker error.

To prevent this, declare arch_kgdb_breakpoint() as noline.

Fix follow error with LLVM-19 *only* when LTO_CLANG_FULL:
    LD      vmlinux.o
  ld.lld-19: error: ld-temp.o <inline asm>:3:1: symbol 'kgdb_breakinst' is already defined
  kgdb_breakinst: break 2
  ^

Fixes: e14dd076964e ("LoongArch: Add basic KGDB & KDB support")
Co-developed-by: Winston Wen <wentao@...ontech.com>
Signed-off-by: Winston Wen <wentao@...ontech.com>
Co-developed-by: Wentao Guan <guanwentao@...ontech.com>
Signed-off-by: Wentao Guan <guanwentao@...ontech.com>
Tested-by: Yuli Wang <wangyuli@...ontech.com>
Signed-off-by: Yuli Wang <wangyuli@...ontech.com>
---
 arch/loongarch/kernel/kgdb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/loongarch/kernel/kgdb.c b/arch/loongarch/kernel/kgdb.c
index 445c452d72a7..03ad4632e720 100644
--- a/arch/loongarch/kernel/kgdb.c
+++ b/arch/loongarch/kernel/kgdb.c
@@ -224,7 +224,7 @@ void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
 	regs->csr_era = pc;
 }
 
-void arch_kgdb_breakpoint(void)
+noinline void arch_kgdb_breakpoint(void)
 {
 	__asm__ __volatile__ (			\
 		".globl kgdb_breakinst\n\t"	\
-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ