How to replace one instruction with another in ARM ELF?

0

I have ARM (EABI and OABI) ELF binaries, and I'm using angr which uses libVEX. Unfortunately libVEX cannot parse OABI svc (swi) call, only EABI.

EABI svc call has format (where 45 is code of system call):

e3a0702d        mov     r7, #45
ef000000        svc     0x00000000

OABI has format (where 2d at the end):

ef90000c        svc     0x0090000c

I would like to convert all ELF binaries such that, OABI above becomes:

push r7
mov r7, 0x0c
svc 0
pop r7

How can I do this? I'm thinking about python script, but the padding is important so I would probably need some framework which understands ELF.

linux
elf
asked on Stack Overflow May 9, 2021 by Hrca12

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0