Skip to contentSkip to conversation

riscv: define ILLEGAL_POINTER_VALUE for 64bit

PATCH Superseded Jisheng Zhang 1 participant 1 message Jul 5, 2024 RISC-V

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: define ILLEGAL_POINTER_VALUE for 64bit

This is used in poison.h for poison pointer offset. Based on current SV39, SV48 and SV59 vm layout, 0xdead000000000000 is a proper value that is not mappable, this can avoid potentially turning an oops to an expolit.

---
 arch/riscv/Kconfig | 5 +++++
 1 file changed, 5 insertions(+)
arch/riscv/Kconfig +5 -0
index c51b32a8ddff..c992eabbd002 100644
@@ -313,6 +313,11 @@ config GENERIC_HWEIGHT
 config FIX_EARLYCON_MEM
 	def_bool MMU
 
+config ILLEGAL_POINTER_VALUE
+	hex
+	default 0 if 32BIT
+	default 0xdead000000000000 if 64BIT
+
 config PGTABLE_LEVELS
 	int
 	default 5 if 64BIT
Signature · 1 line
2.43.0