sha256sum Illegal instruction on musl amd64
Natanael Copa
ncopa at alpinelinux.org
Fri Mar 31 07:07:36 UTC 2023
On Wed, 29 Mar 2023 15:46:58 +0200
Denys Vlasenko <vda.linux at googlemail.com> wrote:
> > > it's caused by having a cpu with AVX512 (the github runners do) but not sha_ni,
> > > and the code that checks it is broken and misdetects sha_ni support when avx512
> > > exists. the github runners don't have sha_ni, so it breaks exactly there.
> >
> > The code is:
> >
> > if (!shaNI) {
> > unsigned eax = 7, ebx = ebx, ecx = 0, edx = edx;
> > cpuid(&eax, &ebx, &ecx, &edx);
> > shaNI = ((ebx >> 29) << 1) - 1;
> > }
> > if (shaNI > 0)
> > ctx->process_block = sha1_process_block64_shaNI;
> >
> > If ebx's bit 29 is set, then shaNI = 1. If it is clear, then shaNI = -1.
>
> ...aaaand this is not true! The bits 30,31 also will affect the result,
> need to be masked out! For example this way:
>
> shaNI = ((ebx >> 28) & 2) - 1;
>
> Sorry...
Thank you for the fix. I can confirm it solves it.
https://github.com/ncopa/busybox/actions/runs/4568076877/jobs/8062671513
-nc
More information about the busybox
mailing list