AFLplusplus / AFLplusplus/LibAFL

[librasan]: link libqasan statically with baremetal application

Đang mở
#3,103 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
2.6k
Fork
481
Merge trung bình
2 ngày 30 phút
Pull request đã merge (30 ngày)
16

Mô tả

#### Description
I am experimenting on writing a fuzzer for a cross compiled application on aarch64.
For now, if I understand correctly, `libqasan` can only get linked dynamically with `LD_LIBRARY_PATH` and override function symbols (`malloc`, `free` etc).
I am not sure `libqasan.so` can be linked with a baremetal application, though

#### Questions
1. Is there a way to link `libqasan.so` to a baremetal app?
2. If not, would statically linking `libqasan.a` (`.renamed`) archive file, be a possible solution?
3. I already have experimented with linking `libqasan.a` (`libqasan.renamed` actually), and the final question is, what header file should be imported to the baremetal target in order to build it with `malloc`, `free` etc defined in `libqasan`? As I can see, the old implementation `qasan` has a `libqasan.h` file for importing it to the target. How can I override `malloc` with a potential static link with `libqasan`?

#### Examples
For example building the `fuzzers/full_system/qemu_baremetal` example with `libqasan.a`.
**NOTE: it is not a working example, I just put it here to show a simple use case**
```bash
arm-none-eabi-gcc -ggdb -ffreestanding -nostartfiles -lgcc \
-T example/mps2_m3.ld \
-mcpu=cortex-m3 \
-D "TARGET_{{ uppercase(flavor) }}" \
-I {{BUILD_DIR / "include"}} \
example/main.c \
libqasan.a \
example/startup.c \
-o {{TARGET_DIR}}/example.elf
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.