Skip to content

Backtrace through signal handlers on alpine #698

@r1viollet

Description

@r1viollet

Description

While using the backtrace::resolve_frame_unsynchronized API it seems we are not going through signal handlers.
Here is what I get when using the API,

Starting backtrace-rs unwinding...
Frame: IP: 0x58951a886bc6, Function: backtrace::backtrace::libunwind::trace::hd9a0af93696308ae, File: "/root/.cargo/git/checkouts/backtrace-rs-fb1f822361417489/f8cc6ac/src/backtrace/libunwind.rs", Line: 116
Frame: IP: 0x58951a886bc6, Function: backtrace::backtrace::trace_unsynchronized::hac1bf9acb19bced3, File: "/root/.cargo/git/checkouts/backtrace-rs-fb1f822361417489/f8cc6ac/src/backtrace/mod.rs", Line: 66
Frame: IP: 0x58951a887eb6, Function: unwind_example::unwind_with_backtrace::h8ed6b6267026e92f, File: "/opt/libdatadog/examples/rust/src/main.rs", Line: 101
Frame: IP: 0x58951a888034, Function: unwind_example::crash_handler::hd3592dcebb8db214, File: "/opt/libdatadog/examples/rust/src/main.rs", Line: 145
Frame: IP: 0x754eafdcf5a4, Function: sigwaitinfo, File: "/home/buildozer/aports/main/musl/src/musl-1.2.5/src/signal/x86_64/restore.s", Line: 1

As you can see I get stuck on sigwaitinfo and to not go up to the main function.
I wrote a small comparison to libunwind where I successfully unwind through the signal handler and get to the main function.

The issue could be within the miri API. I did not dive into what was done within this function.

Reproducer

Here is the source code for my example. I ran this on an alpine image where I made an install of libunwind. It might be difficult to run. Please reach out if you want more precise instructions.

LD_PRELOAD=/usr/lib/libgcc_s.so ./target/debug/unwind_example

Thanks for considering 🙇

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions