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

Wrong loading of ARM Thumb functions from ELF with symbols #4665

Open
XVilka opened this issue Oct 11, 2024 · 0 comments
Open

Wrong loading of ARM Thumb functions from ELF with symbols #4665

XVilka opened this issue Oct 11, 2024 · 0 comments

Comments

@XVilka
Copy link
Member

XVilka commented Oct 11, 2024

Rizin wrongly detects main as ARM but it's marked as Thumb with the special symbol $t.

rizin -A arm-thumb-dwarf.elf
[0x00008000]> is
nth paddr      vaddr      bind   type   size lib name
-----------------------------------------------------------------
1   0x00001000 0x00008000 LOCAL  SECT   0        .text
2   ---------- 0x00009018 LOCAL  SECT   0        .persistent
3   ---------- 0x00009018 LOCAL  SECT   0        .noinit
4   ---------- 0x00000000 LOCAL  SECT   0        .comment
5   ---------- 0x00000000 LOCAL  SECT   0        .debug_aranges
6   ---------- 0x00000000 LOCAL  SECT   0        .debug_info
7   ---------- 0x00000000 LOCAL  SECT   0        .debug_abbrev
8   ---------- 0x00000000 LOCAL  SECT   0        .debug_line
9   ---------- 0x00000000 LOCAL  SECT   0        .debug_frame
10  ---------- 0x00000000 LOCAL  SECT   0        .debug_str
11  ---------- 0x00000000 LOCAL  SECT   0        .ARM.attributes
12  ---------- 0x00000000 LOCAL  FILE   0        main.c
13  0x00001000 0x00008000 LOCAL  SPCL   0        $t
14  ---------- 0x00009018 GLOBAL NOTYPE 0        _bss_end__
15  ---------- 0x00009018 GLOBAL NOTYPE 0        __bss_start__
16  ---------- 0x00009018 GLOBAL NOTYPE 0        __bss_end__
18  ---------- 0x00009018 GLOBAL NOTYPE 0        __bss_start
19  0x00001000 0x00008000 GLOBAL FUNC   24       main
20  ---------- 0x00009018 GLOBAL NOTYPE 0        __end__
21  ---------- 0x00009018 GLOBAL NOTYPE 0        _edata
22  ---------- 0x00009018 GLOBAL NOTYPE 0        _end
23  ---------- 0x00080000 GLOBAL NOTYPE 0        _stack
24  ---------- 0x00009018 GLOBAL NOTYPE 0        __data_start
[0x00008000]> s main
[0x00008000]> pdf
            ;-- main:
            ;-- entry0:
            ;-- section..text:
            ;-- segment.LOAD0:
            ;-- segment.ehdr:
            ;-- .text:
            ;-- pc:
            ;-- r15:
╭ int main(int argc, char **argv)
│           ; var int32_t arg1 @ r0
│           ; arg int argc @ stack - 0x8
│           ; arg char **argv @ stack - 0xc
│           0x00008000      80b582b0       addlt fp, r2, r0, lsl 11    ; main.c:1 ; arg1 ; [00] -r-x section size 24 named .text
│           0x00008004      00af7860       rsbsvs sl, r8, r0, lsl 30
│           0x00008008      39607b68       ldmdavs fp!, {r0, r3, r4, r5, sp, lr} ^
│           0x0000800c      1800bd46       ssatmi r0, 0x1e, r8         ; main.c:3
│           0x00008010      02b080bc       stclt p0, c11, [r0], {2}
╰           0x00008014      02bc0847       strmi fp, [r8, -r2, lsl 24]
[0x00008000]>

arm-thumb-dwarf.elf.zip
arm-thumb-stripped.elf.zip
arm-thumb-stripped-really.elf.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant