From 43357218f024b251fc2b741dc3e8bdc4c001051f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 22 May 2018 18:07:08 +0200 Subject: [PATCH 3/3] gnu: e2fsprogs: Use libuuid with non-blocking random. Partly fixes . * gnu/packages/linux.scm (util-linux/libuuid-non-blocking-random): New variable. (e2fsprogs)[inputs]: Use it instead of UTIL-LINUX. --- gnu/packages/linux.scm | 17 ++++++++++++++++- ...util-linux-libuuid-non-blocking-random.patch | 15 +++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/util-linux-libuuid-non-blocking-random.patch diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index bb4e00394..c93947e68 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -671,6 +671,20 @@ block devices, UUIDs, TTYs, and many other tools.") (append (origin-patches (package-source util-linux)) (search-patches "util-linux-CVE-2018-7738.patch"))))))) +(define-public util-linux/libuuid-non-blocking-random + ;; Package variant where libuuid uses non-blocking (weak) random. See + ;; . + (package + (inherit util-linux) + (name "util-linux-weak-random") + (source (let ((source (package-source util-linux))) + (origin + (inherit source) + (patches (append (search-patches + "util-linux-libuuid-non-blocking-random.patch") + (origin-patches source)))))) + (properties '((hidden? . #t))))) + (define-public ddate (package (name "ddate") @@ -779,7 +793,8 @@ slabtop, and skill.") (base32 "00ilv65dzcgiap435j89xk86shf7rrav3wsik7cahy789qijdcn9")))) (build-system gnu-build-system) - (inputs `(("util-linux" ,util-linux))) + ;; Arrange so that 'mke2fs' doesn't wait: . + (inputs `(("util-linux" ,util-linux/libuuid-non-blocking-random))) (native-inputs `(("pkg-config" ,pkg-config) ("texinfo" ,texinfo) ;for the libext2fs Info manual diff --git a/gnu/packages/patches/util-linux-libuuid-non-blocking-random.patch b/gnu/packages/patches/util-linux-libuuid-non-blocking-random.patch new file mode 100644 index 000000000..c0b3ea24d --- /dev/null +++ b/gnu/packages/patches/util-linux-libuuid-non-blocking-random.patch @@ -0,0 +1,15 @@ +Change libuuid so that 'uuid_generate' is non-blocking. This is needed when +'mke2fs' is used during early boot in VMs with little entropy available. +See . + +--- a/lib/randutils.c ++++ b/lib/randutils.c +@@ -104,7 +104,7 @@ void random_get_bytes(void *buf, size_t nbytes) + int x; + + errno = 0; +- x = getrandom(cp, n, 0); ++ x = getrandom(cp, n, GRND_NONBLOCK); + if (x > 0) { /* success */ + n -= x; + cp += x; -- 2.17.0