frida-gum icon indicating copy to clipboard operation
frida-gum copied to clipboard

ARM Relocator doesn't correctly handle "add sb, pc, r4"

Open WorksButNotTested opened this issue 5 years ago • 1 comments

The output it generates is:

ldr sb, [pc, -#0]
add sb, r4, #0

This results in sb being loaded with the value of r4, and the value of pc being discarded. The correct output should be:

ldr sb, [pc, -#0]
add sb, sb, r4

Note that sb is a synonym for r9.

WorksButNotTested avatar Aug 12 '20 09:08 WorksButNotTested

The defect is here.

code should read:

gum_arm_writer_put_add_reg_reg_reg (ctx->output, target, target, right->reg)

WorksButNotTested avatar Aug 12 '20 09:08 WorksButNotTested