AFLplusplus / AFLplusplus/LibAFL

[librasan]: link libqasan statically with baremetal application

Ouverte
#3,103 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Rust
Étoiles
2.6k
Forks
481
Merge moyen
2 j 30 min
PR mergées (30 j)
16

Description

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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.