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

Fix incorrect sizes for Intel PT packets tma, pwrx, and vmcs #452

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

aleden
Copy link
Contributor

@aleden aleden commented Dec 12, 2024

While comparing the reference Intel PT decoder (i.e. from libipt) with winafl's I found some incorrect sizes in winafl's code, namely for tma, pwrx, vmcs: their size is defined as 8 but according to libipt's sources they should all be 7.

See definition of enum pt_packet_size
(https://github.com/intel/libipt/blob/4310a2f21a368d31cdfc55b37d65928f38101dc4/libipt/internal/include/pt_opcodes.h#L382)

ptps_tma = pt_opcs_tma + pt_pl_tma_size which is = 2 + 5
ptps_pwrx = pt_opcs_pwrx + pt_pl_pwrx_size which is = 2 + 5
ptps_vmcs = pt_opcs_vmcs + pt_pl_vmcs_size which is = 2 + 5

There are two commits in this PR. The first one updates the lookup table dumping code to print something that has the formatting of the dump in winafl's source code. The second commit fixes the packet sizes.

Copy link

google-cla bot commented Dec 12, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@aleden
Copy link
Contributor Author

aleden commented Dec 12, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Signed

@ifratric
Copy link
Collaborator

Hmm interesting, I spent quite some time making sure that the output from the reference decoder matches WinAFL's decoder and never caught this. Perhaps those packets were never generated on the cpus I tried. But you are right, those should have different sizes.

Thanks for catching this and for the fix!

@ifratric ifratric merged commit 5b7d718 into googleprojectzero:master Dec 12, 2024
1 of 3 checks passed
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