Skip to content
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

Make DWARF great again #152

Open
sticnarf opened this issue Jul 28, 2022 · 0 comments
Open

Make DWARF great again #152

sticnarf opened this issue Jul 28, 2022 · 0 comments

Comments

@sticnarf
Copy link
Contributor

sticnarf commented Jul 28, 2022

There have been a lot of issues because of unwinding using backtrace-rs (e.g. #36, #75, #76). They will potentially make the program crash or deadlock. And they lead us to providing an alternative but legacy unwinding mechanism, which uses frame pointers. Frame pointers are solid, but it uses an additional register, and we need special building configurations to enable frame pointers.

The root of these dwarf unwinding issues are:

  • Unable to control when to load module information (e.g. deadlock in dl_iterate_phdr)
  • Unable to prevent reading unaccessible memory (due to incorrect debug information)
  • Simply due to bad unwinding implementation. But this is provided by the system and we cannot fix it.

With gimli and framehop, I think it's possible for us to overcome all these problems.

  • We can initialize the unwinder and load the shared programs ahead of time. We can manage the cache by ourselves. And gimli does not need any additional allocations or system calls. Then,we can make our signal handler 100% signal safe.
  • We can still use our addr_validate during the unwinding, preventing any invalid memory access.
  • Because it is us who provide the unwinding implementation, we can fix the bugs if there are any.

I make a prototype of unwinding with framehop: https://github.com/sticnarf/runwind. Currently, it supports Linux amd64/aarch64 only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant