[OS-BUILD PATCHv2] not upstream: Set vdso is_ready later during boot process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Herbert Xu <herbert.xu@xxxxxxxxxx>

not upstream: Set vdso is_ready later during boot process

Instead of setting vdso is_ready when the CRNG becomes ready, do
it later in the boot process as FIPS mode itself may not have been
set yet during the early-boot stages.

In particular, the CRNG gets initialised very early on arm64, even
before the early boot paramaters are parsed.

Delaying vdso is_ready setting on the other hand is harmless as
there is always a fallback code path that leads to getrandom(2).

Signed-off-by: Herbert Xu <herbert.xu@xxxxxxxxxx>

diff --git a/drivers/char/random.c b/drivers/char/random.c
index blahblah..blahblah 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -121,6 +121,12 @@ EXPORT_SYMBOL(rng_is_initialized);
 static void __cold crng_set_ready(struct work_struct *work)
 {
 	static_branch_enable(&crng_is_ready);
+#ifdef CONFIG_RHEL_DIFFERENCES
+#ifdef CONFIG_VDSO_GETRANDOM
+	if (!fips_enabled)
+		WRITE_ONCE(__arch_get_k_vdso_rng_data()->is_ready, true);
+#endif
+#endif
 }
 
 /* Used by wait_for_random_bytes(), and considered an entropy collector, below. */
@@ -749,9 +755,10 @@ static void __cold _credit_init_bits(size_t bits)
 		if (static_key_initialized && system_unbound_wq)
 			queue_work(system_unbound_wq, &set_ready);
 		atomic_notifier_call_chain(&random_ready_notifier, 0, NULL);
+#ifndef CONFIG_RHEL_DIFFERENCES
 #ifdef CONFIG_VDSO_GETRANDOM
-		if (!fips_enabled)
-			WRITE_ONCE(__arch_get_k_vdso_rng_data()->is_ready, true);
+		WRITE_ONCE(__arch_get_k_vdso_rng_data()->is_ready, true);
+#endif
 #endif
 		wake_up_interruptible(&crng_init_wait);
 		kill_fasync(&fasync, SIGIO, POLL_IN);

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/3667

-- 
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux