-
Notifications
You must be signed in to change notification settings - Fork 362
BEAM minimal unwinder #975
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
BEAM minimal unwinder #975
Conversation
Yes, the But ideally the location would be extracted with disassembly if needed to allow working with stripped binaries. |
c07951b to
a6e7994
Compare
| { | ||
| state->SP_REGISTER += 8; | ||
| bpf_probe_read_user(&state->pc, sizeof(u64), (void *)state->SP_REGISTER); | ||
| if ((state->pc & 0x03) == 0) { |
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.
Is 0x03 a special value that should be documented or we can link to documentation?
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 added a comment for now to document it. I will probably go ahead and just read in the etp_tag_primary_size and etp_tag_primary_header symbols in a future iteration just to make it more clear and less likely to break in the future, but I'm guessing that's very unlikely to change anytime soon since that would mean shuffling the whole tagging system around to make room for more bits in the encoding scheme.
|
I timed out for today, but I think I incorporated most of the feedback, in case you get a chance to review and confirm. I will come back and do some more clean-up though. For example I'm actually not even using any of the VM offsets anymore since they're all just assumed / mirrored in the structs I'm defining in order to read in the data consecutively at this point. |
1095f50 to
ab2533f
Compare
|
I finished the rest of the clean-up and rebased onto |
fabled
left a comment
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.
Looks great module few nits. Should be ready for merge after the non leaf marking move. Thanks!
ab2533f to
a1b2968
Compare
|
I think I got all the nits picked, but let me know if I misunderstood the comment about moving the nonleaf marking thing! |
This PR is a step in between the initial plumbing that was recently merged in #958 and the complete implementation that was spiked out in #289.
It adds a BEAM unwinder that supports x86 and ARM, using Frame Pointers when available and scanning the stack when they're not. For now, the frames that are passed back to the agent only identify which CodeHeader the PC belongs to, along with the PC itself. A final PR will actually do the additional work of reading the CodeHeader to resolve the symbol names.
Initial issues when the PR was opened
The reason I'm opening this initially as a draft is that it seems to no longer be possible to use
ReadSymbolsto read thersymbol like I was before. I get an error like the following:The issue has been resolved now
In my previous code, I was doing this to read it:
So I guess the time has come to figure out how to handle that more correctly. What I've included in the draft PR won't work because I get the following error when trying to load to the BEAM instance: