From: KP Singh <kpsingh@kernel.org>
To: linux-security-module@vger.kernel.org, bpf@vger.kernel.org
Cc: ast@kernel.org, paul@paul-moore.com, casey@schaufler-ca.com,
andrii@kernel.org, keescook@chromium.org, daniel@iogearbox.net,
renauld@google.com, revest@chromium.org, song@kernel.org,
linux@roeck-us.net, KP Singh <kpsingh@kernel.org>
Subject: [PATCH v15 1/4] init/main.c: Initialize early LSMs after arch code, static keys and calls.
Date: Fri, 16 Aug 2024 17:43:04 +0200 [thread overview]
Message-ID: <20240816154307.3031838-2-kpsingh@kernel.org> (raw)
In-Reply-To: <20240816154307.3031838-1-kpsingh@kernel.org>
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.
Signed-off-by: KP Singh <kpsingh@kernel.org>
---
init/main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/init/main.c b/init/main.c
index 206acdde51f5..c4778edae797 100644
--- a/init/main.c
+++ b/init/main.c
@@ -922,8 +922,11 @@ void start_kernel(void)
boot_cpu_init();
page_address_init();
pr_notice("%s", linux_banner);
- early_security_init();
setup_arch(&command_line);
+ /* Static keys and static calls are needed by LSMs */
+ jump_label_init();
+ static_call_init();
+ early_security_init();
setup_boot_config();
setup_command_line(command_line);
setup_nr_cpu_ids();
@@ -934,7 +937,6 @@ void start_kernel(void)
pr_notice("Kernel command line: %s\n", saved_command_line);
/* parameters may set static keys */
- jump_label_init();
parse_early_param();
after_dashes = parse_args("Booting kernel",
static_command_line, __start___param,
--
2.46.0.184.g6999bdac58-goog
next prev parent reply other threads:[~2024-08-16 15:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 15:43 [PATCH v15 0/4] Reduce overhead of LSMs with static calls KP Singh
2024-08-16 15:43 ` KP Singh [this message]
2024-08-16 15:43 ` [PATCH v15 2/4] kernel: Add helper macros for loop unrolling KP Singh
2024-08-16 15:43 ` [PATCH v15 3/4] lsm: count the LSMs enabled at compile time KP Singh
2024-08-20 4:39 ` Paul Moore
2024-08-22 16:27 ` Paul Moore
2024-08-16 15:43 ` [PATCH v15 4/4] lsm: replace indirect LSM hook calls with static calls KP Singh
2024-08-16 21:30 ` [PATCH v15 0/4] Reduce overhead of LSMs " Guenter Roeck
2024-08-20 4:33 ` Paul Moore
2024-08-18 4:37 ` Tetsuo Handa
2024-08-20 5:17 ` Paul Moore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240816154307.3031838-2-kpsingh@kernel.org \
--to=kpsingh@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=casey@schaufler-ca.com \
--cc=daniel@iogearbox.net \
--cc=keescook@chromium.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=paul@paul-moore.com \
--cc=renauld@google.com \
--cc=revest@chromium.org \
--cc=song@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).