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 address underflow on disassemble (Fixed-length ABI) #652

Merged
merged 1 commit into from
May 21, 2021

Conversation

SWW13
Copy link
Contributor

@SWW13 SWW13 commented May 21, 2021

Fix context disassemble near 0x0

Description/Motivation/Screenshots

Firmware execution may start at address 0x0. Disassembling instruction before addresses near 0x0 leads to an address underflow and therefore an gdb.MemoryError exception during context.

NOTE: An unmapped page may still be reached with the unchecked addr - n * instruction_length location calculation, so maybe removing the special case for fixed-sized ABI's may be the better solution.

unfixed:
image
fixed:
image

How Has This Been Tested?

Architecture Yes/No Comments
x86-32 ✖️
x86-64 ✖️
ARM ✖️
AARCH64 ✖️
MIPS ✖️
POWERPC ✖️
SPARC ✔️
RISC-V ✖️
make tests ✔️

Checklist

  • My PR was done against the dev branch, not master.
  • My code follows the code style of this project.
  • My change includes a change to the documentation, if required.
  • My change adds tests as appropriate.
  • I have read and agree to the CONTRIBUTING document.

@Grazfather
Copy link
Collaborator

Nice, I don't do too much firmware debugging. Thanks for this.

@Grazfather Grazfather merged commit 4ae9dbb into hugsy:dev May 21, 2021
@hugsy hugsy added this to the 2021-07 Release milestone Jun 11, 2021
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.

3 participants