BusyBox 1.36.0 regression: Segfaults on i386 musl libc
Sören Tempel
soeren at soeren-tempel.net
Sat Jan 7 12:01:59 UTC 2023
Hello,
Natanael Copa <ncopa at alpinelinux.org> wrote:
> diff --git a/libbb/hash_md5_sha.c b/libbb/hash_md5_sha.c
> index 880ffab01..d2351d3e6 100644
> --- a/libbb/hash_md5_sha.c
> +++ b/libbb/hash_md5_sha.c
> @@ -17,8 +17,11 @@
> # if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
> static void cpuid(unsigned *eax, unsigned *ebx, unsigned *ecx, unsigned *edx)
> {
> - asm ("cpuid"
> - : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx)
> + asm volatile (
> + "mov %%ebx, %%esi;" /* save %ebx PIC register */
> + "cpuid;"
> + "xchg %%ebx, %%esi;"
> + : "=a"(*eax), "=S"(*ebx), "=c"(*ecx), "=d"(*edx)
> : "0"(*eax), "1"(*ebx), "2"(*ecx), "3"(*edx)
> );
> }
Unfortunately, this does not fix the segfault. Since the segfault occurs
in musl's dynamic loader I also don't think that this code is
reached/executed. Instead, this seems to be a problem with the symbols
of the provided assembly file.
I am currently debugging this on a96ccbefe417aaac6a2ce59c788e01fc0f83902f.
If I remove the PSHUFFLE_BYTE_FLIP_MASK definition (and the instruction
using it) in hash_md5_sha256_x86-32_shaNI.S from the checkout for this
commit then the segfault doesn't occur. So this does definitely seem to
be a problem with the hash_md5_sha256_x86-32_shaNI.S assembly file...
Greetings,
Sören
More information about the busybox
mailing list