Skip to contentSkip to conversation

riscv: define ILLEGAL_POINTER_VALUE for 64bit

PATCH Applied Jisheng Zhang 3 participants 4 messages Jul 5, 2024 – Sep 17, 2024 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH v2 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 SV57 vm layout, 0xdead000000000000 is a proper value that is not mappable, this can avoid potentially turning an oops to an expolit.

---

Since v1:
- fix typo:s/SV59/SV57

 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
#1 lore raw
Quoted 4 lines · Jisheng Zhang

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

Maybe I also need to cc stable? This is a secure hole fix patch.

Quoted 34 lines

---

Since v1:
- fix typo:s/SV59/SV57

 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 · 7 lines
2.43.0


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
maintainer
#2 lore raw
Quoted 7 lines · On Fri, 05 Jul 2024 17:50:10 PDT (-0700), [email protected] wrote:
Quoted 4 lines · Jisheng Zhang

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

Maybe I also need to cc stable? This is a secure hole fix patch.

Ya, and I guess it's just been broken forever? I stuck a

Fixes fbe934d69eb7 ("RISC-V: Build Infrastructure")

it should show up on for-next, assuming the tests pass...

Quoted 35 lines
Quoted 35 lines

---

Since v1:
- fix typo:s/SV59/SV57

 arch/riscv/Kconfig | 5 +++++
 1 file changed, 5 insertions(+)
arch/riscv/Kconfig +5 -1
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
--

2.43.0

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#3 lore raw
In reply to Jisheng Zhang
This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:

Hello:

This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:

Quoted 8 lines · On Sat, 6 Jul 2024 01:02:10 +0800 you wrote:

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

[...]

Here is the summary with links:
- [v2] riscv: define ILLEGAL_POINTER_VALUE for 64bit

    https://git.kernel.org/riscv/c/5c178472af24

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html