zelos icon indicating copy to clipboard operation
zelos copied to clipboard

Invalid PC value on ARM, EABI5 version 1 (SYSV)

Open mrsteyk opened this issue 3 years ago • 0 comments

Describe the bug It appears that PC register on 32 bit ARM has an invalid value, resulting in invalid PC-relative resolution.

To Reproduce Steps to reproduce the behavior:

  1. Download this
  2. Type py -3 -m zelos ./libzlib.so
  3. See an error message
  4. Open this place in IDA and see correct address resolution (0x15FD8 instead of 0x15FD0)

Expected behavior Correct PC value should not point at the exact address like IP on x86

Screenshots Not applicable

Additional context According to the ARM IC.

In ARM state, the value of the PC is the address of the current instruction plus 8 bytes. In Thumb state:

  • For B, BL, CBNZ, and CBZ instructions, the value of the PC is the address of the current instruction plus 4 bytes.
  • For all other instructions that use labels, the value of the PC is the address of the current instruction plus 4 bytes, with bit[1] of the result cleared to 0 to make it word-aligned.

mrsteyk avatar May 13 '21 13:05 mrsteyk