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

_R[15] access causes issues downstream #30

Open
danmatichuk opened this issue Jan 19, 2021 · 0 comments
Open

_R[15] access causes issues downstream #30

danmatichuk opened this issue Jan 19, 2021 · 0 comments

Comments

@danmatichuk
Copy link
Collaborator

Later tools can't translate the call to "uf_get_gpr" if the argument is 15, but the current definition of "_R[n]" doesn't immediately preclude this case (it guards with assertions, but those are currently discarded).

This yields an error on some binaries, i.e.

000100d8 <_start>:
   100d8:       e52db004        push    {fp}            ; (str fp, [sp, #-4]!)
   100dc:       e28db000        add     fp, sp, #0
   100e0:       e59f3054        ldr     r3, [pc, #84]   ; 1013c <_start+0x64>
   100e4:       e08f3003        add     r3, pc, r3
   100e8:       e59f2050        ldr     r2, [pc, #80]   ; 10140 <_start+0x68>
   100ec:       e7932002        ldr     r2, [r3, r2]
   100f0:       e5922000        ldr     r2, [r2]
   100f4:       e3520000        cmp     r2, #0
   100f8:       da00000b        ble     1012c <_start+0x54>
   100fc:       e59f203c        ldr     r2, [pc, #60]   ; 10140 <_start+0x68>
   10100:       e7932002        ldr     r2, [r3, r2]
   10104:       e5922000        ldr     r2, [r2]
   10108:       e3520000        cmp     r2, #0
   1010c:       da000006        ble     1012c <_start+0x54>
   10110:       e59f2028        ldr     r2, [pc, #40]   ; 10140 <_start+0x68>
   10114:       e7932002        ldr     r2, [r3, r2]
   10118:       e5922000        ldr     r2, [r2]
   1011c:       e2822001        add     r2, r2, #1
   10120:       e59f1018        ldr     r1, [pc, #24]   ; 10140 <_start+0x68>
   10124:       e7933001        ldr     r3, [r3, r1]
   10128:       e5832000        str     r2, [r3]
   1012c:       e1a00000        nop                     ; (mov r0, r0)
   10130:       e24bd000        sub     sp, fp, #0
   10134:       e49db004        pop     {fp}            ; (ldr fp, [sp], #4)
   10138:       e12fff1e        bx      lr
   1013c:       00010058        .word   0x00010058
   10140:       0000000c        .word   0x0000000c

The simple fix is to guard this function with a redundant check on n.

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

No branches or pull requests

1 participant