Skip to content

Commit 77b644c

Browse files
sinkappcmoore
authored andcommitted
init/main.c: Initialize early LSMs after arch code, static keys and calls.
With LSMs using static calls and static keys, early_lsm_init needs to wait for setup_arch for architecture specific functionality which includes jump tables and static calls to be initialized. Since not all architectures call jump_table_init in setup_arch, explicitly call both jump_table_init and static_call_init before early_security_init. This only affects "early LSMs" i.e. only lockdown when CONFIG_SECURITY_LOCKDOWN_LSM_EARLY is set. Tested-by: Guenter Roeck <[email protected]> Signed-off-by: KP Singh <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent e4b0b54 commit 77b644c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

init/main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,8 +922,11 @@ void start_kernel(void)
922922
boot_cpu_init();
923923
page_address_init();
924924
pr_notice("%s", linux_banner);
925-
early_security_init();
926925
setup_arch(&command_line);
926+
/* Static keys and static calls are needed by LSMs */
927+
jump_label_init();
928+
static_call_init();
929+
early_security_init();
927930
setup_boot_config();
928931
setup_command_line(command_line);
929932
setup_nr_cpu_ids();
@@ -934,7 +937,6 @@ void start_kernel(void)
934937

935938
pr_notice("Kernel command line: %s\n", saved_command_line);
936939
/* parameters may set static keys */
937-
jump_label_init();
938940
parse_early_param();
939941
after_dashes = parse_args("Booting kernel",
940942
static_command_line, __start___param,

0 commit comments

Comments
 (0)