diff --git a/backport-shuf-fix-randomness-bug.patch b/backport-shuf-fix-randomness-bug.patch new file mode 100644 index 0000000000000000000000000000000000000000..d2a70f821f599531e7f5e0fc542796c6ceb87a87 --- /dev/null +++ b/backport-shuf-fix-randomness-bug.patch @@ -0,0 +1,39 @@ +From bfbb3ec7f798b179d7fa7b42673e068b18048899 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Sat, 3 Aug 2024 22:31:20 -0700 +Subject: shuf: fix randomness bug + +Problem reported by Daniel Carpenter . +* gl/lib/randread.c (randread_new): Fill the ISAAC buffer +instead of storing at most BYTES_BOUND bytes into it. +--- + gl/lib/randread.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +(limited to 'gl/lib/randread.c') + +diff --git a/lib/randread.c b/lib/randread.c +index 05d479a..00551c5 100644 +--- a/lib/randread.c ++++ b/lib/randread.c +@@ -220,9 +220,19 @@ randread_new (char const *name, size_t bytes_bound) + setvbuf (source, s->buf.c, _IOFBF, MIN (sizeof s->buf.c, bytes_bound)); + else + { ++ /* Fill the ISAAC buffer. Although it is tempting to read at ++ most BYTES_BOUND bytes, this is incorrect for two reasons. ++ First, BYTES_BOUND is just an estimate. ++ Second, even if the estimate is correct ++ ISAAC64 poorly randomizes when BYTES_BOUND is small ++ and just the first few bytes of s->buf.isaac.state.m ++ are random while the other bytes are all zero. See: ++ Aumasson J-P. On the pseudo-random generator ISAAC. ++ Cryptology ePrint Archive. 2006;438. ++ . */ + s->buf.isaac.buffered = 0; + get_nonce (s->buf.isaac.state.m, sizeof s->buf.isaac.state.m, +- bytes_bound); ++ sizeof s->buf.isaac.state.m); + isaac_seed (&s->buf.isaac.state); + } + diff --git a/coreutils.spec b/coreutils.spec index 3ab7b4a911be9408c63b5a2e8265ea8a18ef2ddc..2b4d45cec43e200bbbe9864273c38c78a5485a6a 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,6 +1,6 @@ Name: coreutils Version: 8.32 -Release: 16 +Release: 17 License: GPLv3+ Summary: A set of basic GNU tools commonly used in shell scripts Url: https://www.gnu.org/software/coreutils/ @@ -58,6 +58,7 @@ Patch40: backport-tac-avoid-out-of-bounds-access.patch Patch41: backport-yes-avoid-failure-on-CHERI-protected-systems.patch Patch42: backport-tail-avoid-infloop-with-c-on-dev-zero.patch Patch43: backport-CVE-2025-5278.patch +Patch44: backport-shuf-fix-randomness-bug.patch Conflicts: filesystem < 3 # To avoid clobbering installs @@ -176,6 +177,10 @@ fi %{_mandir}/man*/* %changelog +* Fri Jun 20 2025 Funda Wang - 8.32-17 +- fix upstream bug#72445: Fill the ISAAC buffer instead of storing at most + BYTES_BOUND bytes into it. + * Sat May 31 2025 Funda Wang - 8.32-16 - fix CVE-2025-5278