[source] util-linux: avoid using the getrandom syscall

LEDE Commits lede-commits at lists.infradead.org
Fri Sep 29 03:33:08 PDT 2017


nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/e64463ebde554071431514925825e2c30f2b6998

commit e64463ebde554071431514925825e2c30f2b6998
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Fri Sep 29 12:30:52 2017 +0200

    util-linux: avoid using the getrandom syscall
    
    getrandom blocks until the random pool is being initialized.
    Unfortunately, this code is being called early during init to create the
    overlay filesystem, on some devices leaving little chance for a
    successful random pool init.
    True randomness is not that important here, so fix this issue by
    sticking to using /dev/urandom, like in older versions of this code.
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/utils/util-linux/patches/100-use_urandom.patch | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/package/utils/util-linux/patches/100-use_urandom.patch b/package/utils/util-linux/patches/100-use_urandom.patch
new file mode 100644
index 0000000..848f2f4
--- /dev/null
+++ b/package/utils/util-linux/patches/100-use_urandom.patch
@@ -0,0 +1,14 @@
+--- a/lib/randutils.c
++++ b/lib/randutils.c
+@@ -25,6 +25,11 @@
+ #define THREAD_LOCAL static
+ #endif
+ 
++/* force /dev/urandom to avoid hanging on early boot */
++#undef HAVE_GETRANDOM
++#undef SYS_getrandom
++#undef __NR_getrandom
++
+ #ifdef HAVE_GETRANDOM
+ # include <sys/random.h>
+ #elif defined (__linux__)



More information about the lede-commits mailing list