From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Cc: Theodore Ts'o <tytso@mit.edu>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] random: drop check for static_key_initialized
Date: Tue, 11 Nov 2025 01:31:45 +0100 [thread overview]
Message-ID: <aRKD8W999x9asNWq@zx2c4.com> (raw)
In-Reply-To: <20251110-random-static_key_initialized-v1-1-5343715a5986@linutronix.de>
On Mon, Nov 10, 2025 at 12:56:34PM +0100, Thomas Weißschuh wrote:
> Commit 77b644c39d6a ("init/main.c: Initialize early LSMs after arch code,
> static keys and calls.") changed the initialization sequence to call
> jump_label_init() before random_init_early().
No it didnt:
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();
setup_per_cpu_areas();
smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
early_numa_node_init();
boot_cpu_hotplug_init();
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,
__stop___param - __start___param,
-1, -1, NULL, &unknown_bootoption);
print_unknown_bootoptions();
if (!IS_ERR_OR_NULL(after_dashes))
parse_args("Setting init args", after_dashes, NULL, 0, -1, -1,
NULL, set_init_arg);
if (extra_init_args)
parse_args("Setting extra init args", extra_init_args,
NULL, 0, -1, -1, NULL, set_init_arg);
/* Architectural and non-timekeeping rng init, before allocator init */
random_init_early(command_line);
jump_label_init() was called before random_init_early() before
77b644c39d6a. And workqueue_init_early() is much further down, after
jump_label_init().
As far as I can tell, jump labels have always been initialized before
workqueues. So your patch is right, but the explanation is not.
What really happened is that e871abcda3b6 ("random: handle creditable
entropy from atomic process context") moved things to a workqueue, but
added the workqueue condition without removing the
static_key_initialized one.
Anyway, I fixed this up and committed it here:
https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git/commit/?id=2db833312d7e6ae22111a6fd3e733b2a14986a29
Please submit patches against random.git in the future.
Regards,
Jason
prev parent reply other threads:[~2025-11-11 0:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 11:56 Thomas Weißschuh
2025-11-11 0:31 ` Jason A. Donenfeld [this message]
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=aRKD8W999x9asNWq@zx2c4.com \
--to=jason@zx2c4.com \
--cc=linux-kernel@vger.kernel.org \
--cc=thomas.weissschuh@linutronix.de \
--cc=tytso@mit.edu \
/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
all inboxes | Powered by JetHome®