Skip to contentSkip to conversation

riscv: Enable ELF-ASLR for riscv

PATCH In review [email protected] 2 participants 3 messages Jul 9, 2020

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 riscv: Enable ELF-ASLR for riscv

From: Guo Ren <[email protected]>

Let riscv enable randomizes the stack, heap and binary images of ELF binaries. Seems it's ok at all after qemu & chip test and there is no founded side effect.

So just simply select ARCH_HAS_ELF_RANDOMIZE :)

Cc Palmer Dabbelt <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Zong Li <[email protected]>
Cc Greentime Hu <[email protected]>
---
 arch/riscv/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/Kconfig +1 -0
index 91bfc6c..eed6647 100644
@@ -20,6 +20,7 @@ config RISCV
 	select ARCH_HAS_GIGANTIC_PAGE
 	select ARCH_HAS_MMIOWB
 	select ARCH_HAS_PTE_SPECIAL
+	select ARCH_HAS_ELF_RANDOMIZE
 	select ARCH_HAS_SET_DIRECT_MAP
 	select ARCH_HAS_SET_MEMORY
 	select ARCH_HAS_STRICT_KERNEL_RWX if MMU
Signature · 1 line
2.7.4
reviewer
#1 lore raw

Hi Guo,

Le 7/9/20 à 12:38 AM, [email protected] a écrit :

Quoted 23 lines

From: Guo Ren <[email protected]>

Let riscv enable randomizes the stack, heap and binary images of ELF binaries. Seems it's ok at all after qemu & chip test and there is no founded side effect.

So just simply select ARCH_HAS_ELF_RANDOMIZE :)

Cc Palmer Dabbelt <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Zong Li <[email protected]>
Cc Greentime Hu <[email protected]>
---
  arch/riscv/Kconfig | 1 +
  1 file changed, 1 insertion(+)
arch/riscv/Kconfig +0 -0
index 91bfc6c..eed6647 100644

arch/riscv/Kconfig config RISCV · line 26

Quoted 7 lines
arch/riscv/Kconfig +1 -0
@@ -20,6 +20,7 @@ config RISCV
  	select ARCH_HAS_GIGANTIC_PAGE
  	select ARCH_HAS_MMIOWB
  	select ARCH_HAS_PTE_SPECIAL
+	select ARCH_HAS_ELF_RANDOMIZE
  	select ARCH_HAS_SET_DIRECT_MAP
  	select ARCH_HAS_SET_MEMORY
  	select ARCH_HAS_STRICT_KERNEL_RWX if MMU

Actually it is already the case: ARCH_HAS_ELF_RANDOMIZE is already selected by ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT.

Thanks,

Alex

author maintainer
#2 lore raw
Quoted 21 lines · Alex Ghiti

Hi Guo,

Quoted 17 lines · Le 7/9/20 à 12:38 AM, [email protected] a écrit :

From: Guo Ren <[email protected]>

Let riscv enable randomizes the stack, heap and binary images of ELF binaries. Seems it's ok at all after qemu & chip test and there is no founded side effect.

So just simply select ARCH_HAS_ELF_RANDOMIZE :)

Cc Palmer Dabbelt <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Zong Li <[email protected]>
Cc Greentime Hu <[email protected]>
---
  arch/riscv/Kconfig | 1 +
  1 file changed, 1 insertion(+)
Quoted 16 lines

arch/riscv/Kconfig config RISCV · line 26

Quoted 13 lines
arch/riscv/Kconfig +1 -0
index 91bfc6c..eed6647 100644
@@ -20,6 +20,7 @@ config RISCV
      select ARCH_HAS_GIGANTIC_PAGE
      select ARCH_HAS_MMIOWB
      select ARCH_HAS_PTE_SPECIAL
+     select ARCH_HAS_ELF_RANDOMIZE
      select ARCH_HAS_SET_DIRECT_MAP
      select ARCH_HAS_SET_MEMORY
      select ARCH_HAS_STRICT_KERNEL_RWX if MMU

Actually it is already the case: ARCH_HAS_ELF_RANDOMIZE is already selected by ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT.

Oops :P, Thx for correcting, abandon the patch.

Signature · 4 lines
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/