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

[WIP] Detection of ARM THUMB context switch #4555

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

TheN00bBuilder
Copy link
Contributor

Your checklist for this pull request

  • [v] I've read the guidelines for contributing to this repository
  • [v (WIP) ] I made sure to follow the project's coding style
  • [] I've documented or updated the documentation of every function and struct this PR changes. If not so I've explained why.
  • I've added tests that prove my fix is effective or that my feature works (if possible)
  • I've updated the rizin book with the relevant information (if needed)

Detailed description

This is a WIP / Draft merge for my work on detecting ARM THUMB context switches. This can only be done when the A2 encoding of the blx instruction is encountered, which I am detecting and handling. See A8-346 of the "ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition."

p2k_mod_binary_analysis

Keep in mind I've yet to clean up artifacts, prints, and other things from the MR, so don't judge too hard the cleanliness until I say otherwise haha. I've also yet to "de-magic" some numbers with defines.

Test plan

I have not written tests yet for this, but I do have an example binary that I have patched from the original issue (#4357) attached here, that will be taken into consideration when writing tests.

Closing issues

closes #4357

p2kmod.zip

@github-actions github-actions bot removed the rz-asm label Jun 27, 2024
@karliss
Copy link
Member

karliss commented Aug 20, 2024

Few advices beside the stuff I wrote in #4357 .

When working on an issue, create a branch for that specific fix and do your work there. Don't work in the dev branch of your github fork.

Having a RZ_ANALYSIS_OP_TYPE_CTX_SWITCH bitwise flag and introducing instruction type RZ_ANALYSIS_OP_TYPE_CTX_SWITCH are two completely different things. Although based on my previous comment both might be unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ARM ELF wrong detection of the mode
2 participants