-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustc build core dump on OpenBSD #31363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@dhuseby Bitrig is relatively similar to OpenBSD. Do you have any problems with building recent tree of rustc under Bitrig ? If no, could you try to build one using |
@semarie I do sometimes get segfaults building rustc on Bitrig. I'll give the MALLOC_OPTIONS=S a shot. Thanks for the suggestion. |
Hm, that's interesting. @semarie, could you please try to check it with optimization turned off? You can do that by adding Also, could you please provide an output from gdb's
For some reason it removes the most significant bits of |
@nbaksalyar here the
I will test to build with |
@semarie, thanks! Looks like it's the same problem - |
Due to backtrace I have take a look at Another possible cause is the update of LLVM (#30448) that touched to unwinding (the backtrace has part with @alexcrichton does this problem say something to you ? |
In theory that PR shouldn't have tampered with unwinding for Unix platforms at all (it should be the same as it was before), but the segfault does sound... bad? |
I have done several tests (but I will continue in this direction to ensure) around the LLVM update:
In all cases I don't expose the core dump issue again. I will continue to test in this direction as I am unsure that the problem is systematic. The fact that I could build and run with just another LLVM version (without reverting the commits) makes me think it could be a LLVM bug ? I dunno for now. |
I have done against several builds with the previous Some codegen comparaison:
00000000000f8e50 <str::from_utf8::hf64d73b10248ef4bdYR>:
f8e50: 55 push %rbp
f8e51: 41 57 push %r15
f8e53: 41 56 push %r14
f8e55: 53 push %rbx
f8e56: 48 85 d2 test %rdx,%rdx
f8e59: 0f 84 65 02 00 00 je f90c4 <str::from_utf8::hf64d73b10248ef4bdYR+0x274>
f8e5f: 4c 8d 5a f0 lea 0xfffffffffffffff0(%rdx),%r11
f8e63: 31 c9 xor %ecx,%ecx
f8e65: 4c 8d 0d 2d bb 12 00 lea 1227565(%rip),%r9 # 224999 <str::UTF8_CHAR_WIDTH::hb3baaadb65d72bbdqNS>
f8e6c: 41 b8 01 c0 00 00 mov $0xc001,%r8d
f8e72: 49 ba 80 80 80 80 80 mov $0x8080808080808080,%r10
f8e79: 80 80 80
f8e7c: 90 nop
f8e7d: 90 nop
f8e7e: 90 nop
f8e7f: 90 nop
f8e80: 44 0f b6 3c 0e movzbl (%rsi,%rcx,1),%r15d
f8e85: 45 84 ff test %r15b,%r15b
f8e88: 78 16 js f8ea0 <str::from_utf8::hf64d73b10248ef4bdYR+0x50>
f8e8a: 8d 04 31 lea (%rcx,%rsi,1),%eax
f8e8d: a8 07 test $0x7,%al
f8e8f: 0f 84 1b 01 00 00 je f8fb0 <str::from_utf8::hf64d73b10248ef4bdYR+0x160>
...
00000000000f95e0 <str::from_utf8::hdcda68873f01cd68dYR>:
f95e0: 55 push %rbp
f95e1: 41 57 push %r15
f95e3: 41 56 push %r14
f95e5: 53 push %rbx
f95e6: 48 85 d2 test %rdx,%rdx
f95e9: 0f 84 60 02 00 00 je f984f <str::from_utf8::hdcda68873f01cd68dYR+0x26f>
f95ef: 4c 8d 5a f0 lea 0xfffffffffffffff0(%rdx),%r11
f95f3: 31 c9 xor %ecx,%ecx
f95f5: 4c 8d 0d 11 c3 12 00 lea 1229585(%rip),%r9 # 22590d <str::UTF8_CHAR_WIDTH::he77aff40c91d8da6qNS>
f95fc: 41 b8 01 c0 00 00 mov $0xc001,%r8d
f9602: 49 ba 80 80 80 80 80 mov $0x8080808080808080,%r10
f9609: 80 80 80
f960c: 8d 74 26 00 lea 0x0(%rsi),%esi
f9610: 44 0f b6 3c 0e movzbl (%rsi,%rcx,1),%r15d
f9615: 45 84 ff test %r15b,%r15b
f9618: 78 16 js f9630 <str::from_utf8::hdcda68873f01cd68dYR+0x50>
f961a: 8d 04 31 lea (%rcx,%rsi,1),%eax
f961d: a8 07 test $0x7,%al
f961f: 74 5f je f9680 <str::from_utf8::hdcda68873f01cd68dYR+0xa0> |
The asm and the object code seems to mismatch: Building
.Ltmp806:
.cfi_offset %rbp, -16
testq %rdx, %rdx
je .LBB2909_46
leaq -16(%rdx), %r11
xorl %ecx, %ecx
leaq _ZN3str15UTF8_CHAR_WIDTH20he77aff40c91d8da6qNSE(%rip), %r9
movl $49153, %r8d
movabsq $-9187201950435737472, %r10
.align 16, 0x90
.LBB2909_2:
movzbl (%rsi,%rcx), %r15d
testb %r15b, %r15b
js .LBB2909_3 and the corresponding object code generated: 6: 48 85 d2 test %rdx,%rdx
9: 0f 84 60 02 00 00 je 26f <str::from_utf8::hdcda68873f01cd68dYR+0x26f>
f: 4c 8d 5a f0 lea 0xfffffffffffffff0(%rdx),%r11
13: 31 c9 xor %ecx,%ecx
15: 4c 8d 0d 00 00 00 00 lea 0(%rip),%r9 # 1c <str::from_utf8::hdcda68873f01cd68dYR+0x1c>
1c: 41 b8 01 c0 00 00 mov $0xc001,%r8d
22: 49 ba 80 80 80 80 80 mov $0x8080808080808080,%r10
29: 80 80 80
2c: 8d 74 26 00 lea 0x0(%rsi),%esi
30: 44 0f b6 3c 0e movzbl (%rsi,%rcx,1),%r15d
35: 45 84 ff test %r15b,%r15b
38: 78 16 js 50 <str::from_utf8::hdcda68873f01cd68dYR+0x50> I have tried to build
|
BTW, I tried building the latest with the MALLOC_OPTIONS=S and I'm still getting segfaults. |
@dhuseby you missed the point I think: the purpose of testing build with But for now, I think the issue could be a bug somewhere in code generation (in LLVM or in rustc, I dunno). |
@steveklabnik could you update labels ?
|
@Zoxc filed an LLVM bug: https://llvm.org/bugs/show_bug.cgi?id=26554 |
\o/ |
I confirm that reverting the LLVM patch |
The initial purpose is to workaround the LLVM bug https://llvm.org/bugs/show_bug.cgi?id=26554 for OpenBSD. By default, the `cpu' is defined to `generic`. But with a 64bit processor, the optimization for `generic` will use invalid asm code as NOP (the generated code for NOP isn't a NOP). According to rust-lang#20777, "x86-64" is the right thing to do for x86_64 builds. Closes: rust-lang#31363
The initial purpose is to workaround the LLVM bug https://llvm.org/bugs/show_bug.cgi?id=26554 for OpenBSD. By default, the `cpu` is defined to `generic`. But with a 64bit processor, the optimization for `generic` will use invalid asm code as NOP (the generated code for NOP isn't a NOP). According to #20777, "x86-64" is the right thing to do for x86_64 builds. Closes: #31363 r? @alexcrichton
I am investigating a core dump issue (rustc compiler crash without panic) under OpenBSD during the build. The segfault occurs at stage2 during libcore building.
It seems to occurs occasionnally on OpenBSD buildhost.
Note that rustc under OpenBSD use system
malloc(3)
, that comes with several security options (see http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man5/malloc.conf.5).Backtrace of one build:
The text was updated successfully, but these errors were encountered: