The patch titled Subject: x86-module-enable-rox-caches-for-module-text-fix has been added to the -mm mm-unstable branch. Its filename is x86-module-enable-rox-caches-for-module-text-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/x86-module-enable-rox-caches-for-module-text-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Mike Rapoport <rppt@xxxxxxxxxx> Subject: x86-module-enable-rox-caches-for-module-text-fix Date: Fri, 11 Oct 2024 16:08:12 +0300 fix 32-bit Link: https://lkml.kernel.org/r/ZwkjPKKxRKUoJuOE@xxxxxxxxxx Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/x86/mm/init.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/arch/x86/mm/init.c~x86-module-enable-rox-caches-for-module-text-fix +++ a/arch/x86/mm/init.c @@ -1065,20 +1065,30 @@ static void execmem_fill_trapping_insns( struct execmem_info __init *execmem_arch_setup(void) { unsigned long start, offset = 0; + enum execmem_range_flags flags; + pgprot_t pgprot; if (kaslr_enabled()) offset = get_random_u32_inclusive(1, 1024) * PAGE_SIZE; start = MODULES_VADDR + offset; + if (IS_ENABLED(CONFIG_X86_64)) { + pgprot = PAGE_KERNEL_ROX; + flags = EXECMEM_KASAN_SHADOW | EXECMEM_ROX_CACHE; + } else { + pgprot = PAGE_KERNEL; + flags = EXECMEM_KASAN_SHADOW; + } + execmem_info = (struct execmem_info){ .fill_trapping_insns = execmem_fill_trapping_insns, .ranges = { [EXECMEM_MODULE_TEXT] = { - .flags = EXECMEM_KASAN_SHADOW | EXECMEM_ROX_CACHE, + .flags = flags, .start = start, .end = MODULES_END, - .pgprot = PAGE_KERNEL_ROX, + .pgprot = pgprot, .alignment = MODULE_ALIGN, }, [EXECMEM_KPROBES ... EXECMEM_BPF] = { _ Patches currently in -mm which might be from rppt@xxxxxxxxxx are mm-vmalloc-group-declarations-depending-on-config_mmu-together.patch mm-vmalloc-dont-account-for-number-of-nodes-for-huge_vmap-allocations.patch asm-generic-introduce-text-patchingh.patch module-prepare-to-handle-rox-allocations-for-text.patch arch-introduce-set_direct_map_valid_noflush.patch x86-module-perpare-module-loading-for-rox-allocations-of-text.patch execmem-add-support-for-cache-of-large-rox-pages.patch x86-module-enable-rox-caches-for-module-text.patch x86-module-enable-rox-caches-for-module-text-fix.patch mm-kmemleak-fix-typo-in-object_no_scan-comment.patch