diff mbox series

[v2] riscv: define ILLEGAL_POINTER_VALUE for 64bit

Message ID 20240705170210.3236-1-jszhang@kernel.org (mailing list archive)
State Accepted
Commit 5c178472af247c7b50f962495bb7462ba453b9fb
Headers show
Series [v2] riscv: define ILLEGAL_POINTER_VALUE for 64bit | expand

Checks

Context Check Description
conchuod/vmtest-for-next-PR success PR summary
conchuod/patch-1-test-1 success .github/scripts/patches/tests/build_rv32_defconfig.sh
conchuod/patch-1-test-2 success .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh
conchuod/patch-1-test-3 success .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh
conchuod/patch-1-test-4 success .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh
conchuod/patch-1-test-5 success .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh
conchuod/patch-1-test-6 success .github/scripts/patches/tests/checkpatch.sh
conchuod/patch-1-test-7 success .github/scripts/patches/tests/dtb_warn_rv64.sh
conchuod/patch-1-test-8 success .github/scripts/patches/tests/header_inline.sh
conchuod/patch-1-test-9 success .github/scripts/patches/tests/kdoc.sh
conchuod/patch-1-test-10 success .github/scripts/patches/tests/module_param.sh
conchuod/patch-1-test-11 success .github/scripts/patches/tests/verify_fixes.sh
conchuod/patch-1-test-12 success .github/scripts/patches/tests/verify_signedoff.sh

Commit Message

Jisheng Zhang July 5, 2024, 5:02 p.m. UTC
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.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---

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

 arch/riscv/Kconfig | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jisheng Zhang July 6, 2024, 12:50 a.m. UTC | #1
On Sat, Jul 06, 2024 at 01:02:10AM +0800, Jisheng Zhang 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.

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

> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
> 
> Since v1:
>  - fix typo:s/SV59/SV57
> 
>  arch/riscv/Kconfig | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index c51b32a8ddff..c992eabbd002 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -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
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
Palmer Dabbelt Sept. 15, 2024, 6:55 a.m. UTC | #2
On Fri, 05 Jul 2024 17:50:10 PDT (-0700), jszhang@kernel.org wrote:
> On Sat, Jul 06, 2024 at 01:02:10AM +0800, Jisheng Zhang 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.
>
> 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...

>
>>
>> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
>> ---
>>
>> Since v1:
>>  - fix typo:s/SV59/SV57
>>
>>  arch/riscv/Kconfig | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
>> index c51b32a8ddff..c992eabbd002 100644
>> --- a/arch/riscv/Kconfig
>> +++ b/arch/riscv/Kconfig
>> @@ -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
>> linux-riscv@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-riscv
patchwork-bot+linux-riscv@kernel.org Sept. 17, 2024, 1 p.m. UTC | #3
Hello:

This patch was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

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.
> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> 
> [...]

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!
diff mbox series

Patch

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index c51b32a8ddff..c992eabbd002 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -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