Message ID | 20240325105456.1338-1-jszhang@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 0ffe1ae7026dd129d86318388ed62ba61f085730 |
Headers | show |
Series | [v2,RESEND] riscv: mm: implement pgprot_nx | expand |
Hello: This patch was applied to riscv/linux.git (fixes) by Palmer Dabbelt <palmer@rivosinc.com>: 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. > > Signed-off-by: Jisheng Zhang <jszhang@kernel.org> > Reviewed-by: Christoph Hellwig <hch@lst.de> > Reviewed-by: Samuel Holland <samuel.holland@sifive.com> > Tested-by: Samuel Holland <samuel.holland@sifive.com> > Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> > > [...] 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!
diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 97fcde30e247..9f8ea0e33eb1 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -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) {