Skip to contentSkip to conversation

riscv: mm: implement pgprot_nx

PATCH RESEND Applied Jisheng Zhang 2 participants 2 messages Mar 25, 2024 – Apr 4, 2024 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/1 riscv: mm: implement pgprot_nx

commit cca98e9f8b5e ("mm: enforce that vmap can't map pages executable") enforces the W^X protection by not allowing remapping existing pages as executable. Add riscv bits so that riscv can benefit the same protection.

---

Hi Palmer,

This patch missed two merge window, I.E 6.8-rc1 and 6.9-rc1, I'm not sure whether there's something to be done from my side.

Thanks in advance

since v1:
- rebase on v6.8-rc1
- collect Reviewed-by and Tested-by tag

 arch/riscv/include/asm/pgtable.h | 6 ++++++
 1 file changed, 6 insertions(+)
arch/riscv/include/asm/pgtable.h +6 -0
index 97fcde30e247..9f8ea0e33eb1 100644
@@ -593,6 +593,12 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma,
 	return ptep_test_and_clear_young(vma, address, ptep);
 }
 
+#define pgprot_nx pgprot_nx
+static inline pgprot_t pgprot_nx(pgprot_t _prot)
+{
+	return __pgprot(pgprot_val(_prot) & ~_PAGE_EXEC);
+}
+
 #define pgprot_noncached pgprot_noncached
 static inline pgprot_t pgprot_noncached(pgprot_t _prot)
 {
Signature · 1 line
2.43.0
#1 lore raw
This patch was applied to riscv/linux.git (fixes) by Palmer Dabbelt <[email protected]>:

Hello:

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

Quoted 5 lines · On Mon, 25 Mar 2024 18:54:56 +0800 you wrote:

commit cca98e9f8b5e ("mm: enforce that vmap can't map pages executable") enforces the W^X protection by not allowing remapping existing pages as executable. Add riscv bits so that riscv can benefit the same protection.

Quoted 7 lines

[...]

Here is the summary with links:
- [v2,RESEND] riscv: mm: implement pgprot_nx

    https://git.kernel.org/riscv/c/0ffe1ae7026d

You are awesome, thank you!

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