-
Notifications
You must be signed in to change notification settings - Fork 212
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
Add control flow information to __rust_probestack #328
Conversation
a5c010a
to
10ffd32
Compare
Unfortunately the mach-o assembler doesn't support the directives I'm using to keep the assembly inline. I don't know how to express what I want to in that assembler (it doesn't like some of the assembly used in #305 either). That means we'll have to split the implementations for Mac out :( |
24e2d26
to
928bd0a
Compare
Actually, it seems #305's implementation did compile on apple except for the There doesn't seem to be any substitute for EDIT: I actually think there's still a way of doing it inline, so I'll play with that. |
66b1486
to
c7b64af
Compare
Hmm, so wrapping our inner implementation in It seems like the enclosing |
.pushsection .text.__rust_probestack | ||
.globl __rust_probestack | ||
.type __rust_probestack, @function | ||
__rust_probestack: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe on Mach-O the linker would be allowed to move this symbol and following content to another location, as it uses symbols to determine the start and end of every function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that would be fine. __rust_probestack
is the function that gets called, not __rust_probestack_wrapper
.
Maybe use |
I didn't know about |
Now that's an impressive set of green :) I think it'd be good to hook this up into rust-lang/rust before merging though (via |
8716942
to
7c53957
Compare
7c53957
to
29fbe3e
Compare
Done! Had to make one change, now all tests pass on both linux and mac. |
👍 |
Bump compiler-builtins - rust-lang/compiler-builtins#306 - rust-lang/compiler-builtins#309 - rust-lang/compiler-builtins#310 - rust-lang/compiler-builtins#311 - rust-lang/compiler-builtins#312 - rust-lang/compiler-builtins#313 - rust-lang/compiler-builtins#315 - rust-lang/compiler-builtins#317 - rust-lang/compiler-builtins#323 - rust-lang/compiler-builtins#324 - rust-lang/compiler-builtins#328 Adds support for backtraces from `__rust_probestack` plus other goodies. r? @alexcrichton
This adds control flow information (CFI) on x86 and x86_64 platforms, so that DWARF-based backtraces work when the stack probe fails.
The implementation builds on the work done in #305 and #306. It manages to keep the CFI in inline assembly by defining a "function within a function." This has been done elsewhere; see e.g. this LibFuzzer code.