From: Greg Kroah-Hartman Date: Fri, 16 May 2025 08:04:18 +0000 (+0200) Subject: fix up queue-6.6/x86-its-fix-build-errors-when-config_modules-n.patch X-Git-Tag: v5.15.183~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=68bc0c93fa993ac266626983a942219ea7b4a6d3;p=thirdparty%2Fkernel%2Fstable-queue.git fix up queue-6.6/x86-its-fix-build-errors-when-config_modules-n.patch --- diff --git a/queue-6.6/x86-its-fix-build-errors-when-config_modules-n.patch b/queue-6.6/x86-its-fix-build-errors-when-config_modules-n.patch index d8c09b6395..3193133383 100644 --- a/queue-6.6/x86-its-fix-build-errors-when-config_modules-n.patch +++ b/queue-6.6/x86-its-fix-build-errors-when-config_modules-n.patch @@ -19,52 +19,38 @@ Acked-by: Dave Hansen Tested-by: Steven Rostedt (Google) Reviewed-by: Alexandre Chartre Signed-off-by: Linus Torvalds +[ pawan: backport: Bring ITS dynamic thunk code under CONFIG_MODULES ] +Signed-off-by: Pawan Gupta Signed-off-by: Greg Kroah-Hartman --- - arch/x86/kernel/alternative.c | 6 ++++++ - 1 file changed, 6 insertions(+) + arch/x86/kernel/alternative.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c -@@ -129,7 +129,9 @@ const unsigned char * const x86_nops[ASM +@@ -129,6 +129,7 @@ const unsigned char * const x86_nops[ASM #ifdef CONFIG_MITIGATION_ITS +#ifdef CONFIG_MODULES static struct module *its_mod; -+#endif static void *its_page; static unsigned int its_offset; - -@@ -150,6 +152,7 @@ static void *its_init_thunk(void *thunk, +@@ -244,7 +245,16 @@ static void *its_allocate_thunk(int reg) return thunk; } -+#ifdef CONFIG_MODULES - void its_init_mod(struct module *mod) - { - if (!cpu_feature_enabled(X86_FEATURE_INDIRECT_THUNK_ITS)) -@@ -188,6 +191,7 @@ void its_free_mod(struct module *mod) - } - kfree(mod->its_page_array); - } +-#endif ++#else /* CONFIG_MODULES */ ++ ++static void *its_allocate_thunk(int reg) ++{ ++ return NULL; ++} ++ +#endif /* CONFIG_MODULES */ ++ ++#endif /* CONFIG_MITIGATION_ITS */ - DEFINE_FREE(its_execmem, void *, if (_T) module_memfree(_T)); - -@@ -198,6 +202,7 @@ static void *its_alloc(void) - if (!page) - return NULL; - -+#ifdef CONFIG_MODULES - if (its_mod) { - void *tmp = krealloc(its_mod->its_page_array, - (its_mod->its_num_pages+1) * sizeof(void *), -@@ -208,6 +213,7 @@ static void *its_alloc(void) - its_mod->its_page_array = tmp; - its_mod->its_page_array[its_mod->its_num_pages++] = page; - } -+#endif /* CONFIG_MODULES */ - - return no_free_ptr(page); - } + /* + * Fill the buffer with a single effective instruction of size @len.