Skip to content

Commit c2bece0

Browse files
ebiggersgregkh
authored andcommitted
x86/its: Fix build errors when CONFIG_MODULES=n
commit 9f35e33144ae5377d6a8de86dd3bd4d995c6ac65 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: 872df34d7c51 ("x86/its: Use dynamic thunks for indirect branches") Cc: [email protected] Signed-off-by: Eric Biggers <[email protected]> Acked-by: Dave Hansen <[email protected]> Tested-by: Steven Rostedt (Google) <[email protected]> Reviewed-by: Alexandre Chartre <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> [ pawan: backport: Bring ITS dynamic thunk code under CONFIG_MODULES ] Signed-off-by: Pawan Gupta <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 959cadf commit c2bece0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

arch/x86/kernel/alternative.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ static int emit_indirect(int op, int reg, u8 *bytes)
402402

403403
#ifdef CONFIG_MITIGATION_ITS
404404

405+
#ifdef CONFIG_MODULES
405406
static struct module *its_mod;
406407
static void *its_page;
407408
static unsigned int its_offset;
@@ -518,6 +519,14 @@ static void *its_allocate_thunk(int reg)
518519

519520
return thunk;
520521
}
522+
#else /* CONFIG_MODULES */
523+
524+
static void *its_allocate_thunk(int reg)
525+
{
526+
return NULL;
527+
}
528+
529+
#endif /* CONFIG_MODULES */
521530

522531
static int __emit_trampoline(void *addr, struct insn *insn, u8 *bytes,
523532
void *call_dest, void *jmp_dest)

0 commit comments

Comments
 (0)