]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
LoongArch: Add pgprot_nx() implementation
authorHuacai Chen <chenhuacai@loongson.cn>
Sat, 25 Jan 2025 10:51:42 +0000 (18:51 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Sat, 25 Jan 2025 10:51:42 +0000 (18:51 +0800)
Commit cca98e9f8b5ebcd964 ("mm: enforce that vmap can't map pages
executable") enforces the W^X protection by not allowing remapping
existing pages as executable. Add LoongArch bits so that LoongArch
can benefit the same protection.

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/include/asm/pgtable-bits.h

index 82cd3a9f094b8a4fb382e04b85bdbee4623e4151..45bfc65a0c9f9dde9a2360b802c850e8a11d7708 100644 (file)
 
 #define _PAGE_IOREMAP          pgprot_val(PAGE_KERNEL_SUC)
 
+#define pgprot_nx pgprot_nx
+
+static inline pgprot_t pgprot_nx(pgprot_t _prot)
+{
+       return __pgprot(pgprot_val(_prot) | _PAGE_NO_EXEC);
+}
+
 #define pgprot_noncached pgprot_noncached
 
 static inline pgprot_t pgprot_noncached(pgprot_t _prot)