Subject: Re: bug#64058: [PATCH] wc: Fix crashes due to incomplete AVX2 enumeration

From: Pádraig Brady <[email-masked]>
Date: Thu, 15 Jun 2023 01:22:07 +0100

On 14/06/2023 23:04, Paul Eggert wrote:
> On 6/14/23 03:46, Pádraig Brady wrote:
> 
>> Paul you removed the "avx" check from cksum.c. Was that intended?
> 
> No, it's a typo I introduced. Thanks for catching that. Fixed in the
> first attached patch.
> 
> While looking into this I noticed a couple of other cleanups, fixed in
> the other attached patches.
> 
> I installed these into coreutils on Savannah.

Changes look good.
I pushed the attached to explicitly document the cksum fix,
and cleanup a syntax-check failure.

Marking this as done.

thanks,
Pádraig

From d53190ed46a55f599800ebb2d8ddfe38205dbd24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email-masked]>
Date: Thu, 15 Jun 2023 00:53:54 +0100
Subject: [PATCH] doc: mention cksum error fix with cpu feature checks changes

* NEWS: Mention the error message to aid those searching
for solutions to the issue, and mention cksum also
as that was confirmed to fix the error with the adjusted
cpu feature detection, as discussed at https://bugs.debian.org/1037264
* src/cksum.c: Cleanup syntax-check failure from previous commit.
---
 NEWS        | 3 ++-
 src/cksum.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 3350f9871..535850549 100644
--- a/NEWS
+++ b/NEWS
@@ -29,7 +29,8 @@ GNU coreutils NEWS                                    -*- outline -*-
   'pr --length=1 --double-space' no longer enters an infinite loop.
   [This bug was present in "the beginning".]
 
-  'wc -l' no longer crashes on x86 Linux kernels that disable XSAVE YMM.
+  'wc -l' and 'cksum' no longer crash with an "Illegal instruction" error
+  on x86 Linux kernels that disable XSAVE YMM.  This was seen on Xen VMs.
   [bug introduced in coreutils-9.0]
 
 ** Changes in behavior
diff --git a/src/cksum.c b/src/cksum.c
index 26bb29bdb..5b6a59c16 100644
--- a/src/cksum.c
+++ b/src/cksum.c
@@ -229,9 +229,9 @@ crc_sum_stream (FILE *stream, void *resstream, uintmax_t *length)
   static bool (*cksum_fp) (FILE *, uint_fast32_t *, uintmax_t *);
   if (! cksum_fp)
     cksum_fp = pclmul_supported () ? cksum_pclmul : cksum_slice8;
-#else
+# else
   bool (*cksum_fp) (FILE *, uint_fast32_t *, uintmax_t *) = cksum_slice8;
-#endif
+# endif
 
   if (! cksum_fp (stream, &crc, &total_bytes))
     return -1;
-- 
2.40.1