lkml.org 
[lkml]   [2022]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2022-07-30 01:30    [W:0.073 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site