git: e698e4a53773 - main - lib/libmd: disable SHA1 AVX2 kernel
Date: Mon, 02 Jun 2025 23:33:01 UTC
The branch main has been updated by fuz:
URL: https://cgit.FreeBSD.org/src/commit/?id=e698e4a537736f6a7dd9a386e00997d7fb08e83f
commit e698e4a537736f6a7dd9a386e00997d7fb08e83f
Author: Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2025-06-02 22:54:32 +0000
Commit: Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2025-06-02 23:27:00 +0000
lib/libmd: disable SHA1 AVX2 kernel
Seems like there is a bug lurking somewhere in the code. This was not
caught during my testing. Disable the affected kernel for now while I
figure out what is wrong with it.
To reproduce, run
jot -s '' -b 'a' -n 1000000 | sha1
This should yield 34aa973cd4c4daa4f61eeb2bdbad27316534016f, but gives
fe161a71d7941e3d63a9cacadc4f20716a721944 with the broken code. Only the
amd64/avx2 kernel is affected, the others seem to operate correctly.
Reported by: olivier
Fixes: 8b4684afcde3930eb49490f0b8431c4cb2ad9a46
---
lib/libmd/amd64/sha1dispatch.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/libmd/amd64/sha1dispatch.c b/lib/libmd/amd64/sha1dispatch.c
index 86509195d56e..6c4d43b95ac9 100644
--- a/lib/libmd/amd64/sha1dispatch.c
+++ b/lib/libmd/amd64/sha1dispatch.c
@@ -47,8 +47,10 @@ DEFINE_UIFUNC(, void, sha1_block, (SHA1_CTX *, const void *, size_t))
{
if (cpu_stdext_feature & CPUID_STDEXT_SHA)
return (_libmd_sha1block_shani);
+#if 0
if ((cpu_stdext_feature & AVX2_STDEXT_NEEDED) == AVX2_STDEXT_NEEDED)
return (sha1block_avx2_wrapper);
+#endif
else
return (_libmd_sha1block_scalar);
}