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

Failing to assemble ADR X29 0xFFFFFFFFFFFFFAC8 due to missing offset #1495

Closed
AeonLucid opened this issue Aug 2, 2024 · 0 comments · Fixed by #1496
Closed

Failing to assemble ADR X29 0xFFFFFFFFFFFFFAC8 due to missing offset #1495

AeonLucid opened this issue Aug 2, 2024 · 0 comments · Fixed by #1496

Comments

@AeonLucid
Copy link
Contributor

AeonLucid commented Aug 2, 2024

I am trying to modify a block inside an arm64 binary.
My steps are as follows:

  1. Load the binary inside miasm
cont = Container.from_stream(open('blabla.so', 'rb'), loc_db=location_db)
dis_engine = machine.dis_engine(cont.bin_stream, loc_db=location_db)
  1. Disassemble blocks
asmcfg = dis_engine.dis_multiblock(...)
  1. Attempt to reassemble the blocks (without any modifications)
dinterval = interval(blk.get_range() for blk in asmcfg.blocks)
dinterval_full = interval([dinterval.hull()])

assembled = asm_resolve_final(machine.mn, asmcfg, dst_interval=dinterval_full)
  1. Error
site-packages\miasm\core\cpu.py", line 1427, in asm
    raise ValueError(
ValueError: cannot asm 'ADR' ['X29', '0xFFFFFFFFFFFFFAC8']

To give some context, this is the instruction it is failing on.

0xC7100: ADR X29, sub_C6BC8 ; Instruction in hex [5D D6 FF 10]

The instruction adr x29, #0xfffffffffffffac8 would be correct, if it were placed at offset 0x0.
However it is assembled for the location 0xC7100 and should be adr x29, #0xc6bc8.

Looking through the miasm codebase I can not see any support for this.
Am I missing something?

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 a pull request may close this issue.

1 participant