-
Notifications
You must be signed in to change notification settings - Fork 566
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
i#6213,i#5490: Add drmemtrace branch targets up front #6219
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The drmemtrace record type TRACE_TYPE_INSTR_CONDITIONAL_JUMP is now deprecated in offline traces where it is replaced by TRACE_TYPE_INSTR_TAKEN_JUMP and TRACE_TYPE_INSTR_UNTAKEN_JUMP. The version number is bumped to accomplish this. Indirect branches in drmemtrace traces now contain a marker holding the actual target (TRACE_MARKER_TYPE_BRANCH_TARGET), which immediately precedes the branch record. These changes are implemented inside raw2trace and in PT ir2trace. raw2trace tests are updated and new tests added. Special cases with new logic and tests include: + Rseq side exits must specially set whether taken or untaken + Rseq abort rollbacks to a branch are tested as this is the case where it was not easy to identify whether a branch was taken in the past (it required particular inferences). + Branches prior to signals. + Trace-final branches: we just delete these. Adds view support: ``` 2212815 1648444: 1249326 ifetch 6 byte(s) @ 0x00007f3406720707 48 3d 01 f0 ff ff cmp %rax, $0xfffff001 2212816 1648445: 1249326 ifetch 2 byte(s) @ 0x00007f340672070d 73 01 jnb $0x00007f3406720710 (untaken) 2212817 1648445: 1249326 <marker: indirect branch target 0x7f34066a8b37> 2212818 1648446: 1249326 ifetch 1 byte(s) @ 0x00007f340672070f c3 ret 2212819 1648446: 1249326 read 8 byte(s) @ 0x00007ffd91e24fa8 by PC 0x00007f340672070f 2212820 1648447: 1249326 ifetch 5 byte(s) @ 0x00007f34066a8b37 4c 8b 54 24 48 mov 0x48(%rsp), %r10 ``` Adds several new invariant checks and augments the existing PC continuity checks. This required a little refactoring to check branches before signals which is part of #5912. Unit tests for each cases are added. Updates the documentation and the changelist. Issue: #5490, #6213, #5912 Fixes #6213 Fixes #5490
x64 failure is #6185 api.rseq synch assert |
Actually the win64 has a failure which is not flaky which I missed before: seems to be failure to remove from the encoding cache; can repro in a new unit test. |
abhinav92003
approved these changes
Jul 25, 2023
+ Remove documented guarantee that branches are delayed (but the impl remains; added a comment about waiting for users to update before changing that, if we do) + Added comments about some issues in signal PC continuity checks that #5912 should address + Added missing clear of last_indirect_target_ + Use last_insr_in_cur_context_ instead of prev_instr_ + Multiple comment wording and variable name and test parameter updates + Added an untaken-before-signal raw2trace unit test + Added an assert on no non-branch instrs being delayed
…ev_instr_decoded_; #5912 covers changing both sides to the prior in the cur context
ivankyluk
pushed a commit
to ivankyluk/dynamorio
that referenced
this pull request
Jul 28, 2023
The drmemtrace record type TRACE_TYPE_INSTR_CONDITIONAL_JUMP is now deprecated in offline traces where it is replaced by TRACE_TYPE_INSTR_TAKEN_JUMP and TRACE_TYPE_INSTR_UNTAKEN_JUMP. The version number is bumped to accomplish this. Indirect branches in drmemtrace traces now contain a marker holding the actual target (TRACE_MARKER_TYPE_BRANCH_TARGET), which immediately precedes the branch record. These changes are implemented inside raw2trace and in PT ir2trace. raw2trace tests are updated and new tests added. Special cases with new logic and tests include: + Rseq side exits must specially set whether taken or untaken + Rseq abort rollbacks to a branch are tested as this is the case where it was not easy to identify whether a branch was taken in the past (it required particular inferences). + Branches prior to signals. + Trace-final and window-final branches: we just delete these. Adds view support: ``` 2212815 1648444: 1249326 ifetch 6 byte(s) @ 0x00007f3406720707 48 3d 01 f0 ff ff cmp %rax, $0xfffff001 2212816 1648445: 1249326 ifetch 2 byte(s) @ 0x00007f340672070d 73 01 jnb $0x00007f3406720710 (untaken) 2212817 1648445: 1249326 <marker: indirect branch target 0x7f34066a8b37> 2212818 1648446: 1249326 ifetch 1 byte(s) @ 0x00007f340672070f c3 ret 2212819 1648446: 1249326 read 8 byte(s) @ 0x00007ffd91e24fa8 by PC 0x00007f340672070f 2212820 1648447: 1249326 ifetch 5 byte(s) @ 0x00007f34066a8b37 4c 8b 54 24 48 mov 0x48(%rsp), %r10 ``` Adds several new invariant checks and augments the existing PC continuity checks. This required a little refactoring to check branches before signals which is part of DynamoRIO#5912. Unit tests for each case are added. Adds a couple of comments on issues that DynamoRIO#5912 should address. Updates the documentation to remove the documented guarantee that branches are delayed. Updates the changelist. Issue: DynamoRIO#5490, DynamoRIO#6213, DynamoRIO#5912 Fixes DynamoRIO#6213 Fixes DynamoRIO#5490
ivankyluk
pushed a commit
to ivankyluk/dynamorio
that referenced
this pull request
Jul 29, 2023
The drmemtrace record type TRACE_TYPE_INSTR_CONDITIONAL_JUMP is now deprecated in offline traces where it is replaced by TRACE_TYPE_INSTR_TAKEN_JUMP and TRACE_TYPE_INSTR_UNTAKEN_JUMP. The version number is bumped to accomplish this. Indirect branches in drmemtrace traces now contain a marker holding the actual target (TRACE_MARKER_TYPE_BRANCH_TARGET), which immediately precedes the branch record. These changes are implemented inside raw2trace and in PT ir2trace. raw2trace tests are updated and new tests added. Special cases with new logic and tests include: + Rseq side exits must specially set whether taken or untaken + Rseq abort rollbacks to a branch are tested as this is the case where it was not easy to identify whether a branch was taken in the past (it required particular inferences). + Branches prior to signals. + Trace-final and window-final branches: we just delete these. Adds view support: ``` 2212815 1648444: 1249326 ifetch 6 byte(s) @ 0x00007f3406720707 48 3d 01 f0 ff ff cmp %rax, $0xfffff001 2212816 1648445: 1249326 ifetch 2 byte(s) @ 0x00007f340672070d 73 01 jnb $0x00007f3406720710 (untaken) 2212817 1648445: 1249326 <marker: indirect branch target 0x7f34066a8b37> 2212818 1648446: 1249326 ifetch 1 byte(s) @ 0x00007f340672070f c3 ret 2212819 1648446: 1249326 read 8 byte(s) @ 0x00007ffd91e24fa8 by PC 0x00007f340672070f 2212820 1648447: 1249326 ifetch 5 byte(s) @ 0x00007f34066a8b37 4c 8b 54 24 48 mov 0x48(%rsp), %r10 ``` Adds several new invariant checks and augments the existing PC continuity checks. This required a little refactoring to check branches before signals which is part of DynamoRIO#5912. Unit tests for each case are added. Adds a couple of comments on issues that DynamoRIO#5912 should address. Updates the documentation to remove the documented guarantee that branches are delayed. Updates the changelist. Issue: DynamoRIO#5490, DynamoRIO#6213, DynamoRIO#5912 Fixes DynamoRIO#6213 Fixes DynamoRIO#5490
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The drmemtrace record type TRACE_TYPE_INSTR_CONDITIONAL_JUMP is now deprecated in offline traces where it is replaced by TRACE_TYPE_INSTR_TAKEN_JUMP and TRACE_TYPE_INSTR_UNTAKEN_JUMP. The version number is bumped to accomplish this.
Indirect branches in drmemtrace traces now contain a marker holding the actual target (TRACE_MARKER_TYPE_BRANCH_TARGET), which immediately precedes the branch record.
These changes are implemented inside raw2trace and in PT ir2trace. raw2trace tests are updated and new tests added.
Special cases with new logic and tests include:
Adds view support:
Adds several new invariant checks and augments the existing PC continuity checks. This required a little refactoring to check branches before signals which is part of #5912. Unit tests for each case are added.
Updates the documentation and the changelist.
Issue: #5490, #6213, #5912
Fixes #6213
Fixes #5490