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

Adds support for generating Tenet traces with bochs backend #12

Merged
merged 9 commits into from
Aug 15, 2021
Merged

Adds support for generating Tenet traces with bochs backend #12

merged 9 commits into from
Aug 15, 2021

Conversation

gaasedelen
Copy link
Contributor

This PR adds experimental support for generating Tenet traces with the bochs backend through wtf.

PS: I also dropped your single use of std:rotr as that is only supported in C++20 which was causing the build to fail on VS 2019.

@0vercl0k
Copy link
Owner

This is dope! I'll review this this weekend 🙏🏽

Copy link
Owner

@0vercl0k 0vercl0k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right, dropped the first round of comments; mostly nits.

src/wtf/bochscpu_backend.cc Outdated Show resolved Hide resolved
src/wtf/bochscpu_backend.cc Outdated Show resolved Hide resolved
src/wtf/bochscpu_backend.cc Outdated Show resolved Hide resolved
src/wtf/bochscpu_backend.cc Outdated Show resolved Hide resolved
src/wtf/bochscpu_backend.cc Outdated Show resolved Hide resolved
src/wtf/bochscpu_backend.cc Outdated Show resolved Hide resolved
src/wtf/utils.cc Outdated Show resolved Hide resolved
src/wtf/utils.cc Outdated Show resolved Hide resolved
src/wtf/bochscpu_backend.cc Outdated Show resolved Hide resolved
src/wtf/bochscpu_backend.cc Outdated Show resolved Hide resolved
@0vercl0k
Copy link
Owner

All right I've fixed a bunch of stuff and it's now in a good state I think - let me know if I've messed up anything up!

I've also attached a sample trace file for you to have a look if it looks fine 😀

Cheers

@0vercl0k
Copy link
Owner

0vercl0k commented Aug 15, 2021

I've also found a bug - basically if a breakpoint would change @rip, bochs wouldn't invoke the AfterExecution callback. It would invoke the BeforeExecution callback for the new @rip which would overwrite the previous state. This means we would miss the instruction executed after every breakpoints that changes @rip.

[update] Ok after talking with @yrp604 this logic is still flawed - if the instruction generates a page-faults we end up in the same scenario.

Cheers

@0vercl0k
Copy link
Owner

All right - I've moved the logic in the BeforeExecution hook - it might be the solution to all our problems. Will run through the various edge cases tomorrow!

Cheers

@0vercl0k 0vercl0k merged commit 445a94f into 0vercl0k:main Aug 15, 2021
@gaasedelen gaasedelen deleted the develop branch August 15, 2021 22:31
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

Successfully merging this pull request may close these issues.

2 participants