FAILED: patch "[PATCH] x86/its: move its_pages array to struct mod_arch_specific" failed to apply to 6.12-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 0b0cae7119a0ec9449d7261b5e672a5fed765068
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025062059-map-powdering-0ee4@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 0b0cae7119a0ec9449d7261b5e672a5fed765068 Mon Sep 17 00:00:00 2001
From: "Mike Rapoport (Microsoft)" <[email protected]>
Date: Tue, 3 Jun 2025 14:14:43 +0300
Subject: [PATCH] x86/its: move its_pages array to struct mod_arch_specific
The of pages with ITS thunks allocated for modules are tracked by an array in 'struct module'.
Since this is very architecture specific data structure, move it to 'struct mod_arch_specific'.
No functional changes.
arch/x86/include/asm/module.h +8 -0
@@ -5,12 +5,20 @@#include <asm-generic/module.h> #include <asm/orc_types.h> +struct its_array { +#ifdef CONFIG_MITIGATION_ITS +void **pages; +int num; +#endif +}; +struct mod_arch_specific {#ifdef CONFIG_UNWINDER_ORC unsigned int num_orcs;int *orc_unwind_ip;struct orc_entry *orc_unwind;#endif +struct its_array its_pages; };#endif /* _ASM_X86_MODULE_H */
arch/x86/kernel/alternative.c +10 -9
@@ -173,8 +173,8 @@ void its_fini_mod(struct module *mod) its_page =NULL ;mutex_unlock (&text_mutex); -for (int i =0 ; i < mod->its_num_pages; i++) { -void *page = mod->its_page_array[i]; +for (int i =0 ; i < mod->arch.its_pages.num; i++) { +void *page = mod->arch.its_pages.pages[i];execmem_restore_rox (page,PAGE_SIZE ); } }
@@ -184,11 +184,11 @@ void its_free_mod(struct module *mod)if (!cpu_feature_enabled (X86_FEATURE_INDIRECT_THUNK_ITS ))return ; -for (int i =0 ; i < mod->its_num_pages; i++) { -void *page = mod->its_page_array[i]; +for (int i =0 ; i < mod->arch.its_pages.num; i++) { +void *page = mod->arch.its_pages.pages[i];execmem_free (page); } - kfree(mod->its_page_array); + kfree(mod->arch.its_pages.pages); }#endif /* CONFIG_MODULES */
@@ -201,14 +201,15 @@ static void *its_alloc(void)#ifdef CONFIG_MODULES if (its_mod) { -void *tmp =krealloc (its_mod->its_page_array, - (its_mod->its_num_pages+1 ) *sizeof (void *), +struct its_array *pages = &its_mod->arch.its_pages; +void *tmp =krealloc (pages->pages, + (pages->num+1 ) *sizeof (void *),GFP_KERNEL );if (!tmp)return NULL ; - its_mod->its_page_array = tmp; - its_mod->its_page_array[its_mod->its_num_pages++] = page; + pages->pages = tmp; + pages->pages[pages->num++] = page;execmem_make_temp_rw (page,PAGE_SIZE ); }
include/linux/module.h +0 -5
@@ -586,11 +586,6 @@ struct module {atomic_t refcnt;#endif -#ifdef CONFIG_MITIGATION_ITS -int its_num_pages; -void **its_page_array; -#endif -#ifdef CONFIG_CONSTRUCTORS /* Constructor functions. */ ctor_fn_t *ctors;