* musl-1.1.22 -static segfaults in __init_tls
@ 2019-04-15 10:59 Sami Farin
2019-04-15 13:07 ` Szabolcs Nagy
0 siblings, 1 reply; 3+ messages in thread
From: Sami Farin @ 2019-04-15 10:59 UTC (permalink / raw)
To: musl; +Cc: hvtaifwkbgefbaei
Fedora 29 Linux, gcc-8.3.1-2.fc29, x86_64 kernel 4.19.33.
$ cat musl_crash.c; musl-gcc musl_crash.c -static; ./a.out
int main(int argc, char* argv[]) {
return 0;
}
Segmentation fault
$ gcc -static musl_crash.c; ./a.out
$
Program received signal SIGSEGV, Segmentation fault.
0x000000000040145c in __init_tls ()
(gdb) d32
Dump of assembler code from 0x40143c to 0x40147c:
0x000000000040143c <__init_tls+12>: xor %ecx,%ecx
0x000000000040143e <__init_tls+14>: push %rbp
0x000000000040143f <__init_tls+15>: xor %edx,%edx
0x0000000000401441 <__init_tls+17>: mov $0x800000,%ebp
0x0000000000401446 <__init_tls+22>: push %rbx
0x0000000000401447 <__init_tls+23>: mov 0x18(%rdi),%r11
0x000000000040144b <__init_tls+27>: mov $0x0,%ebx
0x0000000000401450 <__init_tls+32>: mov 0x28(%rdi),%r9
0x0000000000401454 <__init_tls+36>: mov %r11,%rax
0x0000000000401457 <__init_tls+39>: test %r9,%r9
0x000000000040145a <__init_tls+42>: je 0x4014b3 <__init_tls+131>
=> 0x000000000040145c <__init_tls+44>: mov (%rax),%esi
0x000000000040145e <__init_tls+46>: cmp $0x6,%esi
0x0000000000401461 <__init_tls+49>: jne 0x401468 <__init_tls+56>
0x0000000000401463 <__init_tls+51>: mov %r11,%rcx
0x0000000000401466 <__init_tls+54>: jmp 0x401475 <__init_tls+69>
0x0000000000401468 <__init_tls+56>: cmp $0x2,%esi
0x000000000040146b <__init_tls+59>: jne 0x40147b <__init_tls+75>
0x000000000040146d <__init_tls+61>: test %rbx,%rbx
0x0000000000401470 <__init_tls+64>: je 0x4014aa <__init_tls+122>
0x0000000000401472 <__init_tls+66>: mov %rbx,%rcx
0x0000000000401475 <__init_tls+69>: sub 0x10(%rax),%rcx
0x0000000000401479 <__init_tls+73>: jmp 0x4014aa <__init_tls+122>
0x000000000040147b <__init_tls+75>: cmp $0x7,%esi
End of assembler dump.
(gdb) p $rax
$1 = 4194368
--
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: musl-1.1.22 -static segfaults in __init_tls
2019-04-15 10:59 musl-1.1.22 -static segfaults in __init_tls Sami Farin
@ 2019-04-15 13:07 ` Szabolcs Nagy
2019-04-15 15:10 ` Sami Farin
0 siblings, 1 reply; 3+ messages in thread
From: Szabolcs Nagy @ 2019-04-15 13:07 UTC (permalink / raw)
To: Sami Farin, musl
* Sami Farin <hvtaifwkbgefbaei@gmail.com> [2019-04-15 12:59:17 +0200]:
> Fedora 29 Linux, gcc-8.3.1-2.fc29, x86_64 kernel 4.19.33.
>
> $ cat musl_crash.c; musl-gcc musl_crash.c -static; ./a.out
> int main(int argc, char* argv[]) {
> return 0;
> }
>
> Segmentation fault
this is likely a broken binutils
if the ldflag
-Wl,--build-id
or
-Wl,-z,noseparate-code
fixes it then it's
https://sourceware.org/bugzilla/show_bug.cgi?id=23428
report it to fedora as it affects anything static linked.
(even with glibc if all non-executable load sections are
turned off such as the note section for build-id)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: musl-1.1.22 -static segfaults in __init_tls
2019-04-15 13:07 ` Szabolcs Nagy
@ 2019-04-15 15:10 ` Sami Farin
0 siblings, 0 replies; 3+ messages in thread
From: Sami Farin @ 2019-04-15 15:10 UTC (permalink / raw)
To: musl
On Mon, Apr 15, 2019 at 15:07:37 +0200, Szabolcs Nagy wrote:
> * Sami Farin <hvtaifwkbgefbaei@gmail.com> [2019-04-15 12:59:17 +0200]:
> > Fedora 29 Linux, gcc-8.3.1-2.fc29, x86_64 kernel 4.19.33.
> >
> > $ cat musl_crash.c; musl-gcc musl_crash.c -static; ./a.out
> > int main(int argc, char* argv[]) {
> > return 0;
> > }
> >
> > Segmentation fault
>
> this is likely a broken binutils
>
> if the ldflag
>
> -Wl,--build-id
>
> or
>
> -Wl,-z,noseparate-code
>
> fixes it then it's
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=23428
>
> report it to fedora as it affects anything static linked.
> (even with glibc if all non-executable load sections are
> turned off such as the note section for build-id)
Thanks. Both of those options you suggested generated a non-segfaulting
binary with buggy Fedora binutils.
I applied these commits and musl-gcc generates working binaries (without
needing to pass those ldflags):
6737a6b34f4823deb7142f27b4074831a37ac1e1
d55c3e36094f06bb1fb02f5eac19fdccf1d91f7e
28a27bdbb9500797e6767f80c8128b09112aeed5
d97f1f87b31901ccdb711ec88a0ab792c31d1f60
But I'll just wait till binutils-2.31.2 is released later this year,
Fedora probably doesn't bother cherry-picking...
Make check produces now
# of expected passes 2257
# of unexpected failures 28
# of expected failures 57
# of untested testcases 6
# of unsupported tests 16
which I hope is better than Fedora 29 2.31.1-25:
# of unexpected failures 39
--
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-15 15:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-15 10:59 musl-1.1.22 -static segfaults in __init_tls Sami Farin
2019-04-15 13:07 ` Szabolcs Nagy
2019-04-15 15:10 ` Sami Farin
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).