lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yn35HIqb2vPxg6XB@owl.dominikbrodowski.net>
Date:   Fri, 13 May 2022 08:22:20 +0200
From:   Dominik Brodowski <linux@...inikbrodowski.net>
To:     "Jason A. Donenfeld" <Jason@...c4.com>
Cc:     linux-kernel@...r.kernel.org, linux-crypto@...r.kernel.org,
        Theodore Ts'o <tytso@....edu>,
        Sultan Alsawaf <sultan@...neltoast.com>
Subject: Re: [PATCH v4] random: use static branch for crng_ready()

Am Thu, May 12, 2022 at 06:37:48PM +0200 schrieb Jason A. Donenfeld:
> Since crng_ready() is only false briefly during initialization and then
> forever after becomes true, we don't need to evaluate it after, making
> it a prime candidate for a static branch.
> 
> One complication, however, is that it changes state in a particular call
> to credit_init_bits(), which might be made from atomic context, which
> means we must kick off a workqueue to change the static key. Further
> complicating things, credit_init_bits() may be called sufficiently early
> on in system initialization such that system_wq is NULL.
> 
> Fortunately, there exists the nice function execute_in_process_context(),
> which will immediately execute the function if !in_interrupt(), and
> otherwise defer it to a workqueue. During early init, before workqueues
> are available, in_interrupt() is always false, because interrupts
> haven't even been enabled yet, which means the function in that case
> executes immediately. Later on, after workqueues are available,
> in_interrupt() might be true, but in that case, the work is queued in
> system_wq and all goes well.

	Reviewed-by: Dominik Brodowski <linux@...inikbrodowski.net>

Thanks,
	Dominik

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ