question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect arm (32 bits) CFG

See original GitHub issue

Describe the bug.

I got the following error when running CFGFast()

ERROR   | 2020-06-27 00:49:02,806 | angr.analyses.cfg.cfg_fast | Decoding error occurred at address 0x10338 of function 0x10338.
ERROR   | 2020-06-27 00:49:02,807 | angr.analyses.cfg.cfg_fast | Decoding error occurred at address 0x1033b of function 0x1033b.
ERROR   | 2020-06-27 00:49:02,807 | angr.analyses.cfg.cfg_fast | Decoding error occurred at address 0x1033b of function 0x1033b.

In addition, it seems that the CFG generated by angr is incorrect after comparing the results with disassembly from Ghidra.

CFG node addresses generated by angr ['0x102c8', '0x102d0', '0x102d4', '0x102e8', '0x102f4', '0x10300', '0x1030c', '0x10319', '0x10348', '0x10360', '0x1036d', '0x10381', '0x1038b', '0x1038d', '0x1038f', '0x10391', '0x103ad', '0x103b7', '0x103b9', '0x103bb', '0x103bd', '0x103cb', '0x103cf', '0x103d3', '0x103d5', '0x103d7', '0x103d9', '0x103ed', '0x103f3', '0x103fd', '0x10411', '0x10419', '0x1041d', '0x1042b', '0x1042f', '0x10433', '0x1043d', '0x10440', '0x100000', '0x100004', '0x100008', '0x201044', '0x201048']

disassembly from Ghidra image

As can be seen from the screenshot, at least '0x103d7', '0x103d9', '0x103ed' shouldn’t be starting address of nodes, the correct addresses should be 0x103d8, 0x103ec (if only the instructions in the screenshot are considered).

Environment Information.

Ubuntu Server 18.04 LTS (x86_64)

$ arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0

$ python3 --version
Python 3.6.9

To Reproduce.

example.zip (simple.c, printf_nopie, cfg.py)

$ cat simple.c 
#include <stdio.h>
int main() {
    printf("%s", "Hi");
    return 0;
}
$ arm-linux-gnueabihf-gcc simple.c -o printf_nopie -no-pie
$ cat cfg.py 
import angr

project = angr.Project("printf_nopie", load_options={"auto_load_libs": False})
cfg = project.analyses.CFGFast(normalize=True, data_references=True)

print([hex(n.addr) for n in sorted(cfg.model.nodes(), key=lambda x: x.addr)])
$ python3 cfg.py
ERROR   | 2020-06-27 00:55:15,866 | angr.analyses.cfg.cfg_fast | Decoding error occurred at address 0x10338 of function 0x10338.
ERROR   | 2020-06-27 00:55:15,866 | angr.analyses.cfg.cfg_fast | Decoding error occurred at address 0x1033b of function 0x1033b.
ERROR   | 2020-06-27 00:55:15,867 | angr.analyses.cfg.cfg_fast | Decoding error occurred at address 0x1033b of function 0x1033b.
['0x102c8', '0x102d0', '0x102d4', '0x102e8', '0x102f4', '0x10300', '0x1030c', '0x10319', '0x10348', '0x10360', '0x1036d', '0x10381', '0x1038b', '0x1038d', '0x1038f', '0x10391', '0x103ad', '0x103b7', '0x103b9', '0x103bb', '0x103bd', '0x103cb', '0x103cf', '0x103d3', '0x103d5', '0x103d7', '0x103d9', '0x103ed', '0x103f3', '0x103fd', '0x10411', '0x10419', '0x1041d', '0x1042b', '0x1042f', '0x10433', '0x1043d', '0x10440', '0x100000', '0x100004', '0x100008', '0x201044', '0x201048']

Additional context.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ltfishcommented, Jun 27, 2020

I blame the auto-complete on my phone 😉

0reactions
DennyDaicommented, Jun 27, 2020

@subwire Thank you! force_complete_scan=False eliminates errors. And the new result lgfm after taking thumb bit into consideration.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CPU Variant incorrect when doing armhf builds under aarch64 ...
I think the origin arm/v8 variant is corrent. You may run into situation that accidentally compile a program with armv8+32bit. Since the ...
Read more >
Running 32-bit ARM binary on aarch64 not working despite ...
Runs fine on 32 bit and 64 bit. Controllers and VMs will be running 32 bit architecture for many more years. 4GB memory...
Read more >
Detecting SIMD support on ARM with Android (and patching ...
Android phone on ARM-64 CPU, 32-bit library. Newly detected features: aes , crc , crypto , neon , pmull , sha2 .
Read more >
Understanding 64-bit Builds | Android Open Source Project
The build system supports building binaries for two target CPU architectures (64 bit and 32 bit) in the same build.
Read more >
rm48: spi2 chip select problem - Arm-based microcontrollers forum ...
The chip select goes low and the first 8 bits are sent. ... With mibSpi to solve with enabling 'Lock transmition', but there...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found