Skip to content

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

@mrsteyk

Description

@mrsteyk

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions