Skip to contentSkip to conversation

riscv: disable ARCH_HAS_STRICT_KERNEL_RWX for nommu builds

PATCH In review Wladimir J. van der Laan 3 participants 3 messages Apr 22, 2020 – Apr 24, 2020 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: disable ARCH_HAS_STRICT_KERNEL_RWX for nommu builds

From: "Wladimir J. van der Laan" <[email protected]>

For non-MMU systems, which tend to be low-memory SoCs such as the K210, it's expensive to align sections to 2MB. Besides that, the security guarantees cannot be made anyway.

---
 arch/riscv/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/Kconfig +1 -1
index 62f7bfeb709eb1cdabaccce261320dd0191b3c48..74f82cf4f7816b99fc54155fd40dcf4d40cbf956 100644
@@ -60,7 +60,7 @@ config RISCV
 	select ARCH_HAS_GIGANTIC_PAGE
 	select ARCH_HAS_SET_DIRECT_MAP
 	select ARCH_HAS_SET_MEMORY
-	select ARCH_HAS_STRICT_KERNEL_RWX
+	select ARCH_HAS_STRICT_KERNEL_RWX if MMU
 	select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
 	select SPARSEMEM_STATIC if 32BIT
 	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
Signature · 1 line
2.17.1
#1 lore raw
Quoted 24 lines · Wladimir J. van der Laan

From: "Wladimir J. van der Laan" <[email protected]>

For non-MMU systems, which tend to be low-memory SoCs such as the K210, it's expensive to align sections to 2MB. Besides that, the security guarantees cannot be made anyway.

---
 arch/riscv/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/Kconfig +1 -2
index 62f7bfeb709eb1cdabaccce261320dd0191b3c48..74f82cf4f7816b99fc54155fd40dcf4d40cbf956 100644
@@ -60,7 +60,7 @@ config RISCV
        select ARCH_HAS_GIGANTIC_PAGE
        select ARCH_HAS_SET_DIRECT_MAP
        select ARCH_HAS_SET_MEMORY
-       select ARCH_HAS_STRICT_KERNEL_RWX
+       select ARCH_HAS_STRICT_KERNEL_RWX if MMU
        select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
        select SPARSEMEM_STATIC if 32BIT
        select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
--
Quoted 3 lines

2.17.1

This fix is already available in the mailing list from Damien.
https://patchwork.kernel.org/patch/11485305/

Signature · 2 lines
Regards,
Atish
maintainer
#2 lore raw
In reply to Wladimir J. van der Laan
Quoted 14 lines · On Wed, 22 Apr 2020 09:55:37 PDT (-0700), [email protected] wrote:

From: "Wladimir J. van der Laan" <[email protected]>

For non-MMU systems, which tend to be low-memory SoCs such as the K210, it's expensive to align sections to 2MB. Besides that, the security guarantees cannot be made anyway.

---
 arch/riscv/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/Kconfig +0 -0
index 62f7bfeb709eb1cdabaccce261320dd0191b3c48..74f82cf4f7816b99fc54155fd40dcf4d40cbf956 100644

arch/riscv/Kconfig config RISCV · line 66

Quoted 8 lines
arch/riscv/Kconfig +1 -1
@@ -60,7 +60,7 @@ config RISCV
 	select ARCH_HAS_GIGANTIC_PAGE
 	select ARCH_HAS_SET_DIRECT_MAP
 	select ARCH_HAS_SET_MEMORY
-	select ARCH_HAS_STRICT_KERNEL_RWX
+	select ARCH_HAS_STRICT_KERNEL_RWX if MMU
 	select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
 	select SPARSEMEM_STATIC if 32BIT
 	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU

I took Damien's version because it was posted first. It had missed my inbox, so thanks for pointing this out.