AFLplusplus / AFLplusplus/LibAFL

[librasan]: link libqasan statically with baremetal application

オープン
#3,103 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
2.6k
フォーク
481
平均マージ
2日 30分
マージ済み PR(30日)
16

説明

#### 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
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。