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

Insert instruction patch, lang="C" via copy-and-micropatch strategy #31

Merged
merged 31 commits into from
May 21, 2024

Conversation

calebh
Copy link
Contributor

@calebh calebh commented May 21, 2024

This pull request adds the features discussed in issue #24. Current implementation fully supports x86-64 via the clang-19 preserve_none flag. The current trunk build from https://apt.llvm.org/ works okay. Make sure that you have the latest version of clang-19, as the calling convention for x86-64 recently changed in the trunk.

This pull request also adds support for aarch64/ARM64, even though preserve_none is not implemented for that platform yet. The calling convention and the use of register annotations is sufficient enough to provide a useful micropatch strategy. Once preserve_none lands for this platform, the support for aarch64 in README.md should be marked as "fully functional." Currently it is marked as "limited functionality."

Also included are test cases for the new strategy.

To view examples of how to use this new micropatch strategy, see the examples/insert_instruction_patch_c folder.

calebh added 30 commits April 8, 2024 17:25
… InsertInstructionPatch with C code now working.
…ted inline assembly moves to allow the programmer to modify extra registers not allowed by the calling convention.
…xtra registers not provided for in the calling convention. Added debug logging for generated C code
…P C now links correctly against external symbols. Added asm_header and asm_footer feature.
…longer necessary due to upstream bugfix just merged.
@DennyDai DennyDai self-requested a review May 21, 2024 22:16
@DennyDai
Copy link
Collaborator

Thank you so much for making this happen!

I've tested it locally on my end, and it's working perfectly.
I will take care of it from here and make the CI pass before merging it into the main branch.

Thanks again for your help in getting this done!

@DennyDai DennyDai changed the base branch from main to copy-and-micropatch May 21, 2024 23:49
@DennyDai DennyDai merged commit 48bc2f9 into purseclab:copy-and-micropatch May 21, 2024
1 of 4 checks passed
@DennyDai DennyDai removed their request for review May 22, 2024 00:53
@DennyDai
Copy link
Collaborator

Everything is in good shape now. I'm just currently waiting for the cle fix (#30) to reach PyPI, then I will merge it into the main branch!

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.

None yet

2 participants