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-next>] [day] [month] [year] [list]
Message-Id: <20240508022445.6131-1-gaoshanliukou@163.com>
Date: Wed,  8 May 2024 10:24:45 +0800
From: "yang.zhang" <gaoshanliukou@....com>
To: alexghiti@...osinc.com
Cc: paul.walmsley@...ive.com,
	palmer@...belt.com,
	aou@...s.berkeley.edu,
	linux-riscv@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	"yang.zhang" <yang.zhang@...intek.com>
Subject: [PATCH V3] riscv: set trap vector earlier

From: "yang.zhang" <yang.zhang@...intek.com>

The exception vector of the booting hart is not set before enabling
the mmu and then still points to the value of the previous firmware,
typically _start. That makes it hard to debug setup_vm() when bad
things happen. So fix that by setting the exception vector earlier.

Reviewed-by: Alexandre Ghiti <alexghiti@...osinc.com>
Signed-off-by: yang.zhang <yang.zhang@...intek.com>

---
V2 -> v3:
- Fix commit message

v1 -> v2:
- As Alex commented, remove the patch for supporting hugesize kernek image
- Add the omissive logic of set trap vector earlier
https://lore.kernel.org/lkml/20240506022239.6817-1-gaoshanliukou@163.com
---
 arch/riscv/kernel/head.S | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
index 4236a69c35cb..03dc440e643e 100644
--- a/arch/riscv/kernel/head.S
+++ b/arch/riscv/kernel/head.S
@@ -300,6 +300,9 @@ SYM_CODE_START(_start_kernel)
 #else
 	mv a0, a1
 #endif /* CONFIG_BUILTIN_DTB */
+	/* Set trap vector to spin forever to help debug */
+	la a3, .Lsecondary_park
+	csrw CSR_TVEC, a3
 	call setup_vm
 #ifdef CONFIG_MMU
 	la a0, early_pg_dir
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ