riscv: mm: implement pgprot_nx
PATCH 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.
Signed-off-by Jisheng Zhang <[email protected]>
Reviewed-by Christoph Hellwig <[email protected]>
Reviewed-by Samuel Holland <[email protected]>
Tested-by Samuel Holland <[email protected]>
Reviewed-by Alexandre Ghiti <[email protected]>
---
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
@@ -591,6 +591,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_noncachedstatic inline pgprot_t pgprot_noncached (pgprot_t _prot) {
Signature · 1 line
2.43.0