[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YuRtSGCfe2qxHrqT@zx2c4.com>
Date: Sat, 30 Jul 2022 01:29:12 +0200
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: linux-kernel@...r.kernel.org,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
John Ogness <john.ogness@...utronix.de>,
Mike Galbraith <efault@....de>, Petr Mladek <pmladek@...e.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
Theodore Ts'o <tytso@....edu>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 2/2 v2] lib/vsprintf: Initialize vsprintf's pointer hash
once the random core is ready.
On Fri, Jul 29, 2022 at 05:47:16PM +0200, Sebastian Andrzej Siewior wrote:
> +static void fill_ptr_key_workfn(struct work_struct *work)
> +{
> + int ret;
> +
> + ret = get_random_bytes_wait(&ptr_key, sizeof(ptr_key));
> +static int vsprintf_init_hashval(void)
> +{
> + static DECLARE_WORK(fill_ptr_key_work, fill_ptr_key_workfn);
> +
> + queue_work(system_unbound_wq, &fill_ptr_key_work);
> + return 0;
> +}
> +subsys_initcall(vsprintf_init_hashval)
I'm unsure how good of an idea this is; it'll wind up setting off the
jitter entropy thing very early in init. It's probably a better idea to
just schedule the worker the first time that the RNG is already
initialized by some other means. Check `in_hardirq()` or something if
you're worried about missing the first message.
Jason
Powered by blists - more mailing lists