[PATCH 14/17] s390/mm: Add PAGE_KERNEL_ROX

From: Heiko Carstens

Date: Thu Dec 03 2026 - 05:34:42 EST


Add PAGE_KERNEL_ROX, which is PAGE_KERNEL_RO without the no-execute
bit, i.e. the read-only and executable kernel mapping that
set_memory_rox() creates. This allows to allocate read-only and
executable kernel mappings directly, without the need to change the
permissions afterwards.

Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
---
arch/s390/include/asm/pgtable.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 2f21ce7b545e..52ee989ac88a 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -432,6 +432,8 @@ void setup_protection_map(void);
_PAGE_YOUNG | _PAGE_DIRTY | _PAGE_NOEXEC)
#define __PAGE_KERNEL_RO (_PAGE_PRESENT | _PAGE_READ | _PAGE_YOUNG | \
_PAGE_PROTECT | _PAGE_NOEXEC)
+#define __PAGE_KERNEL_ROX (_PAGE_PRESENT | _PAGE_READ | _PAGE_YOUNG | \
+ _PAGE_PROTECT)

extern unsigned long page_noexec_mask;

@@ -445,6 +447,7 @@ extern unsigned long page_noexec_mask;
#define PAGE_SHARED __pgprot_page_mask(__PAGE_SHARED)
#define PAGE_KERNEL __pgprot_page_mask(__PAGE_KERNEL)
#define PAGE_KERNEL_RO __pgprot_page_mask(__PAGE_KERNEL_RO)
+#define PAGE_KERNEL_ROX __pgprot_page_mask(__PAGE_KERNEL_ROX)

/*
* Segment entry (large page) protection definitions.
--
2.53.0