Skip to content

Commit a822a49

Browse files
ebiggersopsiff
authored andcommitted
x86/its: Fix build errors when CONFIG_MODULES=n
commit 9f35e33 upstream. Fix several build errors when CONFIG_MODULES=n, including the following: ../arch/x86/kernel/alternative.c:195:25: error: incomplete definition of type 'struct module' 195 | for (int i = 0; i < mod->its_num_pages; i++) { Fixes: 872df34 ("x86/its: Use dynamic thunks for indirect branches") Cc: stable@vger.kernel.org Signed-off-by: Eric Biggers <ebiggers@google.com> Acked-by: Dave Hansen <dave.hansen@intel.com> Tested-by: Steven Rostedt (Google) <rostedt@goodmis.org> Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> [ pawan: backport: Bring ITS dynamic thunk code under CONFIG_MODULES ] Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 9f69fe3888f643b16c35c8583036e94c5322ca61)
1 parent 270006d commit a822a49

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

arch/x86/kernel/alternative.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ const unsigned char * const x86_nops[ASM_NOP_MAX+1] =
129129

130130
#ifdef CONFIG_MITIGATION_ITS
131131

132+
#ifdef CONFIG_MODULES
132133
static struct module *its_mod;
133134
static void *its_page;
134135
static unsigned int its_offset;
@@ -244,7 +245,16 @@ static void *its_allocate_thunk(int reg)
244245
return thunk;
245246
}
246247

247-
#endif
248+
#else /* CONFIG_MODULES */
249+
250+
static void *its_allocate_thunk(int reg)
251+
{
252+
return NULL;
253+
}
254+
255+
#endif /* CONFIG_MODULES */
256+
257+
#endif /* CONFIG_MITIGATION_ITS */
248258

249259
/*
250260
* Fill the buffer with a single effective instruction of size @len.

0 commit comments

Comments
 (0)