Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upSegfault in _Backtrace_Unwind #47551
Comments
pietroalbini
added
I-crash
A-LLVM
O-musl
C-bug
labels
Jan 23, 2018
This comment has been minimized.
This comment has been minimized.
|
I ran into this as well. |
This comment has been minimized.
This comment has been minimized.
|
There doesn't seem to be any movement on the LLVM issue since I raised it, not even an assignee. Do you know if this is normal behaviour for them? Or if I've mis-raised the issue? |
This comment has been minimized.
This comment has been minimized.
jwilm
commented
May 7, 2018
|
Running into this as well at OneSignal |
This comment has been minimized.
This comment has been minimized.
|
I can reproduce this on latest stable on an open source project:
On the second run of the final command, the background process will segfault. |
jonas-schievink
referenced this issue
Jul 15, 2018
Closed
Enable most AIO tests on musl targets and clean them up #929
This comment has been minimized.
This comment has been minimized.
|
After much investigation, I think there's two bugs here, one that LLVM's unwinder will consider unreadable memory as part of the The crash is specifically happening when trying to find unwind information for the frame above
This in and of itself isn't a huge problem, the The issue is that libunwind's logic for searching for FDE (frame description entry) for the parent frame is pretty all-encompassing and runs in many phases, and one of these crashes (sometimes) if there searched for address is not present in the unwind information). At a high level the process looks like (https://github.com/llvm-mirror/libunwind/blob/release_39/src/UnwindCursor.hpp#L1196)
For Rust x86_64 musl binaries, the compiler has provided DWARF unwind information, so we fall into the second bullet (https://github.com/llvm-mirror/libunwind/blob/release_39/src/UnwindCursor.hpp#L866):
Digging further, we see that the logic for scanning the
In each loop we check that the newly found CIE entry is in a reasonable place (between Unfortunately, as in the linked issue originally
So, what's the bug(s) here?
Either of these would fix this issue, probably both should be done? |
This comment has been minimized.
This comment has been minimized.
|
Ah, there's another possible route for the crash:
|
clux
referenced this issue
Aug 23, 2018
Open
error-chain segfault when using causes via libunwind #42
This comment has been minimized.
This comment has been minimized.
cetra3
commented
Sep 3, 2018
|
I've ran into this issue as well. What's the status of this? |
This comment has been minimized.
This comment has been minimized.
|
I've been looking at a proper fix for this and neither of the two paths I proposed above are yeilding simple results:
Another option would be for LLVM to skip walking the |
sfackler
referenced this issue
Sep 19, 2018
Open
SEGV in unix::stack_overflow::signal_handler #54294
This comment has been minimized.
This comment has been minimized.
|
Here are two tested workarounds, neither very pretty, but both work: 1 - Custom link script
2 - Add a custom object
2, Add |
bossmc commentedJan 18, 2018
Upstream issue: https://bugs.llvm.org/show_bug.cgi?id=36005
The version of
libunwindused in thex86_64-unknown-linux-musl(and possibly thei686-...-muslone too?) standard library has a bug where it will sometimes walk off the end of the segment containing the.eh_framesection and segfault.I've struggled to reproduce this except in some proprietary code, but the backtrace looks like:
There's a proposed fix in the linked LLVM issue, which can possibly be patched into libunwind before building the musl target if taking an updated libunwind isn't possible.