From: Herbert Xu <[email protected]>

not upstream: Disable vdso getrandom when FIPS is enabled

In order to ensure that the FIPS-certified RNG is always used,
disable the vdso getrandom code by always making it fall back
to getrandom(2) when FIPS mode is enabled.

Signed-off-by: Herbert Xu <[email protected]>

diff --git a/lib/vdso/getrandom.c b/lib/vdso/getrandom.c
index blahblah..blahblah 100644
--- a/lib/vdso/getrandom.c
+++ b/lib/vdso/getrandom.c
@@ -4,6 +4,7 @@
  */
 
 #include <linux/cache.h>
+#include <linux/fips.h>
 #include <linux/kernel.h>
 #include <linux/time64.h>
 #include <vdso/datapage.h>
@@ -85,6 +86,9 @@ __cvdso_getrandom_data(const struct vdso_rng_data *rng_info, 
void *buffer, size_
        if (unlikely(((unsigned long)opaque_state & ~PAGE_MASK) + 
sizeof(*state) > PAGE_SIZE))
                return -EFAULT;
 
+       if (fips_enabled)
+               goto fallback_syscall;
+
        /* If the caller passes the wrong size, which might happen due to CRIU, 
fallback. */
        if (unlikely(opaque_len != sizeof(*state)))
                goto fallback_syscall;

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

-- 
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
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/[email protected]
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to