diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index e08b51e1596..dfb639e2d29 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -74,11 +74,11 @@ jobs: if: runner.os != 'Windows' run: cargo test -- --test-threads 1 - name: Test libafl no_std - run: cd libafl && cargo test --no-default-features + run: cd crates/libafl && cargo test --no-default-features - name: Test libafl_bolts no_std no_alloc - run: cd libafl_bolts && cargo test --no-default-features + run: cd crates/libafl_bolts && cargo test --no-default-features - name: Test libafl_targets no_std - run: cd libafl_targets && cargo test --no-default-features + run: cd crates/libafl_targets && cargo test --no-default-features ubuntu-doc-build: runs-on: ubuntu-24.04 @@ -135,9 +135,9 @@ jobs: - name: Run a normal build run: cargo build --verbose # - name: Run libafl_qemu usermode tests - # run: cd libafl_qemu && cargo test + # run: cd crates/libafl_qemu && cargo test # - name: Run libafl_qemu systemmode tests - # run: cd libafl_qemu && cargo test --no-default-features --features x86_64,systemmode + # run: cd crates/libafl_qemu && cargo test --no-default-features --features x86_64,systemmode - name: Build examples run: cargo build --examples --verbose @@ -196,9 +196,9 @@ jobs: - uses: Swatinem/rust-cache@v2 with: { shared-key: "ubuntu" } - name: Install smoke test deps - run: sudo ./libafl_concolic/test/smoke_test_ubuntu_deps.sh + run: sudo ./crates/libafl_concolic/test/smoke_test_ubuntu_deps.sh - name: Run smoke test - run: ./libafl_concolic/test/smoke_test.sh + run: ./crates/libafl_concolic/test/smoke_test.sh python-bindings: runs-on: ubuntu-24.04 @@ -653,7 +653,7 @@ jobs: RUSTC_BOOTSTRAP=1 \ LLVM_CONFIG=llvm-config-${{env.MAIN_LLVM_VERSION}} \ just \ - -f ./libafl_asan/Justfile \ + -f ./crates/libafl_asan/Justfile \ test_everything libafl_qemu_asan: @@ -691,7 +691,7 @@ jobs: RUSTC_BOOTSTRAP=1 \ LLVM_CONFIG=llvm-config-${{env.MAIN_LLVM_VERSION}} \ just \ - -f ./libafl_qemu/libafl_qemu_asan/Justfile \ + -f ./crates/libafl_qemu/libafl_qemu_asan/Justfile \ build_everything_dev \ build_x86_64_release @@ -712,7 +712,7 @@ jobs: - name: run x86_64 until panic! run: cd fuzzers/fuzz_anything/baby_no_std && cargo run || test $? -ne 0 || exit 1 - name: no_std tests - run: cd ./libafl && cargo test --no-default-features + run: cd ./crates/libafl && cargo test --no-default-features nostd-clippy: runs-on: ubuntu-24.04 @@ -727,9 +727,9 @@ jobs: with: shared-key: no-std-clippy - name: libafl armv6m-none-eabi (32 bit no_std) clippy - run: cd ./libafl && cargo clippy --target thumbv6m-none-eabi --no-default-features + run: cd ./crates/libafl && cargo clippy --target thumbv6m-none-eabi --no-default-features - name: libafl_bolts armv6m-none-eabi (32 bit no_std) clippy - run: cd ./libafl_bolts && cargo clippy --target thumbv6m-none-eabi --no-default-features + run: cd ./crates/libafl_bolts && cargo clippy --target thumbv6m-none-eabi --no-default-features format-toml: runs-on: ubuntu-24.04 @@ -914,7 +914,7 @@ jobs: - uses: actions/checkout@v4 - uses: Swatinem/rust-cache@v2 - name: Build Android - run: cd libafl && PYO3_CROSS_PYTHON_VERSION=$(python3 -c "print('{}.{}'.format(__import__('sys').version_info.major, __import__('sys').version_info.minor))") cargo ndk -t arm64-v8a build --release + run: cd crates/libafl && PYO3_CROSS_PYTHON_VERSION=$(python3 -c "print('{}.{}'.format(__import__('sys').version_info.major, __import__('sys').version_info.minor))") cargo ndk -t arm64-v8a build --release ubuntu-cross-android-x86_64: runs-on: ubuntu-24.04 diff --git a/.gitignore b/.gitignore index 4b3a301b2c4..0f01e05baa0 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ cur_input crashes corpus +!**/src/corpus callgrind.out.* perf.data @@ -48,6 +49,7 @@ test.dict # Ignore all built fuzzers AFLplusplus test_* +!test_harness.cpp *_fuzzer # Ignore common dummy and logfiles diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4c086a24c72..c7b793e79df 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,13 +26,14 @@ Once the package is installed, simply run `pre-commit install` to enable the hoo Before making your pull requests, try to see if your code follows these rules. - Wherever possible, use `Cow<'static, str>` instead of String. -- `PhantomData` should have the smallest set of types needed. Try not adding `PhantomData` to your struct unless it is really necessary. Also even when you really need `PhantomData`, try to keep the types `T` used in `PhantomData` as smallest as possible +- `PhantomData` should have the smallest set of types needed. Try not adding `PhantomData` to your struct unless it is really necessary. Also even when you really need `PhantomData`, try to keep the types `T` used in `PhantomData` as smallest as possible - Wherever possible, trait implementations with lifetime specifiers should use '_ lifetime elision. - Complex constructors should be replaced with `typed_builder`, or write code in the builder pattern for yourself. - ## Rules for Generics and Associated Types + 1. Remove generic restrictions at the definitions (e.g., we do not need to specify that types impl `Serialize`, `Deserialize`, or `Debug` anymore at the struct definitions). Therefore, try avoiding code like this unless the constraint is really necessary. + ```rust pub struct X where @@ -41,7 +42,9 @@ pub struct X fn ... } ``` + 2. Reduce generics to the least restrictive necessary. __Never overspecify the constraints__. There's no automated tool to check the useless constraints, so you have to verify this manually. + ```rust pub struct X where @@ -53,6 +56,7 @@ pub struct X 3. Prefer generic to associated types in traits definition as much as possible. They are much easier to use around, and avoid tricky caveats / type repetition in the code. It is also much easier to have unconstrained struct definitions. Try not to write this: + ```rust pub trait X { @@ -61,7 +65,9 @@ pub trait X fn a(&self) -> Self::A; } ``` + Try to write this instead: + ```rust pub trait X { @@ -70,6 +76,7 @@ pub trait X ``` 4. Traits which have an associated type (if you have made sure you cannot use a generic instead) should refer to the associated type, not the concrete/generic. In other words, you should only have the associated type when you can define a getter to it. For example, in the following code, you can define a associate type. + ```rust pub trait X { @@ -78,7 +85,9 @@ pub trait X fn a(&self) -> Self::A; } ``` + 5. Generic naming should be consistent. Do NOT use multiple name for the same generic, it just makes things more confusing. Do: + ```rust pub struct X { phantom: PhanomData, @@ -86,7 +95,9 @@ pub struct X { impl X {} ``` + But not: + ```rust pub struct X { phantom: PhanomData, @@ -94,7 +105,9 @@ pub struct X { impl X {} // <- Do NOT do that, use A instead of B ``` + 6. __Ideally__ the types used in the arguments of methods in traits should have the same as the types defined on the traits. + ```rust pub trait X // <- this trait have 3 generics, A, B, and C { @@ -103,7 +116,9 @@ pub trait X // <- this trait have 3 generics, A, B, and C fn do_other_stuff(&self, a: A, b: B); // <- this is not ideal because it does not have C. } ``` + 7. Try to avoid cyclical dependency if possible. Sometimes it is necessary but try to avoid it. For example, The following code is a bad example. + ```rust pub struct X {} pub struct Y {} @@ -121,20 +136,26 @@ pub trait EventManager: Sized { fn do_stuff(&self, fuzzer: &Z); // <- This function signature should not take fuzzer } ``` -trait `EventManager` should not implement any method that takes fuzzer, any object that could implement `Fuzzer` trait. +trait `EventManager` should not implement any method that takes fuzzer, any object that could implement `Fuzzer` trait. ## Formatting + 1. Always alphabetically order the type generics. Therefore, + ```rust pub struct X {}; // <- Generics are alphabetically ordered ``` + But not, + ```rust pub struct X {}; // <- Generics are not ordered ``` + 2. Similarly, generic bounds in `where` clauses should be alphabetically sorted. Prefer: + ```rust pub trait FooA {} pub trait FooB {} @@ -147,7 +168,9 @@ where B: FooB, {} ``` + Over: + ```rust pub trait FooA {} pub trait FooB {} diff --git a/Cargo.toml b/Cargo.toml index 031be256a16..d25050126f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,29 +1,29 @@ [workspace] resolver = "2" members = [ - "libafl", - "libafl_asan", - "libafl_asan/libafl_asan_fuzz", - "libafl_asan/libafl_asan_libc", - "libafl_bolts", - "libafl_cc", - "libafl_concolic/symcc_runtime", - "libafl_concolic/symcc_libafl", - "libafl_derive", - "libafl_frida", - "libafl_intelpt", - "libafl_libfuzzer", - "libafl_nyx", - "libafl_unicorn", - "libafl_targets", - "libafl_tinyinst", - "libafl_qemu", - "libafl_qemu/libafl_qemu_build", - "libafl_qemu/libafl_qemu_runner", - "libafl_qemu/libafl_qemu_sys", - "libafl_sugar", - "libafl_concolic/test/dump_constraints", - "libafl_concolic/test/runtime_test", + "crates/libafl", + "crates/libafl_asan", + "crates/libafl_asan/libafl_asan_fuzz", + "crates/libafl_asan/libafl_asan_libc", + "crates/libafl_bolts", + "crates/libafl_cc", + "crates/libafl_concolic/symcc_runtime", + "crates/libafl_concolic/symcc_libafl", + "crates/libafl_derive", + "crates/libafl_frida", + "crates/libafl_intelpt", + "crates/libafl_libfuzzer", + "crates/libafl_nyx", + "crates/libafl_unicorn", + "crates/libafl_targets", + "crates/libafl_tinyinst", + "crates/libafl_qemu", + "crates/libafl_qemu/libafl_qemu_build", + "crates/libafl_qemu/libafl_qemu_runner", + "crates/libafl_qemu/libafl_qemu_sys", + "crates/libafl_sugar", + "crates/libafl_concolic/test/dump_constraints", + "crates/libafl_concolic/test/runtime_test", "utils/build_and_test_fuzzers", "utils/deexit", "utils/drcov_utils", @@ -35,25 +35,25 @@ members = [ ] default-members = [ - "libafl", - "libafl_bolts", - "libafl_cc", - "libafl_derive", - "libafl_targets", + "crates/libafl", + "crates/libafl_bolts", + "crates/libafl_cc", + "crates/libafl_derive", + "crates/libafl_targets", ] exclude = [ "bindings/pylibafl", "docs", "fuzzers", - "libafl_libfuzzer_runtime", + "crates/libafl_libfuzzer_runtime", "utils/noaslr", "utils/gdb_qemu", "utils/libafl_repo_tools", "utils/multi_machine_generator", "scripts", # additional crates - "libafl_concolic/test/symcc/util/symcc_fuzzing_helper", + "crates/libafl_concolic/test/symcc/util/symcc_fuzzing_helper", ] [workspace.package] @@ -64,24 +64,24 @@ readme = "./README.md" [workspace.dependencies] # Internal deps -libafl = { path = "./libafl", version = "0.15.3", default-features = false } -libafl_bolts = { path = "./libafl_bolts", version = "0.15.3", default-features = false } -libafl_cc = { path = "./libafl_cc", version = "0.15.3", default-features = false } -symcc_runtime = { path = "./libafl_concolic/symcc_runtime", version = "0.15.2", default-features = false } -symcc_libafl = { path = "./libafl_concolic/symcc_libafl", version = "0.15.3", default-features = false } -libafl_derive = { path = "./libafl_derive", version = "0.15.3", default-features = false } -libafl_frida = { path = "./libafl_frida", version = "0.15.3", default-features = false } -libafl_intelpt = { path = "./libafl_intelpt", version = "0.15.3", default-features = false } -libafl_libfuzzer = { path = "./libafl_libfuzzer", version = "0.15.3", default-features = false } -libafl_nyx = { path = "./libafl_nyx", version = "0.15.3", default-features = false } -libafl_targets = { path = "./libafl_targets", version = "0.15.3", default-features = false } -libafl_tinyinst = { path = "./libafl_tinyinst", version = "0.15.3", default-features = false } -libafl_qemu = { path = "./libafl_qemu", version = "0.15.3", default-features = false } -libafl_qemu_build = { path = "./libafl_qemu/libafl_qemu_build", version = "0.15.3", default-features = false } -libafl_qemu_sys = { path = "./libafl_qemu/libafl_qemu_sys", version = "0.15.3", default-features = false } -libafl_sugar = { path = "./libafl_sugar", version = "0.15.3", default-features = false } -dump_constraints = { path = "./libafl_concolic/test/dump_constraints", version = "0.15.2", default-features = false } -runtime_test = { path = "./libafl_concolic/test/runtime_test", version = "0.15.2", default-features = false } +libafl = { path = "./crates/libafl", version = "0.15.3", default-features = false } +libafl_bolts = { path = "./crates/libafl_bolts", version = "0.15.3", default-features = false } +libafl_cc = { path = "./crates/libafl_cc", version = "0.15.3", default-features = false } +symcc_runtime = { path = "./crates/libafl_concolic/symcc_runtime", version = "0.15.2", default-features = false } +symcc_libafl = { path = "./crates/libafl_concolic/symcc_libafl", version = "0.15.3", default-features = false } +libafl_derive = { path = "./crates/libafl_derive", version = "0.15.3", default-features = false } +libafl_frida = { path = "./crates/libafl_frida", version = "0.15.3", default-features = false } +libafl_intelpt = { path = "./crates/libafl_intelpt", version = "0.15.3", default-features = false } +libafl_libfuzzer = { path = "./crates/libafl_libfuzzer", version = "0.15.3", default-features = false } +libafl_nyx = { path = "./crates/libafl_nyx", version = "0.15.3", default-features = false } +libafl_targets = { path = "./crates/libafl_targets", version = "0.15.3", default-features = false } +libafl_tinyinst = { path = "./crates/libafl_tinyinst", version = "0.15.3", default-features = false } +libafl_qemu = { path = "./crates/libafl_qemu", version = "0.15.3", default-features = false } +libafl_qemu_build = { path = "./crates/libafl_qemu/libafl_qemu_build", version = "0.15.3", default-features = false } +libafl_qemu_sys = { path = "./crates/libafl_qemu/libafl_qemu_sys", version = "0.15.3", default-features = false } +libafl_sugar = { path = "./crates/libafl_sugar", version = "0.15.3", default-features = false } +dump_constraints = { path = "./crates/libafl_concolic/test/dump_constraints", version = "0.15.2", default-features = false } +runtime_test = { path = "./crates/libafl_concolic/test/runtime_test", version = "0.15.2", default-features = false } build_and_test_fuzzers = { path = "./utils/build_and_test_fuzzers", version = "0.15.2", default-features = false } deexit = { path = "./utils/deexit", version = "0.15.2", default-features = false } drcov_utils = { path = "./utils/drcov_utils", version = "0.15.2", default-features = false } diff --git a/README.md b/README.md index ee068ba3a1e..a75caeee7bf 100644 --- a/README.md +++ b/README.md @@ -1,82 +1,97 @@ -# LibAFL, the fuzzer library. +# `LibAFL`, the fuzzer library LibAFL logo Advanced Fuzzing Library - Slot your own fuzzers together and extend their features using Rust. -LibAFL is a collection of reusable pieces of fuzzers, written in Rust, it gives you many of the benefits of an off-the-shelf fuzzer, while being completely customizable. +`LibAFL` is a collection of reusable pieces of fuzzers, written in Rust, it gives you many of the benefits of an off-the-shelf fuzzer, while being completely customizable. Some highlight features currently include: + - `fast`: We do everything we can at compile time, keeping runtime overhead minimal. Users reach 120k execs/sec in frida-mode on a phone (using all cores). -- `scalable`: `Low Level Message Passing`, `LLMP` for short, allows LibAFL to scale almost linearly over cores, and via TCP to multiple machines. -- `adaptable`: You can replace each part of LibAFL. For example, `BytesInput` is just one potential form input: +- `scalable`: `Low Level Message Passing`, `LLMP` for short, allows `LibAFL` to scale almost linearly over cores, and via TCP to multiple machines. +- `adaptable`: You can replace each part of `LibAFL`. For example, `BytesInput` is just one potential form input: feel free to add an AST-based input for structured fuzzing, and more. -- `multi platform`: LibAFL runs on *Windows*, *macOS*, *iOS* *Linux*, and *Android*, and more. `LibAFL` can be built in `no_std` mode to inject LibAFL into obscure targets like embedded devices and hypervisors. +- `multi platform`: `LibAFL` runs on *Windows*, *macOS*, *iOS* *Linux*, and *Android*, and more. `LibAFL` can be built in `no_std` mode to inject `LibAFL` into obscure targets like embedded devices and hypervisors. - `bring your own target`: We support binary-only modes, like Frida-Mode, as well as multiple compilation passes for sourced-based instrumentation. Of course it's easy to add custom instrumentation backends. ## Core concepts -LibAFL is fast, multi-platform, no_std compatible, and scales over cores and machines. It offers a main crate that provide building blocks for custom fuzzers, [libafl](./libafl), a library containing common code that can be used for targets instrumentation, [libafl_targets](./libafl_targets), and a library providing facilities to wrap compilers, [libafl_cc](./libafl_cc). It offers integrations with popular instrumentation frameworks. At the moment, the supported backends are: -+ `SanitizerCoverage`, in [libafl_targets](./libafl_targets) -+ `Frida`, in [libafl_frida](./libafl_frida) -+ `QEMU` user-mode and system mode, including hooks for emulation, in [libafl_qemu](./libafl_qemu) -+ `TinyInst`, in [libafl_tinyinst](./libafl_tinyinst) by [elbiazo](https://github.com/elbiazo) +`LibAFL` is fast, multi-platform, `no_std` compatible, and scales over cores and machines. It offers a main crate that provide building blocks for custom fuzzers, [libafl](./crates/libafl), a library containing common code that can be used for targets instrumentation, [libafl_targets](./crates/libafl_targets), and a library providing facilities to wrap compilers, [libafl_cc](./crates/libafl_cc). It offers integrations with popular instrumentation frameworks. At the moment, the supported backends are: + +- `SanitizerCoverage`, in [libafl_targets](./crates/libafl_targets) +- `Frida`, in [libafl_frida](./crates/libafl_frida) +- `QEMU` user-mode and system mode, including hooks for emulation, in [libafl_qemu](./crates/libafl_qemu) +- `TinyInst`, in [libafl_tinyinst](./crates/libafl_tinyinst) by [elbiazo](https://github.com/elbiazo) ## Building and installing #### Install the Dependencies + - **The Rust development language** - - We highly recommend *not* to use e.g. your Linux distribution package as this is likely outdated. So rather install Rust directly, instructions can be found [here](https://www.rust-lang.org/tools/install). + - We highly recommend *not* to use e.g. your Linux distribution package as this is likely outdated. So rather install Rust directly, instructions can be found [here](https://www.rust-lang.org/tools/install). - **LLVM tools** - - The LLVM tools (including clang, clang++) are needed (newer than LLVM 15.0.0 up to LLVM 18.1.3) If you are using Debian/Ubuntu, again, we highly recommmend that you install the package from [here](https://apt.llvm.org/) - - (In `libafl_concolic`, we only support LLVM version newer than 18) + - The LLVM tools (including clang, clang++) are needed (newer than LLVM 15.0.0 up to LLVM 18.1.3) If you are using Debian/Ubuntu, again, we highly recommmend that you install the package from [here](https://apt.llvm.org/) + - (In `libafl_concolic`, we only support LLVM version newer than 18) - Just: - - We use [just](https://github.com/casey/just) to build the fuzzers in `fuzzers/` directory. You can find instructions to install it in your environment [in the Just Programmer's Manual](https://just.systems/man/en/packages.html). - -#### Clone the LibAFL repository with + - We use [just](https://github.com/casey/just) to build the fuzzers in `fuzzers/` directory. You can find instructions to install it in your environment [in the Just Programmer's Manual](https://just.systems/man/en/packages.html). + +#### Clone the `LibAFL` repository with + ```sh git clone https://github.com/AFLplusplus/LibAFL ``` + #### Build the library using + ```sh cargo build --release ``` + #### Build the API documentation with + ```sh cargo doc ``` -#### Browse the LibAFL book (WIP!) with (requires [mdbook](https://rust-lang.github.io/mdBook/index.html)) + +#### Browse the `LibAFL` book (WIP!) with (requires [mdbook](https://rust-lang.github.io/mdBook/index.html)) + ```sh cd docs && mdbook serve ``` -## Getting started + +## Getting started + We collect all example fuzzers in [`./fuzzers`](./fuzzers/). Be sure to read their documentation (and source), this is *the natural way to get started!* + ```sh just run ``` -You can run each example fuzzer with this following command, as long as the fuzzer directory has a `Justfile` file. The best-tested fuzzer is [`./fuzzers/inprocess/libfuzzer_libpng`](./fuzzers/inprocess/libfuzzer_libpng), a multicore libfuzzer-like fuzzer using LibAFL for a libpng harness. -### Resources +You can run each example fuzzer with this following command, as long as the fuzzer directory has a `Justfile` file. The best-tested fuzzer is [`./fuzzers/inprocess/libfuzzer_libpng`](./fuzzers/inprocess/libfuzzer_libpng), a multicore libfuzzer-like fuzzer using `LibAFL` for a libpng harness. + +### Resources + - [Installation guide](./docs/src/getting_started/setup.md) - [Online API documentation](https://docs.rs/libafl/) -- The LibAFL book (WIP) [online](https://aflplus.plus/libafl-book) or in the [repo](./docs/src/) +- The `LibAFL` book (WIP) [online](https://aflplus.plus/libafl-book) or in the [repo](./docs/src/) - Our research [paper](https://www.s3.eurecom.fr/docs/ccs22_fioraldi.pdf) - Our RC3 [talk](http://www.youtube.com/watch?v=3RWkT1Q5IV0 "Fuzzers Like LEGO") explaining the core concepts - Our Fuzzcon Europe [talk](https://www.youtube.com/watch?v=PWB8GIhFAaI "LibAFL: The Advanced Fuzzing Library") with a (a bit but not so much outdated) step-by-step discussion on how to build some example fuzzers - The Fuzzing101 [solutions](https://github.com/epi052/fuzzing-101-solutions) & series of [blog posts](https://epi052.gitlab.io/notes-to-self/blog/2021-11-01-fuzzing-101-with-libafl/) by [epi](https://github.com/epi052) -- Blogpost on binary-only fuzzing lib libaf_qemu, [Hacking TMNF - Fuzzing the game server](https://blog.bricked.tech/posts/tmnf/part1/), by [RickdeJager](https://github.com/RickdeJager). +- Blogpost on binary-only fuzzing lib `libaf_qemu`, [Hacking TMNF - Fuzzing the game server](https://blog.bricked.tech/posts/tmnf/part1/), by [RickdeJager](https://github.com/RickdeJager). - [A LibAFL Introductory Workshop](https://www.atredis.com/blog/2023/12/4/a-libafl-introductory-workshop), by [Jordan Whitehead](https://github.com/jordan9001) ## Contributors -LibAFL is written and maintained by +`LibAFL` is written and maintained by - * [Andrea Fioraldi](https://twitter.com/andreafioraldi) - * [Dominik Maier](https://twitter.com/domenuk) - * [s1341](https://twitter.com/srubenst1341) - * [Dongjia Zhang](https://github.com/tokatoka) - * [Addison Crump](https://github.com/addisoncrump) - * [Romain Malmain](https://github.com/rmalmain) +- [Andrea Fioraldi](https://twitter.com/andreafioraldi) +- [Dominik Maier](https://twitter.com/domenuk) +- [s1341](https://twitter.com/srubenst1341) +- [Dongjia Zhang](https://github.com/tokatoka) +- [Addison Crump](https://github.com/addisoncrump) +- [Romain Malmain](https://github.com/rmalmain) ## Contributing @@ -87,7 +102,8 @@ Please check out **[CONTRIBUTING.md](CONTRIBUTING.md)** for the contributing gui Your fuzzer doesn't work as expected? Try reading [DEBUGGING.md](./docs/src/DEBUGGING.md) to understand how to debug your problems. ## Cite -If you use LibAFL for your academic work, please cite the following paper: + +If you use `LibAFL` for your academic work, please cite the following paper: ```bibtex @inproceedings{libafl, @@ -102,7 +118,7 @@ If you use LibAFL for your academic work, please cite the following paper: } ``` -#### License +## License Licensed under either of Apache License, Version diff --git a/bindings/pylibafl/Cargo.toml b/bindings/pylibafl/Cargo.toml index 75351c9b868..ccbf0d60e34 100644 --- a/bindings/pylibafl/Cargo.toml +++ b/bindings/pylibafl/Cargo.toml @@ -11,15 +11,15 @@ categories = ["development-tools::testing", "emulators", "embedded", "os"] [dependencies] pyo3 = { version = "0.24.0", features = ["extension-module"] } pyo3-log = { version = "0.12.2" } -libafl_sugar = { path = "../../libafl_sugar", version = "0.15.3", features = [ +libafl_sugar = { path = "../../crates/libafl_sugar", version = "0.15.3", features = [ "python", ] } -libafl_bolts = { path = "../../libafl_bolts", version = "0.15.3", features = [ +libafl_bolts = { path = "../../crates/libafl_bolts", version = "0.15.3", features = [ "python", ] } [target.'cfg(target_os = "linux")'.dependencies] -libafl_qemu = { path = "../../libafl_qemu", version = "0.15.3", features = [ +libafl_qemu = { path = "../../crates/libafl_qemu", version = "0.15.3", features = [ "python", ] } diff --git a/bindings/pylibafl/README.md b/bindings/pylibafl/README.md index 3e3922251e4..5c19d97cf88 100644 --- a/bindings/pylibafl/README.md +++ b/bindings/pylibafl/README.md @@ -1,31 +1,42 @@ # How to use python bindings + ## First time setup + ```bash # Install maturin pip install maturin # Create virtual environment python3 -m venv .env ``` + ## Build bindings -``` + +```sh # Activate virtual environment source .env/bin/activate # Build python module maturin develop ``` -This is going to install `pylibafl` python module into this venv. + +This is going to install `pylibafl` python module into this venv. ## Use bindings + ### Example: Running baby_fuzzer in fuzzers/baby_fuzzer/baby_fuzzer.py + First, make sure the python virtual environment is activated. If not, run `source .env/bin/activate `. Running `pip freeze` at this point should display the following (versions may differ): -``` + +```ini maturin==0.12.6 pylibafl==0.7.0 toml==0.10.2 ``` + Then simply run -``` + +```sh python PATH_TO_BABY_FUZZER/baby_fuzzer.py ``` + The crashes directory will be created in the directory from which you ran the command. diff --git a/libafl/Cargo.toml b/crates/libafl/Cargo.toml similarity index 100% rename from libafl/Cargo.toml rename to crates/libafl/Cargo.toml diff --git a/libafl/LICENSE-APACHE b/crates/libafl/LICENSE-APACHE similarity index 100% rename from libafl/LICENSE-APACHE rename to crates/libafl/LICENSE-APACHE diff --git a/libafl/LICENSE-MIT b/crates/libafl/LICENSE-MIT similarity index 100% rename from libafl/LICENSE-MIT rename to crates/libafl/LICENSE-MIT diff --git a/libafl/README.md b/crates/libafl/README.md similarity index 100% rename from libafl/README.md rename to crates/libafl/README.md diff --git a/libafl/build.rs b/crates/libafl/build.rs similarity index 100% rename from libafl/build.rs rename to crates/libafl/build.rs diff --git a/libafl/examples/tui_mock/main.rs b/crates/libafl/examples/tui_mock/main.rs similarity index 100% rename from libafl/examples/tui_mock/main.rs rename to crates/libafl/examples/tui_mock/main.rs diff --git a/libafl/src/common/mod.rs b/crates/libafl/src/common/mod.rs similarity index 100% rename from libafl/src/common/mod.rs rename to crates/libafl/src/common/mod.rs diff --git a/libafl/src/common/nautilus/README.md b/crates/libafl/src/common/nautilus/README.md similarity index 100% rename from libafl/src/common/nautilus/README.md rename to crates/libafl/src/common/nautilus/README.md diff --git a/libafl/src/common/nautilus/grammartec/chunkstore.rs b/crates/libafl/src/common/nautilus/grammartec/chunkstore.rs similarity index 100% rename from libafl/src/common/nautilus/grammartec/chunkstore.rs rename to crates/libafl/src/common/nautilus/grammartec/chunkstore.rs diff --git a/libafl/src/common/nautilus/grammartec/context.rs b/crates/libafl/src/common/nautilus/grammartec/context.rs similarity index 100% rename from libafl/src/common/nautilus/grammartec/context.rs rename to crates/libafl/src/common/nautilus/grammartec/context.rs diff --git a/libafl/src/common/nautilus/grammartec/mod.rs b/crates/libafl/src/common/nautilus/grammartec/mod.rs similarity index 100% rename from libafl/src/common/nautilus/grammartec/mod.rs rename to crates/libafl/src/common/nautilus/grammartec/mod.rs diff --git a/libafl/src/common/nautilus/grammartec/mutator.rs b/crates/libafl/src/common/nautilus/grammartec/mutator.rs similarity index 100% rename from libafl/src/common/nautilus/grammartec/mutator.rs rename to crates/libafl/src/common/nautilus/grammartec/mutator.rs diff --git a/libafl/src/common/nautilus/grammartec/newtypes.rs b/crates/libafl/src/common/nautilus/grammartec/newtypes.rs similarity index 100% rename from libafl/src/common/nautilus/grammartec/newtypes.rs rename to crates/libafl/src/common/nautilus/grammartec/newtypes.rs diff --git a/libafl/src/common/nautilus/grammartec/python_grammar_loader.rs b/crates/libafl/src/common/nautilus/grammartec/python_grammar_loader.rs similarity index 100% rename from libafl/src/common/nautilus/grammartec/python_grammar_loader.rs rename to crates/libafl/src/common/nautilus/grammartec/python_grammar_loader.rs diff --git a/libafl/src/common/nautilus/grammartec/recursion_info.rs b/crates/libafl/src/common/nautilus/grammartec/recursion_info.rs similarity index 100% rename from libafl/src/common/nautilus/grammartec/recursion_info.rs rename to crates/libafl/src/common/nautilus/grammartec/recursion_info.rs diff --git a/libafl/src/common/nautilus/grammartec/rule.rs b/crates/libafl/src/common/nautilus/grammartec/rule.rs similarity index 100% rename from libafl/src/common/nautilus/grammartec/rule.rs rename to crates/libafl/src/common/nautilus/grammartec/rule.rs diff --git a/libafl/src/common/nautilus/grammartec/tree.rs b/crates/libafl/src/common/nautilus/grammartec/tree.rs similarity index 100% rename from libafl/src/common/nautilus/grammartec/tree.rs rename to crates/libafl/src/common/nautilus/grammartec/tree.rs diff --git a/libafl/src/common/nautilus/mod.rs b/crates/libafl/src/common/nautilus/mod.rs similarity index 100% rename from libafl/src/common/nautilus/mod.rs rename to crates/libafl/src/common/nautilus/mod.rs diff --git a/libafl/src/common/nautilus/regex_mutator/mod.rs b/crates/libafl/src/common/nautilus/regex_mutator/mod.rs similarity index 100% rename from libafl/src/common/nautilus/regex_mutator/mod.rs rename to crates/libafl/src/common/nautilus/regex_mutator/mod.rs diff --git a/libafl/src/corpus/cached.rs b/crates/libafl/src/corpus/cached.rs similarity index 100% rename from libafl/src/corpus/cached.rs rename to crates/libafl/src/corpus/cached.rs diff --git a/libafl/src/corpus/inmemory.rs b/crates/libafl/src/corpus/inmemory.rs similarity index 100% rename from libafl/src/corpus/inmemory.rs rename to crates/libafl/src/corpus/inmemory.rs diff --git a/libafl/src/corpus/inmemory_ondisk.rs b/crates/libafl/src/corpus/inmemory_ondisk.rs similarity index 100% rename from libafl/src/corpus/inmemory_ondisk.rs rename to crates/libafl/src/corpus/inmemory_ondisk.rs diff --git a/libafl/src/corpus/minimizer.rs b/crates/libafl/src/corpus/minimizer.rs similarity index 100% rename from libafl/src/corpus/minimizer.rs rename to crates/libafl/src/corpus/minimizer.rs diff --git a/libafl/src/corpus/mod.rs b/crates/libafl/src/corpus/mod.rs similarity index 100% rename from libafl/src/corpus/mod.rs rename to crates/libafl/src/corpus/mod.rs diff --git a/libafl/src/corpus/nop.rs b/crates/libafl/src/corpus/nop.rs similarity index 100% rename from libafl/src/corpus/nop.rs rename to crates/libafl/src/corpus/nop.rs diff --git a/libafl/src/corpus/ondisk.rs b/crates/libafl/src/corpus/ondisk.rs similarity index 100% rename from libafl/src/corpus/ondisk.rs rename to crates/libafl/src/corpus/ondisk.rs diff --git a/libafl/src/corpus/testcase.rs b/crates/libafl/src/corpus/testcase.rs similarity index 100% rename from libafl/src/corpus/testcase.rs rename to crates/libafl/src/corpus/testcase.rs diff --git a/libafl/src/events/broker_hooks/centralized.rs b/crates/libafl/src/events/broker_hooks/centralized.rs similarity index 100% rename from libafl/src/events/broker_hooks/centralized.rs rename to crates/libafl/src/events/broker_hooks/centralized.rs diff --git a/libafl/src/events/broker_hooks/centralized_multi_machine.rs b/crates/libafl/src/events/broker_hooks/centralized_multi_machine.rs similarity index 100% rename from libafl/src/events/broker_hooks/centralized_multi_machine.rs rename to crates/libafl/src/events/broker_hooks/centralized_multi_machine.rs diff --git a/libafl/src/events/broker_hooks/mod.rs b/crates/libafl/src/events/broker_hooks/mod.rs similarity index 100% rename from libafl/src/events/broker_hooks/mod.rs rename to crates/libafl/src/events/broker_hooks/mod.rs diff --git a/libafl/src/events/centralized.rs b/crates/libafl/src/events/centralized.rs similarity index 100% rename from libafl/src/events/centralized.rs rename to crates/libafl/src/events/centralized.rs diff --git a/libafl/src/events/events_hooks/mod.rs b/crates/libafl/src/events/events_hooks/mod.rs similarity index 100% rename from libafl/src/events/events_hooks/mod.rs rename to crates/libafl/src/events/events_hooks/mod.rs diff --git a/libafl/src/events/launcher.rs b/crates/libafl/src/events/launcher.rs similarity index 100% rename from libafl/src/events/launcher.rs rename to crates/libafl/src/events/launcher.rs diff --git a/libafl/src/events/llmp/mod.rs b/crates/libafl/src/events/llmp/mod.rs similarity index 100% rename from libafl/src/events/llmp/mod.rs rename to crates/libafl/src/events/llmp/mod.rs diff --git a/libafl/src/events/llmp/restarting.rs b/crates/libafl/src/events/llmp/restarting.rs similarity index 100% rename from libafl/src/events/llmp/restarting.rs rename to crates/libafl/src/events/llmp/restarting.rs diff --git a/libafl/src/events/mod.rs b/crates/libafl/src/events/mod.rs similarity index 100% rename from libafl/src/events/mod.rs rename to crates/libafl/src/events/mod.rs diff --git a/libafl/src/events/multi_machine.rs b/crates/libafl/src/events/multi_machine.rs similarity index 100% rename from libafl/src/events/multi_machine.rs rename to crates/libafl/src/events/multi_machine.rs diff --git a/libafl/src/events/simple.rs b/crates/libafl/src/events/simple.rs similarity index 100% rename from libafl/src/events/simple.rs rename to crates/libafl/src/events/simple.rs diff --git a/libafl/src/events/tcp.rs b/crates/libafl/src/events/tcp.rs similarity index 100% rename from libafl/src/events/tcp.rs rename to crates/libafl/src/events/tcp.rs diff --git a/libafl/src/executors/combined.rs b/crates/libafl/src/executors/combined.rs similarity index 100% rename from libafl/src/executors/combined.rs rename to crates/libafl/src/executors/combined.rs diff --git a/libafl/src/executors/command.rs b/crates/libafl/src/executors/command.rs similarity index 100% rename from libafl/src/executors/command.rs rename to crates/libafl/src/executors/command.rs diff --git a/libafl/src/executors/differential.rs b/crates/libafl/src/executors/differential.rs similarity index 100% rename from libafl/src/executors/differential.rs rename to crates/libafl/src/executors/differential.rs diff --git a/libafl/src/executors/forkserver.rs b/crates/libafl/src/executors/forkserver.rs similarity index 100% rename from libafl/src/executors/forkserver.rs rename to crates/libafl/src/executors/forkserver.rs diff --git a/libafl/src/executors/hooks/inprocess.rs b/crates/libafl/src/executors/hooks/inprocess.rs similarity index 100% rename from libafl/src/executors/hooks/inprocess.rs rename to crates/libafl/src/executors/hooks/inprocess.rs diff --git a/libafl/src/executors/hooks/inprocess_fork.rs b/crates/libafl/src/executors/hooks/inprocess_fork.rs similarity index 100% rename from libafl/src/executors/hooks/inprocess_fork.rs rename to crates/libafl/src/executors/hooks/inprocess_fork.rs diff --git a/libafl/src/executors/hooks/intel_pt.rs b/crates/libafl/src/executors/hooks/intel_pt.rs similarity index 100% rename from libafl/src/executors/hooks/intel_pt.rs rename to crates/libafl/src/executors/hooks/intel_pt.rs diff --git a/libafl/src/executors/hooks/mod.rs b/crates/libafl/src/executors/hooks/mod.rs similarity index 100% rename from libafl/src/executors/hooks/mod.rs rename to crates/libafl/src/executors/hooks/mod.rs diff --git a/libafl/src/executors/hooks/timer.rs b/crates/libafl/src/executors/hooks/timer.rs similarity index 100% rename from libafl/src/executors/hooks/timer.rs rename to crates/libafl/src/executors/hooks/timer.rs diff --git a/libafl/src/executors/hooks/unix.rs b/crates/libafl/src/executors/hooks/unix.rs similarity index 100% rename from libafl/src/executors/hooks/unix.rs rename to crates/libafl/src/executors/hooks/unix.rs diff --git a/libafl/src/executors/hooks/windows.rs b/crates/libafl/src/executors/hooks/windows.rs similarity index 100% rename from libafl/src/executors/hooks/windows.rs rename to crates/libafl/src/executors/hooks/windows.rs diff --git a/libafl/src/executors/inprocess/inner.rs b/crates/libafl/src/executors/inprocess/inner.rs similarity index 100% rename from libafl/src/executors/inprocess/inner.rs rename to crates/libafl/src/executors/inprocess/inner.rs diff --git a/libafl/src/executors/inprocess/mod.rs b/crates/libafl/src/executors/inprocess/mod.rs similarity index 100% rename from libafl/src/executors/inprocess/mod.rs rename to crates/libafl/src/executors/inprocess/mod.rs diff --git a/libafl/src/executors/inprocess/stateful.rs b/crates/libafl/src/executors/inprocess/stateful.rs similarity index 100% rename from libafl/src/executors/inprocess/stateful.rs rename to crates/libafl/src/executors/inprocess/stateful.rs diff --git a/libafl/src/executors/inprocess_fork/inner.rs b/crates/libafl/src/executors/inprocess_fork/inner.rs similarity index 100% rename from libafl/src/executors/inprocess_fork/inner.rs rename to crates/libafl/src/executors/inprocess_fork/inner.rs diff --git a/libafl/src/executors/inprocess_fork/mod.rs b/crates/libafl/src/executors/inprocess_fork/mod.rs similarity index 100% rename from libafl/src/executors/inprocess_fork/mod.rs rename to crates/libafl/src/executors/inprocess_fork/mod.rs diff --git a/libafl/src/executors/inprocess_fork/stateful.rs b/crates/libafl/src/executors/inprocess_fork/stateful.rs similarity index 100% rename from libafl/src/executors/inprocess_fork/stateful.rs rename to crates/libafl/src/executors/inprocess_fork/stateful.rs diff --git a/libafl/src/executors/mod.rs b/crates/libafl/src/executors/mod.rs similarity index 100% rename from libafl/src/executors/mod.rs rename to crates/libafl/src/executors/mod.rs diff --git a/libafl/src/executors/nop.rs b/crates/libafl/src/executors/nop.rs similarity index 100% rename from libafl/src/executors/nop.rs rename to crates/libafl/src/executors/nop.rs diff --git a/libafl/src/executors/sand.rs b/crates/libafl/src/executors/sand.rs similarity index 100% rename from libafl/src/executors/sand.rs rename to crates/libafl/src/executors/sand.rs diff --git a/libafl/src/executors/shadow.rs b/crates/libafl/src/executors/shadow.rs similarity index 100% rename from libafl/src/executors/shadow.rs rename to crates/libafl/src/executors/shadow.rs diff --git a/libafl/src/executors/with_observers.rs b/crates/libafl/src/executors/with_observers.rs similarity index 100% rename from libafl/src/executors/with_observers.rs rename to crates/libafl/src/executors/with_observers.rs diff --git a/libafl/src/feedbacks/bool.rs b/crates/libafl/src/feedbacks/bool.rs similarity index 100% rename from libafl/src/feedbacks/bool.rs rename to crates/libafl/src/feedbacks/bool.rs diff --git a/libafl/src/feedbacks/capture_feedback.rs b/crates/libafl/src/feedbacks/capture_feedback.rs similarity index 100% rename from libafl/src/feedbacks/capture_feedback.rs rename to crates/libafl/src/feedbacks/capture_feedback.rs diff --git a/libafl/src/feedbacks/concolic.rs b/crates/libafl/src/feedbacks/concolic.rs similarity index 100% rename from libafl/src/feedbacks/concolic.rs rename to crates/libafl/src/feedbacks/concolic.rs diff --git a/libafl/src/feedbacks/custom_filename.rs b/crates/libafl/src/feedbacks/custom_filename.rs similarity index 100% rename from libafl/src/feedbacks/custom_filename.rs rename to crates/libafl/src/feedbacks/custom_filename.rs diff --git a/libafl/src/feedbacks/differential.rs b/crates/libafl/src/feedbacks/differential.rs similarity index 100% rename from libafl/src/feedbacks/differential.rs rename to crates/libafl/src/feedbacks/differential.rs diff --git a/libafl/src/feedbacks/list.rs b/crates/libafl/src/feedbacks/list.rs similarity index 100% rename from libafl/src/feedbacks/list.rs rename to crates/libafl/src/feedbacks/list.rs diff --git a/libafl/src/feedbacks/map.rs b/crates/libafl/src/feedbacks/map.rs similarity index 100% rename from libafl/src/feedbacks/map.rs rename to crates/libafl/src/feedbacks/map.rs diff --git a/libafl/src/feedbacks/mod.rs b/crates/libafl/src/feedbacks/mod.rs similarity index 100% rename from libafl/src/feedbacks/mod.rs rename to crates/libafl/src/feedbacks/mod.rs diff --git a/libafl/src/feedbacks/nautilus.rs b/crates/libafl/src/feedbacks/nautilus.rs similarity index 100% rename from libafl/src/feedbacks/nautilus.rs rename to crates/libafl/src/feedbacks/nautilus.rs diff --git a/libafl/src/feedbacks/new_hash_feedback.rs b/crates/libafl/src/feedbacks/new_hash_feedback.rs similarity index 100% rename from libafl/src/feedbacks/new_hash_feedback.rs rename to crates/libafl/src/feedbacks/new_hash_feedback.rs diff --git a/libafl/src/feedbacks/simd.rs b/crates/libafl/src/feedbacks/simd.rs similarity index 100% rename from libafl/src/feedbacks/simd.rs rename to crates/libafl/src/feedbacks/simd.rs diff --git a/libafl/src/feedbacks/stdio.rs b/crates/libafl/src/feedbacks/stdio.rs similarity index 100% rename from libafl/src/feedbacks/stdio.rs rename to crates/libafl/src/feedbacks/stdio.rs diff --git a/libafl/src/feedbacks/transferred.rs b/crates/libafl/src/feedbacks/transferred.rs similarity index 100% rename from libafl/src/feedbacks/transferred.rs rename to crates/libafl/src/feedbacks/transferred.rs diff --git a/libafl/src/feedbacks/value_bloom.rs b/crates/libafl/src/feedbacks/value_bloom.rs similarity index 100% rename from libafl/src/feedbacks/value_bloom.rs rename to crates/libafl/src/feedbacks/value_bloom.rs diff --git a/libafl/src/fuzzer/mod.rs b/crates/libafl/src/fuzzer/mod.rs similarity index 100% rename from libafl/src/fuzzer/mod.rs rename to crates/libafl/src/fuzzer/mod.rs diff --git a/libafl/src/generators/gramatron.rs b/crates/libafl/src/generators/gramatron.rs similarity index 100% rename from libafl/src/generators/gramatron.rs rename to crates/libafl/src/generators/gramatron.rs diff --git a/libafl/src/generators/mod.rs b/crates/libafl/src/generators/mod.rs similarity index 100% rename from libafl/src/generators/mod.rs rename to crates/libafl/src/generators/mod.rs diff --git a/libafl/src/generators/nautilus.rs b/crates/libafl/src/generators/nautilus.rs similarity index 100% rename from libafl/src/generators/nautilus.rs rename to crates/libafl/src/generators/nautilus.rs diff --git a/libafl/src/inputs/bytes.rs b/crates/libafl/src/inputs/bytes.rs similarity index 100% rename from libafl/src/inputs/bytes.rs rename to crates/libafl/src/inputs/bytes.rs diff --git a/libafl/src/inputs/bytessub.rs b/crates/libafl/src/inputs/bytessub.rs similarity index 100% rename from libafl/src/inputs/bytessub.rs rename to crates/libafl/src/inputs/bytessub.rs diff --git a/libafl/src/inputs/encoded.rs b/crates/libafl/src/inputs/encoded.rs similarity index 100% rename from libafl/src/inputs/encoded.rs rename to crates/libafl/src/inputs/encoded.rs diff --git a/libafl/src/inputs/generalized.rs b/crates/libafl/src/inputs/generalized.rs similarity index 100% rename from libafl/src/inputs/generalized.rs rename to crates/libafl/src/inputs/generalized.rs diff --git a/libafl/src/inputs/gramatron.rs b/crates/libafl/src/inputs/gramatron.rs similarity index 100% rename from libafl/src/inputs/gramatron.rs rename to crates/libafl/src/inputs/gramatron.rs diff --git a/libafl/src/inputs/list.rs b/crates/libafl/src/inputs/list.rs similarity index 100% rename from libafl/src/inputs/list.rs rename to crates/libafl/src/inputs/list.rs diff --git a/libafl/src/inputs/mod.rs b/crates/libafl/src/inputs/mod.rs similarity index 100% rename from libafl/src/inputs/mod.rs rename to crates/libafl/src/inputs/mod.rs diff --git a/libafl/src/inputs/multi.rs b/crates/libafl/src/inputs/multi.rs similarity index 100% rename from libafl/src/inputs/multi.rs rename to crates/libafl/src/inputs/multi.rs diff --git a/libafl/src/inputs/nautilus.rs b/crates/libafl/src/inputs/nautilus.rs similarity index 100% rename from libafl/src/inputs/nautilus.rs rename to crates/libafl/src/inputs/nautilus.rs diff --git a/libafl/src/inputs/value.rs b/crates/libafl/src/inputs/value.rs similarity index 100% rename from libafl/src/inputs/value.rs rename to crates/libafl/src/inputs/value.rs diff --git a/libafl/src/lib.rs b/crates/libafl/src/lib.rs similarity index 99% rename from libafl/src/lib.rs rename to crates/libafl/src/lib.rs index d6e7737953b..d3389e8cef3 100644 --- a/libafl/src/lib.rs +++ b/crates/libafl/src/lib.rs @@ -1,7 +1,7 @@ /*! Welcome to `LibAFL` */ -#![doc = include_str!("../README.md")] +#![doc = include_str!("../../../README.md")] /*! */ #![cfg_attr(feature = "document-features", doc = document_features::document_features!())] #![no_std] diff --git a/libafl/src/monitors/disk.rs b/crates/libafl/src/monitors/disk.rs similarity index 100% rename from libafl/src/monitors/disk.rs rename to crates/libafl/src/monitors/disk.rs diff --git a/libafl/src/monitors/disk_aggregate.rs b/crates/libafl/src/monitors/disk_aggregate.rs similarity index 100% rename from libafl/src/monitors/disk_aggregate.rs rename to crates/libafl/src/monitors/disk_aggregate.rs diff --git a/libafl/src/monitors/logics.rs b/crates/libafl/src/monitors/logics.rs similarity index 100% rename from libafl/src/monitors/logics.rs rename to crates/libafl/src/monitors/logics.rs diff --git a/libafl/src/monitors/mod.rs b/crates/libafl/src/monitors/mod.rs similarity index 100% rename from libafl/src/monitors/mod.rs rename to crates/libafl/src/monitors/mod.rs diff --git a/libafl/src/monitors/multi.rs b/crates/libafl/src/monitors/multi.rs similarity index 100% rename from libafl/src/monitors/multi.rs rename to crates/libafl/src/monitors/multi.rs diff --git a/libafl/src/monitors/prometheus.rs b/crates/libafl/src/monitors/prometheus.rs similarity index 100% rename from libafl/src/monitors/prometheus.rs rename to crates/libafl/src/monitors/prometheus.rs diff --git a/libafl/src/monitors/stats/manager.rs b/crates/libafl/src/monitors/stats/manager.rs similarity index 100% rename from libafl/src/monitors/stats/manager.rs rename to crates/libafl/src/monitors/stats/manager.rs diff --git a/libafl/src/monitors/stats/mod.rs b/crates/libafl/src/monitors/stats/mod.rs similarity index 100% rename from libafl/src/monitors/stats/mod.rs rename to crates/libafl/src/monitors/stats/mod.rs diff --git a/libafl/src/monitors/stats/perf_stats.rs b/crates/libafl/src/monitors/stats/perf_stats.rs similarity index 100% rename from libafl/src/monitors/stats/perf_stats.rs rename to crates/libafl/src/monitors/stats/perf_stats.rs diff --git a/libafl/src/monitors/stats/user_stats/mod.rs b/crates/libafl/src/monitors/stats/user_stats/mod.rs similarity index 100% rename from libafl/src/monitors/stats/user_stats/mod.rs rename to crates/libafl/src/monitors/stats/user_stats/mod.rs diff --git a/libafl/src/monitors/stats/user_stats/user_stats_value.rs b/crates/libafl/src/monitors/stats/user_stats/user_stats_value.rs similarity index 100% rename from libafl/src/monitors/stats/user_stats/user_stats_value.rs rename to crates/libafl/src/monitors/stats/user_stats/user_stats_value.rs diff --git a/libafl/src/monitors/statsd.rs b/crates/libafl/src/monitors/statsd.rs similarity index 100% rename from libafl/src/monitors/statsd.rs rename to crates/libafl/src/monitors/statsd.rs diff --git a/libafl/src/monitors/tui/mod.rs b/crates/libafl/src/monitors/tui/mod.rs similarity index 100% rename from libafl/src/monitors/tui/mod.rs rename to crates/libafl/src/monitors/tui/mod.rs diff --git a/libafl/src/monitors/tui/ui.rs b/crates/libafl/src/monitors/tui/ui.rs similarity index 100% rename from libafl/src/monitors/tui/ui.rs rename to crates/libafl/src/monitors/tui/ui.rs diff --git a/libafl/src/mutators/encoded_mutations.rs b/crates/libafl/src/mutators/encoded_mutations.rs similarity index 100% rename from libafl/src/mutators/encoded_mutations.rs rename to crates/libafl/src/mutators/encoded_mutations.rs diff --git a/libafl/src/mutators/gramatron.rs b/crates/libafl/src/mutators/gramatron.rs similarity index 100% rename from libafl/src/mutators/gramatron.rs rename to crates/libafl/src/mutators/gramatron.rs diff --git a/libafl/src/mutators/grimoire.rs b/crates/libafl/src/mutators/grimoire.rs similarity index 100% rename from libafl/src/mutators/grimoire.rs rename to crates/libafl/src/mutators/grimoire.rs diff --git a/libafl/src/mutators/hash.rs b/crates/libafl/src/mutators/hash.rs similarity index 100% rename from libafl/src/mutators/hash.rs rename to crates/libafl/src/mutators/hash.rs diff --git a/libafl/src/mutators/havoc_mutations.rs b/crates/libafl/src/mutators/havoc_mutations.rs similarity index 100% rename from libafl/src/mutators/havoc_mutations.rs rename to crates/libafl/src/mutators/havoc_mutations.rs diff --git a/libafl/src/mutators/list.rs b/crates/libafl/src/mutators/list.rs similarity index 100% rename from libafl/src/mutators/list.rs rename to crates/libafl/src/mutators/list.rs diff --git a/libafl/src/mutators/lua.rs b/crates/libafl/src/mutators/lua.rs similarity index 100% rename from libafl/src/mutators/lua.rs rename to crates/libafl/src/mutators/lua.rs diff --git a/libafl/src/mutators/mapping.rs b/crates/libafl/src/mutators/mapping.rs similarity index 100% rename from libafl/src/mutators/mapping.rs rename to crates/libafl/src/mutators/mapping.rs diff --git a/libafl/src/mutators/mod.rs b/crates/libafl/src/mutators/mod.rs similarity index 100% rename from libafl/src/mutators/mod.rs rename to crates/libafl/src/mutators/mod.rs diff --git a/libafl/src/mutators/mopt_mutator.rs b/crates/libafl/src/mutators/mopt_mutator.rs similarity index 100% rename from libafl/src/mutators/mopt_mutator.rs rename to crates/libafl/src/mutators/mopt_mutator.rs diff --git a/libafl/src/mutators/multi.rs b/crates/libafl/src/mutators/multi.rs similarity index 100% rename from libafl/src/mutators/multi.rs rename to crates/libafl/src/mutators/multi.rs diff --git a/libafl/src/mutators/mutations.rs b/crates/libafl/src/mutators/mutations.rs similarity index 100% rename from libafl/src/mutators/mutations.rs rename to crates/libafl/src/mutators/mutations.rs diff --git a/libafl/src/mutators/nautilus.rs b/crates/libafl/src/mutators/nautilus.rs similarity index 100% rename from libafl/src/mutators/nautilus.rs rename to crates/libafl/src/mutators/nautilus.rs diff --git a/libafl/src/mutators/numeric.rs b/crates/libafl/src/mutators/numeric.rs similarity index 100% rename from libafl/src/mutators/numeric.rs rename to crates/libafl/src/mutators/numeric.rs diff --git a/libafl/src/mutators/scheduled.rs b/crates/libafl/src/mutators/scheduled.rs similarity index 100% rename from libafl/src/mutators/scheduled.rs rename to crates/libafl/src/mutators/scheduled.rs diff --git a/libafl/src/mutators/token_mutations.rs b/crates/libafl/src/mutators/token_mutations.rs similarity index 100% rename from libafl/src/mutators/token_mutations.rs rename to crates/libafl/src/mutators/token_mutations.rs diff --git a/libafl/src/mutators/tuneable.rs b/crates/libafl/src/mutators/tuneable.rs similarity index 100% rename from libafl/src/mutators/tuneable.rs rename to crates/libafl/src/mutators/tuneable.rs diff --git a/libafl/src/mutators/unicode/mod.rs b/crates/libafl/src/mutators/unicode/mod.rs similarity index 100% rename from libafl/src/mutators/unicode/mod.rs rename to crates/libafl/src/mutators/unicode/mod.rs diff --git a/libafl/src/mutators/unicode/unicode_categories.rs b/crates/libafl/src/mutators/unicode/unicode_categories.rs similarity index 100% rename from libafl/src/mutators/unicode/unicode_categories.rs rename to crates/libafl/src/mutators/unicode/unicode_categories.rs diff --git a/libafl/src/observers/cmp.rs b/crates/libafl/src/observers/cmp.rs similarity index 100% rename from libafl/src/observers/cmp.rs rename to crates/libafl/src/observers/cmp.rs diff --git a/libafl/src/observers/concolic/metadata.rs b/crates/libafl/src/observers/concolic/metadata.rs similarity index 100% rename from libafl/src/observers/concolic/metadata.rs rename to crates/libafl/src/observers/concolic/metadata.rs diff --git a/libafl/src/observers/concolic/mod.rs b/crates/libafl/src/observers/concolic/mod.rs similarity index 100% rename from libafl/src/observers/concolic/mod.rs rename to crates/libafl/src/observers/concolic/mod.rs diff --git a/libafl/src/observers/concolic/observer.rs b/crates/libafl/src/observers/concolic/observer.rs similarity index 100% rename from libafl/src/observers/concolic/observer.rs rename to crates/libafl/src/observers/concolic/observer.rs diff --git a/libafl/src/observers/concolic/serialization_format.rs b/crates/libafl/src/observers/concolic/serialization_format.rs similarity index 100% rename from libafl/src/observers/concolic/serialization_format.rs rename to crates/libafl/src/observers/concolic/serialization_format.rs diff --git a/libafl/src/observers/list.rs b/crates/libafl/src/observers/list.rs similarity index 100% rename from libafl/src/observers/list.rs rename to crates/libafl/src/observers/list.rs diff --git a/libafl/src/observers/map/const_map.rs b/crates/libafl/src/observers/map/const_map.rs similarity index 100% rename from libafl/src/observers/map/const_map.rs rename to crates/libafl/src/observers/map/const_map.rs diff --git a/libafl/src/observers/map/hitcount_map.rs b/crates/libafl/src/observers/map/hitcount_map.rs similarity index 100% rename from libafl/src/observers/map/hitcount_map.rs rename to crates/libafl/src/observers/map/hitcount_map.rs diff --git a/libafl/src/observers/map/mod.rs b/crates/libafl/src/observers/map/mod.rs similarity index 100% rename from libafl/src/observers/map/mod.rs rename to crates/libafl/src/observers/map/mod.rs diff --git a/libafl/src/observers/map/multi_map.rs b/crates/libafl/src/observers/map/multi_map.rs similarity index 100% rename from libafl/src/observers/map/multi_map.rs rename to crates/libafl/src/observers/map/multi_map.rs diff --git a/libafl/src/observers/map/owned_map.rs b/crates/libafl/src/observers/map/owned_map.rs similarity index 100% rename from libafl/src/observers/map/owned_map.rs rename to crates/libafl/src/observers/map/owned_map.rs diff --git a/libafl/src/observers/map/variable_map.rs b/crates/libafl/src/observers/map/variable_map.rs similarity index 100% rename from libafl/src/observers/map/variable_map.rs rename to crates/libafl/src/observers/map/variable_map.rs diff --git a/libafl/src/observers/mod.rs b/crates/libafl/src/observers/mod.rs similarity index 100% rename from libafl/src/observers/mod.rs rename to crates/libafl/src/observers/mod.rs diff --git a/libafl/src/observers/stacktrace.rs b/crates/libafl/src/observers/stacktrace.rs similarity index 100% rename from libafl/src/observers/stacktrace.rs rename to crates/libafl/src/observers/stacktrace.rs diff --git a/libafl/src/observers/stdio.rs b/crates/libafl/src/observers/stdio.rs similarity index 100% rename from libafl/src/observers/stdio.rs rename to crates/libafl/src/observers/stdio.rs diff --git a/libafl/src/observers/value.rs b/crates/libafl/src/observers/value.rs similarity index 100% rename from libafl/src/observers/value.rs rename to crates/libafl/src/observers/value.rs diff --git a/libafl/src/schedulers/accounting.rs b/crates/libafl/src/schedulers/accounting.rs similarity index 100% rename from libafl/src/schedulers/accounting.rs rename to crates/libafl/src/schedulers/accounting.rs diff --git a/libafl/src/schedulers/minimizer.rs b/crates/libafl/src/schedulers/minimizer.rs similarity index 100% rename from libafl/src/schedulers/minimizer.rs rename to crates/libafl/src/schedulers/minimizer.rs diff --git a/libafl/src/schedulers/mod.rs b/crates/libafl/src/schedulers/mod.rs similarity index 100% rename from libafl/src/schedulers/mod.rs rename to crates/libafl/src/schedulers/mod.rs diff --git a/libafl/src/schedulers/powersched.rs b/crates/libafl/src/schedulers/powersched.rs similarity index 100% rename from libafl/src/schedulers/powersched.rs rename to crates/libafl/src/schedulers/powersched.rs diff --git a/libafl/src/schedulers/probabilistic_sampling.rs b/crates/libafl/src/schedulers/probabilistic_sampling.rs similarity index 100% rename from libafl/src/schedulers/probabilistic_sampling.rs rename to crates/libafl/src/schedulers/probabilistic_sampling.rs diff --git a/libafl/src/schedulers/queue.rs b/crates/libafl/src/schedulers/queue.rs similarity index 100% rename from libafl/src/schedulers/queue.rs rename to crates/libafl/src/schedulers/queue.rs diff --git a/libafl/src/schedulers/testcase_score.rs b/crates/libafl/src/schedulers/testcase_score.rs similarity index 100% rename from libafl/src/schedulers/testcase_score.rs rename to crates/libafl/src/schedulers/testcase_score.rs diff --git a/libafl/src/schedulers/tuneable.rs b/crates/libafl/src/schedulers/tuneable.rs similarity index 100% rename from libafl/src/schedulers/tuneable.rs rename to crates/libafl/src/schedulers/tuneable.rs diff --git a/libafl/src/schedulers/weighted.rs b/crates/libafl/src/schedulers/weighted.rs similarity index 100% rename from libafl/src/schedulers/weighted.rs rename to crates/libafl/src/schedulers/weighted.rs diff --git a/libafl/src/stages/afl_stats.rs b/crates/libafl/src/stages/afl_stats.rs similarity index 100% rename from libafl/src/stages/afl_stats.rs rename to crates/libafl/src/stages/afl_stats.rs diff --git a/libafl/src/stages/calibrate.rs b/crates/libafl/src/stages/calibrate.rs similarity index 100% rename from libafl/src/stages/calibrate.rs rename to crates/libafl/src/stages/calibrate.rs diff --git a/libafl/src/stages/colorization.rs b/crates/libafl/src/stages/colorization.rs similarity index 100% rename from libafl/src/stages/colorization.rs rename to crates/libafl/src/stages/colorization.rs diff --git a/libafl/src/stages/concolic.rs b/crates/libafl/src/stages/concolic.rs similarity index 100% rename from libafl/src/stages/concolic.rs rename to crates/libafl/src/stages/concolic.rs diff --git a/libafl/src/stages/dump.rs b/crates/libafl/src/stages/dump.rs similarity index 100% rename from libafl/src/stages/dump.rs rename to crates/libafl/src/stages/dump.rs diff --git a/libafl/src/stages/dynamic.rs b/crates/libafl/src/stages/dynamic.rs similarity index 100% rename from libafl/src/stages/dynamic.rs rename to crates/libafl/src/stages/dynamic.rs diff --git a/libafl/src/stages/generalization.rs b/crates/libafl/src/stages/generalization.rs similarity index 100% rename from libafl/src/stages/generalization.rs rename to crates/libafl/src/stages/generalization.rs diff --git a/libafl/src/stages/generation.rs b/crates/libafl/src/stages/generation.rs similarity index 100% rename from libafl/src/stages/generation.rs rename to crates/libafl/src/stages/generation.rs diff --git a/libafl/src/stages/logics.rs b/crates/libafl/src/stages/logics.rs similarity index 100% rename from libafl/src/stages/logics.rs rename to crates/libafl/src/stages/logics.rs diff --git a/libafl/src/stages/mod.rs b/crates/libafl/src/stages/mod.rs similarity index 100% rename from libafl/src/stages/mod.rs rename to crates/libafl/src/stages/mod.rs diff --git a/libafl/src/stages/mutational.rs b/crates/libafl/src/stages/mutational.rs similarity index 100% rename from libafl/src/stages/mutational.rs rename to crates/libafl/src/stages/mutational.rs diff --git a/libafl/src/stages/nop.rs b/crates/libafl/src/stages/nop.rs similarity index 100% rename from libafl/src/stages/nop.rs rename to crates/libafl/src/stages/nop.rs diff --git a/libafl/src/stages/power.rs b/crates/libafl/src/stages/power.rs similarity index 100% rename from libafl/src/stages/power.rs rename to crates/libafl/src/stages/power.rs diff --git a/libafl/src/stages/push/mod.rs b/crates/libafl/src/stages/push/mod.rs similarity index 100% rename from libafl/src/stages/push/mod.rs rename to crates/libafl/src/stages/push/mod.rs diff --git a/libafl/src/stages/push/mutational.rs b/crates/libafl/src/stages/push/mutational.rs similarity index 100% rename from libafl/src/stages/push/mutational.rs rename to crates/libafl/src/stages/push/mutational.rs diff --git a/libafl/src/stages/replay.rs b/crates/libafl/src/stages/replay.rs similarity index 100% rename from libafl/src/stages/replay.rs rename to crates/libafl/src/stages/replay.rs diff --git a/libafl/src/stages/shadow.rs b/crates/libafl/src/stages/shadow.rs similarity index 100% rename from libafl/src/stages/shadow.rs rename to crates/libafl/src/stages/shadow.rs diff --git a/libafl/src/stages/sync.rs b/crates/libafl/src/stages/sync.rs similarity index 100% rename from libafl/src/stages/sync.rs rename to crates/libafl/src/stages/sync.rs diff --git a/libafl/src/stages/time_tracker.rs b/crates/libafl/src/stages/time_tracker.rs similarity index 100% rename from libafl/src/stages/time_tracker.rs rename to crates/libafl/src/stages/time_tracker.rs diff --git a/libafl/src/stages/tmin.rs b/crates/libafl/src/stages/tmin.rs similarity index 100% rename from libafl/src/stages/tmin.rs rename to crates/libafl/src/stages/tmin.rs diff --git a/libafl/src/stages/tracing.rs b/crates/libafl/src/stages/tracing.rs similarity index 100% rename from libafl/src/stages/tracing.rs rename to crates/libafl/src/stages/tracing.rs diff --git a/libafl/src/stages/tuneable.rs b/crates/libafl/src/stages/tuneable.rs similarity index 100% rename from libafl/src/stages/tuneable.rs rename to crates/libafl/src/stages/tuneable.rs diff --git a/libafl/src/stages/unicode.rs b/crates/libafl/src/stages/unicode.rs similarity index 100% rename from libafl/src/stages/unicode.rs rename to crates/libafl/src/stages/unicode.rs diff --git a/libafl/src/stages/verify_timeouts.rs b/crates/libafl/src/stages/verify_timeouts.rs similarity index 100% rename from libafl/src/stages/verify_timeouts.rs rename to crates/libafl/src/stages/verify_timeouts.rs diff --git a/libafl/src/state/mod.rs b/crates/libafl/src/state/mod.rs similarity index 100% rename from libafl/src/state/mod.rs rename to crates/libafl/src/state/mod.rs diff --git a/libafl/src/state/stack.rs b/crates/libafl/src/state/stack.rs similarity index 100% rename from libafl/src/state/stack.rs rename to crates/libafl/src/state/stack.rs diff --git a/libafl_asan/.cargo/config.toml b/crates/libafl_asan/.cargo/config.toml similarity index 100% rename from libafl_asan/.cargo/config.toml rename to crates/libafl_asan/.cargo/config.toml diff --git a/libafl_asan/Cargo.toml b/crates/libafl_asan/Cargo.toml similarity index 100% rename from libafl_asan/Cargo.toml rename to crates/libafl_asan/Cargo.toml diff --git a/libafl_asan/Justfile b/crates/libafl_asan/Justfile similarity index 98% rename from libafl_asan/Justfile rename to crates/libafl_asan/Justfile index 3e8e6144e3a..0be201b2d83 100644 --- a/libafl_asan/Justfile +++ b/crates/libafl_asan/Justfile @@ -1,4 +1,4 @@ -import "../just/libafl-qemu.just" +import "../../just/libafl-qemu.just" import "libafl_asan_fuzz/Justfile" import "libafl_asan_libc/Justfile" import "fuzzer_name.just" diff --git a/libafl_asan/build.rs b/crates/libafl_asan/build.rs similarity index 100% rename from libafl_asan/build.rs rename to crates/libafl_asan/build.rs diff --git a/libafl_asan/cc/include/hooks.h b/crates/libafl_asan/cc/include/hooks.h similarity index 100% rename from libafl_asan/cc/include/hooks.h rename to crates/libafl_asan/cc/include/hooks.h diff --git a/libafl_asan/cc/include/trace.h b/crates/libafl_asan/cc/include/trace.h similarity index 100% rename from libafl_asan/cc/include/trace.h rename to crates/libafl_asan/cc/include/trace.h diff --git a/libafl_asan/cc/src/asprintf.c b/crates/libafl_asan/cc/src/asprintf.c similarity index 100% rename from libafl_asan/cc/src/asprintf.c rename to crates/libafl_asan/cc/src/asprintf.c diff --git a/libafl_asan/cc/src/log.c b/crates/libafl_asan/cc/src/log.c similarity index 100% rename from libafl_asan/cc/src/log.c rename to crates/libafl_asan/cc/src/log.c diff --git a/libafl_asan/cc/src/vasprintf.c b/crates/libafl_asan/cc/src/vasprintf.c similarity index 100% rename from libafl_asan/cc/src/vasprintf.c rename to crates/libafl_asan/cc/src/vasprintf.c diff --git a/libafl_asan/fuzzer_name.just b/crates/libafl_asan/fuzzer_name.just similarity index 100% rename from libafl_asan/fuzzer_name.just rename to crates/libafl_asan/fuzzer_name.just diff --git a/libafl_asan/libafl_asan_fuzz/.gitignore b/crates/libafl_asan/libafl_asan_fuzz/.gitignore similarity index 100% rename from libafl_asan/libafl_asan_fuzz/.gitignore rename to crates/libafl_asan/libafl_asan_fuzz/.gitignore diff --git a/libafl_asan/libafl_asan_fuzz/Cargo.toml b/crates/libafl_asan/libafl_asan_fuzz/Cargo.toml similarity index 100% rename from libafl_asan/libafl_asan_fuzz/Cargo.toml rename to crates/libafl_asan/libafl_asan_fuzz/Cargo.toml diff --git a/libafl_asan/libafl_asan_fuzz/Justfile b/crates/libafl_asan/libafl_asan_fuzz/Justfile similarity index 97% rename from libafl_asan/libafl_asan_fuzz/Justfile rename to crates/libafl_asan/libafl_asan_fuzz/Justfile index c5ea533fc4e..caa25894a9b 100644 --- a/libafl_asan/libafl_asan_fuzz/Justfile +++ b/crates/libafl_asan/libafl_asan_fuzz/Justfile @@ -1,4 +1,4 @@ -import "../../just/libafl-qemu.just" +import "../../../just/libafl-qemu.just" import "../fuzzer_name.just" FUZZ_SOURCE_DIR := source_directory() diff --git a/libafl_asan/libafl_asan_fuzz/fuzz_targets/default_frontend_dlmalloc.rs b/crates/libafl_asan/libafl_asan_fuzz/fuzz_targets/default_frontend_dlmalloc.rs similarity index 100% rename from libafl_asan/libafl_asan_fuzz/fuzz_targets/default_frontend_dlmalloc.rs rename to crates/libafl_asan/libafl_asan_fuzz/fuzz_targets/default_frontend_dlmalloc.rs diff --git a/libafl_asan/libafl_asan_fuzz/fuzz_targets/default_frontend_mock.rs b/crates/libafl_asan/libafl_asan_fuzz/fuzz_targets/default_frontend_mock.rs similarity index 100% rename from libafl_asan/libafl_asan_fuzz/fuzz_targets/default_frontend_mock.rs rename to crates/libafl_asan/libafl_asan_fuzz/fuzz_targets/default_frontend_mock.rs diff --git a/libafl_asan/libafl_asan_fuzz/fuzz_targets/guest_shadow.rs b/crates/libafl_asan/libafl_asan_fuzz/fuzz_targets/guest_shadow.rs similarity index 100% rename from libafl_asan/libafl_asan_fuzz/fuzz_targets/guest_shadow.rs rename to crates/libafl_asan/libafl_asan_fuzz/fuzz_targets/guest_shadow.rs diff --git a/libafl_asan/libafl_asan_fuzz/fuzz_targets/guest_tracking.rs b/crates/libafl_asan/libafl_asan_fuzz/fuzz_targets/guest_tracking.rs similarity index 100% rename from libafl_asan/libafl_asan_fuzz/fuzz_targets/guest_tracking.rs rename to crates/libafl_asan/libafl_asan_fuzz/fuzz_targets/guest_tracking.rs diff --git a/libafl_asan/libafl_asan_libc/Cargo.toml b/crates/libafl_asan/libafl_asan_libc/Cargo.toml similarity index 100% rename from libafl_asan/libafl_asan_libc/Cargo.toml rename to crates/libafl_asan/libafl_asan_libc/Cargo.toml diff --git a/libafl_asan/libafl_asan_libc/Justfile b/crates/libafl_asan/libafl_asan_libc/Justfile similarity index 97% rename from libafl_asan/libafl_asan_libc/Justfile rename to crates/libafl_asan/libafl_asan_libc/Justfile index 1d301b7dc09..058737439da 100644 --- a/libafl_asan/libafl_asan_libc/Justfile +++ b/crates/libafl_asan/libafl_asan_libc/Justfile @@ -1,4 +1,4 @@ -import "../../just/libafl-qemu.just" +import "../../../just/libafl-qemu.just" import "../fuzzer_name.just" libc_SOURCE_DIR := source_directory() diff --git a/libafl_asan/libafl_asan_libc/libc.map b/crates/libafl_asan/libafl_asan_libc/libc.map similarity index 100% rename from libafl_asan/libafl_asan_libc/libc.map rename to crates/libafl_asan/libafl_asan_libc/libc.map diff --git a/libafl_asan/libafl_asan_libc/src/lib.rs b/crates/libafl_asan/libafl_asan_libc/src/lib.rs similarity index 100% rename from libafl_asan/libafl_asan_libc/src/lib.rs rename to crates/libafl_asan/libafl_asan_libc/src/lib.rs diff --git a/libafl_asan/src/allocator/backend/dlmalloc.rs b/crates/libafl_asan/src/allocator/backend/dlmalloc.rs similarity index 100% rename from libafl_asan/src/allocator/backend/dlmalloc.rs rename to crates/libafl_asan/src/allocator/backend/dlmalloc.rs diff --git a/libafl_asan/src/allocator/backend/mimalloc.rs b/crates/libafl_asan/src/allocator/backend/mimalloc.rs similarity index 100% rename from libafl_asan/src/allocator/backend/mimalloc.rs rename to crates/libafl_asan/src/allocator/backend/mimalloc.rs diff --git a/libafl_asan/src/allocator/backend/mod.rs b/crates/libafl_asan/src/allocator/backend/mod.rs similarity index 100% rename from libafl_asan/src/allocator/backend/mod.rs rename to crates/libafl_asan/src/allocator/backend/mod.rs diff --git a/libafl_asan/src/allocator/frontend/default.rs b/crates/libafl_asan/src/allocator/frontend/default.rs similarity index 100% rename from libafl_asan/src/allocator/frontend/default.rs rename to crates/libafl_asan/src/allocator/frontend/default.rs diff --git a/libafl_asan/src/allocator/frontend/mod.rs b/crates/libafl_asan/src/allocator/frontend/mod.rs similarity index 100% rename from libafl_asan/src/allocator/frontend/mod.rs rename to crates/libafl_asan/src/allocator/frontend/mod.rs diff --git a/libafl_asan/src/allocator/mod.rs b/crates/libafl_asan/src/allocator/mod.rs similarity index 100% rename from libafl_asan/src/allocator/mod.rs rename to crates/libafl_asan/src/allocator/mod.rs diff --git a/libafl_asan/src/arch/aarch64.rs b/crates/libafl_asan/src/arch/aarch64.rs similarity index 100% rename from libafl_asan/src/arch/aarch64.rs rename to crates/libafl_asan/src/arch/aarch64.rs diff --git a/libafl_asan/src/arch/arm.rs b/crates/libafl_asan/src/arch/arm.rs similarity index 100% rename from libafl_asan/src/arch/arm.rs rename to crates/libafl_asan/src/arch/arm.rs diff --git a/libafl_asan/src/arch/mod.rs b/crates/libafl_asan/src/arch/mod.rs similarity index 100% rename from libafl_asan/src/arch/mod.rs rename to crates/libafl_asan/src/arch/mod.rs diff --git a/libafl_asan/src/env/mod.rs b/crates/libafl_asan/src/env/mod.rs similarity index 100% rename from libafl_asan/src/env/mod.rs rename to crates/libafl_asan/src/env/mod.rs diff --git a/libafl_asan/src/exit/libc.rs b/crates/libafl_asan/src/exit/libc.rs similarity index 100% rename from libafl_asan/src/exit/libc.rs rename to crates/libafl_asan/src/exit/libc.rs diff --git a/libafl_asan/src/exit/linux.rs b/crates/libafl_asan/src/exit/linux.rs similarity index 100% rename from libafl_asan/src/exit/linux.rs rename to crates/libafl_asan/src/exit/linux.rs diff --git a/libafl_asan/src/exit/mod.rs b/crates/libafl_asan/src/exit/mod.rs similarity index 100% rename from libafl_asan/src/exit/mod.rs rename to crates/libafl_asan/src/exit/mod.rs diff --git a/libafl_asan/src/file/libc.rs b/crates/libafl_asan/src/file/libc.rs similarity index 100% rename from libafl_asan/src/file/libc.rs rename to crates/libafl_asan/src/file/libc.rs diff --git a/libafl_asan/src/file/linux.rs b/crates/libafl_asan/src/file/linux.rs similarity index 100% rename from libafl_asan/src/file/linux.rs rename to crates/libafl_asan/src/file/linux.rs diff --git a/libafl_asan/src/file/mod.rs b/crates/libafl_asan/src/file/mod.rs similarity index 100% rename from libafl_asan/src/file/mod.rs rename to crates/libafl_asan/src/file/mod.rs diff --git a/libafl_asan/src/hooks/aligned_alloc.rs b/crates/libafl_asan/src/hooks/aligned_alloc.rs similarity index 100% rename from libafl_asan/src/hooks/aligned_alloc.rs rename to crates/libafl_asan/src/hooks/aligned_alloc.rs diff --git a/libafl_asan/src/hooks/atoi.rs b/crates/libafl_asan/src/hooks/atoi.rs similarity index 100% rename from libafl_asan/src/hooks/atoi.rs rename to crates/libafl_asan/src/hooks/atoi.rs diff --git a/libafl_asan/src/hooks/atol.rs b/crates/libafl_asan/src/hooks/atol.rs similarity index 100% rename from libafl_asan/src/hooks/atol.rs rename to crates/libafl_asan/src/hooks/atol.rs diff --git a/libafl_asan/src/hooks/atoll.rs b/crates/libafl_asan/src/hooks/atoll.rs similarity index 100% rename from libafl_asan/src/hooks/atoll.rs rename to crates/libafl_asan/src/hooks/atoll.rs diff --git a/libafl_asan/src/hooks/bcmp.rs b/crates/libafl_asan/src/hooks/bcmp.rs similarity index 100% rename from libafl_asan/src/hooks/bcmp.rs rename to crates/libafl_asan/src/hooks/bcmp.rs diff --git a/libafl_asan/src/hooks/bzero.rs b/crates/libafl_asan/src/hooks/bzero.rs similarity index 100% rename from libafl_asan/src/hooks/bzero.rs rename to crates/libafl_asan/src/hooks/bzero.rs diff --git a/libafl_asan/src/hooks/calloc.rs b/crates/libafl_asan/src/hooks/calloc.rs similarity index 100% rename from libafl_asan/src/hooks/calloc.rs rename to crates/libafl_asan/src/hooks/calloc.rs diff --git a/libafl_asan/src/hooks/explicit_bzero.rs b/crates/libafl_asan/src/hooks/explicit_bzero.rs similarity index 100% rename from libafl_asan/src/hooks/explicit_bzero.rs rename to crates/libafl_asan/src/hooks/explicit_bzero.rs diff --git a/libafl_asan/src/hooks/fgets.rs b/crates/libafl_asan/src/hooks/fgets.rs similarity index 100% rename from libafl_asan/src/hooks/fgets.rs rename to crates/libafl_asan/src/hooks/fgets.rs diff --git a/libafl_asan/src/hooks/free.rs b/crates/libafl_asan/src/hooks/free.rs similarity index 100% rename from libafl_asan/src/hooks/free.rs rename to crates/libafl_asan/src/hooks/free.rs diff --git a/libafl_asan/src/hooks/malloc.rs b/crates/libafl_asan/src/hooks/malloc.rs similarity index 100% rename from libafl_asan/src/hooks/malloc.rs rename to crates/libafl_asan/src/hooks/malloc.rs diff --git a/libafl_asan/src/hooks/malloc_usable_size.rs b/crates/libafl_asan/src/hooks/malloc_usable_size.rs similarity index 100% rename from libafl_asan/src/hooks/malloc_usable_size.rs rename to crates/libafl_asan/src/hooks/malloc_usable_size.rs diff --git a/libafl_asan/src/hooks/memalign.rs b/crates/libafl_asan/src/hooks/memalign.rs similarity index 100% rename from libafl_asan/src/hooks/memalign.rs rename to crates/libafl_asan/src/hooks/memalign.rs diff --git a/libafl_asan/src/hooks/memchr.rs b/crates/libafl_asan/src/hooks/memchr.rs similarity index 100% rename from libafl_asan/src/hooks/memchr.rs rename to crates/libafl_asan/src/hooks/memchr.rs diff --git a/libafl_asan/src/hooks/memcmp.rs b/crates/libafl_asan/src/hooks/memcmp.rs similarity index 100% rename from libafl_asan/src/hooks/memcmp.rs rename to crates/libafl_asan/src/hooks/memcmp.rs diff --git a/libafl_asan/src/hooks/memcpy.rs b/crates/libafl_asan/src/hooks/memcpy.rs similarity index 100% rename from libafl_asan/src/hooks/memcpy.rs rename to crates/libafl_asan/src/hooks/memcpy.rs diff --git a/libafl_asan/src/hooks/memmem.rs b/crates/libafl_asan/src/hooks/memmem.rs similarity index 100% rename from libafl_asan/src/hooks/memmem.rs rename to crates/libafl_asan/src/hooks/memmem.rs diff --git a/libafl_asan/src/hooks/memmove.rs b/crates/libafl_asan/src/hooks/memmove.rs similarity index 100% rename from libafl_asan/src/hooks/memmove.rs rename to crates/libafl_asan/src/hooks/memmove.rs diff --git a/libafl_asan/src/hooks/mempcpy.rs b/crates/libafl_asan/src/hooks/mempcpy.rs similarity index 100% rename from libafl_asan/src/hooks/mempcpy.rs rename to crates/libafl_asan/src/hooks/mempcpy.rs diff --git a/libafl_asan/src/hooks/memrchr.rs b/crates/libafl_asan/src/hooks/memrchr.rs similarity index 100% rename from libafl_asan/src/hooks/memrchr.rs rename to crates/libafl_asan/src/hooks/memrchr.rs diff --git a/libafl_asan/src/hooks/memset.rs b/crates/libafl_asan/src/hooks/memset.rs similarity index 100% rename from libafl_asan/src/hooks/memset.rs rename to crates/libafl_asan/src/hooks/memset.rs diff --git a/libafl_asan/src/hooks/mmap/libc.rs b/crates/libafl_asan/src/hooks/mmap/libc.rs similarity index 100% rename from libafl_asan/src/hooks/mmap/libc.rs rename to crates/libafl_asan/src/hooks/mmap/libc.rs diff --git a/libafl_asan/src/hooks/mmap/linux.rs b/crates/libafl_asan/src/hooks/mmap/linux.rs similarity index 100% rename from libafl_asan/src/hooks/mmap/linux.rs rename to crates/libafl_asan/src/hooks/mmap/linux.rs diff --git a/libafl_asan/src/hooks/mmap/mod.rs b/crates/libafl_asan/src/hooks/mmap/mod.rs similarity index 100% rename from libafl_asan/src/hooks/mmap/mod.rs rename to crates/libafl_asan/src/hooks/mmap/mod.rs diff --git a/libafl_asan/src/hooks/mod.rs b/crates/libafl_asan/src/hooks/mod.rs similarity index 100% rename from libafl_asan/src/hooks/mod.rs rename to crates/libafl_asan/src/hooks/mod.rs diff --git a/libafl_asan/src/hooks/munmap/libc.rs b/crates/libafl_asan/src/hooks/munmap/libc.rs similarity index 100% rename from libafl_asan/src/hooks/munmap/libc.rs rename to crates/libafl_asan/src/hooks/munmap/libc.rs diff --git a/libafl_asan/src/hooks/munmap/linux.rs b/crates/libafl_asan/src/hooks/munmap/linux.rs similarity index 100% rename from libafl_asan/src/hooks/munmap/linux.rs rename to crates/libafl_asan/src/hooks/munmap/linux.rs diff --git a/libafl_asan/src/hooks/munmap/mod.rs b/crates/libafl_asan/src/hooks/munmap/mod.rs similarity index 100% rename from libafl_asan/src/hooks/munmap/mod.rs rename to crates/libafl_asan/src/hooks/munmap/mod.rs diff --git a/libafl_asan/src/hooks/posix_memalign.rs b/crates/libafl_asan/src/hooks/posix_memalign.rs similarity index 100% rename from libafl_asan/src/hooks/posix_memalign.rs rename to crates/libafl_asan/src/hooks/posix_memalign.rs diff --git a/libafl_asan/src/hooks/pvalloc.rs b/crates/libafl_asan/src/hooks/pvalloc.rs similarity index 100% rename from libafl_asan/src/hooks/pvalloc.rs rename to crates/libafl_asan/src/hooks/pvalloc.rs diff --git a/libafl_asan/src/hooks/rawmemchr.rs b/crates/libafl_asan/src/hooks/rawmemchr.rs similarity index 100% rename from libafl_asan/src/hooks/rawmemchr.rs rename to crates/libafl_asan/src/hooks/rawmemchr.rs diff --git a/libafl_asan/src/hooks/read/libc.rs b/crates/libafl_asan/src/hooks/read/libc.rs similarity index 100% rename from libafl_asan/src/hooks/read/libc.rs rename to crates/libafl_asan/src/hooks/read/libc.rs diff --git a/libafl_asan/src/hooks/read/linux.rs b/crates/libafl_asan/src/hooks/read/linux.rs similarity index 100% rename from libafl_asan/src/hooks/read/linux.rs rename to crates/libafl_asan/src/hooks/read/linux.rs diff --git a/libafl_asan/src/hooks/read/mod.rs b/crates/libafl_asan/src/hooks/read/mod.rs similarity index 100% rename from libafl_asan/src/hooks/read/mod.rs rename to crates/libafl_asan/src/hooks/read/mod.rs diff --git a/libafl_asan/src/hooks/realloc.rs b/crates/libafl_asan/src/hooks/realloc.rs similarity index 100% rename from libafl_asan/src/hooks/realloc.rs rename to crates/libafl_asan/src/hooks/realloc.rs diff --git a/libafl_asan/src/hooks/reallocarray.rs b/crates/libafl_asan/src/hooks/reallocarray.rs similarity index 100% rename from libafl_asan/src/hooks/reallocarray.rs rename to crates/libafl_asan/src/hooks/reallocarray.rs diff --git a/libafl_asan/src/hooks/stpcpy.rs b/crates/libafl_asan/src/hooks/stpcpy.rs similarity index 100% rename from libafl_asan/src/hooks/stpcpy.rs rename to crates/libafl_asan/src/hooks/stpcpy.rs diff --git a/libafl_asan/src/hooks/stpncpy.rs b/crates/libafl_asan/src/hooks/stpncpy.rs similarity index 100% rename from libafl_asan/src/hooks/stpncpy.rs rename to crates/libafl_asan/src/hooks/stpncpy.rs diff --git a/libafl_asan/src/hooks/strcasecmp.rs b/crates/libafl_asan/src/hooks/strcasecmp.rs similarity index 100% rename from libafl_asan/src/hooks/strcasecmp.rs rename to crates/libafl_asan/src/hooks/strcasecmp.rs diff --git a/libafl_asan/src/hooks/strcasestr.rs b/crates/libafl_asan/src/hooks/strcasestr.rs similarity index 100% rename from libafl_asan/src/hooks/strcasestr.rs rename to crates/libafl_asan/src/hooks/strcasestr.rs diff --git a/libafl_asan/src/hooks/strcat.rs b/crates/libafl_asan/src/hooks/strcat.rs similarity index 100% rename from libafl_asan/src/hooks/strcat.rs rename to crates/libafl_asan/src/hooks/strcat.rs diff --git a/libafl_asan/src/hooks/strchr.rs b/crates/libafl_asan/src/hooks/strchr.rs similarity index 100% rename from libafl_asan/src/hooks/strchr.rs rename to crates/libafl_asan/src/hooks/strchr.rs diff --git a/libafl_asan/src/hooks/strchrnul.rs b/crates/libafl_asan/src/hooks/strchrnul.rs similarity index 100% rename from libafl_asan/src/hooks/strchrnul.rs rename to crates/libafl_asan/src/hooks/strchrnul.rs diff --git a/libafl_asan/src/hooks/strcmp.rs b/crates/libafl_asan/src/hooks/strcmp.rs similarity index 100% rename from libafl_asan/src/hooks/strcmp.rs rename to crates/libafl_asan/src/hooks/strcmp.rs diff --git a/libafl_asan/src/hooks/strcpy.rs b/crates/libafl_asan/src/hooks/strcpy.rs similarity index 100% rename from libafl_asan/src/hooks/strcpy.rs rename to crates/libafl_asan/src/hooks/strcpy.rs diff --git a/libafl_asan/src/hooks/strdup.rs b/crates/libafl_asan/src/hooks/strdup.rs similarity index 100% rename from libafl_asan/src/hooks/strdup.rs rename to crates/libafl_asan/src/hooks/strdup.rs diff --git a/libafl_asan/src/hooks/strlen.rs b/crates/libafl_asan/src/hooks/strlen.rs similarity index 100% rename from libafl_asan/src/hooks/strlen.rs rename to crates/libafl_asan/src/hooks/strlen.rs diff --git a/libafl_asan/src/hooks/strncasecmp.rs b/crates/libafl_asan/src/hooks/strncasecmp.rs similarity index 100% rename from libafl_asan/src/hooks/strncasecmp.rs rename to crates/libafl_asan/src/hooks/strncasecmp.rs diff --git a/libafl_asan/src/hooks/strncat.rs b/crates/libafl_asan/src/hooks/strncat.rs similarity index 100% rename from libafl_asan/src/hooks/strncat.rs rename to crates/libafl_asan/src/hooks/strncat.rs diff --git a/libafl_asan/src/hooks/strncmp.rs b/crates/libafl_asan/src/hooks/strncmp.rs similarity index 100% rename from libafl_asan/src/hooks/strncmp.rs rename to crates/libafl_asan/src/hooks/strncmp.rs diff --git a/libafl_asan/src/hooks/strncpy.rs b/crates/libafl_asan/src/hooks/strncpy.rs similarity index 100% rename from libafl_asan/src/hooks/strncpy.rs rename to crates/libafl_asan/src/hooks/strncpy.rs diff --git a/libafl_asan/src/hooks/strndup.rs b/crates/libafl_asan/src/hooks/strndup.rs similarity index 100% rename from libafl_asan/src/hooks/strndup.rs rename to crates/libafl_asan/src/hooks/strndup.rs diff --git a/libafl_asan/src/hooks/strnlen.rs b/crates/libafl_asan/src/hooks/strnlen.rs similarity index 100% rename from libafl_asan/src/hooks/strnlen.rs rename to crates/libafl_asan/src/hooks/strnlen.rs diff --git a/libafl_asan/src/hooks/strrchr.rs b/crates/libafl_asan/src/hooks/strrchr.rs similarity index 100% rename from libafl_asan/src/hooks/strrchr.rs rename to crates/libafl_asan/src/hooks/strrchr.rs diff --git a/libafl_asan/src/hooks/strstr.rs b/crates/libafl_asan/src/hooks/strstr.rs similarity index 100% rename from libafl_asan/src/hooks/strstr.rs rename to crates/libafl_asan/src/hooks/strstr.rs diff --git a/libafl_asan/src/hooks/valloc.rs b/crates/libafl_asan/src/hooks/valloc.rs similarity index 100% rename from libafl_asan/src/hooks/valloc.rs rename to crates/libafl_asan/src/hooks/valloc.rs diff --git a/libafl_asan/src/hooks/wcschr.rs b/crates/libafl_asan/src/hooks/wcschr.rs similarity index 100% rename from libafl_asan/src/hooks/wcschr.rs rename to crates/libafl_asan/src/hooks/wcschr.rs diff --git a/libafl_asan/src/hooks/wcscmp.rs b/crates/libafl_asan/src/hooks/wcscmp.rs similarity index 100% rename from libafl_asan/src/hooks/wcscmp.rs rename to crates/libafl_asan/src/hooks/wcscmp.rs diff --git a/libafl_asan/src/hooks/wcscpy.rs b/crates/libafl_asan/src/hooks/wcscpy.rs similarity index 100% rename from libafl_asan/src/hooks/wcscpy.rs rename to crates/libafl_asan/src/hooks/wcscpy.rs diff --git a/libafl_asan/src/hooks/wcslen.rs b/crates/libafl_asan/src/hooks/wcslen.rs similarity index 100% rename from libafl_asan/src/hooks/wcslen.rs rename to crates/libafl_asan/src/hooks/wcslen.rs diff --git a/libafl_asan/src/hooks/wcsncmp.rs b/crates/libafl_asan/src/hooks/wcsncmp.rs similarity index 100% rename from libafl_asan/src/hooks/wcsncmp.rs rename to crates/libafl_asan/src/hooks/wcsncmp.rs diff --git a/libafl_asan/src/hooks/wcsnlen.rs b/crates/libafl_asan/src/hooks/wcsnlen.rs similarity index 100% rename from libafl_asan/src/hooks/wcsnlen.rs rename to crates/libafl_asan/src/hooks/wcsnlen.rs diff --git a/libafl_asan/src/hooks/wcsrchr.rs b/crates/libafl_asan/src/hooks/wcsrchr.rs similarity index 100% rename from libafl_asan/src/hooks/wcsrchr.rs rename to crates/libafl_asan/src/hooks/wcsrchr.rs diff --git a/libafl_asan/src/hooks/wmemchr.rs b/crates/libafl_asan/src/hooks/wmemchr.rs similarity index 100% rename from libafl_asan/src/hooks/wmemchr.rs rename to crates/libafl_asan/src/hooks/wmemchr.rs diff --git a/libafl_asan/src/hooks/write/libc.rs b/crates/libafl_asan/src/hooks/write/libc.rs similarity index 100% rename from libafl_asan/src/hooks/write/libc.rs rename to crates/libafl_asan/src/hooks/write/libc.rs diff --git a/libafl_asan/src/hooks/write/linux.rs b/crates/libafl_asan/src/hooks/write/linux.rs similarity index 100% rename from libafl_asan/src/hooks/write/linux.rs rename to crates/libafl_asan/src/hooks/write/linux.rs diff --git a/libafl_asan/src/hooks/write/mod.rs b/crates/libafl_asan/src/hooks/write/mod.rs similarity index 100% rename from libafl_asan/src/hooks/write/mod.rs rename to crates/libafl_asan/src/hooks/write/mod.rs diff --git a/libafl_asan/src/host/libc.rs b/crates/libafl_asan/src/host/libc.rs similarity index 100% rename from libafl_asan/src/host/libc.rs rename to crates/libafl_asan/src/host/libc.rs diff --git a/libafl_asan/src/host/linux.rs b/crates/libafl_asan/src/host/linux.rs similarity index 100% rename from libafl_asan/src/host/linux.rs rename to crates/libafl_asan/src/host/linux.rs diff --git a/libafl_asan/src/host/mod.rs b/crates/libafl_asan/src/host/mod.rs similarity index 100% rename from libafl_asan/src/host/mod.rs rename to crates/libafl_asan/src/host/mod.rs diff --git a/libafl_asan/src/lib.rs b/crates/libafl_asan/src/lib.rs similarity index 100% rename from libafl_asan/src/lib.rs rename to crates/libafl_asan/src/lib.rs diff --git a/libafl_asan/src/logger/libc.rs b/crates/libafl_asan/src/logger/libc.rs similarity index 100% rename from libafl_asan/src/logger/libc.rs rename to crates/libafl_asan/src/logger/libc.rs diff --git a/libafl_asan/src/logger/linux.rs b/crates/libafl_asan/src/logger/linux.rs similarity index 100% rename from libafl_asan/src/logger/linux.rs rename to crates/libafl_asan/src/logger/linux.rs diff --git a/libafl_asan/src/logger/mod.rs b/crates/libafl_asan/src/logger/mod.rs similarity index 100% rename from libafl_asan/src/logger/mod.rs rename to crates/libafl_asan/src/logger/mod.rs diff --git a/libafl_asan/src/maps/decode.rs b/crates/libafl_asan/src/maps/decode.rs similarity index 100% rename from libafl_asan/src/maps/decode.rs rename to crates/libafl_asan/src/maps/decode.rs diff --git a/libafl_asan/src/maps/entry.rs b/crates/libafl_asan/src/maps/entry.rs similarity index 100% rename from libafl_asan/src/maps/entry.rs rename to crates/libafl_asan/src/maps/entry.rs diff --git a/libafl_asan/src/maps/iterator.rs b/crates/libafl_asan/src/maps/iterator.rs similarity index 100% rename from libafl_asan/src/maps/iterator.rs rename to crates/libafl_asan/src/maps/iterator.rs diff --git a/libafl_asan/src/maps/libc.rs b/crates/libafl_asan/src/maps/libc.rs similarity index 100% rename from libafl_asan/src/maps/libc.rs rename to crates/libafl_asan/src/maps/libc.rs diff --git a/libafl_asan/src/maps/linux.rs b/crates/libafl_asan/src/maps/linux.rs similarity index 100% rename from libafl_asan/src/maps/linux.rs rename to crates/libafl_asan/src/maps/linux.rs diff --git a/libafl_asan/src/maps/mod.rs b/crates/libafl_asan/src/maps/mod.rs similarity index 100% rename from libafl_asan/src/maps/mod.rs rename to crates/libafl_asan/src/maps/mod.rs diff --git a/libafl_asan/src/mem.rs b/crates/libafl_asan/src/mem.rs similarity index 100% rename from libafl_asan/src/mem.rs rename to crates/libafl_asan/src/mem.rs diff --git a/libafl_asan/src/mmap/libc.rs b/crates/libafl_asan/src/mmap/libc.rs similarity index 100% rename from libafl_asan/src/mmap/libc.rs rename to crates/libafl_asan/src/mmap/libc.rs diff --git a/libafl_asan/src/mmap/linux.rs b/crates/libafl_asan/src/mmap/linux.rs similarity index 100% rename from libafl_asan/src/mmap/linux.rs rename to crates/libafl_asan/src/mmap/linux.rs diff --git a/libafl_asan/src/mmap/mod.rs b/crates/libafl_asan/src/mmap/mod.rs similarity index 100% rename from libafl_asan/src/mmap/mod.rs rename to crates/libafl_asan/src/mmap/mod.rs diff --git a/libafl_asan/src/nostd/mod.rs b/crates/libafl_asan/src/nostd/mod.rs similarity index 100% rename from libafl_asan/src/nostd/mod.rs rename to crates/libafl_asan/src/nostd/mod.rs diff --git a/libafl_asan/src/patch/mod.rs b/crates/libafl_asan/src/patch/mod.rs similarity index 100% rename from libafl_asan/src/patch/mod.rs rename to crates/libafl_asan/src/patch/mod.rs diff --git a/libafl_asan/src/patch/raw.rs b/crates/libafl_asan/src/patch/raw.rs similarity index 100% rename from libafl_asan/src/patch/raw.rs rename to crates/libafl_asan/src/patch/raw.rs diff --git a/libafl_asan/src/shadow/guest.rs b/crates/libafl_asan/src/shadow/guest.rs similarity index 100% rename from libafl_asan/src/shadow/guest.rs rename to crates/libafl_asan/src/shadow/guest.rs diff --git a/libafl_asan/src/shadow/host.rs b/crates/libafl_asan/src/shadow/host.rs similarity index 100% rename from libafl_asan/src/shadow/host.rs rename to crates/libafl_asan/src/shadow/host.rs diff --git a/libafl_asan/src/shadow/mod.rs b/crates/libafl_asan/src/shadow/mod.rs similarity index 100% rename from libafl_asan/src/shadow/mod.rs rename to crates/libafl_asan/src/shadow/mod.rs diff --git a/libafl_asan/src/symbols/dlsym.rs b/crates/libafl_asan/src/symbols/dlsym.rs similarity index 100% rename from libafl_asan/src/symbols/dlsym.rs rename to crates/libafl_asan/src/symbols/dlsym.rs diff --git a/libafl_asan/src/symbols/mod.rs b/crates/libafl_asan/src/symbols/mod.rs similarity index 100% rename from libafl_asan/src/symbols/mod.rs rename to crates/libafl_asan/src/symbols/mod.rs diff --git a/libafl_asan/src/symbols/nop.rs b/crates/libafl_asan/src/symbols/nop.rs similarity index 100% rename from libafl_asan/src/symbols/nop.rs rename to crates/libafl_asan/src/symbols/nop.rs diff --git a/libafl_asan/src/test.rs b/crates/libafl_asan/src/test.rs similarity index 100% rename from libafl_asan/src/test.rs rename to crates/libafl_asan/src/test.rs diff --git a/libafl_asan/src/tracking/guest.rs b/crates/libafl_asan/src/tracking/guest.rs similarity index 100% rename from libafl_asan/src/tracking/guest.rs rename to crates/libafl_asan/src/tracking/guest.rs diff --git a/libafl_asan/src/tracking/guest_fast.rs b/crates/libafl_asan/src/tracking/guest_fast.rs similarity index 100% rename from libafl_asan/src/tracking/guest_fast.rs rename to crates/libafl_asan/src/tracking/guest_fast.rs diff --git a/libafl_asan/src/tracking/host.rs b/crates/libafl_asan/src/tracking/host.rs similarity index 100% rename from libafl_asan/src/tracking/host.rs rename to crates/libafl_asan/src/tracking/host.rs diff --git a/libafl_asan/src/tracking/mod.rs b/crates/libafl_asan/src/tracking/mod.rs similarity index 100% rename from libafl_asan/src/tracking/mod.rs rename to crates/libafl_asan/src/tracking/mod.rs diff --git a/libafl_asan/tests/default_frontend.rs b/crates/libafl_asan/tests/default_frontend.rs similarity index 100% rename from libafl_asan/tests/default_frontend.rs rename to crates/libafl_asan/tests/default_frontend.rs diff --git a/libafl_asan/tests/default_frontend_mock.rs b/crates/libafl_asan/tests/default_frontend_mock.rs similarity index 100% rename from libafl_asan/tests/default_frontend_mock.rs rename to crates/libafl_asan/tests/default_frontend_mock.rs diff --git a/libafl_asan/tests/dlmalloc_backend.rs b/crates/libafl_asan/tests/dlmalloc_backend.rs similarity index 100% rename from libafl_asan/tests/dlmalloc_backend.rs rename to crates/libafl_asan/tests/dlmalloc_backend.rs diff --git a/libafl_asan/tests/guest_shadow_align.rs b/crates/libafl_asan/tests/guest_shadow_align.rs similarity index 100% rename from libafl_asan/tests/guest_shadow_align.rs rename to crates/libafl_asan/tests/guest_shadow_align.rs diff --git a/libafl_asan/tests/guest_shadow_example.rs b/crates/libafl_asan/tests/guest_shadow_example.rs similarity index 100% rename from libafl_asan/tests/guest_shadow_example.rs rename to crates/libafl_asan/tests/guest_shadow_example.rs diff --git a/libafl_asan/tests/guest_shadow_is_memory.rs b/crates/libafl_asan/tests/guest_shadow_is_memory.rs similarity index 100% rename from libafl_asan/tests/guest_shadow_is_memory.rs rename to crates/libafl_asan/tests/guest_shadow_is_memory.rs diff --git a/libafl_asan/tests/guest_shadow_libc_is_poison.rs b/crates/libafl_asan/tests/guest_shadow_libc_is_poison.rs similarity index 100% rename from libafl_asan/tests/guest_shadow_libc_is_poison.rs rename to crates/libafl_asan/tests/guest_shadow_libc_is_poison.rs diff --git a/libafl_asan/tests/guest_shadow_libc_poison.rs b/crates/libafl_asan/tests/guest_shadow_libc_poison.rs similarity index 100% rename from libafl_asan/tests/guest_shadow_libc_poison.rs rename to crates/libafl_asan/tests/guest_shadow_libc_poison.rs diff --git a/libafl_asan/tests/guest_shadow_linux_is_poison.rs b/crates/libafl_asan/tests/guest_shadow_linux_is_poison.rs similarity index 100% rename from libafl_asan/tests/guest_shadow_linux_is_poison.rs rename to crates/libafl_asan/tests/guest_shadow_linux_is_poison.rs diff --git a/libafl_asan/tests/guest_shadow_linux_poison.rs b/crates/libafl_asan/tests/guest_shadow_linux_poison.rs similarity index 100% rename from libafl_asan/tests/guest_shadow_linux_poison.rs rename to crates/libafl_asan/tests/guest_shadow_linux_poison.rs diff --git a/libafl_asan/tests/guest_shadow_linux_unpoison.rs b/crates/libafl_asan/tests/guest_shadow_linux_unpoison.rs similarity index 100% rename from libafl_asan/tests/guest_shadow_linux_unpoison.rs rename to crates/libafl_asan/tests/guest_shadow_linux_unpoison.rs diff --git a/libafl_asan/tests/guest_shadow_unpoison.rs b/crates/libafl_asan/tests/guest_shadow_unpoison.rs similarity index 100% rename from libafl_asan/tests/guest_shadow_unpoison.rs rename to crates/libafl_asan/tests/guest_shadow_unpoison.rs diff --git a/libafl_asan/tests/guest_tracking.rs b/crates/libafl_asan/tests/guest_tracking.rs similarity index 100% rename from libafl_asan/tests/guest_tracking.rs rename to crates/libafl_asan/tests/guest_tracking.rs diff --git a/libafl_asan/tests/hooks_aligned_alloc.rs b/crates/libafl_asan/tests/hooks_aligned_alloc.rs similarity index 100% rename from libafl_asan/tests/hooks_aligned_alloc.rs rename to crates/libafl_asan/tests/hooks_aligned_alloc.rs diff --git a/libafl_asan/tests/hooks_atoi.rs b/crates/libafl_asan/tests/hooks_atoi.rs similarity index 100% rename from libafl_asan/tests/hooks_atoi.rs rename to crates/libafl_asan/tests/hooks_atoi.rs diff --git a/libafl_asan/tests/hooks_atol.rs b/crates/libafl_asan/tests/hooks_atol.rs similarity index 100% rename from libafl_asan/tests/hooks_atol.rs rename to crates/libafl_asan/tests/hooks_atol.rs diff --git a/libafl_asan/tests/hooks_atoll.rs b/crates/libafl_asan/tests/hooks_atoll.rs similarity index 100% rename from libafl_asan/tests/hooks_atoll.rs rename to crates/libafl_asan/tests/hooks_atoll.rs diff --git a/libafl_asan/tests/hooks_bcmp.rs b/crates/libafl_asan/tests/hooks_bcmp.rs similarity index 100% rename from libafl_asan/tests/hooks_bcmp.rs rename to crates/libafl_asan/tests/hooks_bcmp.rs diff --git a/libafl_asan/tests/hooks_bzero.rs b/crates/libafl_asan/tests/hooks_bzero.rs similarity index 100% rename from libafl_asan/tests/hooks_bzero.rs rename to crates/libafl_asan/tests/hooks_bzero.rs diff --git a/libafl_asan/tests/hooks_calloc.rs b/crates/libafl_asan/tests/hooks_calloc.rs similarity index 100% rename from libafl_asan/tests/hooks_calloc.rs rename to crates/libafl_asan/tests/hooks_calloc.rs diff --git a/libafl_asan/tests/hooks_explicit_bzero.rs b/crates/libafl_asan/tests/hooks_explicit_bzero.rs similarity index 100% rename from libafl_asan/tests/hooks_explicit_bzero.rs rename to crates/libafl_asan/tests/hooks_explicit_bzero.rs diff --git a/libafl_asan/tests/hooks_fgets.rs b/crates/libafl_asan/tests/hooks_fgets.rs similarity index 100% rename from libafl_asan/tests/hooks_fgets.rs rename to crates/libafl_asan/tests/hooks_fgets.rs diff --git a/libafl_asan/tests/hooks_free.rs b/crates/libafl_asan/tests/hooks_free.rs similarity index 100% rename from libafl_asan/tests/hooks_free.rs rename to crates/libafl_asan/tests/hooks_free.rs diff --git a/libafl_asan/tests/hooks_malloc.rs b/crates/libafl_asan/tests/hooks_malloc.rs similarity index 100% rename from libafl_asan/tests/hooks_malloc.rs rename to crates/libafl_asan/tests/hooks_malloc.rs diff --git a/libafl_asan/tests/hooks_malloc_usable_size.rs b/crates/libafl_asan/tests/hooks_malloc_usable_size.rs similarity index 100% rename from libafl_asan/tests/hooks_malloc_usable_size.rs rename to crates/libafl_asan/tests/hooks_malloc_usable_size.rs diff --git a/libafl_asan/tests/hooks_memalign.rs b/crates/libafl_asan/tests/hooks_memalign.rs similarity index 100% rename from libafl_asan/tests/hooks_memalign.rs rename to crates/libafl_asan/tests/hooks_memalign.rs diff --git a/libafl_asan/tests/hooks_memchr.rs b/crates/libafl_asan/tests/hooks_memchr.rs similarity index 100% rename from libafl_asan/tests/hooks_memchr.rs rename to crates/libafl_asan/tests/hooks_memchr.rs diff --git a/libafl_asan/tests/hooks_memcmp.rs b/crates/libafl_asan/tests/hooks_memcmp.rs similarity index 100% rename from libafl_asan/tests/hooks_memcmp.rs rename to crates/libafl_asan/tests/hooks_memcmp.rs diff --git a/libafl_asan/tests/hooks_memcpy.rs b/crates/libafl_asan/tests/hooks_memcpy.rs similarity index 100% rename from libafl_asan/tests/hooks_memcpy.rs rename to crates/libafl_asan/tests/hooks_memcpy.rs diff --git a/libafl_asan/tests/hooks_memmem.rs b/crates/libafl_asan/tests/hooks_memmem.rs similarity index 100% rename from libafl_asan/tests/hooks_memmem.rs rename to crates/libafl_asan/tests/hooks_memmem.rs diff --git a/libafl_asan/tests/hooks_memmove.rs b/crates/libafl_asan/tests/hooks_memmove.rs similarity index 100% rename from libafl_asan/tests/hooks_memmove.rs rename to crates/libafl_asan/tests/hooks_memmove.rs diff --git a/libafl_asan/tests/hooks_mempcpy.rs b/crates/libafl_asan/tests/hooks_mempcpy.rs similarity index 100% rename from libafl_asan/tests/hooks_mempcpy.rs rename to crates/libafl_asan/tests/hooks_mempcpy.rs diff --git a/libafl_asan/tests/hooks_memrchr.rs b/crates/libafl_asan/tests/hooks_memrchr.rs similarity index 100% rename from libafl_asan/tests/hooks_memrchr.rs rename to crates/libafl_asan/tests/hooks_memrchr.rs diff --git a/libafl_asan/tests/hooks_memset.rs b/crates/libafl_asan/tests/hooks_memset.rs similarity index 100% rename from libafl_asan/tests/hooks_memset.rs rename to crates/libafl_asan/tests/hooks_memset.rs diff --git a/libafl_asan/tests/hooks_posix_memalign.rs b/crates/libafl_asan/tests/hooks_posix_memalign.rs similarity index 100% rename from libafl_asan/tests/hooks_posix_memalign.rs rename to crates/libafl_asan/tests/hooks_posix_memalign.rs diff --git a/libafl_asan/tests/hooks_pvalloc.rs b/crates/libafl_asan/tests/hooks_pvalloc.rs similarity index 100% rename from libafl_asan/tests/hooks_pvalloc.rs rename to crates/libafl_asan/tests/hooks_pvalloc.rs diff --git a/libafl_asan/tests/hooks_rawmemchr.rs b/crates/libafl_asan/tests/hooks_rawmemchr.rs similarity index 100% rename from libafl_asan/tests/hooks_rawmemchr.rs rename to crates/libafl_asan/tests/hooks_rawmemchr.rs diff --git a/libafl_asan/tests/hooks_read_libc.rs b/crates/libafl_asan/tests/hooks_read_libc.rs similarity index 100% rename from libafl_asan/tests/hooks_read_libc.rs rename to crates/libafl_asan/tests/hooks_read_libc.rs diff --git a/libafl_asan/tests/hooks_read_linux.rs b/crates/libafl_asan/tests/hooks_read_linux.rs similarity index 100% rename from libafl_asan/tests/hooks_read_linux.rs rename to crates/libafl_asan/tests/hooks_read_linux.rs diff --git a/libafl_asan/tests/hooks_realloc.rs b/crates/libafl_asan/tests/hooks_realloc.rs similarity index 100% rename from libafl_asan/tests/hooks_realloc.rs rename to crates/libafl_asan/tests/hooks_realloc.rs diff --git a/libafl_asan/tests/hooks_reallocarray.rs b/crates/libafl_asan/tests/hooks_reallocarray.rs similarity index 100% rename from libafl_asan/tests/hooks_reallocarray.rs rename to crates/libafl_asan/tests/hooks_reallocarray.rs diff --git a/libafl_asan/tests/hooks_stpcpy.rs b/crates/libafl_asan/tests/hooks_stpcpy.rs similarity index 100% rename from libafl_asan/tests/hooks_stpcpy.rs rename to crates/libafl_asan/tests/hooks_stpcpy.rs diff --git a/libafl_asan/tests/hooks_stpncpy.rs b/crates/libafl_asan/tests/hooks_stpncpy.rs similarity index 100% rename from libafl_asan/tests/hooks_stpncpy.rs rename to crates/libafl_asan/tests/hooks_stpncpy.rs diff --git a/libafl_asan/tests/hooks_strcasecmp.rs b/crates/libafl_asan/tests/hooks_strcasecmp.rs similarity index 100% rename from libafl_asan/tests/hooks_strcasecmp.rs rename to crates/libafl_asan/tests/hooks_strcasecmp.rs diff --git a/libafl_asan/tests/hooks_strcasestr.rs b/crates/libafl_asan/tests/hooks_strcasestr.rs similarity index 100% rename from libafl_asan/tests/hooks_strcasestr.rs rename to crates/libafl_asan/tests/hooks_strcasestr.rs diff --git a/libafl_asan/tests/hooks_strcat.rs b/crates/libafl_asan/tests/hooks_strcat.rs similarity index 100% rename from libafl_asan/tests/hooks_strcat.rs rename to crates/libafl_asan/tests/hooks_strcat.rs diff --git a/libafl_asan/tests/hooks_strchr.rs b/crates/libafl_asan/tests/hooks_strchr.rs similarity index 100% rename from libafl_asan/tests/hooks_strchr.rs rename to crates/libafl_asan/tests/hooks_strchr.rs diff --git a/libafl_asan/tests/hooks_strchrnul.rs b/crates/libafl_asan/tests/hooks_strchrnul.rs similarity index 100% rename from libafl_asan/tests/hooks_strchrnul.rs rename to crates/libafl_asan/tests/hooks_strchrnul.rs diff --git a/libafl_asan/tests/hooks_strcmp.rs b/crates/libafl_asan/tests/hooks_strcmp.rs similarity index 100% rename from libafl_asan/tests/hooks_strcmp.rs rename to crates/libafl_asan/tests/hooks_strcmp.rs diff --git a/libafl_asan/tests/hooks_strcpy.rs b/crates/libafl_asan/tests/hooks_strcpy.rs similarity index 100% rename from libafl_asan/tests/hooks_strcpy.rs rename to crates/libafl_asan/tests/hooks_strcpy.rs diff --git a/libafl_asan/tests/hooks_strdup.rs b/crates/libafl_asan/tests/hooks_strdup.rs similarity index 100% rename from libafl_asan/tests/hooks_strdup.rs rename to crates/libafl_asan/tests/hooks_strdup.rs diff --git a/libafl_asan/tests/hooks_strlen.rs b/crates/libafl_asan/tests/hooks_strlen.rs similarity index 100% rename from libafl_asan/tests/hooks_strlen.rs rename to crates/libafl_asan/tests/hooks_strlen.rs diff --git a/libafl_asan/tests/hooks_strncasecmp.rs b/crates/libafl_asan/tests/hooks_strncasecmp.rs similarity index 100% rename from libafl_asan/tests/hooks_strncasecmp.rs rename to crates/libafl_asan/tests/hooks_strncasecmp.rs diff --git a/libafl_asan/tests/hooks_strncat.rs b/crates/libafl_asan/tests/hooks_strncat.rs similarity index 100% rename from libafl_asan/tests/hooks_strncat.rs rename to crates/libafl_asan/tests/hooks_strncat.rs diff --git a/libafl_asan/tests/hooks_strncmp.rs b/crates/libafl_asan/tests/hooks_strncmp.rs similarity index 100% rename from libafl_asan/tests/hooks_strncmp.rs rename to crates/libafl_asan/tests/hooks_strncmp.rs diff --git a/libafl_asan/tests/hooks_strncpy.rs b/crates/libafl_asan/tests/hooks_strncpy.rs similarity index 100% rename from libafl_asan/tests/hooks_strncpy.rs rename to crates/libafl_asan/tests/hooks_strncpy.rs diff --git a/libafl_asan/tests/hooks_strndup.rs b/crates/libafl_asan/tests/hooks_strndup.rs similarity index 100% rename from libafl_asan/tests/hooks_strndup.rs rename to crates/libafl_asan/tests/hooks_strndup.rs diff --git a/libafl_asan/tests/hooks_strnlen.rs b/crates/libafl_asan/tests/hooks_strnlen.rs similarity index 100% rename from libafl_asan/tests/hooks_strnlen.rs rename to crates/libafl_asan/tests/hooks_strnlen.rs diff --git a/libafl_asan/tests/hooks_strrchr.rs b/crates/libafl_asan/tests/hooks_strrchr.rs similarity index 100% rename from libafl_asan/tests/hooks_strrchr.rs rename to crates/libafl_asan/tests/hooks_strrchr.rs diff --git a/libafl_asan/tests/hooks_strstr.rs b/crates/libafl_asan/tests/hooks_strstr.rs similarity index 100% rename from libafl_asan/tests/hooks_strstr.rs rename to crates/libafl_asan/tests/hooks_strstr.rs diff --git a/libafl_asan/tests/hooks_valloc.rs b/crates/libafl_asan/tests/hooks_valloc.rs similarity index 100% rename from libafl_asan/tests/hooks_valloc.rs rename to crates/libafl_asan/tests/hooks_valloc.rs diff --git a/libafl_asan/tests/hooks_wcschr.rs b/crates/libafl_asan/tests/hooks_wcschr.rs similarity index 100% rename from libafl_asan/tests/hooks_wcschr.rs rename to crates/libafl_asan/tests/hooks_wcschr.rs diff --git a/libafl_asan/tests/hooks_wcscmp.rs b/crates/libafl_asan/tests/hooks_wcscmp.rs similarity index 100% rename from libafl_asan/tests/hooks_wcscmp.rs rename to crates/libafl_asan/tests/hooks_wcscmp.rs diff --git a/libafl_asan/tests/hooks_wcscpy.rs b/crates/libafl_asan/tests/hooks_wcscpy.rs similarity index 100% rename from libafl_asan/tests/hooks_wcscpy.rs rename to crates/libafl_asan/tests/hooks_wcscpy.rs diff --git a/libafl_asan/tests/hooks_wcslen.rs b/crates/libafl_asan/tests/hooks_wcslen.rs similarity index 100% rename from libafl_asan/tests/hooks_wcslen.rs rename to crates/libafl_asan/tests/hooks_wcslen.rs diff --git a/libafl_asan/tests/hooks_wcsncmp.rs b/crates/libafl_asan/tests/hooks_wcsncmp.rs similarity index 100% rename from libafl_asan/tests/hooks_wcsncmp.rs rename to crates/libafl_asan/tests/hooks_wcsncmp.rs diff --git a/libafl_asan/tests/hooks_wcsnlen.rs b/crates/libafl_asan/tests/hooks_wcsnlen.rs similarity index 100% rename from libafl_asan/tests/hooks_wcsnlen.rs rename to crates/libafl_asan/tests/hooks_wcsnlen.rs diff --git a/libafl_asan/tests/hooks_wcsrchr.rs b/crates/libafl_asan/tests/hooks_wcsrchr.rs similarity index 100% rename from libafl_asan/tests/hooks_wcsrchr.rs rename to crates/libafl_asan/tests/hooks_wcsrchr.rs diff --git a/libafl_asan/tests/hooks_wmemchr.rs b/crates/libafl_asan/tests/hooks_wmemchr.rs similarity index 100% rename from libafl_asan/tests/hooks_wmemchr.rs rename to crates/libafl_asan/tests/hooks_wmemchr.rs diff --git a/libafl_asan/tests/hooks_write_libc.rs b/crates/libafl_asan/tests/hooks_write_libc.rs similarity index 100% rename from libafl_asan/tests/hooks_write_libc.rs rename to crates/libafl_asan/tests/hooks_write_libc.rs diff --git a/libafl_asan/tests/hooks_write_linux.rs b/crates/libafl_asan/tests/hooks_write_linux.rs similarity index 100% rename from libafl_asan/tests/hooks_write_linux.rs rename to crates/libafl_asan/tests/hooks_write_linux.rs diff --git a/libafl_asan/tests/host.rs b/crates/libafl_asan/tests/host.rs similarity index 100% rename from libafl_asan/tests/host.rs rename to crates/libafl_asan/tests/host.rs diff --git a/libafl_asan/tests/libc_env.rs b/crates/libafl_asan/tests/libc_env.rs similarity index 100% rename from libafl_asan/tests/libc_env.rs rename to crates/libafl_asan/tests/libc_env.rs diff --git a/libafl_asan/tests/libc_map_reader.rs b/crates/libafl_asan/tests/libc_map_reader.rs similarity index 100% rename from libafl_asan/tests/libc_map_reader.rs rename to crates/libafl_asan/tests/libc_map_reader.rs diff --git a/libafl_asan/tests/linux_env.rs b/crates/libafl_asan/tests/linux_env.rs similarity index 100% rename from libafl_asan/tests/linux_env.rs rename to crates/libafl_asan/tests/linux_env.rs diff --git a/libafl_asan/tests/linux_map_reader.rs b/crates/libafl_asan/tests/linux_map_reader.rs similarity index 100% rename from libafl_asan/tests/linux_map_reader.rs rename to crates/libafl_asan/tests/linux_map_reader.rs diff --git a/libafl_asan/tests/patch_raw.rs b/crates/libafl_asan/tests/patch_raw.rs similarity index 100% rename from libafl_asan/tests/patch_raw.rs rename to crates/libafl_asan/tests/patch_raw.rs diff --git a/libafl_asan/tests/symbols_dlsym.rs b/crates/libafl_asan/tests/symbols_dlsym.rs similarity index 100% rename from libafl_asan/tests/symbols_dlsym.rs rename to crates/libafl_asan/tests/symbols_dlsym.rs diff --git a/libafl_bolts/Cargo.toml b/crates/libafl_bolts/Cargo.toml similarity index 100% rename from libafl_bolts/Cargo.toml rename to crates/libafl_bolts/Cargo.toml diff --git a/libafl_bolts/LICENSE-APACHE b/crates/libafl_bolts/LICENSE-APACHE similarity index 100% rename from libafl_bolts/LICENSE-APACHE rename to crates/libafl_bolts/LICENSE-APACHE diff --git a/libafl_bolts/LICENSE-MIT b/crates/libafl_bolts/LICENSE-MIT similarity index 100% rename from libafl_bolts/LICENSE-MIT rename to crates/libafl_bolts/LICENSE-MIT diff --git a/libafl_bolts/README.md b/crates/libafl_bolts/README.md similarity index 100% rename from libafl_bolts/README.md rename to crates/libafl_bolts/README.md diff --git a/libafl_bolts/build.rs b/crates/libafl_bolts/build.rs similarity index 100% rename from libafl_bolts/build.rs rename to crates/libafl_bolts/build.rs diff --git a/libafl_bolts/examples/llmp_test/main.rs b/crates/libafl_bolts/examples/llmp_test/main.rs similarity index 100% rename from libafl_bolts/examples/llmp_test/main.rs rename to crates/libafl_bolts/examples/llmp_test/main.rs diff --git a/libafl_bolts/examples/simd/simd.rs b/crates/libafl_bolts/examples/simd/simd.rs similarity index 100% rename from libafl_bolts/examples/simd/simd.rs rename to crates/libafl_bolts/examples/simd/simd.rs diff --git a/libafl_bolts/src/anymap.rs b/crates/libafl_bolts/src/anymap.rs similarity index 100% rename from libafl_bolts/src/anymap.rs rename to crates/libafl_bolts/src/anymap.rs diff --git a/libafl_bolts/src/argparse.rs b/crates/libafl_bolts/src/argparse.rs similarity index 100% rename from libafl_bolts/src/argparse.rs rename to crates/libafl_bolts/src/argparse.rs diff --git a/libafl_bolts/src/build_id.rs b/crates/libafl_bolts/src/build_id.rs similarity index 100% rename from libafl_bolts/src/build_id.rs rename to crates/libafl_bolts/src/build_id.rs diff --git a/libafl_bolts/src/cli.rs b/crates/libafl_bolts/src/cli.rs similarity index 100% rename from libafl_bolts/src/cli.rs rename to crates/libafl_bolts/src/cli.rs diff --git a/libafl_bolts/src/compress.rs b/crates/libafl_bolts/src/compress.rs similarity index 100% rename from libafl_bolts/src/compress.rs rename to crates/libafl_bolts/src/compress.rs diff --git a/libafl_bolts/src/core_affinity.rs b/crates/libafl_bolts/src/core_affinity.rs similarity index 100% rename from libafl_bolts/src/core_affinity.rs rename to crates/libafl_bolts/src/core_affinity.rs diff --git a/libafl_bolts/src/cpu.rs b/crates/libafl_bolts/src/cpu.rs similarity index 100% rename from libafl_bolts/src/cpu.rs rename to crates/libafl_bolts/src/cpu.rs diff --git a/libafl_bolts/src/fs.rs b/crates/libafl_bolts/src/fs.rs similarity index 100% rename from libafl_bolts/src/fs.rs rename to crates/libafl_bolts/src/fs.rs diff --git a/libafl_bolts/src/lib.rs b/crates/libafl_bolts/src/lib.rs similarity index 99% rename from libafl_bolts/src/lib.rs rename to crates/libafl_bolts/src/lib.rs index 31d598debee..049787f4a5c 100644 --- a/libafl_bolts/src/lib.rs +++ b/crates/libafl_bolts/src/lib.rs @@ -1,7 +1,7 @@ /*! * Welcome to `LibAFL_bolts` */ -#![doc = include_str!("../README.md")] +#![doc = include_str!("../../../README.md")] /*! */ #![cfg_attr(feature = "document-features", doc = document_features::document_features!())] #![no_std] diff --git a/libafl_bolts/src/llmp.rs b/crates/libafl_bolts/src/llmp.rs similarity index 100% rename from libafl_bolts/src/llmp.rs rename to crates/libafl_bolts/src/llmp.rs diff --git a/libafl_bolts/src/math.rs b/crates/libafl_bolts/src/math.rs similarity index 100% rename from libafl_bolts/src/math.rs rename to crates/libafl_bolts/src/math.rs diff --git a/libafl_bolts/src/minibsod.rs b/crates/libafl_bolts/src/minibsod.rs similarity index 100% rename from libafl_bolts/src/minibsod.rs rename to crates/libafl_bolts/src/minibsod.rs diff --git a/libafl_bolts/src/os/mod.rs b/crates/libafl_bolts/src/os/mod.rs similarity index 100% rename from libafl_bolts/src/os/mod.rs rename to crates/libafl_bolts/src/os/mod.rs diff --git a/libafl_bolts/src/os/pipes.rs b/crates/libafl_bolts/src/os/pipes.rs similarity index 100% rename from libafl_bolts/src/os/pipes.rs rename to crates/libafl_bolts/src/os/pipes.rs diff --git a/libafl_bolts/src/os/unix_shmem_server.rs b/crates/libafl_bolts/src/os/unix_shmem_server.rs similarity index 100% rename from libafl_bolts/src/os/unix_shmem_server.rs rename to crates/libafl_bolts/src/os/unix_shmem_server.rs diff --git a/libafl_bolts/src/os/unix_signals.rs b/crates/libafl_bolts/src/os/unix_signals.rs similarity index 100% rename from libafl_bolts/src/os/unix_signals.rs rename to crates/libafl_bolts/src/os/unix_signals.rs diff --git a/libafl_bolts/src/os/windows_exceptions.rs b/crates/libafl_bolts/src/os/windows_exceptions.rs similarity index 100% rename from libafl_bolts/src/os/windows_exceptions.rs rename to crates/libafl_bolts/src/os/windows_exceptions.rs diff --git a/libafl_bolts/src/ownedref.rs b/crates/libafl_bolts/src/ownedref.rs similarity index 100% rename from libafl_bolts/src/ownedref.rs rename to crates/libafl_bolts/src/ownedref.rs diff --git a/libafl_bolts/src/rands/loaded_dice.rs b/crates/libafl_bolts/src/rands/loaded_dice.rs similarity index 100% rename from libafl_bolts/src/rands/loaded_dice.rs rename to crates/libafl_bolts/src/rands/loaded_dice.rs diff --git a/libafl_bolts/src/rands/mod.rs b/crates/libafl_bolts/src/rands/mod.rs similarity index 100% rename from libafl_bolts/src/rands/mod.rs rename to crates/libafl_bolts/src/rands/mod.rs diff --git a/libafl_bolts/src/serdeany.rs b/crates/libafl_bolts/src/serdeany.rs similarity index 100% rename from libafl_bolts/src/serdeany.rs rename to crates/libafl_bolts/src/serdeany.rs diff --git a/libafl_bolts/src/shmem.rs b/crates/libafl_bolts/src/shmem.rs similarity index 100% rename from libafl_bolts/src/shmem.rs rename to crates/libafl_bolts/src/shmem.rs diff --git a/libafl_bolts/src/simd.rs b/crates/libafl_bolts/src/simd.rs similarity index 100% rename from libafl_bolts/src/simd.rs rename to crates/libafl_bolts/src/simd.rs diff --git a/libafl_bolts/src/staterestore.rs b/crates/libafl_bolts/src/staterestore.rs similarity index 100% rename from libafl_bolts/src/staterestore.rs rename to crates/libafl_bolts/src/staterestore.rs diff --git a/libafl_bolts/src/subrange.rs b/crates/libafl_bolts/src/subrange.rs similarity index 100% rename from libafl_bolts/src/subrange.rs rename to crates/libafl_bolts/src/subrange.rs diff --git a/libafl_bolts/src/target_args.rs b/crates/libafl_bolts/src/target_args.rs similarity index 100% rename from libafl_bolts/src/target_args.rs rename to crates/libafl_bolts/src/target_args.rs diff --git a/libafl_bolts/src/tuples.rs b/crates/libafl_bolts/src/tuples.rs similarity index 100% rename from libafl_bolts/src/tuples.rs rename to crates/libafl_bolts/src/tuples.rs diff --git a/libafl_cc/Cargo.toml b/crates/libafl_cc/Cargo.toml similarity index 100% rename from libafl_cc/Cargo.toml rename to crates/libafl_cc/Cargo.toml diff --git a/libafl_cc/README.md b/crates/libafl_cc/README.md similarity index 87% rename from libafl_cc/README.md rename to crates/libafl_cc/README.md index 0965dc87ead..d2bcc982381 100644 --- a/libafl_cc/README.md +++ b/crates/libafl_cc/README.md @@ -8,8 +8,10 @@ Currently, we support LLVM version 11 up to 17, but other versions may work. To install LLVM, use the official [download page](https://releases.llvm.org/download.html). The LLVM tools (including clang, clang++) are needed (newer than LLVM 11.0.0 up to LLVM 17.0.0) - - When compiling LLVM tools on Windows, you can try to compile LLVM with the below commands (tested on LLVM 16.0.6). - - NOTE: This assumes you have Visual Studio 17 2022 and MSVC v143 Tools installed under "Individual Components" + +- When compiling LLVM tools on Windows, you can try to compile LLVM with the below commands (tested on LLVM 16.0.6). +- NOTE: This assumes you have Visual Studio 17 2022 and MSVC v143 Tools installed under "Individual Components" + ```sh ## Start x64 Native Tools Command Prompt for VS 2022 RUN AS ADMINISTRATOR: %comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" diff --git a/libafl_cc/build.rs b/crates/libafl_cc/build.rs similarity index 100% rename from libafl_cc/build.rs rename to crates/libafl_cc/build.rs diff --git a/libafl_cc/src/ar.rs b/crates/libafl_cc/src/ar.rs similarity index 100% rename from libafl_cc/src/ar.rs rename to crates/libafl_cc/src/ar.rs diff --git a/libafl_cc/src/autotokens-pass.cc b/crates/libafl_cc/src/autotokens-pass.cc similarity index 100% rename from libafl_cc/src/autotokens-pass.cc rename to crates/libafl_cc/src/autotokens-pass.cc diff --git a/libafl_cc/src/cfg.rs b/crates/libafl_cc/src/cfg.rs similarity index 100% rename from libafl_cc/src/cfg.rs rename to crates/libafl_cc/src/cfg.rs diff --git a/libafl_cc/src/clang.rs b/crates/libafl_cc/src/clang.rs similarity index 100% rename from libafl_cc/src/clang.rs rename to crates/libafl_cc/src/clang.rs diff --git a/libafl_cc/src/cmplog-instructions-pass.cc b/crates/libafl_cc/src/cmplog-instructions-pass.cc similarity index 100% rename from libafl_cc/src/cmplog-instructions-pass.cc rename to crates/libafl_cc/src/cmplog-instructions-pass.cc diff --git a/libafl_cc/src/cmplog-routines-pass.cc b/crates/libafl_cc/src/cmplog-routines-pass.cc similarity index 100% rename from libafl_cc/src/cmplog-routines-pass.cc rename to crates/libafl_cc/src/cmplog-routines-pass.cc diff --git a/libafl_cc/src/common-llvm.h b/crates/libafl_cc/src/common-llvm.h similarity index 100% rename from libafl_cc/src/common-llvm.h rename to crates/libafl_cc/src/common-llvm.h diff --git a/libafl_cc/src/coverage-accounting-pass.cc b/crates/libafl_cc/src/coverage-accounting-pass.cc similarity index 100% rename from libafl_cc/src/coverage-accounting-pass.cc rename to crates/libafl_cc/src/coverage-accounting-pass.cc diff --git a/libafl_cc/src/ctx-pass.cc b/crates/libafl_cc/src/ctx-pass.cc similarity index 100% rename from libafl_cc/src/ctx-pass.cc rename to crates/libafl_cc/src/ctx-pass.cc diff --git a/libafl_cc/src/dump-cfg-pass.cc b/crates/libafl_cc/src/dump-cfg-pass.cc similarity index 100% rename from libafl_cc/src/dump-cfg-pass.cc rename to crates/libafl_cc/src/dump-cfg-pass.cc diff --git a/libafl_cc/src/function-logging.cc b/crates/libafl_cc/src/function-logging.cc similarity index 100% rename from libafl_cc/src/function-logging.cc rename to crates/libafl_cc/src/function-logging.cc diff --git a/libafl_cc/src/lib.rs b/crates/libafl_cc/src/lib.rs similarity index 100% rename from libafl_cc/src/lib.rs rename to crates/libafl_cc/src/lib.rs diff --git a/libafl_cc/src/libtool.rs b/crates/libafl_cc/src/libtool.rs similarity index 100% rename from libafl_cc/src/libtool.rs rename to crates/libafl_cc/src/libtool.rs diff --git a/libafl_cc/src/no-link-rt.c b/crates/libafl_cc/src/no-link-rt.c similarity index 100% rename from libafl_cc/src/no-link-rt.c rename to crates/libafl_cc/src/no-link-rt.c diff --git a/libafl_concolic/symcc_libafl/Cargo.toml b/crates/libafl_concolic/symcc_libafl/Cargo.toml similarity index 100% rename from libafl_concolic/symcc_libafl/Cargo.toml rename to crates/libafl_concolic/symcc_libafl/Cargo.toml diff --git a/libafl_concolic/symcc_libafl/README.md b/crates/libafl_concolic/symcc_libafl/README.md similarity index 96% rename from libafl_concolic/symcc_libafl/README.md rename to crates/libafl_concolic/symcc_libafl/README.md index 997785d68ff..d5506bdda45 100644 --- a/libafl_concolic/symcc_libafl/README.md +++ b/crates/libafl_concolic/symcc_libafl/README.md @@ -1,3 +1,5 @@ +# SymCC_LibAFL + This is a support crate for [symcc_runtime](https://crates.io/crates/symcc_runtime). It defines a stable URL and commit hash for the [LibAFL](https://github.com/AFLplusplus/LibAFL) [fork](https://github.com/AFLplusplus/symcc) of [SymCC](https://github.com/eurecom-s3/symcc). It also provides convenient methods to clone and build SymCC to be used in build scripts in LibAFL-based fuzzers. diff --git a/libafl_concolic/symcc_libafl/src/lib.rs b/crates/libafl_concolic/symcc_libafl/src/lib.rs similarity index 100% rename from libafl_concolic/symcc_libafl/src/lib.rs rename to crates/libafl_concolic/symcc_libafl/src/lib.rs diff --git a/libafl_concolic/symcc_runtime/Cargo.toml b/crates/libafl_concolic/symcc_runtime/Cargo.toml similarity index 100% rename from libafl_concolic/symcc_runtime/Cargo.toml rename to crates/libafl_concolic/symcc_runtime/Cargo.toml diff --git a/libafl_concolic/symcc_runtime/README.md b/crates/libafl_concolic/symcc_runtime/README.md similarity index 53% rename from libafl_concolic/symcc_runtime/README.md rename to crates/libafl_concolic/symcc_runtime/README.md index d6886878890..ad9e3aae0ac 100644 --- a/libafl_concolic/symcc_runtime/README.md +++ b/crates/libafl_concolic/symcc_runtime/README.md @@ -1,3 +1,4 @@ # SymCC Concolic Tracing Runtime Rust Bindings -This crate allows you to build custom runtimes for SymCC. + +This crate allows you to build custom runtimes for [SymCC](https://github.com/eurecom-s3/symcc). See the [documentation](https://docs.rs/symcc_runtime) for details. diff --git a/libafl_concolic/symcc_runtime/build.rs b/crates/libafl_concolic/symcc_runtime/build.rs similarity index 100% rename from libafl_concolic/symcc_runtime/build.rs rename to crates/libafl_concolic/symcc_runtime/build.rs diff --git a/libafl_concolic/symcc_runtime/src/filter.rs b/crates/libafl_concolic/symcc_runtime/src/filter.rs similarity index 100% rename from libafl_concolic/symcc_runtime/src/filter.rs rename to crates/libafl_concolic/symcc_runtime/src/filter.rs diff --git a/libafl_concolic/symcc_runtime/src/filter/coverage.rs b/crates/libafl_concolic/symcc_runtime/src/filter/coverage.rs similarity index 100% rename from libafl_concolic/symcc_runtime/src/filter/coverage.rs rename to crates/libafl_concolic/symcc_runtime/src/filter/coverage.rs diff --git a/libafl_concolic/symcc_runtime/src/lib.rs b/crates/libafl_concolic/symcc_runtime/src/lib.rs similarity index 100% rename from libafl_concolic/symcc_runtime/src/lib.rs rename to crates/libafl_concolic/symcc_runtime/src/lib.rs diff --git a/libafl_concolic/symcc_runtime/src/tracing.rs b/crates/libafl_concolic/symcc_runtime/src/tracing.rs similarity index 100% rename from libafl_concolic/symcc_runtime/src/tracing.rs rename to crates/libafl_concolic/symcc_runtime/src/tracing.rs diff --git a/libafl_concolic/test/.gitignore b/crates/libafl_concolic/test/.gitignore similarity index 100% rename from libafl_concolic/test/.gitignore rename to crates/libafl_concolic/test/.gitignore diff --git a/libafl_concolic/test/README.md b/crates/libafl_concolic/test/README.md similarity index 100% rename from libafl_concolic/test/README.md rename to crates/libafl_concolic/test/README.md diff --git a/libafl_concolic/test/dump_constraints/Cargo.toml b/crates/libafl_concolic/test/dump_constraints/Cargo.toml similarity index 100% rename from libafl_concolic/test/dump_constraints/Cargo.toml rename to crates/libafl_concolic/test/dump_constraints/Cargo.toml diff --git a/libafl_concolic/test/dump_constraints/src/main.rs b/crates/libafl_concolic/test/dump_constraints/src/main.rs similarity index 100% rename from libafl_concolic/test/dump_constraints/src/main.rs rename to crates/libafl_concolic/test/dump_constraints/src/main.rs diff --git a/libafl_concolic/test/expected_constraints.txt b/crates/libafl_concolic/test/expected_constraints.txt similarity index 100% rename from libafl_concolic/test/expected_constraints.txt rename to crates/libafl_concolic/test/expected_constraints.txt diff --git a/libafl_concolic/test/if_test_input b/crates/libafl_concolic/test/if_test_input similarity index 100% rename from libafl_concolic/test/if_test_input rename to crates/libafl_concolic/test/if_test_input diff --git a/libafl_concolic/test/runtime_test/Cargo.toml b/crates/libafl_concolic/test/runtime_test/Cargo.toml similarity index 100% rename from libafl_concolic/test/runtime_test/Cargo.toml rename to crates/libafl_concolic/test/runtime_test/Cargo.toml diff --git a/libafl_concolic/test/runtime_test/src/lib.rs b/crates/libafl_concolic/test/runtime_test/src/lib.rs similarity index 100% rename from libafl_concolic/test/runtime_test/src/lib.rs rename to crates/libafl_concolic/test/runtime_test/src/lib.rs diff --git a/libafl_concolic/test/smoke_test.sh b/crates/libafl_concolic/test/smoke_test.sh similarity index 94% rename from libafl_concolic/test/smoke_test.sh rename to crates/libafl_concolic/test/smoke_test.sh index e47db28f4a5..187c90a6c29 100755 --- a/libafl_concolic/test/smoke_test.sh +++ b/crates/libafl_concolic/test/smoke_test.sh @@ -34,7 +34,7 @@ echo "building runtime and dump_constraints" cargo build -p runtime_test -p dump_constraints echo "building target" -SYMCC_RUNTIME_DIR=../../target/debug symcc_build/symcc symcc/test/if.c -o "if" +SYMCC_RUNTIME_DIR=../../../target/debug symcc_build/symcc symcc/test/if.c -o "if" echo "running target with dump_constraints" cargo run -p dump_constraints -- --plain-text --output constraints.txt -- ./if < if_test_input diff --git a/libafl_concolic/test/smoke_test_ubuntu_deps.sh b/crates/libafl_concolic/test/smoke_test_ubuntu_deps.sh similarity index 100% rename from libafl_concolic/test/smoke_test_ubuntu_deps.sh rename to crates/libafl_concolic/test/smoke_test_ubuntu_deps.sh diff --git a/libafl_derive/Cargo.toml b/crates/libafl_derive/Cargo.toml similarity index 95% rename from libafl_derive/Cargo.toml rename to crates/libafl_derive/Cargo.toml index 46417c5a8a9..ecb6aedb774 100644 --- a/libafl_derive/Cargo.toml +++ b/crates/libafl_derive/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Andrea Fioraldi "] description = "Derive proc-macro crate for LibAFL" documentation = "https://docs.rs/libafl_derive" repository = "https://github.com/AFLplusplus/LibAFL/" -readme = "../README.md" +readme = "../../README.md" license = "MIT OR Apache-2.0" keywords = ["fuzzing", "testing"] edition = "2024" diff --git a/libafl_derive/src/lib.rs b/crates/libafl_derive/src/lib.rs similarity index 100% rename from libafl_derive/src/lib.rs rename to crates/libafl_derive/src/lib.rs diff --git a/libafl_frida/Cargo.toml b/crates/libafl_frida/Cargo.toml similarity index 99% rename from libafl_frida/Cargo.toml rename to crates/libafl_frida/Cargo.toml index 12992dfc0ca..7e42acd23a5 100644 --- a/libafl_frida/Cargo.toml +++ b/crates/libafl_frida/Cargo.toml @@ -5,7 +5,7 @@ authors = ["s1341 "] description = "Frida backend library for LibAFL" documentation = "https://docs.rs/libafl_frida" repository = "https://github.com/AFLplusplus/LibAFL/" -readme = "../README.md" +readme = "../../README.md" license = "MIT OR Apache-2.0" keywords = ["fuzzing", "frida", "instrumentation"] edition = "2024" diff --git a/libafl_frida/build.rs b/crates/libafl_frida/build.rs similarity index 100% rename from libafl_frida/build.rs rename to crates/libafl_frida/build.rs diff --git a/libafl_frida/src/allocator.rs b/crates/libafl_frida/src/allocator.rs similarity index 100% rename from libafl_frida/src/allocator.rs rename to crates/libafl_frida/src/allocator.rs diff --git a/libafl_frida/src/asan/asan_rt.rs b/crates/libafl_frida/src/asan/asan_rt.rs similarity index 100% rename from libafl_frida/src/asan/asan_rt.rs rename to crates/libafl_frida/src/asan/asan_rt.rs diff --git a/libafl_frida/src/asan/errors.rs b/crates/libafl_frida/src/asan/errors.rs similarity index 100% rename from libafl_frida/src/asan/errors.rs rename to crates/libafl_frida/src/asan/errors.rs diff --git a/libafl_frida/src/asan/hook_funcs.rs b/crates/libafl_frida/src/asan/hook_funcs.rs similarity index 100% rename from libafl_frida/src/asan/hook_funcs.rs rename to crates/libafl_frida/src/asan/hook_funcs.rs diff --git a/libafl_frida/src/asan/mod.rs b/crates/libafl_frida/src/asan/mod.rs similarity index 100% rename from libafl_frida/src/asan/mod.rs rename to crates/libafl_frida/src/asan/mod.rs diff --git a/libafl_frida/src/cmplog_rt.rs b/crates/libafl_frida/src/cmplog_rt.rs similarity index 100% rename from libafl_frida/src/cmplog_rt.rs rename to crates/libafl_frida/src/cmplog_rt.rs diff --git a/libafl_frida/src/coverage_rt.rs b/crates/libafl_frida/src/coverage_rt.rs similarity index 100% rename from libafl_frida/src/coverage_rt.rs rename to crates/libafl_frida/src/coverage_rt.rs diff --git a/libafl_frida/src/drcov_rt.rs b/crates/libafl_frida/src/drcov_rt.rs similarity index 100% rename from libafl_frida/src/drcov_rt.rs rename to crates/libafl_frida/src/drcov_rt.rs diff --git a/libafl_frida/src/executor.rs b/crates/libafl_frida/src/executor.rs similarity index 100% rename from libafl_frida/src/executor.rs rename to crates/libafl_frida/src/executor.rs diff --git a/libafl_frida/src/frida_helper_shutdown_observer.rs b/crates/libafl_frida/src/frida_helper_shutdown_observer.rs similarity index 100% rename from libafl_frida/src/frida_helper_shutdown_observer.rs rename to crates/libafl_frida/src/frida_helper_shutdown_observer.rs diff --git a/libafl_frida/src/gettls.c b/crates/libafl_frida/src/gettls.c similarity index 100% rename from libafl_frida/src/gettls.c rename to crates/libafl_frida/src/gettls.c diff --git a/libafl_frida/src/helper.rs b/crates/libafl_frida/src/helper.rs similarity index 100% rename from libafl_frida/src/helper.rs rename to crates/libafl_frida/src/helper.rs diff --git a/libafl_frida/src/lib.rs b/crates/libafl_frida/src/lib.rs similarity index 100% rename from libafl_frida/src/lib.rs rename to crates/libafl_frida/src/lib.rs diff --git a/libafl_frida/src/pthread_hook.rs b/crates/libafl_frida/src/pthread_hook.rs similarity index 100% rename from libafl_frida/src/pthread_hook.rs rename to crates/libafl_frida/src/pthread_hook.rs diff --git a/libafl_frida/src/script.js b/crates/libafl_frida/src/script.js similarity index 100% rename from libafl_frida/src/script.js rename to crates/libafl_frida/src/script.js diff --git a/libafl_frida/src/utils.rs b/crates/libafl_frida/src/utils.rs similarity index 100% rename from libafl_frida/src/utils.rs rename to crates/libafl_frida/src/utils.rs diff --git a/libafl_frida/src/windows_hooks.rs b/crates/libafl_frida/src/windows_hooks.rs similarity index 100% rename from libafl_frida/src/windows_hooks.rs rename to crates/libafl_frida/src/windows_hooks.rs diff --git a/libafl_frida/test_harness.cpp b/crates/libafl_frida/test_harness.cpp similarity index 100% rename from libafl_frida/test_harness.cpp rename to crates/libafl_frida/test_harness.cpp diff --git a/libafl_intelpt/Cargo.toml b/crates/libafl_intelpt/Cargo.toml similarity index 100% rename from libafl_intelpt/Cargo.toml rename to crates/libafl_intelpt/Cargo.toml diff --git a/crates/libafl_intelpt/README.md b/crates/libafl_intelpt/README.md new file mode 100644 index 00000000000..deebb9303a6 --- /dev/null +++ b/crates/libafl_intelpt/README.md @@ -0,0 +1,5 @@ +# Intel Processor Trace (PT) low level code + +This module is a wrapper around the `IntelPT` kernel driver, exposing functionalities specifically crafted for `LibAFL`. + +At the moment only `Linux` hosts are supported. diff --git a/libafl_intelpt/src/lib.rs b/crates/libafl_intelpt/src/lib.rs similarity index 100% rename from libafl_intelpt/src/lib.rs rename to crates/libafl_intelpt/src/lib.rs diff --git a/libafl_intelpt/src/linux.rs b/crates/libafl_intelpt/src/linux.rs similarity index 100% rename from libafl_intelpt/src/linux.rs rename to crates/libafl_intelpt/src/linux.rs diff --git a/libafl_intelpt/tests/integration_tests_linux.rs b/crates/libafl_intelpt/tests/integration_tests_linux.rs similarity index 100% rename from libafl_intelpt/tests/integration_tests_linux.rs rename to crates/libafl_intelpt/tests/integration_tests_linux.rs diff --git a/libafl_intelpt/tests/run_integration_tests_linux_with_caps.sh b/crates/libafl_intelpt/tests/run_integration_tests_linux_with_caps.sh similarity index 100% rename from libafl_intelpt/tests/run_integration_tests_linux_with_caps.sh rename to crates/libafl_intelpt/tests/run_integration_tests_linux_with_caps.sh diff --git a/libafl_libfuzzer/Cargo.toml b/crates/libafl_libfuzzer/Cargo.toml similarity index 98% rename from libafl_libfuzzer/Cargo.toml rename to crates/libafl_libfuzzer/Cargo.toml index f8462f74b09..8f24ad756ca 100644 --- a/libafl_libfuzzer/Cargo.toml +++ b/crates/libafl_libfuzzer/Cargo.toml @@ -3,7 +3,7 @@ name = "libafl_libfuzzer" version.workspace = true description = "libFuzzer shim which uses LibAFL with common defaults" repository = "https://github.com/AFLplusplus/LibAFL/" -readme = "../README.md" +readme = "../../README.md" license = "MIT OR Apache-2.0" keywords = ["fuzzing", "testing", "security"] edition = "2024" diff --git a/libafl_libfuzzer/LICENSE-APACHE b/crates/libafl_libfuzzer/LICENSE-APACHE similarity index 100% rename from libafl_libfuzzer/LICENSE-APACHE rename to crates/libafl_libfuzzer/LICENSE-APACHE diff --git a/libafl_libfuzzer/LICENSE-MIT b/crates/libafl_libfuzzer/LICENSE-MIT similarity index 100% rename from libafl_libfuzzer/LICENSE-MIT rename to crates/libafl_libfuzzer/LICENSE-MIT diff --git a/libafl_libfuzzer/README.md b/crates/libafl_libfuzzer/README.md similarity index 91% rename from libafl_libfuzzer/README.md rename to crates/libafl_libfuzzer/README.md index c6f58ce2acb..dcdc988afa8 100644 --- a/libafl_libfuzzer/README.md +++ b/crates/libafl_libfuzzer/README.md @@ -137,14 +137,14 @@ to partial support of libfuzzer flags, `libafl_libfuzzer` offers: - `-dedup=n`, with `n` = 1 enabling deduplication of crashes by stacktrace. - `-grimoire=n`, with `n` set to 0 or 1 disabling or enabling [grimoire] mutations, respectively. - - if not specified explicitly, `libafl_libfuzzer` will select based on whether existing inputs are UTF-8 - - you should disable grimoire if your target is not string-like + - if not specified explicitly, `libafl_libfuzzer` will select based on whether existing inputs are UTF-8 + - you should disable grimoire if your target is not string-like - `-report=n`, with `n` = 1 causing `libafl_libfuzzer` to emit a report on the corpus content. - `-skip_tracing=n`, with `n` = 1 causing `libafl_libfuzzer` to disable cmplog tracing. - - you should do this if your target performs many comparisons on memory sequences which are + - you should do this if your target performs many comparisons on memory sequences which are not contained in the input - `-tui=n`, with `n` = 1 enabling a graphical terminal interface. - - experimental; some users report inconsistent behaviour with tui enabled + - experimental; some users report inconsistent behaviour with tui enabled ### Supported flags from libfuzzer @@ -152,12 +152,12 @@ to partial support of libfuzzer flags, `libafl_libfuzzer` offers: - `-minimize_crash` - `-artifact_prefix` - `-timeout` - - unlike libfuzzer, `libafl_libfuzzer` supports partial second timeouts (e.g. `-timeout=.5`) + - unlike libfuzzer, `libafl_libfuzzer` supports partial second timeouts (e.g. `-timeout=.5`) - `-dict` - `-fork` and `-jobs` - - in `libafl_libfuzzer`, these are synonymous + - in `libafl_libfuzzer`, these are synonymous - `-ignore_crashes`, `-ignore_ooms`, and `-ignore_timeouts` - - note that setting `-tui=1` enables these flags by default, so you'll need to explicitly mention `-ignore_...=0` to + - note that setting `-tui=1` enables these flags by default, so you'll need to explicitly mention `-ignore_...=0` to disable them - `-rss_limit_mb` and `-malloc_limit_mb` - `-ignore_remaining_args` diff --git a/libafl_libfuzzer/build.rs b/crates/libafl_libfuzzer/build.rs similarity index 100% rename from libafl_libfuzzer/build.rs rename to crates/libafl_libfuzzer/build.rs diff --git a/libafl_libfuzzer/runtime/Cargo.toml.template b/crates/libafl_libfuzzer/runtime/Cargo.toml.template similarity index 100% rename from libafl_libfuzzer/runtime/Cargo.toml.template rename to crates/libafl_libfuzzer/runtime/Cargo.toml.template diff --git a/libafl_libfuzzer/runtime/build.rs b/crates/libafl_libfuzzer/runtime/build.rs similarity index 100% rename from libafl_libfuzzer/runtime/build.rs rename to crates/libafl_libfuzzer/runtime/build.rs diff --git a/libafl_libfuzzer/runtime/src/corpus.rs b/crates/libafl_libfuzzer/runtime/src/corpus.rs similarity index 100% rename from libafl_libfuzzer/runtime/src/corpus.rs rename to crates/libafl_libfuzzer/runtime/src/corpus.rs diff --git a/libafl_libfuzzer/runtime/src/feedbacks.rs b/crates/libafl_libfuzzer/runtime/src/feedbacks.rs similarity index 100% rename from libafl_libfuzzer/runtime/src/feedbacks.rs rename to crates/libafl_libfuzzer/runtime/src/feedbacks.rs diff --git a/libafl_libfuzzer/runtime/src/fuzz.rs b/crates/libafl_libfuzzer/runtime/src/fuzz.rs similarity index 100% rename from libafl_libfuzzer/runtime/src/fuzz.rs rename to crates/libafl_libfuzzer/runtime/src/fuzz.rs diff --git a/libafl_libfuzzer/runtime/src/harness_wrap.cpp b/crates/libafl_libfuzzer/runtime/src/harness_wrap.cpp similarity index 100% rename from libafl_libfuzzer/runtime/src/harness_wrap.cpp rename to crates/libafl_libfuzzer/runtime/src/harness_wrap.cpp diff --git a/libafl_libfuzzer/runtime/src/harness_wrap.h b/crates/libafl_libfuzzer/runtime/src/harness_wrap.h similarity index 100% rename from libafl_libfuzzer/runtime/src/harness_wrap.h rename to crates/libafl_libfuzzer/runtime/src/harness_wrap.h diff --git a/libafl_libfuzzer/runtime/src/lib.rs b/crates/libafl_libfuzzer/runtime/src/lib.rs similarity index 100% rename from libafl_libfuzzer/runtime/src/lib.rs rename to crates/libafl_libfuzzer/runtime/src/lib.rs diff --git a/libafl_libfuzzer/runtime/src/merge.rs b/crates/libafl_libfuzzer/runtime/src/merge.rs similarity index 100% rename from libafl_libfuzzer/runtime/src/merge.rs rename to crates/libafl_libfuzzer/runtime/src/merge.rs diff --git a/libafl_libfuzzer/runtime/src/misc.rs b/crates/libafl_libfuzzer/runtime/src/misc.rs similarity index 100% rename from libafl_libfuzzer/runtime/src/misc.rs rename to crates/libafl_libfuzzer/runtime/src/misc.rs diff --git a/libafl_libfuzzer/runtime/src/observers.rs b/crates/libafl_libfuzzer/runtime/src/observers.rs similarity index 100% rename from libafl_libfuzzer/runtime/src/observers.rs rename to crates/libafl_libfuzzer/runtime/src/observers.rs diff --git a/libafl_libfuzzer/runtime/src/options.rs b/crates/libafl_libfuzzer/runtime/src/options.rs similarity index 100% rename from libafl_libfuzzer/runtime/src/options.rs rename to crates/libafl_libfuzzer/runtime/src/options.rs diff --git a/libafl_libfuzzer/runtime/src/report.rs b/crates/libafl_libfuzzer/runtime/src/report.rs similarity index 100% rename from libafl_libfuzzer/runtime/src/report.rs rename to crates/libafl_libfuzzer/runtime/src/report.rs diff --git a/libafl_libfuzzer/runtime/src/schedulers.rs b/crates/libafl_libfuzzer/runtime/src/schedulers.rs similarity index 100% rename from libafl_libfuzzer/runtime/src/schedulers.rs rename to crates/libafl_libfuzzer/runtime/src/schedulers.rs diff --git a/libafl_libfuzzer/runtime/src/tmin.rs b/crates/libafl_libfuzzer/runtime/src/tmin.rs similarity index 100% rename from libafl_libfuzzer/runtime/src/tmin.rs rename to crates/libafl_libfuzzer/runtime/src/tmin.rs diff --git a/libafl_libfuzzer/src/lib.rs b/crates/libafl_libfuzzer/src/lib.rs similarity index 100% rename from libafl_libfuzzer/src/lib.rs rename to crates/libafl_libfuzzer/src/lib.rs diff --git a/libafl_libfuzzer_runtime/Cargo.toml b/crates/libafl_libfuzzer_runtime/Cargo.toml similarity index 100% rename from libafl_libfuzzer_runtime/Cargo.toml rename to crates/libafl_libfuzzer_runtime/Cargo.toml diff --git a/libafl_libfuzzer_runtime/Justfile b/crates/libafl_libfuzzer_runtime/Justfile similarity index 93% rename from libafl_libfuzzer_runtime/Justfile rename to crates/libafl_libfuzzer_runtime/Justfile index ae991e7a5cb..7c61b0e3b2a 100644 --- a/libafl_libfuzzer_runtime/Justfile +++ b/crates/libafl_libfuzzer_runtime/Justfile @@ -1,10 +1,10 @@ -set windows-shell := ['cmd.exe', '/c'] -set unstable - -[unix] -build: - ./build.sh - -[windows] -build: +set windows-shell := ['cmd.exe', '/c'] +set unstable + +[unix] +build: + ./build.sh + +[windows] +build: powershell -File build.ps1 \ No newline at end of file diff --git a/libafl_libfuzzer_runtime/LICENSE-APACHE b/crates/libafl_libfuzzer_runtime/LICENSE-APACHE similarity index 100% rename from libafl_libfuzzer_runtime/LICENSE-APACHE rename to crates/libafl_libfuzzer_runtime/LICENSE-APACHE diff --git a/libafl_libfuzzer_runtime/LICENSE-MIT b/crates/libafl_libfuzzer_runtime/LICENSE-MIT similarity index 100% rename from libafl_libfuzzer_runtime/LICENSE-MIT rename to crates/libafl_libfuzzer_runtime/LICENSE-MIT diff --git a/libafl_libfuzzer_runtime/README.md b/crates/libafl_libfuzzer_runtime/README.md similarity index 100% rename from libafl_libfuzzer_runtime/README.md rename to crates/libafl_libfuzzer_runtime/README.md diff --git a/libafl_libfuzzer_runtime/build.ps1 b/crates/libafl_libfuzzer_runtime/build.ps1 similarity index 96% rename from libafl_libfuzzer_runtime/build.ps1 rename to crates/libafl_libfuzzer_runtime/build.ps1 index 12400f03bf4..27c4108efc2 100644 --- a/libafl_libfuzzer_runtime/build.ps1 +++ b/crates/libafl_libfuzzer_runtime/build.ps1 @@ -1,46 +1,46 @@ -#!/usr/bin/env pwsh - -$ErrorActionPreference = "Stop" - -$SCRIPT_DIR = Split-Path -Parent $MyInvocation.MyCommand.Path - -Set-Location $SCRIPT_DIR - -if ($args.Count -eq 0) { - $profile = "release" -} else { - $profile = $args[0] -} - -Write-Host "Building libafl_libfuzzer runtime with profile '$profile'" -ForegroundColor Green -Invoke-Expression "cargo build --profile $profile" - -$tmpdir = Join-Path $env:TEMP ([System.IO.Path]::GetRandomFileName()) -New-Item -ItemType Directory -Path $tmpdir | Out-Null - -function Cleanup { - if (Test-Path $tmpdir) { - Remove-Item -Recurse -Force $tmpdir - } -} - -try { - if ($profile -eq "dev") { - # Set the profile to debug for dev builds, because the path isn't the same - # as the profile name - $profile = "debug" - } - - $targetPath = Join-Path $SCRIPT_DIR "target\$profile\afl_libfuzzer_runtime.lib" - $outputPath = Join-Path $SCRIPT_DIR "libFuzzer.lib" - - Copy-Item -Path $targetPath -Destination $outputPath -Force | Out-Null - - if ($LASTEXITCODE -ne 0) { - throw "Failed to copy final library" - } - - Write-Host "Done! Wrote the runtime to '$outputPath'" -ForegroundColor Green -} finally { - Cleanup +#!/usr/bin/env pwsh + +$ErrorActionPreference = "Stop" + +$SCRIPT_DIR = Split-Path -Parent $MyInvocation.MyCommand.Path + +Set-Location $SCRIPT_DIR + +if ($args.Count -eq 0) { + $profile = "release" +} else { + $profile = $args[0] +} + +Write-Host "Building libafl_libfuzzer runtime with profile '$profile'" -ForegroundColor Green +Invoke-Expression "cargo build --profile $profile" + +$tmpdir = Join-Path $env:TEMP ([System.IO.Path]::GetRandomFileName()) +New-Item -ItemType Directory -Path $tmpdir | Out-Null + +function Cleanup { + if (Test-Path $tmpdir) { + Remove-Item -Recurse -Force $tmpdir + } +} + +try { + if ($profile -eq "dev") { + # Set the profile to debug for dev builds, because the path isn't the same + # as the profile name + $profile = "debug" + } + + $targetPath = Join-Path $SCRIPT_DIR "target\$profile\afl_libfuzzer_runtime.lib" + $outputPath = Join-Path $SCRIPT_DIR "libFuzzer.lib" + + Copy-Item -Path $targetPath -Destination $outputPath -Force | Out-Null + + if ($LASTEXITCODE -ne 0) { + throw "Failed to copy final library" + } + + Write-Host "Done! Wrote the runtime to '$outputPath'" -ForegroundColor Green +} finally { + Cleanup } \ No newline at end of file diff --git a/libafl_libfuzzer_runtime/build.rs b/crates/libafl_libfuzzer_runtime/build.rs similarity index 100% rename from libafl_libfuzzer_runtime/build.rs rename to crates/libafl_libfuzzer_runtime/build.rs diff --git a/libafl_libfuzzer_runtime/build.sh b/crates/libafl_libfuzzer_runtime/build.sh similarity index 100% rename from libafl_libfuzzer_runtime/build.sh rename to crates/libafl_libfuzzer_runtime/build.sh diff --git a/libafl_libfuzzer_runtime/src b/crates/libafl_libfuzzer_runtime/src similarity index 100% rename from libafl_libfuzzer_runtime/src rename to crates/libafl_libfuzzer_runtime/src diff --git a/libafl_nyx/.clang-format b/crates/libafl_nyx/.clang-format similarity index 100% rename from libafl_nyx/.clang-format rename to crates/libafl_nyx/.clang-format diff --git a/libafl_nyx/Cargo.toml b/crates/libafl_nyx/Cargo.toml similarity index 97% rename from libafl_nyx/Cargo.toml rename to crates/libafl_nyx/Cargo.toml index 38187838d0c..ba793322f44 100644 --- a/libafl_nyx/Cargo.toml +++ b/crates/libafl_nyx/Cargo.toml @@ -6,7 +6,7 @@ authors = ["syheliel "] description = "libafl using nyx, only avaliable on linux" documentation = "https://docs.rs/libafl_nyx" repository = "https://github.com/AFLplusplus/LibAFL/" -readme = "../README.md" +readme = "../../README.md" license = "MIT OR Apache-2.0" keywords = ["fuzzing", "testing", "security"] categories = [ diff --git a/libafl_nyx/Makefile.libxdc b/crates/libafl_nyx/Makefile.libxdc similarity index 100% rename from libafl_nyx/Makefile.libxdc rename to crates/libafl_nyx/Makefile.libxdc diff --git a/libafl_nyx/README.md b/crates/libafl_nyx/README.md similarity index 94% rename from libafl_nyx/README.md rename to crates/libafl_nyx/README.md index 0d954a76e6a..0846050059b 100644 --- a/libafl_nyx/README.md +++ b/crates/libafl_nyx/README.md @@ -1,6 +1,8 @@ +# LibAFL Nyx + `libafl_nyx` is the `libafl`'s front-end for the [nyx fuzzing framework](https://github.com/nyx-fuzz), which facilitates fuzzing in virtual machines such as qemu. This crate provides both the standalone mode and parallel mode: - In standalone mode, no VM snapshot is serialized and stored in the working directory. That might be useful if you really want to run the fuzzer with only one process (meaning one VM). - In parallel mode, the first fuzzer process (parent) has to create the VM snapshot while all other child processes will wait for the snapshot files to appear in the working directory. -In order to use this crate, you need to specify the shared directory and mode in `NyxHelper`, then use `NyxExecutor`. For more details, please see `./fuzzers/nyx_libxml2_standalone` and `./fuzzers/nyx_libxml2_parallel`. \ No newline at end of file +In order to use this crate, you need to specify the shared directory and mode in `NyxHelper`, then use `NyxExecutor`. For more details, please see `./fuzzers/nyx_libxml2_standalone` and `./fuzzers/nyx_libxml2_parallel`. diff --git a/libafl_nyx/build.rs b/crates/libafl_nyx/build.rs similarity index 100% rename from libafl_nyx/build.rs rename to crates/libafl_nyx/build.rs diff --git a/libafl_nyx/build_nyx_support.sh b/crates/libafl_nyx/build_nyx_support.sh similarity index 100% rename from libafl_nyx/build_nyx_support.sh rename to crates/libafl_nyx/build_nyx_support.sh diff --git a/libafl_nyx/src/cmplog.rs b/crates/libafl_nyx/src/cmplog.rs similarity index 100% rename from libafl_nyx/src/cmplog.rs rename to crates/libafl_nyx/src/cmplog.rs diff --git a/libafl_nyx/src/executor.rs b/crates/libafl_nyx/src/executor.rs similarity index 100% rename from libafl_nyx/src/executor.rs rename to crates/libafl_nyx/src/executor.rs diff --git a/libafl_nyx/src/helper.rs b/crates/libafl_nyx/src/helper.rs similarity index 100% rename from libafl_nyx/src/helper.rs rename to crates/libafl_nyx/src/helper.rs diff --git a/libafl_nyx/src/lib.rs b/crates/libafl_nyx/src/lib.rs similarity index 100% rename from libafl_nyx/src/lib.rs rename to crates/libafl_nyx/src/lib.rs diff --git a/libafl_nyx/src/settings.rs b/crates/libafl_nyx/src/settings.rs similarity index 100% rename from libafl_nyx/src/settings.rs rename to crates/libafl_nyx/src/settings.rs diff --git a/libafl_qemu/Cargo.toml b/crates/libafl_qemu/Cargo.toml similarity index 99% rename from libafl_qemu/Cargo.toml rename to crates/libafl_qemu/Cargo.toml index e764806b604..69bb25bbecd 100644 --- a/libafl_qemu/Cargo.toml +++ b/crates/libafl_qemu/Cargo.toml @@ -8,7 +8,7 @@ authors = [ description = "QEMU user backend library for LibAFL" documentation = "https://docs.rs/libafl_qemu" repository = "https://github.com/AFLplusplus/LibAFL/" -readme = "../README.md" +readme = "../../README.md" license = "MIT OR Apache-2.0" keywords = ["fuzzing", "qemu", "instrumentation"] edition = "2024" diff --git a/libafl_qemu/README.md b/crates/libafl_qemu/README.md similarity index 99% rename from libafl_qemu/README.md rename to crates/libafl_qemu/README.md index ff4b4eb4ac2..64261366ecf 100644 --- a/libafl_qemu/README.md +++ b/crates/libafl_qemu/README.md @@ -20,5 +20,3 @@ If you use LibAFL QEMU for your academic work, consider citing the follwing pape keywords = {fuzzing, emulation}, } ``` - - diff --git a/libafl_qemu/build.rs b/crates/libafl_qemu/build.rs similarity index 100% rename from libafl_qemu/build.rs rename to crates/libafl_qemu/build.rs diff --git a/libafl_qemu/build_linux.rs b/crates/libafl_qemu/build_linux.rs similarity index 100% rename from libafl_qemu/build_linux.rs rename to crates/libafl_qemu/build_linux.rs diff --git a/libafl_qemu/libafl_qemu_asan/.gitignore b/crates/libafl_qemu/libafl_qemu_asan/.gitignore similarity index 100% rename from libafl_qemu/libafl_qemu_asan/.gitignore rename to crates/libafl_qemu/libafl_qemu_asan/.gitignore diff --git a/libafl_qemu/libafl_qemu_asan/Cargo.toml b/crates/libafl_qemu/libafl_qemu_asan/Cargo.toml similarity index 100% rename from libafl_qemu/libafl_qemu_asan/Cargo.toml rename to crates/libafl_qemu/libafl_qemu_asan/Cargo.toml diff --git a/libafl_qemu/libafl_qemu_asan/Justfile b/crates/libafl_qemu/libafl_qemu_asan/Justfile similarity index 97% rename from libafl_qemu/libafl_qemu_asan/Justfile rename to crates/libafl_qemu/libafl_qemu_asan/Justfile index a05ce9284c8..45826ba171f 100644 --- a/libafl_qemu/libafl_qemu_asan/Justfile +++ b/crates/libafl_qemu/libafl_qemu_asan/Justfile @@ -1,4 +1,4 @@ -import "../../just/libafl-qemu.just" +import "../../../just/libafl-qemu.just" import "libafl_qemu_asan_guest/Justfile" import "libafl_qemu_asan_host/Justfile" import "libafl_qemu_asan_nolibc/Justfile" diff --git a/libafl_qemu/libafl_qemu_asan/README.md b/crates/libafl_qemu/libafl_qemu_asan/README.md similarity index 99% rename from libafl_qemu/libafl_qemu_asan/README.md rename to crates/libafl_qemu/libafl_qemu_asan/README.md index 1cfd18e5b3e..64cf6aef145 100644 --- a/libafl_qemu/libafl_qemu_asan/README.md +++ b/crates/libafl_qemu/libafl_qemu_asan/README.md @@ -1,4 +1,5 @@ # libafl_qemu_asan + `libafl_qemu_asan` is a library intended to be used by a guest running in QEMU to support address sanitizer. @@ -21,6 +22,7 @@ adapt `libafl_qemu_asan` to their needs with minimal modification by selecting and combining alternative implementations of the various key components. ## Features + - `dlmalloc` - Enable support for the dlmalloc allocator backend. - `guest` - Enable support for shadow memory and tracking in the guest - `host` - Enable support for shadow memory and tracking in the host @@ -31,9 +33,11 @@ host interaction using `rustix`. - `std` - Disable the magic used to support `no_std` environments ## Testing + This project makes use of a number of unit and integration tests to validate the implementation. ## Fuzzing + The project also includes a couple of fuzzing harnesses supported by `cargo-fuzz` in order to supplement unit and integration tests. diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/Cargo.toml b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/Cargo.toml similarity index 100% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/Cargo.toml rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/Cargo.toml diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/Justfile b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/Justfile similarity index 98% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/Justfile rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/Justfile index 3e3d7b37031..dda17d02f43 100644 --- a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/Justfile +++ b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/Justfile @@ -1,4 +1,4 @@ -import "../../../just/libafl-qemu.just" +import "../../../../just/libafl-qemu.just" import "../../../libafl_asan/libafl_asan_libc/Justfile" import "../../../libafl_asan/fuzzer_name.just" diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/guest.map b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/guest.map similarity index 100% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/guest.map rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/guest.map diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/rename_patch.syms b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/rename_patch.syms similarity index 100% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/rename_patch.syms rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/rename_patch.syms diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/rename_real.syms b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/rename_real.syms similarity index 100% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/rename_real.syms rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/rename_real.syms diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/src/lib.rs b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/src/lib.rs similarity index 100% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/src/lib.rs rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest/src/lib.rs diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/Cargo.toml b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/Cargo.toml similarity index 100% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/Cargo.toml rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/Cargo.toml diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/Justfile b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/Justfile similarity index 98% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/Justfile rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/Justfile index a785019cb60..4178401ad4a 100644 --- a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/Justfile +++ b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/Justfile @@ -1,4 +1,4 @@ -import "../../../just/libafl-qemu.just" +import "../../../../just/libafl-qemu.just" import "../../../libafl_asan/libafl_asan_libc/Justfile" import "../../../libafl_asan/fuzzer_name.just" diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/host.map b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/host.map similarity index 100% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/host.map rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/host.map diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/rename_patch.syms b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/rename_patch.syms similarity index 100% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/rename_patch.syms rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/rename_patch.syms diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/rename_real.syms b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/rename_real.syms similarity index 100% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/rename_real.syms rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/rename_real.syms diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/src/lib.rs b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/src/lib.rs similarity index 100% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/src/lib.rs rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host/src/lib.rs diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/Cargo.toml b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/Cargo.toml similarity index 100% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/Cargo.toml rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/Cargo.toml diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/Justfile b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/Justfile similarity index 98% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/Justfile rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/Justfile index bffc700ccb5..f11db3b6578 100644 --- a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/Justfile +++ b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/Justfile @@ -1,4 +1,4 @@ -import "../../../just/libafl-qemu.just" +import "../../../../just/libafl-qemu.just" import "../../../libafl_asan/fuzzer_name.just" NOLIBC_SOURCE_DIR := source_directory() diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/nolibc.map b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/nolibc.map similarity index 100% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/nolibc.map rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/nolibc.map diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/rename_patch.syms b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/rename_patch.syms similarity index 100% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/rename_patch.syms rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/rename_patch.syms diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/rename_real.syms b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/rename_real.syms similarity index 100% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/rename_real.syms rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/rename_real.syms diff --git a/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/src/lib.rs b/crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/src/lib.rs similarity index 100% rename from libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/src/lib.rs rename to crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc/src/lib.rs diff --git a/libafl_qemu/libafl_qemu_build/Cargo.toml b/crates/libafl_qemu/libafl_qemu_build/Cargo.toml similarity index 100% rename from libafl_qemu/libafl_qemu_build/Cargo.toml rename to crates/libafl_qemu/libafl_qemu_build/Cargo.toml diff --git a/libafl_qemu/libafl_qemu_build/README.md b/crates/libafl_qemu/libafl_qemu_build/README.md similarity index 100% rename from libafl_qemu/libafl_qemu_build/README.md rename to crates/libafl_qemu/libafl_qemu_build/README.md diff --git a/libafl_qemu/libafl_qemu_build/src/bindings.rs b/crates/libafl_qemu/libafl_qemu_build/src/bindings.rs similarity index 100% rename from libafl_qemu/libafl_qemu_build/src/bindings.rs rename to crates/libafl_qemu/libafl_qemu_build/src/bindings.rs diff --git a/libafl_qemu/libafl_qemu_build/src/build.rs b/crates/libafl_qemu/libafl_qemu_build/src/build.rs similarity index 100% rename from libafl_qemu/libafl_qemu_build/src/build.rs rename to crates/libafl_qemu/libafl_qemu_build/src/build.rs diff --git a/libafl_qemu/libafl_qemu_build/src/lib.rs b/crates/libafl_qemu/libafl_qemu_build/src/lib.rs similarity index 100% rename from libafl_qemu/libafl_qemu_build/src/lib.rs rename to crates/libafl_qemu/libafl_qemu_build/src/lib.rs diff --git a/libafl_qemu/libafl_qemu_runner/Cargo.toml b/crates/libafl_qemu/libafl_qemu_runner/Cargo.toml similarity index 100% rename from libafl_qemu/libafl_qemu_runner/Cargo.toml rename to crates/libafl_qemu/libafl_qemu_runner/Cargo.toml diff --git a/libafl_qemu/libafl_qemu_runner/Justfile b/crates/libafl_qemu/libafl_qemu_runner/Justfile similarity index 95% rename from libafl_qemu/libafl_qemu_runner/Justfile rename to crates/libafl_qemu/libafl_qemu_runner/Justfile index b95f159a004..7e4801ee69f 100644 --- a/libafl_qemu/libafl_qemu_runner/Justfile +++ b/crates/libafl_qemu/libafl_qemu_runner/Justfile @@ -1,4 +1,4 @@ -import "../../just/libafl-qemu.just" +import "../../../just/libafl-qemu.just" import "../../libafl_asan/fuzzer_name.just" [unix] diff --git a/libafl_qemu/libafl_qemu_runner/build.rs b/crates/libafl_qemu/libafl_qemu_runner/build.rs similarity index 100% rename from libafl_qemu/libafl_qemu_runner/build.rs rename to crates/libafl_qemu/libafl_qemu_runner/build.rs diff --git a/libafl_qemu/libafl_qemu_runner/src/aarch64.rs b/crates/libafl_qemu/libafl_qemu_runner/src/aarch64.rs similarity index 100% rename from libafl_qemu/libafl_qemu_runner/src/aarch64.rs rename to crates/libafl_qemu/libafl_qemu_runner/src/aarch64.rs diff --git a/libafl_qemu/libafl_qemu_runner/src/arm.rs b/crates/libafl_qemu/libafl_qemu_runner/src/arm.rs similarity index 100% rename from libafl_qemu/libafl_qemu_runner/src/arm.rs rename to crates/libafl_qemu/libafl_qemu_runner/src/arm.rs diff --git a/libafl_qemu/libafl_qemu_runner/src/fuzz.rs b/crates/libafl_qemu/libafl_qemu_runner/src/fuzz.rs similarity index 100% rename from libafl_qemu/libafl_qemu_runner/src/fuzz.rs rename to crates/libafl_qemu/libafl_qemu_runner/src/fuzz.rs diff --git a/libafl_qemu/libafl_qemu_runner/src/i386.rs b/crates/libafl_qemu/libafl_qemu_runner/src/i386.rs similarity index 100% rename from libafl_qemu/libafl_qemu_runner/src/i386.rs rename to crates/libafl_qemu/libafl_qemu_runner/src/i386.rs diff --git a/libafl_qemu/libafl_qemu_runner/src/ppc.rs b/crates/libafl_qemu/libafl_qemu_runner/src/ppc.rs similarity index 100% rename from libafl_qemu/libafl_qemu_runner/src/ppc.rs rename to crates/libafl_qemu/libafl_qemu_runner/src/ppc.rs diff --git a/libafl_qemu/libafl_qemu_runner/src/x86_64.rs b/crates/libafl_qemu/libafl_qemu_runner/src/x86_64.rs similarity index 100% rename from libafl_qemu/libafl_qemu_runner/src/x86_64.rs rename to crates/libafl_qemu/libafl_qemu_runner/src/x86_64.rs diff --git a/libafl_qemu/libafl_qemu_sys/Cargo.toml b/crates/libafl_qemu/libafl_qemu_sys/Cargo.toml similarity index 98% rename from libafl_qemu/libafl_qemu_sys/Cargo.toml rename to crates/libafl_qemu/libafl_qemu_sys/Cargo.toml index 77167265e00..3d22eed5bcc 100644 --- a/libafl_qemu/libafl_qemu_sys/Cargo.toml +++ b/crates/libafl_qemu/libafl_qemu_sys/Cargo.toml @@ -8,7 +8,7 @@ authors = [ description = "C to Rust bindings for the LibAFL QEMU bridge" documentation = "https://docs.rs/libafl_qemu_sys" repository = "https://github.com/AFLplusplus/LibAFL/" -readme = "../../README.md" +readme = "../../../README.md" license = "MIT OR Apache-2.0" keywords = ["fuzzing", "qemu", "instrumentation"] edition = "2024" diff --git a/libafl_qemu/libafl_qemu_sys/build.rs b/crates/libafl_qemu/libafl_qemu_sys/build.rs similarity index 100% rename from libafl_qemu/libafl_qemu_sys/build.rs rename to crates/libafl_qemu/libafl_qemu_sys/build.rs diff --git a/libafl_qemu/libafl_qemu_sys/build_linux.rs b/crates/libafl_qemu/libafl_qemu_sys/build_linux.rs similarity index 100% rename from libafl_qemu/libafl_qemu_sys/build_linux.rs rename to crates/libafl_qemu/libafl_qemu_sys/build_linux.rs diff --git a/libafl_qemu/libafl_qemu_sys/src/bindings/mod.rs b/crates/libafl_qemu/libafl_qemu_sys/src/bindings/mod.rs similarity index 100% rename from libafl_qemu/libafl_qemu_sys/src/bindings/mod.rs rename to crates/libafl_qemu/libafl_qemu_sys/src/bindings/mod.rs diff --git a/libafl_qemu/libafl_qemu_sys/src/bindings/x86_64_stub_bindings.rs b/crates/libafl_qemu/libafl_qemu_sys/src/bindings/x86_64_stub_bindings.rs similarity index 100% rename from libafl_qemu/libafl_qemu_sys/src/bindings/x86_64_stub_bindings.rs rename to crates/libafl_qemu/libafl_qemu_sys/src/bindings/x86_64_stub_bindings.rs diff --git a/libafl_qemu/libafl_qemu_sys/src/lib.rs b/crates/libafl_qemu/libafl_qemu_sys/src/lib.rs similarity index 100% rename from libafl_qemu/libafl_qemu_sys/src/lib.rs rename to crates/libafl_qemu/libafl_qemu_sys/src/lib.rs diff --git a/libafl_qemu/libafl_qemu_sys/src/systemmode.rs b/crates/libafl_qemu/libafl_qemu_sys/src/systemmode.rs similarity index 100% rename from libafl_qemu/libafl_qemu_sys/src/systemmode.rs rename to crates/libafl_qemu/libafl_qemu_sys/src/systemmode.rs diff --git a/libafl_qemu/libafl_qemu_sys/src/usermode.rs b/crates/libafl_qemu/libafl_qemu_sys/src/usermode.rs similarity index 100% rename from libafl_qemu/libafl_qemu_sys/src/usermode.rs rename to crates/libafl_qemu/libafl_qemu_sys/src/usermode.rs diff --git a/libafl_qemu/libqasan/Makefile b/crates/libafl_qemu/libqasan/Makefile similarity index 100% rename from libafl_qemu/libqasan/Makefile rename to crates/libafl_qemu/libqasan/Makefile diff --git a/libafl_qemu/libqasan/README.md b/crates/libafl_qemu/libqasan/README.md similarity index 100% rename from libafl_qemu/libqasan/README.md rename to crates/libafl_qemu/libqasan/README.md diff --git a/libafl_qemu/libqasan/dlmalloc.c b/crates/libafl_qemu/libqasan/dlmalloc.c similarity index 100% rename from libafl_qemu/libqasan/dlmalloc.c rename to crates/libafl_qemu/libqasan/dlmalloc.c diff --git a/libafl_qemu/libqasan/hooks.c b/crates/libafl_qemu/libqasan/hooks.c similarity index 100% rename from libafl_qemu/libqasan/hooks.c rename to crates/libafl_qemu/libqasan/hooks.c diff --git a/libafl_qemu/libqasan/libqasan.c b/crates/libafl_qemu/libqasan/libqasan.c similarity index 100% rename from libafl_qemu/libqasan/libqasan.c rename to crates/libafl_qemu/libqasan/libqasan.c diff --git a/libafl_qemu/libqasan/libqasan.h b/crates/libafl_qemu/libqasan/libqasan.h similarity index 100% rename from libafl_qemu/libqasan/libqasan.h rename to crates/libafl_qemu/libqasan/libqasan.h diff --git a/libafl_qemu/libqasan/malloc.c b/crates/libafl_qemu/libqasan/malloc.c similarity index 100% rename from libafl_qemu/libqasan/malloc.c rename to crates/libafl_qemu/libqasan/malloc.c diff --git a/libafl_qemu/libqasan/map_macro.h b/crates/libafl_qemu/libqasan/map_macro.h similarity index 100% rename from libafl_qemu/libqasan/map_macro.h rename to crates/libafl_qemu/libqasan/map_macro.h diff --git a/libafl_qemu/libqasan/mmap.c b/crates/libafl_qemu/libqasan/mmap.c similarity index 100% rename from libafl_qemu/libqasan/mmap.c rename to crates/libafl_qemu/libqasan/mmap.c diff --git a/libafl_qemu/libqasan/patch.c b/crates/libafl_qemu/libqasan/patch.c similarity index 100% rename from libafl_qemu/libqasan/patch.c rename to crates/libafl_qemu/libqasan/patch.c diff --git a/libafl_qemu/libqasan/printf/.gitattributes b/crates/libafl_qemu/libqasan/printf/.gitattributes similarity index 95% rename from libafl_qemu/libqasan/printf/.gitattributes rename to crates/libafl_qemu/libqasan/printf/.gitattributes index 6d4472862e4..eef9aef0ef2 100644 --- a/libafl_qemu/libqasan/printf/.gitattributes +++ b/crates/libafl_qemu/libqasan/printf/.gitattributes @@ -1,2 +1,2 @@ -# ignore test path -test/* linguist-vendored +# ignore test path +test/* linguist-vendored diff --git a/libafl_qemu/libqasan/printf/.travis.yml b/crates/libafl_qemu/libqasan/printf/.travis.yml similarity index 95% rename from libafl_qemu/libqasan/printf/.travis.yml rename to crates/libafl_qemu/libqasan/printf/.travis.yml index 7cff9cff6b1..f86e4449363 100644 --- a/libafl_qemu/libqasan/printf/.travis.yml +++ b/crates/libafl_qemu/libqasan/printf/.travis.yml @@ -1,63 +1,63 @@ -# Use a C++11 distro -dist: trusty -sudo: required - -# Enable C++ support -language: cpp - -# Compiler selection -compiler: gcc - -env: - global: - # coverity key - - secure: "NKZbBnMALGIIQJy/s2kc3EST/stw+gjhtrGq0jkbsWr7Wx3FH+lmLeHNsDXRnD1VbpG02c5YsLllqz9OVu+0yxWGepvKNmCz1cNITIALEHbrax8/Af9LzPRL/QZxS/Qe11sMuySp4X16mFBUyxMd/X+I9i96Xf1vKkZABklYD1Q=" - -# addons -addons: - apt: - packages: - - gcc-6 - - g++-6 - sources: - - ubuntu-toolchain-r-test - - coverity_scan: - project: - name: "mpaland/printf" - description: "Tiny printf implementation" - notification_email: marco@paland.com - build_command_prepend: "make clean" - build_command: "make" - branch_pattern: master - -before_install: - # connect coverity - - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- - -# Active branches -branches: - only: - - master - -script: - # Link gcc-6 and g++-6 to their standard commands - - sudo rm /usr/bin/gcc - - sudo rm /usr/bin/g++ - - sudo ln -s /usr/bin/gcc-6 /usr/bin/gcc - - sudo ln -s /usr/bin/g++-6 /usr/bin/g++ - # Export CC and CXX - - export CC=/usr/bin/gcc-6 - - export CXX=/usr/bin/g++-6 - # Check versions of gcc, g++ - - gcc -v && g++ -v - # Run build commands - - make - # execute the text suite - - bin/test_suite -d yes - # coverall profiling - - tmp/cov/test_suite - -after_success: - ## Report to codecov - - bash <(curl -s https://codecov.io/bash) +# Use a C++11 distro +dist: trusty +sudo: required + +# Enable C++ support +language: cpp + +# Compiler selection +compiler: gcc + +env: + global: + # coverity key + - secure: "NKZbBnMALGIIQJy/s2kc3EST/stw+gjhtrGq0jkbsWr7Wx3FH+lmLeHNsDXRnD1VbpG02c5YsLllqz9OVu+0yxWGepvKNmCz1cNITIALEHbrax8/Af9LzPRL/QZxS/Qe11sMuySp4X16mFBUyxMd/X+I9i96Xf1vKkZABklYD1Q=" + +# addons +addons: + apt: + packages: + - gcc-6 + - g++-6 + sources: + - ubuntu-toolchain-r-test + + coverity_scan: + project: + name: "mpaland/printf" + description: "Tiny printf implementation" + notification_email: marco@paland.com + build_command_prepend: "make clean" + build_command: "make" + branch_pattern: master + +before_install: + # connect coverity + - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- + +# Active branches +branches: + only: + - master + +script: + # Link gcc-6 and g++-6 to their standard commands + - sudo rm /usr/bin/gcc + - sudo rm /usr/bin/g++ + - sudo ln -s /usr/bin/gcc-6 /usr/bin/gcc + - sudo ln -s /usr/bin/g++-6 /usr/bin/g++ + # Export CC and CXX + - export CC=/usr/bin/gcc-6 + - export CXX=/usr/bin/g++-6 + # Check versions of gcc, g++ + - gcc -v && g++ -v + # Run build commands + - make + # execute the text suite + - bin/test_suite -d yes + # coverall profiling + - tmp/cov/test_suite + +after_success: + ## Report to codecov + - bash <(curl -s https://codecov.io/bash) diff --git a/libafl_qemu/libqasan/printf/LICENSE b/crates/libafl_qemu/libqasan/printf/LICENSE similarity index 100% rename from libafl_qemu/libqasan/printf/LICENSE rename to crates/libafl_qemu/libqasan/printf/LICENSE diff --git a/libafl_qemu/libqasan/printf/Makefile b/crates/libafl_qemu/libqasan/printf/Makefile similarity index 97% rename from libafl_qemu/libqasan/printf/Makefile rename to crates/libafl_qemu/libqasan/printf/Makefile index 7b28a1a1a2d..9dba1f0b43b 100644 --- a/libafl_qemu/libqasan/printf/Makefile +++ b/crates/libafl_qemu/libqasan/printf/Makefile @@ -1,271 +1,271 @@ -# ------------------------------------------------------------------------------ -# -# Generic Makefile -# -# Copyright Marco Paland 2007 - 2017 -# Distributed under the MIT License -# -# ------------------------------------------------------------------------------ - -# ------------------------------------------------------------------------------ -# Paths -# ------------------------------------------------------------------------------ -PATH_TOOLS_CC = /usr/bin/ -PATH_TOOLS_CC_LIB = /usr/lib/ -PATH_TOOLS_UTIL = - -PATH_BIN = bin -PATH_TMP = tmp -PATH_NUL = /dev/null -PATH_OBJ = $(PATH_TMP)/obj -PATH_LST = $(PATH_TMP)/lst -PATH_ERR = $(PATH_TMP)/err -PATH_PRE = $(PATH_TMP)/pre -PATH_COV = $(PATH_TMP)/cov - - -# ------------------------------------------------------------------------------ -# Application to build -# ------------------------------------------------------------------------------ - -APP = test_suite - - -# ----------------------------------------------------------------------------- -# Project file list -# Format is: -# FILES_PRJ = file1 \ -# foo/file2 \ -# bar/file3 -# ----------------------------------------------------------------------------- - -FILES_PRJ = test/test_suite - - -# ------------------------------------------------------------------------------ -# Additional include files and compiler defines -# Format is: -# C_INCLUDES = -Iinclude_path1 \ -# -Iinclude_path2 \ -# -Iinclude_path3 \ -# ------------------------------------------------------------------------------ - -C_INCLUDES = - -C_DEFINES = - - -# ------------------------------------------------------------------------------ -# The target name and location -# ------------------------------------------------------------------------------ -TRG = $(PATH_BIN)/$(APP) - - -# ------------------------------------------------------------------------------ -# object files -# ------------------------------------------------------------------------------ -FILES_TMP = $(FILES_PRJ) -FILES_O = $(addsuffix .o, $(FILES_TMP)) - - -# ------------------------------------------------------------------------------ -# VPATH definition -# -# VPATH is required for the maker to find the C-/ASM-Source files. -# Extract the directory/module names from the file list with the dir -# command and remove the duplicated directory names with the sort command. -# FILES_PRJ is listed first to make sure that the source files in the project -# directory are searched first. -# ------------------------------------------------------------------------------ -VPATH := $(sort $(dir $(FILES_TMP))) - - -# ------------------------------------------------------------------------------ -# Development tools -# ------------------------------------------------------------------------------ -AR = $(PATH_TOOLS_CC)ar -AS = $(PATH_TOOLS_CC)g++ -CC = $(PATH_TOOLS_CC)g++ -CL = $(PATH_TOOLS_CC)g++ -NM = $(PATH_TOOLS_CC)nm -GCOV = $(PATH_TOOLS_CC)gcov -OBJDUMP = $(PATH_TOOLS_CC)objdump -OBJCOPY = $(PATH_TOOLS_CC)objcopy -READELF = $(PATH_TOOLS_CC)readelf -SIZE = $(PATH_TOOLS_CC)size - -ECHO = $(PATH_TOOLS_UTIL)echo -MAKE = $(PATH_TOOLS_UTIL)make -MKDIR = $(PATH_TOOLS_UTIL)mkdir -RM = $(PATH_TOOLS_UTIL)rm -SED = $(PATH_TOOLS_UTIL)sed - - -# ------------------------------------------------------------------------------ -# Compiler flags for the target architecture -# ------------------------------------------------------------------------------ - -GCCFLAGS = $(C_INCLUDES) \ - $(C_DEFINES) \ - -std=c++11 \ - -g \ - -Wall \ - -pedantic \ - -Wmain \ - -Wundef \ - -Wsign-conversion \ - -Wuninitialized \ - -Wshadow \ - -Wunreachable-code \ - -Wswitch-default \ - -Wswitch \ - -Wcast-align \ - -Wmissing-include-dirs \ - -Winit-self \ - -Wdouble-promotion \ - -gdwarf-2 \ - -fno-exceptions \ - -O2 \ - -ffunction-sections \ - -ffat-lto-objects \ - -fdata-sections \ - -fverbose-asm \ - -Wextra \ - -Wunused-parameter \ - -Wfloat-equal - -CFLAGS = $(GCCFLAGS) \ - -Wunsuffixed-float-constants \ - -x c \ - -std=c99 - -CPPFLAGS = $(GCCFLAGS) \ - -x c++ \ - -fno-rtti \ - -fstrict-enums \ - -fno-use-cxa-atexit \ - -fno-use-cxa-get-exception-ptr \ - -fno-nonansi-builtins \ - -fno-threadsafe-statics \ - -fno-enforce-eh-specs \ - -ftemplate-depth-64 \ - -fexceptions - -AFLAGS = $(GCCFLAGS) \ - -x assembler - -LFLAGS = $(GCCFLAGS) \ - -x none \ - -Wl,--gc-sections - -# ------------------------------------------------------------------------------ -# Targets -# ------------------------------------------------------------------------------ - -# ------------------------------------------------------------------------------ -# Main-Dependencies (app: all) -# ------------------------------------------------------------------------------ -.PHONY: all -all: clean_prj $(TRG) $(TRG)_nm.txt - - -# ------------------------------------------------------------------------------ -# Main-Dependencies (app: rebuild) -# ------------------------------------------------------------------------------ -.PHONY: rebuild -rebuild: clean $(TRG) $(TRG)_nm.txt - - -# ------------------------------------------------------------------------------ -# clean project -# ------------------------------------------------------------------------------ -.PHONY: clean_prj -clean_prj: - @-$(ECHO) +++ cleaning project - @-$(RM) -rf $(PATH_BIN) 2> $(PATH_NUL) - @-$(MKDIR) -p $(PATH_BIN) - @-$(MKDIR) -p $(PATH_OBJ) - @-$(MKDIR) -p $(PATH_ERR) - @-$(MKDIR) -p $(PATH_LST) - @-$(MKDIR) -p $(PATH_PRE) - @-$(MKDIR) -p $(PATH_COV) - - -# ------------------------------------------------------------------------------ -# clean all -# ------------------------------------------------------------------------------ -.PHONY: clean -clean: - @-$(ECHO) +++ cleaning all - @-$(RM) -rf $(PATH_BIN) 2> $(PATH_NUL) - @-$(RM) -rf $(PATH_TMP) 2> $(PATH_NUL) - @-$(MKDIR) -p $(PATH_BIN) - @-$(MKDIR) -p $(PATH_OBJ) - @-$(MKDIR) -p $(PATH_ERR) - @-$(MKDIR) -p $(PATH_LST) - @-$(MKDIR) -p $(PATH_COV) - - -# ------------------------------------------------------------------------------ -# print the GNUmake version and the compiler version -# ------------------------------------------------------------------------------ -.PHONY: version -version: - # Print the GNU make version and the compiler version - @$(ECHO) GNUmake version: - @$(MAKE) --version - @$(ECHO) GCC version: - @$(CL) -v - - -# ------------------------------------------------------------------------------ -# Rules -# ------------------------------------------------------------------------------ - -# ------------------------------------------------------------------------------ -# Link/locate application -# ------------------------------------------------------------------------------ -$(TRG) : $(FILES_O) - @-$(ECHO) +++ linkink application to generate: $(TRG) - @-$(CL) $(LFLAGS) -L. -lc $(PATH_OBJ)/*.o -Wl,-Map,$(TRG).map -o $(TRG) - # profiling - @-$(CL) $(LFLAGS) -L. -lc $(PATH_COV)/*.o --coverage -o $(PATH_COV)/$(APP) - - -# ------------------------------------------------------------------------------ -# parse the object files to obtain symbol information, and create a size summary -# ------------------------------------------------------------------------------ -$(TRG)_nm.txt : $(TRG) - @-$(ECHO) +++ parsing symbols with nm to generate: $(TRG)_nm.txt - @-$(NM) --numeric-sort --print-size $(TRG) > $(TRG)_nm.txt - @-$(ECHO) +++ demangling symbols with c++filt to generate: $(TRG)_cppfilt.txt - @-$(NM) --numeric-sort --print-size $(TRG) | $(CPPFILT) > $(TRG)_cppfilt.txt - @-$(ECHO) +++ creating size summary table with size to generate: $(TRG)_size.txt - @-$(SIZE) -A -t $(TRG) > $(TRG)_size.txt - - -%.o : %.cpp - @$(ECHO) +++ compile: $< - # Compile the source file - # ...and Reformat (using sed) any possible error/warning messages for the VisualStudio(R) output window - # ...and Create an assembly listing using objdump - # ...and Generate a dependency file (using the -MM flag) - @-$(CL) $(CPPFLAGS) $< -E -o $(PATH_PRE)/$(basename $(@F)).pre - @-$(CL) $(CPPFLAGS) $< -c -o $(PATH_OBJ)/$(basename $(@F)).o 2> $(PATH_ERR)/$(basename $(@F)).err - @-$(SED) -e 's|.h:\([0-9]*\),|.h(\1) :|' -e 's|:\([0-9]*\):|(\1) :|' $(PATH_ERR)/$(basename $(@F)).err - @-$(OBJDUMP) --disassemble --line-numbers -S $(PATH_OBJ)/$(basename $(@F)).o > $(PATH_LST)/$(basename $(@F)).lst - @-$(CL) $(CPPFLAGS) $< -MM > $(PATH_OBJ)/$(basename $(@F)).d - # profiling - @-$(CL) $(CPPFLAGS) -O0 --coverage $< -c -o $(PATH_COV)/$(basename $(@F)).o 2> $(PATH_NUL) - -%.o : %.c - @$(ECHO) +++ compile: $< - # Compile the source file - # ...and Reformat (using sed) any possible error/warning messages for the VisualStudio(R) output window - # ...and Create an assembly listing using objdump - # ...and Generate a dependency file (using the -MM flag) - @-$(CL) $(CFLAGS) $< -E -o $(PATH_PRE)/$(basename $(@F)).pre - @-$(CC) $(CFLAGS) $< -c -o $(PATH_OBJ)/$(basename $(@F)).o 2> $(PATH_ERR)/$(basename $(@F)).err - @-$(SED) -e 's|.h:\([0-9]*\),|.h(\1) :|' -e 's|:\([0-9]*\):|(\1) :|' $(PATH_ERR)/$(basename $(@F)).err - @-$(OBJDUMP) -S $(PATH_OBJ)/$(basename $(@F)).o > $(PATH_LST)/$(basename $(@F)).lst - @-$(CC) $(CFLAGS) $< -MM > $(PATH_OBJ)/$(basename $(@F)).d +# ------------------------------------------------------------------------------ +# +# Generic Makefile +# +# Copyright Marco Paland 2007 - 2017 +# Distributed under the MIT License +# +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# Paths +# ------------------------------------------------------------------------------ +PATH_TOOLS_CC = /usr/bin/ +PATH_TOOLS_CC_LIB = /usr/lib/ +PATH_TOOLS_UTIL = + +PATH_BIN = bin +PATH_TMP = tmp +PATH_NUL = /dev/null +PATH_OBJ = $(PATH_TMP)/obj +PATH_LST = $(PATH_TMP)/lst +PATH_ERR = $(PATH_TMP)/err +PATH_PRE = $(PATH_TMP)/pre +PATH_COV = $(PATH_TMP)/cov + + +# ------------------------------------------------------------------------------ +# Application to build +# ------------------------------------------------------------------------------ + +APP = test_suite + + +# ----------------------------------------------------------------------------- +# Project file list +# Format is: +# FILES_PRJ = file1 \ +# foo/file2 \ +# bar/file3 +# ----------------------------------------------------------------------------- + +FILES_PRJ = test/test_suite + + +# ------------------------------------------------------------------------------ +# Additional include files and compiler defines +# Format is: +# C_INCLUDES = -Iinclude_path1 \ +# -Iinclude_path2 \ +# -Iinclude_path3 \ +# ------------------------------------------------------------------------------ + +C_INCLUDES = + +C_DEFINES = + + +# ------------------------------------------------------------------------------ +# The target name and location +# ------------------------------------------------------------------------------ +TRG = $(PATH_BIN)/$(APP) + + +# ------------------------------------------------------------------------------ +# object files +# ------------------------------------------------------------------------------ +FILES_TMP = $(FILES_PRJ) +FILES_O = $(addsuffix .o, $(FILES_TMP)) + + +# ------------------------------------------------------------------------------ +# VPATH definition +# +# VPATH is required for the maker to find the C-/ASM-Source files. +# Extract the directory/module names from the file list with the dir +# command and remove the duplicated directory names with the sort command. +# FILES_PRJ is listed first to make sure that the source files in the project +# directory are searched first. +# ------------------------------------------------------------------------------ +VPATH := $(sort $(dir $(FILES_TMP))) + + +# ------------------------------------------------------------------------------ +# Development tools +# ------------------------------------------------------------------------------ +AR = $(PATH_TOOLS_CC)ar +AS = $(PATH_TOOLS_CC)g++ +CC = $(PATH_TOOLS_CC)g++ +CL = $(PATH_TOOLS_CC)g++ +NM = $(PATH_TOOLS_CC)nm +GCOV = $(PATH_TOOLS_CC)gcov +OBJDUMP = $(PATH_TOOLS_CC)objdump +OBJCOPY = $(PATH_TOOLS_CC)objcopy +READELF = $(PATH_TOOLS_CC)readelf +SIZE = $(PATH_TOOLS_CC)size + +ECHO = $(PATH_TOOLS_UTIL)echo +MAKE = $(PATH_TOOLS_UTIL)make +MKDIR = $(PATH_TOOLS_UTIL)mkdir +RM = $(PATH_TOOLS_UTIL)rm +SED = $(PATH_TOOLS_UTIL)sed + + +# ------------------------------------------------------------------------------ +# Compiler flags for the target architecture +# ------------------------------------------------------------------------------ + +GCCFLAGS = $(C_INCLUDES) \ + $(C_DEFINES) \ + -std=c++11 \ + -g \ + -Wall \ + -pedantic \ + -Wmain \ + -Wundef \ + -Wsign-conversion \ + -Wuninitialized \ + -Wshadow \ + -Wunreachable-code \ + -Wswitch-default \ + -Wswitch \ + -Wcast-align \ + -Wmissing-include-dirs \ + -Winit-self \ + -Wdouble-promotion \ + -gdwarf-2 \ + -fno-exceptions \ + -O2 \ + -ffunction-sections \ + -ffat-lto-objects \ + -fdata-sections \ + -fverbose-asm \ + -Wextra \ + -Wunused-parameter \ + -Wfloat-equal + +CFLAGS = $(GCCFLAGS) \ + -Wunsuffixed-float-constants \ + -x c \ + -std=c99 + +CPPFLAGS = $(GCCFLAGS) \ + -x c++ \ + -fno-rtti \ + -fstrict-enums \ + -fno-use-cxa-atexit \ + -fno-use-cxa-get-exception-ptr \ + -fno-nonansi-builtins \ + -fno-threadsafe-statics \ + -fno-enforce-eh-specs \ + -ftemplate-depth-64 \ + -fexceptions + +AFLAGS = $(GCCFLAGS) \ + -x assembler + +LFLAGS = $(GCCFLAGS) \ + -x none \ + -Wl,--gc-sections + +# ------------------------------------------------------------------------------ +# Targets +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# Main-Dependencies (app: all) +# ------------------------------------------------------------------------------ +.PHONY: all +all: clean_prj $(TRG) $(TRG)_nm.txt + + +# ------------------------------------------------------------------------------ +# Main-Dependencies (app: rebuild) +# ------------------------------------------------------------------------------ +.PHONY: rebuild +rebuild: clean $(TRG) $(TRG)_nm.txt + + +# ------------------------------------------------------------------------------ +# clean project +# ------------------------------------------------------------------------------ +.PHONY: clean_prj +clean_prj: + @-$(ECHO) +++ cleaning project + @-$(RM) -rf $(PATH_BIN) 2> $(PATH_NUL) + @-$(MKDIR) -p $(PATH_BIN) + @-$(MKDIR) -p $(PATH_OBJ) + @-$(MKDIR) -p $(PATH_ERR) + @-$(MKDIR) -p $(PATH_LST) + @-$(MKDIR) -p $(PATH_PRE) + @-$(MKDIR) -p $(PATH_COV) + + +# ------------------------------------------------------------------------------ +# clean all +# ------------------------------------------------------------------------------ +.PHONY: clean +clean: + @-$(ECHO) +++ cleaning all + @-$(RM) -rf $(PATH_BIN) 2> $(PATH_NUL) + @-$(RM) -rf $(PATH_TMP) 2> $(PATH_NUL) + @-$(MKDIR) -p $(PATH_BIN) + @-$(MKDIR) -p $(PATH_OBJ) + @-$(MKDIR) -p $(PATH_ERR) + @-$(MKDIR) -p $(PATH_LST) + @-$(MKDIR) -p $(PATH_COV) + + +# ------------------------------------------------------------------------------ +# print the GNUmake version and the compiler version +# ------------------------------------------------------------------------------ +.PHONY: version +version: + # Print the GNU make version and the compiler version + @$(ECHO) GNUmake version: + @$(MAKE) --version + @$(ECHO) GCC version: + @$(CL) -v + + +# ------------------------------------------------------------------------------ +# Rules +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# Link/locate application +# ------------------------------------------------------------------------------ +$(TRG) : $(FILES_O) + @-$(ECHO) +++ linkink application to generate: $(TRG) + @-$(CL) $(LFLAGS) -L. -lc $(PATH_OBJ)/*.o -Wl,-Map,$(TRG).map -o $(TRG) + # profiling + @-$(CL) $(LFLAGS) -L. -lc $(PATH_COV)/*.o --coverage -o $(PATH_COV)/$(APP) + + +# ------------------------------------------------------------------------------ +# parse the object files to obtain symbol information, and create a size summary +# ------------------------------------------------------------------------------ +$(TRG)_nm.txt : $(TRG) + @-$(ECHO) +++ parsing symbols with nm to generate: $(TRG)_nm.txt + @-$(NM) --numeric-sort --print-size $(TRG) > $(TRG)_nm.txt + @-$(ECHO) +++ demangling symbols with c++filt to generate: $(TRG)_cppfilt.txt + @-$(NM) --numeric-sort --print-size $(TRG) | $(CPPFILT) > $(TRG)_cppfilt.txt + @-$(ECHO) +++ creating size summary table with size to generate: $(TRG)_size.txt + @-$(SIZE) -A -t $(TRG) > $(TRG)_size.txt + + +%.o : %.cpp + @$(ECHO) +++ compile: $< + # Compile the source file + # ...and Reformat (using sed) any possible error/warning messages for the VisualStudio(R) output window + # ...and Create an assembly listing using objdump + # ...and Generate a dependency file (using the -MM flag) + @-$(CL) $(CPPFLAGS) $< -E -o $(PATH_PRE)/$(basename $(@F)).pre + @-$(CL) $(CPPFLAGS) $< -c -o $(PATH_OBJ)/$(basename $(@F)).o 2> $(PATH_ERR)/$(basename $(@F)).err + @-$(SED) -e 's|.h:\([0-9]*\),|.h(\1) :|' -e 's|:\([0-9]*\):|(\1) :|' $(PATH_ERR)/$(basename $(@F)).err + @-$(OBJDUMP) --disassemble --line-numbers -S $(PATH_OBJ)/$(basename $(@F)).o > $(PATH_LST)/$(basename $(@F)).lst + @-$(CL) $(CPPFLAGS) $< -MM > $(PATH_OBJ)/$(basename $(@F)).d + # profiling + @-$(CL) $(CPPFLAGS) -O0 --coverage $< -c -o $(PATH_COV)/$(basename $(@F)).o 2> $(PATH_NUL) + +%.o : %.c + @$(ECHO) +++ compile: $< + # Compile the source file + # ...and Reformat (using sed) any possible error/warning messages for the VisualStudio(R) output window + # ...and Create an assembly listing using objdump + # ...and Generate a dependency file (using the -MM flag) + @-$(CL) $(CFLAGS) $< -E -o $(PATH_PRE)/$(basename $(@F)).pre + @-$(CC) $(CFLAGS) $< -c -o $(PATH_OBJ)/$(basename $(@F)).o 2> $(PATH_ERR)/$(basename $(@F)).err + @-$(SED) -e 's|.h:\([0-9]*\),|.h(\1) :|' -e 's|:\([0-9]*\):|(\1) :|' $(PATH_ERR)/$(basename $(@F)).err + @-$(OBJDUMP) -S $(PATH_OBJ)/$(basename $(@F)).o > $(PATH_LST)/$(basename $(@F)).lst + @-$(CC) $(CFLAGS) $< -MM > $(PATH_OBJ)/$(basename $(@F)).d diff --git a/libafl_qemu/libqasan/printf/README.md b/crates/libafl_qemu/libqasan/printf/README.md similarity index 98% rename from libafl_qemu/libqasan/printf/README.md rename to crates/libafl_qemu/libqasan/printf/README.md index 17f2cec37ab..e2e4a72ad4b 100644 --- a/libafl_qemu/libqasan/printf/README.md +++ b/crates/libafl_qemu/libqasan/printf/README.md @@ -1,216 +1,216 @@ - -Modified to add the `__libqasan_` prefix to avoid stdlib conflicts and an internal buffer without malloc usage. - -=========================================================== - -# A printf / sprintf Implementation for Embedded Systems - -[![Build Status](https://travis-ci.org/mpaland/printf.svg?branch=master)](https://travis-ci.org/mpaland/printf) -[![codecov](https://codecov.io/gh/mpaland/printf/branch/master/graph/badge.svg)](https://codecov.io/gh/mpaland/printf) -[![Coverity Status](https://img.shields.io/coverity/scan/14180.svg)](https://scan.coverity.com/projects/mpaland-printf) -[![Github Issues](https://img.shields.io/github/issues/mpaland/printf.svg)](http://github.com/mpaland/printf/issues) -[![Github Releases](https://img.shields.io/github/release/mpaland/printf.svg)](https://github.com/mpaland/printf/releases) -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/mpaland/avl_array/master/LICENSE) - -This is a tiny but **fully loaded** printf, sprintf and (v)snprintf implementation. -Primarily designed for usage in embedded systems, where printf is not available due to memory issues or in avoidance of linking against libc. -Using the standard libc printf may pull **a lot** of unwanted library stuff and can bloat code size about 20k or is not 100% thread safe. In this cases the following implementation can be used. -Absolutely **NO dependencies** are required, *printf.c* brings all necessary routines, even its own fast `ftoa` (floating point), `ntoa` (decimal) conversion. - -If memory footprint is really a critical issue, floating point, exponential and 'long long' support and can be turned off via the `PRINTF_DISABLE_SUPPORT_FLOAT`, `PRINTF_DISABLE_SUPPORT_EXPONENTIAL` and `PRINTF_DISABLE_SUPPORT_LONG_LONG` compiler switches. -When using printf (instead of sprintf/snprintf) you have to provide your own `_putchar()` low level function as console/serial output. - - -## 2020 announcement -This project is not dead! I just had no time in 2019 for sufficient support, sorry. -Within the next weeks, I will have a look to all PRs and open issues. -Thank you all for supporting this project. - - -## Highlights and Design Goals - -There is a boatload of so called 'tiny' printf implementations around. So why this one? -I've tested many implementations, but most of them have very limited flag/specifier support, a lot of other dependencies or are just not standard compliant and failing most of the test suite. -Therefore I decided to write an own, final implementation which meets the following items: - - - Very small implementation (around 600 code lines) - - NO dependencies, no libs, just one module file - - Support of all important flags, width and precision sub-specifiers (see below) - - Support of decimal/floating number representation (with an own fast itoa/ftoa) - - Reentrant and thread-safe, malloc free, no static vars/buffers - - LINT and compiler L4 warning free, mature, coverity clean, automotive ready - - Extensive test suite (> 400 test cases) passing - - Simply the best *printf* around the net - - MIT license - - -## Usage - -Add/link *printf.c* to your project and include *printf.h*. That's it. -Implement your low level output function needed for `printf()`: -```C -void _putchar(char character) -{ - // send char to console etc. -} -``` - -Usage is 1:1 like the according stdio.h library version: -```C -int printf(const char* format, ...); -int sprintf(char* buffer, const char* format, ...); -int snprintf(char* buffer, size_t count, const char* format, ...); -int vsnprintf(char* buffer, size_t count, const char* format, va_list va); - -// use output function (instead of buffer) for streamlike interface -int fctprintf(void (*out)(char character, void* arg), void* arg, const char* format, ...); -``` - -**Due to general security reasons it is highly recommended to prefer and use `snprintf` (with the max buffer size as `count` parameter) instead of `sprintf`.** -`sprintf` has no buffer limitation, so when needed - use it really with care! - -### Streamlike Usage -Besides the regular standard `printf()` functions, this module also provides `fctprintf()`, which takes an output function as first parameter to build a streamlike output like `fprintf()`: -```C -// define the output function -void my_stream_output(char character, void* arg) -{ - // opt. evaluate the argument and send the char somewhere -} - -{ - // in your code - void* arg = (void*)100; // this argument is passed to the output function - fctprintf(&my_stream_output, arg, "This is a test: %X", 0xAA); - fctprintf(&my_stream_output, nullptr, "Send to null dev"); -} -``` - -## Format Specifiers - -A format specifier follows this prototype: `%[flags][width][.precision][length]type` -The following format specifiers are supported: - - -### Supported Types - -| Type | Output | -|--------|--------| -| d or i | Signed decimal integer | -| u | Unsigned decimal integer | -| b | Unsigned binary | -| o | Unsigned octal | -| x | Unsigned hexadecimal integer (lowercase) | -| X | Unsigned hexadecimal integer (uppercase) | -| f or F | Decimal floating point | -| e or E | Scientific-notation (exponential) floating point | -| g or G | Scientific or decimal floating point | -| c | Single character | -| s | String of characters | -| p | Pointer address | -| % | A % followed by another % character will write a single % | - - -### Supported Flags - -| Flags | Description | -|-------|-------------| -| - | Left-justify within the given field width; Right justification is the default. | -| + | Forces to precede the result with a plus or minus sign (+ or -) even for positive numbers.
By default, only negative numbers are preceded with a - sign. | -| (space) | If no sign is going to be written, a blank space is inserted before the value. | -| # | Used with o, b, x or X specifiers the value is preceded with 0, 0b, 0x or 0X respectively for values different than zero.
Used with f, F it forces the written output to contain a decimal point even if no more digits follow. By default, if no digits follow, no decimal point is written. | -| 0 | Left-pads the number with zeros (0) instead of spaces when padding is specified (see width sub-specifier). | - - -### Supported Width - -| Width | Description | -|----------|-------------| -| (number) | Minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. The value is not truncated even if the result is larger. | -| * | The width is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted. | - - -### Supported Precision - -| Precision | Description | -|-----------|-------------| -| .number | For integer specifiers (d, i, o, u, x, X): precision specifies the minimum number of digits to be written. If the value to be written is shorter than this number, the result is padded with leading zeros. The value is not truncated even if the result is longer. A precision of 0 means that no character is written for the value 0.
For f and F specifiers: this is the number of digits to be printed after the decimal point. **By default, this is 6, maximum is 9**.
For s: this is the maximum number of characters to be printed. By default all characters are printed until the ending null character is encountered.
If the period is specified without an explicit value for precision, 0 is assumed. | -| .* | The precision is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted. | - - -### Supported Length - -The length sub-specifier modifies the length of the data type. - -| Length | d i | u o x X | -|--------|------|---------| -| (none) | int | unsigned int | -| hh | char | unsigned char | -| h | short int | unsigned short int | -| l | long int | unsigned long int | -| ll | long long int | unsigned long long int (if PRINTF_SUPPORT_LONG_LONG is defined) | -| j | intmax_t | uintmax_t | -| z | size_t | size_t | -| t | ptrdiff_t | ptrdiff_t (if PRINTF_SUPPORT_PTRDIFF_T is defined) | - - -### Return Value - -Upon successful return, all functions return the number of characters written, _excluding_ the terminating null character used to end the string. -Functions `snprintf()` and `vsnprintf()` don't write more than `count` bytes, _including_ the terminating null byte ('\0'). -Anyway, if the output was truncated due to this limit, the return value is the number of characters that _could_ have been written. -Notice that a value equal or larger than `count` indicates a truncation. Only when the returned value is non-negative and less than `count`, -the string has been completely written. -If any error is encountered, `-1` is returned. - -If `buffer` is set to `NULL` (`nullptr`) nothing is written and just the formatted length is returned. -```C -int length = sprintf(NULL, "Hello, world"); // length is set to 12 -``` - - -## Compiler Switches/Defines - -| Name | Default value | Description | -|------|---------------|-------------| -| PRINTF_INCLUDE_CONFIG_H | undefined | Define this as compiler switch (e.g. `gcc -DPRINTF_INCLUDE_CONFIG_H`) to include a "printf_config.h" definition file | -| PRINTF_NTOA_BUFFER_SIZE | 32 | ntoa (integer) conversion buffer size. This must be big enough to hold one converted numeric number _including_ leading zeros, normally 32 is a sufficient value. Created on the stack | -| PRINTF_FTOA_BUFFER_SIZE | 32 | ftoa (float) conversion buffer size. This must be big enough to hold one converted float number _including_ leading zeros, normally 32 is a sufficient value. Created on the stack | -| PRINTF_DEFAULT_FLOAT_PRECISION | 6 | Define the default floating point precision | -| PRINTF_MAX_FLOAT | 1e9 | Define the largest suitable value to be printed with %f, before using exponential representation | -| PRINTF_DISABLE_SUPPORT_FLOAT | undefined | Define this to disable floating point (%f) support | -| PRINTF_DISABLE_SUPPORT_EXPONENTIAL | undefined | Define this to disable exponential floating point (%e) support | -| PRINTF_DISABLE_SUPPORT_LONG_LONG | undefined | Define this to disable long long (%ll) support | -| PRINTF_DISABLE_SUPPORT_PTRDIFF_T | undefined | Define this to disable ptrdiff_t (%t) support | - - -## Caveats -None anymore (finally). - - -## Test Suite -For testing just compile, build and run the test suite located in `test/test_suite.cpp`. This uses the [catch](https://github.com/catchorg/Catch2) framework for unit-tests, which is auto-adding main(). -Running with the `--wait-for-keypress exit` option waits for the enter key after test end. - - -## Projects Using printf -- [turnkeyboard](https://github.com/mpaland/turnkeyboard) uses printf as log and generic tty (formatting) output. -- printf is part of [embeddedartistry/libc](https://github.com/embeddedartistry/libc), a libc targeted for embedded systems usage. - -(Just send me a mail/issue/PR to get *your* project listed here) - - -## Contributing - -0. Give this project a :star: -1. Create an issue and describe your idea -2. [Fork it](https://github.com/mpaland/printf/fork) -3. Create your feature branch (`git checkout -b my-new-feature`) -4. Commit your changes (`git commit -am 'Add some feature'`) -5. Publish the branch (`git push origin my-new-feature`) -6. Create a new pull request -7. Profit! :heavy_check_mark: - - -## License -printf is written under the [MIT license](http://www.opensource.org/licenses/MIT). + +Modified to add the `__libqasan_` prefix to avoid stdlib conflicts and an internal buffer without malloc usage. + +=========================================================== + +# A printf / sprintf Implementation for Embedded Systems + +[![Build Status](https://travis-ci.org/mpaland/printf.svg?branch=master)](https://travis-ci.org/mpaland/printf) +[![codecov](https://codecov.io/gh/mpaland/printf/branch/master/graph/badge.svg)](https://codecov.io/gh/mpaland/printf) +[![Coverity Status](https://img.shields.io/coverity/scan/14180.svg)](https://scan.coverity.com/projects/mpaland-printf) +[![Github Issues](https://img.shields.io/github/issues/mpaland/printf.svg)](http://github.com/mpaland/printf/issues) +[![Github Releases](https://img.shields.io/github/release/mpaland/printf.svg)](https://github.com/mpaland/printf/releases) +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/mpaland/avl_array/master/LICENSE) + +This is a tiny but **fully loaded** printf, sprintf and (v)snprintf implementation. +Primarily designed for usage in embedded systems, where printf is not available due to memory issues or in avoidance of linking against libc. +Using the standard libc printf may pull **a lot** of unwanted library stuff and can bloat code size about 20k or is not 100% thread safe. In this cases the following implementation can be used. +Absolutely **NO dependencies** are required, *printf.c* brings all necessary routines, even its own fast `ftoa` (floating point), `ntoa` (decimal) conversion. + +If memory footprint is really a critical issue, floating point, exponential and 'long long' support and can be turned off via the `PRINTF_DISABLE_SUPPORT_FLOAT`, `PRINTF_DISABLE_SUPPORT_EXPONENTIAL` and `PRINTF_DISABLE_SUPPORT_LONG_LONG` compiler switches. +When using printf (instead of sprintf/snprintf) you have to provide your own `_putchar()` low level function as console/serial output. + + +## 2020 announcement +This project is not dead! I just had no time in 2019 for sufficient support, sorry. +Within the next weeks, I will have a look to all PRs and open issues. +Thank you all for supporting this project. + + +## Highlights and Design Goals + +There is a boatload of so called 'tiny' printf implementations around. So why this one? +I've tested many implementations, but most of them have very limited flag/specifier support, a lot of other dependencies or are just not standard compliant and failing most of the test suite. +Therefore I decided to write an own, final implementation which meets the following items: + + - Very small implementation (around 600 code lines) + - NO dependencies, no libs, just one module file + - Support of all important flags, width and precision sub-specifiers (see below) + - Support of decimal/floating number representation (with an own fast itoa/ftoa) + - Reentrant and thread-safe, malloc free, no static vars/buffers + - LINT and compiler L4 warning free, mature, coverity clean, automotive ready + - Extensive test suite (> 400 test cases) passing + - Simply the best *printf* around the net + - MIT license + + +## Usage + +Add/link *printf.c* to your project and include *printf.h*. That's it. +Implement your low level output function needed for `printf()`: +```C +void _putchar(char character) +{ + // send char to console etc. +} +``` + +Usage is 1:1 like the according stdio.h library version: +```C +int printf(const char* format, ...); +int sprintf(char* buffer, const char* format, ...); +int snprintf(char* buffer, size_t count, const char* format, ...); +int vsnprintf(char* buffer, size_t count, const char* format, va_list va); + +// use output function (instead of buffer) for streamlike interface +int fctprintf(void (*out)(char character, void* arg), void* arg, const char* format, ...); +``` + +**Due to general security reasons it is highly recommended to prefer and use `snprintf` (with the max buffer size as `count` parameter) instead of `sprintf`.** +`sprintf` has no buffer limitation, so when needed - use it really with care! + +### Streamlike Usage +Besides the regular standard `printf()` functions, this module also provides `fctprintf()`, which takes an output function as first parameter to build a streamlike output like `fprintf()`: +```C +// define the output function +void my_stream_output(char character, void* arg) +{ + // opt. evaluate the argument and send the char somewhere +} + +{ + // in your code + void* arg = (void*)100; // this argument is passed to the output function + fctprintf(&my_stream_output, arg, "This is a test: %X", 0xAA); + fctprintf(&my_stream_output, nullptr, "Send to null dev"); +} +``` + +## Format Specifiers + +A format specifier follows this prototype: `%[flags][width][.precision][length]type` +The following format specifiers are supported: + + +### Supported Types + +| Type | Output | +|--------|--------| +| d or i | Signed decimal integer | +| u | Unsigned decimal integer | +| b | Unsigned binary | +| o | Unsigned octal | +| x | Unsigned hexadecimal integer (lowercase) | +| X | Unsigned hexadecimal integer (uppercase) | +| f or F | Decimal floating point | +| e or E | Scientific-notation (exponential) floating point | +| g or G | Scientific or decimal floating point | +| c | Single character | +| s | String of characters | +| p | Pointer address | +| % | A % followed by another % character will write a single % | + + +### Supported Flags + +| Flags | Description | +|-------|-------------| +| - | Left-justify within the given field width; Right justification is the default. | +| + | Forces to precede the result with a plus or minus sign (+ or -) even for positive numbers.
By default, only negative numbers are preceded with a - sign. | +| (space) | If no sign is going to be written, a blank space is inserted before the value. | +| # | Used with o, b, x or X specifiers the value is preceded with 0, 0b, 0x or 0X respectively for values different than zero.
Used with f, F it forces the written output to contain a decimal point even if no more digits follow. By default, if no digits follow, no decimal point is written. | +| 0 | Left-pads the number with zeros (0) instead of spaces when padding is specified (see width sub-specifier). | + + +### Supported Width + +| Width | Description | +|----------|-------------| +| (number) | Minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. The value is not truncated even if the result is larger. | +| * | The width is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted. | + + +### Supported Precision + +| Precision | Description | +|-----------|-------------| +| .number | For integer specifiers (d, i, o, u, x, X): precision specifies the minimum number of digits to be written. If the value to be written is shorter than this number, the result is padded with leading zeros. The value is not truncated even if the result is longer. A precision of 0 means that no character is written for the value 0.
For f and F specifiers: this is the number of digits to be printed after the decimal point. **By default, this is 6, maximum is 9**.
For s: this is the maximum number of characters to be printed. By default all characters are printed until the ending null character is encountered.
If the period is specified without an explicit value for precision, 0 is assumed. | +| .* | The precision is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted. | + + +### Supported Length + +The length sub-specifier modifies the length of the data type. + +| Length | d i | u o x X | +|--------|------|---------| +| (none) | int | unsigned int | +| hh | char | unsigned char | +| h | short int | unsigned short int | +| l | long int | unsigned long int | +| ll | long long int | unsigned long long int (if PRINTF_SUPPORT_LONG_LONG is defined) | +| j | intmax_t | uintmax_t | +| z | size_t | size_t | +| t | ptrdiff_t | ptrdiff_t (if PRINTF_SUPPORT_PTRDIFF_T is defined) | + + +### Return Value + +Upon successful return, all functions return the number of characters written, _excluding_ the terminating null character used to end the string. +Functions `snprintf()` and `vsnprintf()` don't write more than `count` bytes, _including_ the terminating null byte ('\0'). +Anyway, if the output was truncated due to this limit, the return value is the number of characters that _could_ have been written. +Notice that a value equal or larger than `count` indicates a truncation. Only when the returned value is non-negative and less than `count`, +the string has been completely written. +If any error is encountered, `-1` is returned. + +If `buffer` is set to `NULL` (`nullptr`) nothing is written and just the formatted length is returned. +```C +int length = sprintf(NULL, "Hello, world"); // length is set to 12 +``` + + +## Compiler Switches/Defines + +| Name | Default value | Description | +|------|---------------|-------------| +| PRINTF_INCLUDE_CONFIG_H | undefined | Define this as compiler switch (e.g. `gcc -DPRINTF_INCLUDE_CONFIG_H`) to include a "printf_config.h" definition file | +| PRINTF_NTOA_BUFFER_SIZE | 32 | ntoa (integer) conversion buffer size. This must be big enough to hold one converted numeric number _including_ leading zeros, normally 32 is a sufficient value. Created on the stack | +| PRINTF_FTOA_BUFFER_SIZE | 32 | ftoa (float) conversion buffer size. This must be big enough to hold one converted float number _including_ leading zeros, normally 32 is a sufficient value. Created on the stack | +| PRINTF_DEFAULT_FLOAT_PRECISION | 6 | Define the default floating point precision | +| PRINTF_MAX_FLOAT | 1e9 | Define the largest suitable value to be printed with %f, before using exponential representation | +| PRINTF_DISABLE_SUPPORT_FLOAT | undefined | Define this to disable floating point (%f) support | +| PRINTF_DISABLE_SUPPORT_EXPONENTIAL | undefined | Define this to disable exponential floating point (%e) support | +| PRINTF_DISABLE_SUPPORT_LONG_LONG | undefined | Define this to disable long long (%ll) support | +| PRINTF_DISABLE_SUPPORT_PTRDIFF_T | undefined | Define this to disable ptrdiff_t (%t) support | + + +## Caveats +None anymore (finally). + + +## Test Suite +For testing just compile, build and run the test suite located in `test/test_suite.cpp`. This uses the [catch](https://github.com/catchorg/Catch2) framework for unit-tests, which is auto-adding main(). +Running with the `--wait-for-keypress exit` option waits for the enter key after test end. + + +## Projects Using printf +- [turnkeyboard](https://github.com/mpaland/turnkeyboard) uses printf as log and generic tty (formatting) output. +- printf is part of [embeddedartistry/libc](https://github.com/embeddedartistry/libc), a libc targeted for embedded systems usage. + +(Just send me a mail/issue/PR to get *your* project listed here) + + +## Contributing + +0. Give this project a :star: +1. Create an issue and describe your idea +2. [Fork it](https://github.com/mpaland/printf/fork) +3. Create your feature branch (`git checkout -b my-new-feature`) +4. Commit your changes (`git commit -am 'Add some feature'`) +5. Publish the branch (`git push origin my-new-feature`) +6. Create a new pull request +7. Profit! :heavy_check_mark: + + +## License +printf is written under the [MIT license](http://www.opensource.org/licenses/MIT). diff --git a/libafl_qemu/libqasan/printf/printf.c b/crates/libafl_qemu/libqasan/printf/printf.c similarity index 96% rename from libafl_qemu/libqasan/printf/printf.c rename to crates/libafl_qemu/libqasan/printf/printf.c index e3f0afea4c6..5849dc54180 100644 --- a/libafl_qemu/libqasan/printf/printf.c +++ b/crates/libafl_qemu/libqasan/printf/printf.c @@ -1,986 +1,986 @@ -/////////////////////////////////////////////////////////////////////////////// -// \author (c) Marco Paland (info@paland.com) -// 2014-2019, PALANDesign Hannover, Germany -// -// \license The MIT License (MIT) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -// \brief Tiny printf, sprintf and (v)snprintf implementation, optimized for -// speed on -// embedded systems with a very limited resources. These routines are -// thread safe and reentrant! Use this instead of the bloated -// standard/newlib printf cause these use malloc for printf (and may not -// be thread safe). -// -/////////////////////////////////////////////////////////////////////////////// - -#include -#include - -#include "printf.h" -#include "../libqasan.h" - -// qasan define -#define PRINTF_SUPPORT_FLOAT - -// define this globally (e.g. gcc -DPRINTF_INCLUDE_CONFIG_H ...) to include the -// printf_config.h header file -// default: undefined -#ifdef PRINTF_INCLUDE_CONFIG_H - #include "printf_config.h" -#endif - -// 'ntoa' conversion buffer size, this must be big enough to hold one converted -// numeric number including padded zeros (dynamically created on stack) -// default: 32 byte -#ifndef PRINTF_NTOA_BUFFER_SIZE - #define PRINTF_NTOA_BUFFER_SIZE 32U -#endif - -// 'ftoa' conversion buffer size, this must be big enough to hold one converted -// float number including padded zeros (dynamically created on stack) -// default: 32 byte -#ifndef PRINTF_FTOA_BUFFER_SIZE - #define PRINTF_FTOA_BUFFER_SIZE 32U -#endif - -// support for the floating point type (%f) -// default: activated -#ifndef PRINTF_DISABLE_SUPPORT_FLOAT - #define PRINTF_SUPPORT_FLOAT -#endif - -// support for exponential floating point notation (%e/%g) -// default: activated -#ifndef PRINTF_DISABLE_SUPPORT_EXPONENTIAL - #define PRINTF_SUPPORT_EXPONENTIAL -#endif - -// define the default floating point precision -// default: 6 digits -#ifndef PRINTF_DEFAULT_FLOAT_PRECISION - #define PRINTF_DEFAULT_FLOAT_PRECISION 6U -#endif - -// define the largest float suitable to print with %f -// default: 1e9 -#ifndef PRINTF_MAX_FLOAT - #define PRINTF_MAX_FLOAT 1e9 -#endif - -// support for the long long types (%llu or %p) -// default: activated -#ifndef PRINTF_DISABLE_SUPPORT_LONG_LONG - #define PRINTF_SUPPORT_LONG_LONG -#endif - -// support for the ptrdiff_t type (%t) -// ptrdiff_t is normally defined in as long or long long type -// default: activated -#ifndef PRINTF_DISABLE_SUPPORT_PTRDIFF_T - #define PRINTF_SUPPORT_PTRDIFF_T -#endif - -/////////////////////////////////////////////////////////////////////////////// - -// internal flag definitions -#define FLAGS_ZEROPAD (1U << 0U) -#define FLAGS_LEFT (1U << 1U) -#define FLAGS_PLUS (1U << 2U) -#define FLAGS_SPACE (1U << 3U) -#define FLAGS_HASH (1U << 4U) -#define FLAGS_UPPERCASE (1U << 5U) -#define FLAGS_CHAR (1U << 6U) -#define FLAGS_SHORT (1U << 7U) -#define FLAGS_LONG (1U << 8U) -#define FLAGS_LONG_LONG (1U << 9U) -#define FLAGS_PRECISION (1U << 10U) -#define FLAGS_ADAPT_EXP (1U << 11U) - -// import float.h for DBL_MAX -#if defined(PRINTF_SUPPORT_FLOAT) - #include -#endif - -// output function type -typedef void (*out_fct_type)(char character, void *buffer, size_t idx, - size_t maxlen); - -// wrapper (used as buffer) for output function type -typedef struct { - void (*fct)(char character, void *arg); - void *arg; -} out_fct_wrap_type; - -// internal buffer output -static inline void _out_buffer(char character, void *buffer, size_t idx, - size_t maxlen) { - if (idx < maxlen) { ((char *)buffer)[idx] = character; } -} - -// internal null output -static inline void _out_null(char character, void *buffer, size_t idx, - size_t maxlen) { - (void)character; - (void)buffer; - (void)idx; - (void)maxlen; -} - -// internal _putchar wrapper -static inline void _out_char(char character, void *buffer, size_t idx, - size_t maxlen) { - (void)buffer; - (void)idx; - (void)maxlen; - if (character) { __libqasan_putchar(character); } -} - -// internal output function wrapper -static inline void _out_fct(char character, void *buffer, size_t idx, - size_t maxlen) { - (void)idx; - (void)maxlen; - if (character) { - // buffer is the output fct pointer - ((out_fct_wrap_type *)buffer) - ->fct(character, ((out_fct_wrap_type *)buffer)->arg); - } -} - -// internal secure strlen -// \return The length of the string (excluding the terminating 0) limited by -// 'maxsize' -static inline unsigned int _strnlen_s(const char *str, size_t maxsize) { - const char *s; - for (s = str; *s && maxsize--; ++s) - ; - return (unsigned int)(s - str); -} - -// internal test if char is a digit (0-9) -// \return true if char is a digit -static inline bool _is_digit(char ch) { - return (ch >= '0') && (ch <= '9'); -} - -// internal ASCII string to unsigned int conversion -static unsigned int _atoi(const char **str) { - unsigned int i = 0U; - while (_is_digit(**str)) { - i = i * 10U + (unsigned int)(*((*str)++) - '0'); - } - return i; -} - -// output the specified string in reverse, taking care of any zero-padding -static size_t _out_rev(out_fct_type out, char *buffer, size_t idx, - size_t maxlen, const char *buf, size_t len, - unsigned int width, unsigned int flags) { - const size_t start_idx = idx; - - // pad spaces up to given width - if (!(flags & FLAGS_LEFT) && !(flags & FLAGS_ZEROPAD)) { - for (size_t i = len; i < width; i++) { - out(' ', buffer, idx++, maxlen); - } - } - - // reverse string - while (len) { - out(buf[--len], buffer, idx++, maxlen); - } - - // append pad spaces up to given width - if (flags & FLAGS_LEFT) { - while (idx - start_idx < width) { - out(' ', buffer, idx++, maxlen); - } - } - - return idx; -} - -// internal itoa format -static size_t _ntoa_format(out_fct_type out, char *buffer, size_t idx, - size_t maxlen, char *buf, size_t len, bool negative, - unsigned int base, unsigned int prec, - unsigned int width, unsigned int flags) { - // pad leading zeros - if (!(flags & FLAGS_LEFT)) { - if (width && (flags & FLAGS_ZEROPAD) && - (negative || (flags & (FLAGS_PLUS | FLAGS_SPACE)))) { - width--; - } - while ((len < prec) && (len < PRINTF_NTOA_BUFFER_SIZE)) { - buf[len++] = '0'; - } - while ((flags & FLAGS_ZEROPAD) && (len < width) && - (len < PRINTF_NTOA_BUFFER_SIZE)) { - buf[len++] = '0'; - } - } - - // handle hash - if (flags & FLAGS_HASH) { - if (!(flags & FLAGS_PRECISION) && len && - ((len == prec) || (len == width))) { - len--; - if (len && (base == 16U)) { len--; } - } - if ((base == 16U) && !(flags & FLAGS_UPPERCASE) && - (len < PRINTF_NTOA_BUFFER_SIZE)) { - buf[len++] = 'x'; - } else if ((base == 16U) && (flags & FLAGS_UPPERCASE) && - (len < PRINTF_NTOA_BUFFER_SIZE)) { - buf[len++] = 'X'; - } else if ((base == 2U) && (len < PRINTF_NTOA_BUFFER_SIZE)) { - buf[len++] = 'b'; - } - if (len < PRINTF_NTOA_BUFFER_SIZE) { buf[len++] = '0'; } - } - - if (len < PRINTF_NTOA_BUFFER_SIZE) { - if (negative) { - buf[len++] = '-'; - } else if (flags & FLAGS_PLUS) { - buf[len++] = '+'; // ignore the space if the '+' exists - } else if (flags & FLAGS_SPACE) { - buf[len++] = ' '; - } - } - - return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags); -} - -// internal itoa for 'long' type -static size_t _ntoa_long(out_fct_type out, char *buffer, size_t idx, - size_t maxlen, unsigned long value, bool negative, - unsigned long base, unsigned int prec, - unsigned int width, unsigned int flags) { - char buf[PRINTF_NTOA_BUFFER_SIZE]; - size_t len = 0U; - - // no hash for 0 values - if (!value) { flags &= ~FLAGS_HASH; } - - // write if precision != 0 and value is != 0 - if (!(flags & FLAGS_PRECISION) || value) { - do { - const char digit = (char)(value % base); - buf[len++] = digit < 10 - ? '0' + digit - : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10; - value /= base; - } while (value && (len < PRINTF_NTOA_BUFFER_SIZE)); - } - - return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, - (unsigned int)base, prec, width, flags); -} - -// internal itoa for 'long long' type -#if defined(PRINTF_SUPPORT_LONG_LONG) -static size_t _ntoa_long_long(out_fct_type out, char *buffer, size_t idx, - size_t maxlen, unsigned long long value, - bool negative, unsigned long long base, - unsigned int prec, unsigned int width, - unsigned int flags) { - char buf[PRINTF_NTOA_BUFFER_SIZE]; - size_t len = 0U; - - // no hash for 0 values - if (!value) { flags &= ~FLAGS_HASH; } - - // write if precision != 0 and value is != 0 - if (!(flags & FLAGS_PRECISION) || value) { - do { - const char digit = (char)(value % base); - buf[len++] = digit < 10 - ? '0' + digit - : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10; - value /= base; - } while (value && (len < PRINTF_NTOA_BUFFER_SIZE)); - } - - return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, - (unsigned int)base, prec, width, flags); -} -#endif // PRINTF_SUPPORT_LONG_LONG - -#if defined(PRINTF_SUPPORT_FLOAT) - - #if defined(PRINTF_SUPPORT_EXPONENTIAL) -// forward declaration so that _ftoa can switch to exp notation for values > -// PRINTF_MAX_FLOAT -static size_t _etoa(out_fct_type out, char *buffer, size_t idx, size_t maxlen, - double value, unsigned int prec, unsigned int width, - unsigned int flags); - #endif - -// internal ftoa for fixed decimal floating point -static size_t _ftoa(out_fct_type out, char *buffer, size_t idx, size_t maxlen, - double value, unsigned int prec, unsigned int width, - unsigned int flags) { - char buf[PRINTF_FTOA_BUFFER_SIZE]; - size_t len = 0U; - double diff = 0.0; - - // powers of 10 - static const double pow10[] = {1, 10, 100, 1000, - 10000, 100000, 1000000, 10000000, - 100000000, 1000000000}; - - // test for special values - if (value != value) - return _out_rev(out, buffer, idx, maxlen, "nan", 3, width, flags); - if (value < -DBL_MAX) - return _out_rev(out, buffer, idx, maxlen, "fni-", 4, width, flags); - if (value > DBL_MAX) - return _out_rev(out, buffer, idx, maxlen, - (flags & FLAGS_PLUS) ? "fni+" : "fni", - (flags & FLAGS_PLUS) ? 4U : 3U, width, flags); - - // test for very large values - // standard printf behavior is to print EVERY whole number digit -- which - // could be 100s of characters overflowing your buffers == bad - if ((value > PRINTF_MAX_FLOAT) || (value < -PRINTF_MAX_FLOAT)) { - #if defined(PRINTF_SUPPORT_EXPONENTIAL) - return _etoa(out, buffer, idx, maxlen, value, prec, width, flags); - #else - return 0U; - #endif - } - - // test for negative - bool negative = false; - if (value < 0) { - negative = true; - value = 0 - value; - } - - // set default precision, if not set explicitly - if (!(flags & FLAGS_PRECISION)) { prec = PRINTF_DEFAULT_FLOAT_PRECISION; } - // limit precision to 9, cause a prec >= 10 can lead to overflow errors - while ((len < PRINTF_FTOA_BUFFER_SIZE) && (prec > 9U)) { - buf[len++] = '0'; - prec--; - } - - int whole = (int)value; - double tmp = (value - whole) * pow10[prec]; - unsigned long frac = (unsigned long)tmp; - diff = tmp - frac; - - if (diff > 0.5) { - ++frac; - // handle rollover, e.g. case 0.99 with prec 1 is 1.0 - if (frac >= pow10[prec]) { - frac = 0; - ++whole; - } - } else if (diff < 0.5) { - } else if ((frac == 0U) || (frac & 1U)) { - // if halfway, round up if odd OR if last digit is 0 - ++frac; - } - - if (prec == 0U) { - diff = value - (double)whole; - if ((!(diff < 0.5) || (diff > 0.5)) && (whole & 1)) { - // exactly 0.5 and ODD, then round up - // 1.5 -> 2, but 2.5 -> 2 - ++whole; - } - } else { - unsigned int count = prec; - // now do fractional part, as an unsigned number - while (len < PRINTF_FTOA_BUFFER_SIZE) { - --count; - buf[len++] = (char)(48U + (frac % 10U)); - if (!(frac /= 10U)) { break; } - } - // add extra 0s - while ((len < PRINTF_FTOA_BUFFER_SIZE) && (count-- > 0U)) { - buf[len++] = '0'; - } - if (len < PRINTF_FTOA_BUFFER_SIZE) { - // add decimal - buf[len++] = '.'; - } - } - - // do whole part, number is reversed - while (len < PRINTF_FTOA_BUFFER_SIZE) { - buf[len++] = (char)(48 + (whole % 10)); - if (!(whole /= 10)) { break; } - } - - // pad leading zeros - if (!(flags & FLAGS_LEFT) && (flags & FLAGS_ZEROPAD)) { - if (width && (negative || (flags & (FLAGS_PLUS | FLAGS_SPACE)))) { - width--; - } - while ((len < width) && (len < PRINTF_FTOA_BUFFER_SIZE)) { - buf[len++] = '0'; - } - } - - if (len < PRINTF_FTOA_BUFFER_SIZE) { - if (negative) { - buf[len++] = '-'; - } else if (flags & FLAGS_PLUS) { - buf[len++] = '+'; // ignore the space if the '+' exists - } else if (flags & FLAGS_SPACE) { - buf[len++] = ' '; - } - } - - return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags); -} - - #if defined(PRINTF_SUPPORT_EXPONENTIAL) -// internal ftoa variant for exponential floating-point type, contributed by -// Martijn Jasperse -static size_t _etoa(out_fct_type out, char *buffer, size_t idx, size_t maxlen, - double value, unsigned int prec, unsigned int width, - unsigned int flags) { - // check for NaN and special values - if ((value != value) || (value > DBL_MAX) || (value < -DBL_MAX)) { - return _ftoa(out, buffer, idx, maxlen, value, prec, width, flags); - } - - // determine the sign - const bool negative = value < 0; - if (negative) { value = -value; } - - // default precision - if (!(flags & FLAGS_PRECISION)) { prec = PRINTF_DEFAULT_FLOAT_PRECISION; } - - // determine the decimal exponent - // based on the algorithm by David Gay (https://www.ampl.com/netlib/fp/dtoa.c) - union { - uint64_t U; - double F; - } conv; - - conv.F = value; - int exp2 = (int)((conv.U >> 52U) & 0x07FFU) - 1023; // effectively log2 - conv.U = (conv.U & ((1ULL << 52U) - 1U)) | - (1023ULL << 52U); // drop the exponent so conv.F is now in [1,2) - // now approximate log10 from the log2 integer part and an expansion of ln - // around 1.5 - int expval = (int)(0.1760912590558 + exp2 * 0.301029995663981 + - (conv.F - 1.5) * 0.289529654602168); - // now we want to compute 10^expval but we want to be sure it won't overflow - exp2 = (int)(expval * 3.321928094887362 + 0.5); - const double z = expval * 2.302585092994046 - exp2 * 0.6931471805599453; - const double z2 = z * z; - conv.U = (uint64_t)(exp2 + 1023) << 52U; - // compute exp(z) using continued fractions, see - // https://en.wikipedia.org/wiki/Exponential_function#Continued_fractions_for_ex - conv.F *= 1 + 2 * z / (2 - z + (z2 / (6 + (z2 / (10 + z2 / 14))))); - // correct for rounding errors - if (value < conv.F) { - expval--; - conv.F /= 10; - } - - // the exponent format is "%+03d" and largest value is "307", so set aside 4-5 - // characters - unsigned int minwidth = ((expval < 100) && (expval > -100)) ? 4U : 5U; - - // in "%g" mode, "prec" is the number of *significant figures* not decimals - if (flags & FLAGS_ADAPT_EXP) { - // do we want to fall-back to "%f" mode? - if ((value >= 1e-4) && (value < 1e6)) { - if ((int)prec > expval) { - prec = (unsigned)((int)prec - expval - 1); - } else { - prec = 0; - } - flags |= FLAGS_PRECISION; // make sure _ftoa respects precision - // no characters in exponent - minwidth = 0U; - expval = 0; - } else { - // we use one sigfig for the whole part - if ((prec > 0) && (flags & FLAGS_PRECISION)) { --prec; } - } - } - - // will everything fit? - unsigned int fwidth = width; - if (width > minwidth) { - // we didn't fall-back so subtract the characters required for the exponent - fwidth -= minwidth; - } else { - // not enough characters, so go back to default sizing - fwidth = 0U; - } - if ((flags & FLAGS_LEFT) && minwidth) { - // if we're padding on the right, DON'T pad the floating part - fwidth = 0U; - } - - // rescale the float value - if (expval) { value /= conv.F; } - - // output the floating part - const size_t start_idx = idx; - idx = _ftoa(out, buffer, idx, maxlen, negative ? -value : value, prec, fwidth, - flags & ~FLAGS_ADAPT_EXP); - - // output the exponent part - if (minwidth) { - // output the exponential symbol - out((flags & FLAGS_UPPERCASE) ? 'E' : 'e', buffer, idx++, maxlen); - // output the exponent value - idx = - _ntoa_long(out, buffer, idx, maxlen, (expval < 0) ? -expval : expval, - expval < 0, 10, 0, minwidth - 1, FLAGS_ZEROPAD | FLAGS_PLUS); - // might need to right-pad spaces - if (flags & FLAGS_LEFT) { - while (idx - start_idx < width) - out(' ', buffer, idx++, maxlen); - } - } - return idx; -} - #endif // PRINTF_SUPPORT_EXPONENTIAL -#endif // PRINTF_SUPPORT_FLOAT - -// internal vsnprintf -static int _vsnprintf(out_fct_type out, char *buffer, const size_t maxlen, - const char *format, va_list va) { - unsigned int flags, width, precision, n; - size_t idx = 0U; - - if (!buffer) { - // use null output function - out = _out_null; - } - - while (*format) { - // format specifier? %[flags][width][.precision][length] - if (*format != '%') { - // no - out(*format, buffer, idx++, maxlen); - format++; - continue; - } else { - // yes, evaluate it - format++; - } - - // evaluate flags - flags = 0U; - do { - switch (*format) { - case '0': - flags |= FLAGS_ZEROPAD; - format++; - n = 1U; - break; - case '-': - flags |= FLAGS_LEFT; - format++; - n = 1U; - break; - case '+': - flags |= FLAGS_PLUS; - format++; - n = 1U; - break; - case ' ': - flags |= FLAGS_SPACE; - format++; - n = 1U; - break; - case '#': - flags |= FLAGS_HASH; - format++; - n = 1U; - break; - default: - n = 0U; - break; - } - } while (n); - - // evaluate width field - width = 0U; - if (_is_digit(*format)) { - width = _atoi(&format); - } else if (*format == '*') { - const int w = va_arg(va, int); - if (w < 0) { - flags |= FLAGS_LEFT; // reverse padding - width = (unsigned int)-w; - } else { - width = (unsigned int)w; - } - format++; - } - - // evaluate precision field - precision = 0U; - if (*format == '.') { - flags |= FLAGS_PRECISION; - format++; - if (_is_digit(*format)) { - precision = _atoi(&format); - } else if (*format == '*') { - const int prec = (int)va_arg(va, int); - precision = prec > 0 ? (unsigned int)prec : 0U; - format++; - } - } - - // evaluate length field - switch (*format) { - case 'l': - flags |= FLAGS_LONG; - format++; - if (*format == 'l') { - flags |= FLAGS_LONG_LONG; - format++; - } - break; - case 'h': - flags |= FLAGS_SHORT; - format++; - if (*format == 'h') { - flags |= FLAGS_CHAR; - format++; - } - break; -#if defined(PRINTF_SUPPORT_PTRDIFF_T) - case 't': - flags |= - (sizeof(ptrdiff_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG); - format++; - break; -#endif - case 'j': - flags |= - (sizeof(intmax_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG); - format++; - break; - case 'z': - flags |= - (sizeof(size_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG); - format++; - break; - default: - break; - } - - // evaluate specifier - switch (*format) { - case 'd': - case 'i': - case 'u': - case 'x': - case 'X': - case 'o': - case 'b': { - // set the base - unsigned int base; - if (*format == 'x' || *format == 'X') { - base = 16U; - } else if (*format == 'o') { - base = 8U; - } else if (*format == 'b') { - base = 2U; - } else { - base = 10U; - flags &= ~FLAGS_HASH; // no hash for dec format - } - // uppercase - if (*format == 'X') { flags |= FLAGS_UPPERCASE; } - - // no plus or space flag for u, x, X, o, b - if ((*format != 'i') && (*format != 'd')) { - flags &= ~(FLAGS_PLUS | FLAGS_SPACE); - } - - // ignore '0' flag when precision is given - if (flags & FLAGS_PRECISION) { flags &= ~FLAGS_ZEROPAD; } - - // convert the integer - if ((*format == 'i') || (*format == 'd')) { - // signed - if (flags & FLAGS_LONG_LONG) { -#if defined(PRINTF_SUPPORT_LONG_LONG) - const long long value = va_arg(va, long long); - idx = _ntoa_long_long( - out, buffer, idx, maxlen, - (unsigned long long)(value > 0 ? value : 0 - value), value < 0, - base, precision, width, flags); -#endif - } else if (flags & FLAGS_LONG) { - const long value = va_arg(va, long); - idx = _ntoa_long(out, buffer, idx, maxlen, - (unsigned long)(value > 0 ? value : 0 - value), - value < 0, base, precision, width, flags); - } else { - const int value = (flags & FLAGS_CHAR) ? (char)va_arg(va, int) - : (flags & FLAGS_SHORT) - ? (short int)va_arg(va, int) - : va_arg(va, int); - idx = _ntoa_long(out, buffer, idx, maxlen, - (unsigned int)(value > 0 ? value : 0 - value), - value < 0, base, precision, width, flags); - } - } else { - // unsigned - if (flags & FLAGS_LONG_LONG) { -#if defined(PRINTF_SUPPORT_LONG_LONG) - idx = _ntoa_long_long(out, buffer, idx, maxlen, - va_arg(va, unsigned long long), false, base, - precision, width, flags); -#endif - } else if (flags & FLAGS_LONG) { - idx = - _ntoa_long(out, buffer, idx, maxlen, va_arg(va, unsigned long), - false, base, precision, width, flags); - } else { - const unsigned int value = - (flags & FLAGS_CHAR) ? (unsigned char)va_arg(va, unsigned int) - : (flags & FLAGS_SHORT) - ? (unsigned short int)va_arg(va, unsigned int) - : va_arg(va, unsigned int); - idx = _ntoa_long(out, buffer, idx, maxlen, value, false, base, - precision, width, flags); - } - } - format++; - break; - } -#if defined(PRINTF_SUPPORT_FLOAT) - case 'f': - case 'F': - if (*format == 'F') flags |= FLAGS_UPPERCASE; - idx = _ftoa(out, buffer, idx, maxlen, va_arg(va, double), precision, - width, flags); - format++; - break; - #if defined(PRINTF_SUPPORT_EXPONENTIAL) - case 'e': - case 'E': - case 'g': - case 'G': - if ((*format == 'g') || (*format == 'G')) flags |= FLAGS_ADAPT_EXP; - if ((*format == 'E') || (*format == 'G')) flags |= FLAGS_UPPERCASE; - idx = _etoa(out, buffer, idx, maxlen, va_arg(va, double), precision, - width, flags); - format++; - break; - #endif // PRINTF_SUPPORT_EXPONENTIAL -#endif // PRINTF_SUPPORT_FLOAT - case 'c': { - unsigned int l = 1U; - // pre padding - if (!(flags & FLAGS_LEFT)) { - while (l++ < width) { - out(' ', buffer, idx++, maxlen); - } - } - // char output - out((char)va_arg(va, int), buffer, idx++, maxlen); - // post padding - if (flags & FLAGS_LEFT) { - while (l++ < width) { - out(' ', buffer, idx++, maxlen); - } - } - format++; - break; - } - - case 's': { - const char *p = va_arg(va, char *); - unsigned int l = _strnlen_s(p, precision ? precision : (size_t)-1); - // pre padding - if (flags & FLAGS_PRECISION) { l = (l < precision ? l : precision); } - if (!(flags & FLAGS_LEFT)) { - while (l++ < width) { - out(' ', buffer, idx++, maxlen); - } - } - // string output - while ((*p != 0) && (!(flags & FLAGS_PRECISION) || precision--)) { - out(*(p++), buffer, idx++, maxlen); - } - // post padding - if (flags & FLAGS_LEFT) { - while (l++ < width) { - out(' ', buffer, idx++, maxlen); - } - } - format++; - break; - } - - case 'p': { - width = sizeof(void *) * 2U; - flags |= FLAGS_ZEROPAD | FLAGS_UPPERCASE; -#if defined(PRINTF_SUPPORT_LONG_LONG) - const bool is_ll = sizeof(uintptr_t) == sizeof(long long); - if (is_ll) { - idx = _ntoa_long_long(out, buffer, idx, maxlen, - (uintptr_t)va_arg(va, void *), false, 16U, - precision, width, flags); - } else { -#endif - idx = _ntoa_long(out, buffer, idx, maxlen, - (unsigned long)((uintptr_t)va_arg(va, void *)), - false, 16U, precision, width, flags); -#if defined(PRINTF_SUPPORT_LONG_LONG) - } -#endif - format++; - break; - } - - case '%': - out('%', buffer, idx++, maxlen); - format++; - break; - - default: - out(*format, buffer, idx++, maxlen); - format++; - break; - } - } - - // termination - out((char)0, buffer, idx < maxlen ? idx : maxlen - 1U, maxlen); - - // return written chars without terminating \0 - return (int)idx; -} - -/////////////////////////////////////////////////////////////////////////////// - -int __libqasan_printf(const char *format, ...) { - va_list va; - va_start(va, format); - char buffer[1]; - const int ret = _vsnprintf(_out_char, buffer, (size_t)-1, format, va); - va_end(va); - return ret; -} - -int __libqasan_sprintf(char *buffer, const char *format, ...) { - va_list va; - va_start(va, format); - const int ret = _vsnprintf(_out_buffer, buffer, (size_t)-1, format, va); - va_end(va); - return ret; -} - -int __libqasan_snprintf(char *buffer, size_t count, const char *format, ...) { - va_list va; - va_start(va, format); - const int ret = _vsnprintf(_out_buffer, buffer, count, format, va); - va_end(va); - return ret; -} - -int __libqasan_vprintf(const char *format, va_list va) { - char buffer[1]; - return _vsnprintf(_out_char, buffer, (size_t)-1, format, va); -} - -int __libqasan_vasprintf(char **restrict strp, const char *restrict format, - va_list va) { - // get the string size - const int len = _vsnprintf(NULL, NULL, (size_t)-1, format, va); - - void *buffer = __libqasan_malloc(len + 1); - *strp = buffer; - const int ret = _vsnprintf(_out_buffer, buffer, len + 1, format, va); - return ret; -} - -int __libqasan_vsnprintf(char *buffer, size_t count, const char *format, - va_list va) { - return _vsnprintf(_out_buffer, buffer, count, format, va); -} - -int __libqasan_fctprintf(void (*out)(char character, void *arg), void *arg, - const char *format, ...) { - va_list va; - va_start(va, format); - const out_fct_wrap_type out_fct_wrap = {out, arg}; - const int ret = _vsnprintf(_out_fct, (char *)(uintptr_t)&out_fct_wrap, - (size_t)-1, format, va); - va_end(va); - return ret; -} - -//////////////////////////////// libqasan internal output buffer putchar - -#include -#include -#include - -static ssize_t reliable_write(int fd, const void *buf, size_t count) { - ssize_t total_written = 0; - ssize_t bytes_written; - - while (total_written < count) { - bytes_written = - syscall(SYS_write, fd, buf + total_written, count - total_written); - - if (bytes_written == -1) { - if (errno == EINTR) { - continue; - } else { - return -1; - } - } else if (bytes_written == 0) { - break; - } else { - total_written += bytes_written; - } - } - - return total_written; -} - -#define INTERNAL_BUF_SIZE 4096 - -static char output_internal_buf[INTERNAL_BUF_SIZE]; -static size_t output_internal_bug_idx = 0; - -void __libqasan_putchar(char character) { - if (output_internal_bug_idx >= INTERNAL_BUF_SIZE) __libqasan_flush(); - - output_internal_buf[output_internal_bug_idx++] = character; -} - -void __libqasan_flush(void) { - reliable_write(2, output_internal_buf, output_internal_bug_idx); - output_internal_bug_idx = 0; -} +/////////////////////////////////////////////////////////////////////////////// +// \author (c) Marco Paland (info@paland.com) +// 2014-2019, PALANDesign Hannover, Germany +// +// \license The MIT License (MIT) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// \brief Tiny printf, sprintf and (v)snprintf implementation, optimized for +// speed on +// embedded systems with a very limited resources. These routines are +// thread safe and reentrant! Use this instead of the bloated +// standard/newlib printf cause these use malloc for printf (and may not +// be thread safe). +// +/////////////////////////////////////////////////////////////////////////////// + +#include +#include + +#include "printf.h" +#include "../libqasan.h" + +// qasan define +#define PRINTF_SUPPORT_FLOAT + +// define this globally (e.g. gcc -DPRINTF_INCLUDE_CONFIG_H ...) to include the +// printf_config.h header file +// default: undefined +#ifdef PRINTF_INCLUDE_CONFIG_H + #include "printf_config.h" +#endif + +// 'ntoa' conversion buffer size, this must be big enough to hold one converted +// numeric number including padded zeros (dynamically created on stack) +// default: 32 byte +#ifndef PRINTF_NTOA_BUFFER_SIZE + #define PRINTF_NTOA_BUFFER_SIZE 32U +#endif + +// 'ftoa' conversion buffer size, this must be big enough to hold one converted +// float number including padded zeros (dynamically created on stack) +// default: 32 byte +#ifndef PRINTF_FTOA_BUFFER_SIZE + #define PRINTF_FTOA_BUFFER_SIZE 32U +#endif + +// support for the floating point type (%f) +// default: activated +#ifndef PRINTF_DISABLE_SUPPORT_FLOAT + #define PRINTF_SUPPORT_FLOAT +#endif + +// support for exponential floating point notation (%e/%g) +// default: activated +#ifndef PRINTF_DISABLE_SUPPORT_EXPONENTIAL + #define PRINTF_SUPPORT_EXPONENTIAL +#endif + +// define the default floating point precision +// default: 6 digits +#ifndef PRINTF_DEFAULT_FLOAT_PRECISION + #define PRINTF_DEFAULT_FLOAT_PRECISION 6U +#endif + +// define the largest float suitable to print with %f +// default: 1e9 +#ifndef PRINTF_MAX_FLOAT + #define PRINTF_MAX_FLOAT 1e9 +#endif + +// support for the long long types (%llu or %p) +// default: activated +#ifndef PRINTF_DISABLE_SUPPORT_LONG_LONG + #define PRINTF_SUPPORT_LONG_LONG +#endif + +// support for the ptrdiff_t type (%t) +// ptrdiff_t is normally defined in as long or long long type +// default: activated +#ifndef PRINTF_DISABLE_SUPPORT_PTRDIFF_T + #define PRINTF_SUPPORT_PTRDIFF_T +#endif + +/////////////////////////////////////////////////////////////////////////////// + +// internal flag definitions +#define FLAGS_ZEROPAD (1U << 0U) +#define FLAGS_LEFT (1U << 1U) +#define FLAGS_PLUS (1U << 2U) +#define FLAGS_SPACE (1U << 3U) +#define FLAGS_HASH (1U << 4U) +#define FLAGS_UPPERCASE (1U << 5U) +#define FLAGS_CHAR (1U << 6U) +#define FLAGS_SHORT (1U << 7U) +#define FLAGS_LONG (1U << 8U) +#define FLAGS_LONG_LONG (1U << 9U) +#define FLAGS_PRECISION (1U << 10U) +#define FLAGS_ADAPT_EXP (1U << 11U) + +// import float.h for DBL_MAX +#if defined(PRINTF_SUPPORT_FLOAT) + #include +#endif + +// output function type +typedef void (*out_fct_type)(char character, void *buffer, size_t idx, + size_t maxlen); + +// wrapper (used as buffer) for output function type +typedef struct { + void (*fct)(char character, void *arg); + void *arg; +} out_fct_wrap_type; + +// internal buffer output +static inline void _out_buffer(char character, void *buffer, size_t idx, + size_t maxlen) { + if (idx < maxlen) { ((char *)buffer)[idx] = character; } +} + +// internal null output +static inline void _out_null(char character, void *buffer, size_t idx, + size_t maxlen) { + (void)character; + (void)buffer; + (void)idx; + (void)maxlen; +} + +// internal _putchar wrapper +static inline void _out_char(char character, void *buffer, size_t idx, + size_t maxlen) { + (void)buffer; + (void)idx; + (void)maxlen; + if (character) { __libqasan_putchar(character); } +} + +// internal output function wrapper +static inline void _out_fct(char character, void *buffer, size_t idx, + size_t maxlen) { + (void)idx; + (void)maxlen; + if (character) { + // buffer is the output fct pointer + ((out_fct_wrap_type *)buffer) + ->fct(character, ((out_fct_wrap_type *)buffer)->arg); + } +} + +// internal secure strlen +// \return The length of the string (excluding the terminating 0) limited by +// 'maxsize' +static inline unsigned int _strnlen_s(const char *str, size_t maxsize) { + const char *s; + for (s = str; *s && maxsize--; ++s) + ; + return (unsigned int)(s - str); +} + +// internal test if char is a digit (0-9) +// \return true if char is a digit +static inline bool _is_digit(char ch) { + return (ch >= '0') && (ch <= '9'); +} + +// internal ASCII string to unsigned int conversion +static unsigned int _atoi(const char **str) { + unsigned int i = 0U; + while (_is_digit(**str)) { + i = i * 10U + (unsigned int)(*((*str)++) - '0'); + } + return i; +} + +// output the specified string in reverse, taking care of any zero-padding +static size_t _out_rev(out_fct_type out, char *buffer, size_t idx, + size_t maxlen, const char *buf, size_t len, + unsigned int width, unsigned int flags) { + const size_t start_idx = idx; + + // pad spaces up to given width + if (!(flags & FLAGS_LEFT) && !(flags & FLAGS_ZEROPAD)) { + for (size_t i = len; i < width; i++) { + out(' ', buffer, idx++, maxlen); + } + } + + // reverse string + while (len) { + out(buf[--len], buffer, idx++, maxlen); + } + + // append pad spaces up to given width + if (flags & FLAGS_LEFT) { + while (idx - start_idx < width) { + out(' ', buffer, idx++, maxlen); + } + } + + return idx; +} + +// internal itoa format +static size_t _ntoa_format(out_fct_type out, char *buffer, size_t idx, + size_t maxlen, char *buf, size_t len, bool negative, + unsigned int base, unsigned int prec, + unsigned int width, unsigned int flags) { + // pad leading zeros + if (!(flags & FLAGS_LEFT)) { + if (width && (flags & FLAGS_ZEROPAD) && + (negative || (flags & (FLAGS_PLUS | FLAGS_SPACE)))) { + width--; + } + while ((len < prec) && (len < PRINTF_NTOA_BUFFER_SIZE)) { + buf[len++] = '0'; + } + while ((flags & FLAGS_ZEROPAD) && (len < width) && + (len < PRINTF_NTOA_BUFFER_SIZE)) { + buf[len++] = '0'; + } + } + + // handle hash + if (flags & FLAGS_HASH) { + if (!(flags & FLAGS_PRECISION) && len && + ((len == prec) || (len == width))) { + len--; + if (len && (base == 16U)) { len--; } + } + if ((base == 16U) && !(flags & FLAGS_UPPERCASE) && + (len < PRINTF_NTOA_BUFFER_SIZE)) { + buf[len++] = 'x'; + } else if ((base == 16U) && (flags & FLAGS_UPPERCASE) && + (len < PRINTF_NTOA_BUFFER_SIZE)) { + buf[len++] = 'X'; + } else if ((base == 2U) && (len < PRINTF_NTOA_BUFFER_SIZE)) { + buf[len++] = 'b'; + } + if (len < PRINTF_NTOA_BUFFER_SIZE) { buf[len++] = '0'; } + } + + if (len < PRINTF_NTOA_BUFFER_SIZE) { + if (negative) { + buf[len++] = '-'; + } else if (flags & FLAGS_PLUS) { + buf[len++] = '+'; // ignore the space if the '+' exists + } else if (flags & FLAGS_SPACE) { + buf[len++] = ' '; + } + } + + return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags); +} + +// internal itoa for 'long' type +static size_t _ntoa_long(out_fct_type out, char *buffer, size_t idx, + size_t maxlen, unsigned long value, bool negative, + unsigned long base, unsigned int prec, + unsigned int width, unsigned int flags) { + char buf[PRINTF_NTOA_BUFFER_SIZE]; + size_t len = 0U; + + // no hash for 0 values + if (!value) { flags &= ~FLAGS_HASH; } + + // write if precision != 0 and value is != 0 + if (!(flags & FLAGS_PRECISION) || value) { + do { + const char digit = (char)(value % base); + buf[len++] = digit < 10 + ? '0' + digit + : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10; + value /= base; + } while (value && (len < PRINTF_NTOA_BUFFER_SIZE)); + } + + return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, + (unsigned int)base, prec, width, flags); +} + +// internal itoa for 'long long' type +#if defined(PRINTF_SUPPORT_LONG_LONG) +static size_t _ntoa_long_long(out_fct_type out, char *buffer, size_t idx, + size_t maxlen, unsigned long long value, + bool negative, unsigned long long base, + unsigned int prec, unsigned int width, + unsigned int flags) { + char buf[PRINTF_NTOA_BUFFER_SIZE]; + size_t len = 0U; + + // no hash for 0 values + if (!value) { flags &= ~FLAGS_HASH; } + + // write if precision != 0 and value is != 0 + if (!(flags & FLAGS_PRECISION) || value) { + do { + const char digit = (char)(value % base); + buf[len++] = digit < 10 + ? '0' + digit + : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10; + value /= base; + } while (value && (len < PRINTF_NTOA_BUFFER_SIZE)); + } + + return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, + (unsigned int)base, prec, width, flags); +} +#endif // PRINTF_SUPPORT_LONG_LONG + +#if defined(PRINTF_SUPPORT_FLOAT) + + #if defined(PRINTF_SUPPORT_EXPONENTIAL) +// forward declaration so that _ftoa can switch to exp notation for values > +// PRINTF_MAX_FLOAT +static size_t _etoa(out_fct_type out, char *buffer, size_t idx, size_t maxlen, + double value, unsigned int prec, unsigned int width, + unsigned int flags); + #endif + +// internal ftoa for fixed decimal floating point +static size_t _ftoa(out_fct_type out, char *buffer, size_t idx, size_t maxlen, + double value, unsigned int prec, unsigned int width, + unsigned int flags) { + char buf[PRINTF_FTOA_BUFFER_SIZE]; + size_t len = 0U; + double diff = 0.0; + + // powers of 10 + static const double pow10[] = {1, 10, 100, 1000, + 10000, 100000, 1000000, 10000000, + 100000000, 1000000000}; + + // test for special values + if (value != value) + return _out_rev(out, buffer, idx, maxlen, "nan", 3, width, flags); + if (value < -DBL_MAX) + return _out_rev(out, buffer, idx, maxlen, "fni-", 4, width, flags); + if (value > DBL_MAX) + return _out_rev(out, buffer, idx, maxlen, + (flags & FLAGS_PLUS) ? "fni+" : "fni", + (flags & FLAGS_PLUS) ? 4U : 3U, width, flags); + + // test for very large values + // standard printf behavior is to print EVERY whole number digit -- which + // could be 100s of characters overflowing your buffers == bad + if ((value > PRINTF_MAX_FLOAT) || (value < -PRINTF_MAX_FLOAT)) { + #if defined(PRINTF_SUPPORT_EXPONENTIAL) + return _etoa(out, buffer, idx, maxlen, value, prec, width, flags); + #else + return 0U; + #endif + } + + // test for negative + bool negative = false; + if (value < 0) { + negative = true; + value = 0 - value; + } + + // set default precision, if not set explicitly + if (!(flags & FLAGS_PRECISION)) { prec = PRINTF_DEFAULT_FLOAT_PRECISION; } + // limit precision to 9, cause a prec >= 10 can lead to overflow errors + while ((len < PRINTF_FTOA_BUFFER_SIZE) && (prec > 9U)) { + buf[len++] = '0'; + prec--; + } + + int whole = (int)value; + double tmp = (value - whole) * pow10[prec]; + unsigned long frac = (unsigned long)tmp; + diff = tmp - frac; + + if (diff > 0.5) { + ++frac; + // handle rollover, e.g. case 0.99 with prec 1 is 1.0 + if (frac >= pow10[prec]) { + frac = 0; + ++whole; + } + } else if (diff < 0.5) { + } else if ((frac == 0U) || (frac & 1U)) { + // if halfway, round up if odd OR if last digit is 0 + ++frac; + } + + if (prec == 0U) { + diff = value - (double)whole; + if ((!(diff < 0.5) || (diff > 0.5)) && (whole & 1)) { + // exactly 0.5 and ODD, then round up + // 1.5 -> 2, but 2.5 -> 2 + ++whole; + } + } else { + unsigned int count = prec; + // now do fractional part, as an unsigned number + while (len < PRINTF_FTOA_BUFFER_SIZE) { + --count; + buf[len++] = (char)(48U + (frac % 10U)); + if (!(frac /= 10U)) { break; } + } + // add extra 0s + while ((len < PRINTF_FTOA_BUFFER_SIZE) && (count-- > 0U)) { + buf[len++] = '0'; + } + if (len < PRINTF_FTOA_BUFFER_SIZE) { + // add decimal + buf[len++] = '.'; + } + } + + // do whole part, number is reversed + while (len < PRINTF_FTOA_BUFFER_SIZE) { + buf[len++] = (char)(48 + (whole % 10)); + if (!(whole /= 10)) { break; } + } + + // pad leading zeros + if (!(flags & FLAGS_LEFT) && (flags & FLAGS_ZEROPAD)) { + if (width && (negative || (flags & (FLAGS_PLUS | FLAGS_SPACE)))) { + width--; + } + while ((len < width) && (len < PRINTF_FTOA_BUFFER_SIZE)) { + buf[len++] = '0'; + } + } + + if (len < PRINTF_FTOA_BUFFER_SIZE) { + if (negative) { + buf[len++] = '-'; + } else if (flags & FLAGS_PLUS) { + buf[len++] = '+'; // ignore the space if the '+' exists + } else if (flags & FLAGS_SPACE) { + buf[len++] = ' '; + } + } + + return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags); +} + + #if defined(PRINTF_SUPPORT_EXPONENTIAL) +// internal ftoa variant for exponential floating-point type, contributed by +// Martijn Jasperse +static size_t _etoa(out_fct_type out, char *buffer, size_t idx, size_t maxlen, + double value, unsigned int prec, unsigned int width, + unsigned int flags) { + // check for NaN and special values + if ((value != value) || (value > DBL_MAX) || (value < -DBL_MAX)) { + return _ftoa(out, buffer, idx, maxlen, value, prec, width, flags); + } + + // determine the sign + const bool negative = value < 0; + if (negative) { value = -value; } + + // default precision + if (!(flags & FLAGS_PRECISION)) { prec = PRINTF_DEFAULT_FLOAT_PRECISION; } + + // determine the decimal exponent + // based on the algorithm by David Gay (https://www.ampl.com/netlib/fp/dtoa.c) + union { + uint64_t U; + double F; + } conv; + + conv.F = value; + int exp2 = (int)((conv.U >> 52U) & 0x07FFU) - 1023; // effectively log2 + conv.U = (conv.U & ((1ULL << 52U) - 1U)) | + (1023ULL << 52U); // drop the exponent so conv.F is now in [1,2) + // now approximate log10 from the log2 integer part and an expansion of ln + // around 1.5 + int expval = (int)(0.1760912590558 + exp2 * 0.301029995663981 + + (conv.F - 1.5) * 0.289529654602168); + // now we want to compute 10^expval but we want to be sure it won't overflow + exp2 = (int)(expval * 3.321928094887362 + 0.5); + const double z = expval * 2.302585092994046 - exp2 * 0.6931471805599453; + const double z2 = z * z; + conv.U = (uint64_t)(exp2 + 1023) << 52U; + // compute exp(z) using continued fractions, see + // https://en.wikipedia.org/wiki/Exponential_function#Continued_fractions_for_ex + conv.F *= 1 + 2 * z / (2 - z + (z2 / (6 + (z2 / (10 + z2 / 14))))); + // correct for rounding errors + if (value < conv.F) { + expval--; + conv.F /= 10; + } + + // the exponent format is "%+03d" and largest value is "307", so set aside 4-5 + // characters + unsigned int minwidth = ((expval < 100) && (expval > -100)) ? 4U : 5U; + + // in "%g" mode, "prec" is the number of *significant figures* not decimals + if (flags & FLAGS_ADAPT_EXP) { + // do we want to fall-back to "%f" mode? + if ((value >= 1e-4) && (value < 1e6)) { + if ((int)prec > expval) { + prec = (unsigned)((int)prec - expval - 1); + } else { + prec = 0; + } + flags |= FLAGS_PRECISION; // make sure _ftoa respects precision + // no characters in exponent + minwidth = 0U; + expval = 0; + } else { + // we use one sigfig for the whole part + if ((prec > 0) && (flags & FLAGS_PRECISION)) { --prec; } + } + } + + // will everything fit? + unsigned int fwidth = width; + if (width > minwidth) { + // we didn't fall-back so subtract the characters required for the exponent + fwidth -= minwidth; + } else { + // not enough characters, so go back to default sizing + fwidth = 0U; + } + if ((flags & FLAGS_LEFT) && minwidth) { + // if we're padding on the right, DON'T pad the floating part + fwidth = 0U; + } + + // rescale the float value + if (expval) { value /= conv.F; } + + // output the floating part + const size_t start_idx = idx; + idx = _ftoa(out, buffer, idx, maxlen, negative ? -value : value, prec, fwidth, + flags & ~FLAGS_ADAPT_EXP); + + // output the exponent part + if (minwidth) { + // output the exponential symbol + out((flags & FLAGS_UPPERCASE) ? 'E' : 'e', buffer, idx++, maxlen); + // output the exponent value + idx = + _ntoa_long(out, buffer, idx, maxlen, (expval < 0) ? -expval : expval, + expval < 0, 10, 0, minwidth - 1, FLAGS_ZEROPAD | FLAGS_PLUS); + // might need to right-pad spaces + if (flags & FLAGS_LEFT) { + while (idx - start_idx < width) + out(' ', buffer, idx++, maxlen); + } + } + return idx; +} + #endif // PRINTF_SUPPORT_EXPONENTIAL +#endif // PRINTF_SUPPORT_FLOAT + +// internal vsnprintf +static int _vsnprintf(out_fct_type out, char *buffer, const size_t maxlen, + const char *format, va_list va) { + unsigned int flags, width, precision, n; + size_t idx = 0U; + + if (!buffer) { + // use null output function + out = _out_null; + } + + while (*format) { + // format specifier? %[flags][width][.precision][length] + if (*format != '%') { + // no + out(*format, buffer, idx++, maxlen); + format++; + continue; + } else { + // yes, evaluate it + format++; + } + + // evaluate flags + flags = 0U; + do { + switch (*format) { + case '0': + flags |= FLAGS_ZEROPAD; + format++; + n = 1U; + break; + case '-': + flags |= FLAGS_LEFT; + format++; + n = 1U; + break; + case '+': + flags |= FLAGS_PLUS; + format++; + n = 1U; + break; + case ' ': + flags |= FLAGS_SPACE; + format++; + n = 1U; + break; + case '#': + flags |= FLAGS_HASH; + format++; + n = 1U; + break; + default: + n = 0U; + break; + } + } while (n); + + // evaluate width field + width = 0U; + if (_is_digit(*format)) { + width = _atoi(&format); + } else if (*format == '*') { + const int w = va_arg(va, int); + if (w < 0) { + flags |= FLAGS_LEFT; // reverse padding + width = (unsigned int)-w; + } else { + width = (unsigned int)w; + } + format++; + } + + // evaluate precision field + precision = 0U; + if (*format == '.') { + flags |= FLAGS_PRECISION; + format++; + if (_is_digit(*format)) { + precision = _atoi(&format); + } else if (*format == '*') { + const int prec = (int)va_arg(va, int); + precision = prec > 0 ? (unsigned int)prec : 0U; + format++; + } + } + + // evaluate length field + switch (*format) { + case 'l': + flags |= FLAGS_LONG; + format++; + if (*format == 'l') { + flags |= FLAGS_LONG_LONG; + format++; + } + break; + case 'h': + flags |= FLAGS_SHORT; + format++; + if (*format == 'h') { + flags |= FLAGS_CHAR; + format++; + } + break; +#if defined(PRINTF_SUPPORT_PTRDIFF_T) + case 't': + flags |= + (sizeof(ptrdiff_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG); + format++; + break; +#endif + case 'j': + flags |= + (sizeof(intmax_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG); + format++; + break; + case 'z': + flags |= + (sizeof(size_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG); + format++; + break; + default: + break; + } + + // evaluate specifier + switch (*format) { + case 'd': + case 'i': + case 'u': + case 'x': + case 'X': + case 'o': + case 'b': { + // set the base + unsigned int base; + if (*format == 'x' || *format == 'X') { + base = 16U; + } else if (*format == 'o') { + base = 8U; + } else if (*format == 'b') { + base = 2U; + } else { + base = 10U; + flags &= ~FLAGS_HASH; // no hash for dec format + } + // uppercase + if (*format == 'X') { flags |= FLAGS_UPPERCASE; } + + // no plus or space flag for u, x, X, o, b + if ((*format != 'i') && (*format != 'd')) { + flags &= ~(FLAGS_PLUS | FLAGS_SPACE); + } + + // ignore '0' flag when precision is given + if (flags & FLAGS_PRECISION) { flags &= ~FLAGS_ZEROPAD; } + + // convert the integer + if ((*format == 'i') || (*format == 'd')) { + // signed + if (flags & FLAGS_LONG_LONG) { +#if defined(PRINTF_SUPPORT_LONG_LONG) + const long long value = va_arg(va, long long); + idx = _ntoa_long_long( + out, buffer, idx, maxlen, + (unsigned long long)(value > 0 ? value : 0 - value), value < 0, + base, precision, width, flags); +#endif + } else if (flags & FLAGS_LONG) { + const long value = va_arg(va, long); + idx = _ntoa_long(out, buffer, idx, maxlen, + (unsigned long)(value > 0 ? value : 0 - value), + value < 0, base, precision, width, flags); + } else { + const int value = (flags & FLAGS_CHAR) ? (char)va_arg(va, int) + : (flags & FLAGS_SHORT) + ? (short int)va_arg(va, int) + : va_arg(va, int); + idx = _ntoa_long(out, buffer, idx, maxlen, + (unsigned int)(value > 0 ? value : 0 - value), + value < 0, base, precision, width, flags); + } + } else { + // unsigned + if (flags & FLAGS_LONG_LONG) { +#if defined(PRINTF_SUPPORT_LONG_LONG) + idx = _ntoa_long_long(out, buffer, idx, maxlen, + va_arg(va, unsigned long long), false, base, + precision, width, flags); +#endif + } else if (flags & FLAGS_LONG) { + idx = + _ntoa_long(out, buffer, idx, maxlen, va_arg(va, unsigned long), + false, base, precision, width, flags); + } else { + const unsigned int value = + (flags & FLAGS_CHAR) ? (unsigned char)va_arg(va, unsigned int) + : (flags & FLAGS_SHORT) + ? (unsigned short int)va_arg(va, unsigned int) + : va_arg(va, unsigned int); + idx = _ntoa_long(out, buffer, idx, maxlen, value, false, base, + precision, width, flags); + } + } + format++; + break; + } +#if defined(PRINTF_SUPPORT_FLOAT) + case 'f': + case 'F': + if (*format == 'F') flags |= FLAGS_UPPERCASE; + idx = _ftoa(out, buffer, idx, maxlen, va_arg(va, double), precision, + width, flags); + format++; + break; + #if defined(PRINTF_SUPPORT_EXPONENTIAL) + case 'e': + case 'E': + case 'g': + case 'G': + if ((*format == 'g') || (*format == 'G')) flags |= FLAGS_ADAPT_EXP; + if ((*format == 'E') || (*format == 'G')) flags |= FLAGS_UPPERCASE; + idx = _etoa(out, buffer, idx, maxlen, va_arg(va, double), precision, + width, flags); + format++; + break; + #endif // PRINTF_SUPPORT_EXPONENTIAL +#endif // PRINTF_SUPPORT_FLOAT + case 'c': { + unsigned int l = 1U; + // pre padding + if (!(flags & FLAGS_LEFT)) { + while (l++ < width) { + out(' ', buffer, idx++, maxlen); + } + } + // char output + out((char)va_arg(va, int), buffer, idx++, maxlen); + // post padding + if (flags & FLAGS_LEFT) { + while (l++ < width) { + out(' ', buffer, idx++, maxlen); + } + } + format++; + break; + } + + case 's': { + const char *p = va_arg(va, char *); + unsigned int l = _strnlen_s(p, precision ? precision : (size_t)-1); + // pre padding + if (flags & FLAGS_PRECISION) { l = (l < precision ? l : precision); } + if (!(flags & FLAGS_LEFT)) { + while (l++ < width) { + out(' ', buffer, idx++, maxlen); + } + } + // string output + while ((*p != 0) && (!(flags & FLAGS_PRECISION) || precision--)) { + out(*(p++), buffer, idx++, maxlen); + } + // post padding + if (flags & FLAGS_LEFT) { + while (l++ < width) { + out(' ', buffer, idx++, maxlen); + } + } + format++; + break; + } + + case 'p': { + width = sizeof(void *) * 2U; + flags |= FLAGS_ZEROPAD | FLAGS_UPPERCASE; +#if defined(PRINTF_SUPPORT_LONG_LONG) + const bool is_ll = sizeof(uintptr_t) == sizeof(long long); + if (is_ll) { + idx = _ntoa_long_long(out, buffer, idx, maxlen, + (uintptr_t)va_arg(va, void *), false, 16U, + precision, width, flags); + } else { +#endif + idx = _ntoa_long(out, buffer, idx, maxlen, + (unsigned long)((uintptr_t)va_arg(va, void *)), + false, 16U, precision, width, flags); +#if defined(PRINTF_SUPPORT_LONG_LONG) + } +#endif + format++; + break; + } + + case '%': + out('%', buffer, idx++, maxlen); + format++; + break; + + default: + out(*format, buffer, idx++, maxlen); + format++; + break; + } + } + + // termination + out((char)0, buffer, idx < maxlen ? idx : maxlen - 1U, maxlen); + + // return written chars without terminating \0 + return (int)idx; +} + +/////////////////////////////////////////////////////////////////////////////// + +int __libqasan_printf(const char *format, ...) { + va_list va; + va_start(va, format); + char buffer[1]; + const int ret = _vsnprintf(_out_char, buffer, (size_t)-1, format, va); + va_end(va); + return ret; +} + +int __libqasan_sprintf(char *buffer, const char *format, ...) { + va_list va; + va_start(va, format); + const int ret = _vsnprintf(_out_buffer, buffer, (size_t)-1, format, va); + va_end(va); + return ret; +} + +int __libqasan_snprintf(char *buffer, size_t count, const char *format, ...) { + va_list va; + va_start(va, format); + const int ret = _vsnprintf(_out_buffer, buffer, count, format, va); + va_end(va); + return ret; +} + +int __libqasan_vprintf(const char *format, va_list va) { + char buffer[1]; + return _vsnprintf(_out_char, buffer, (size_t)-1, format, va); +} + +int __libqasan_vasprintf(char **restrict strp, const char *restrict format, + va_list va) { + // get the string size + const int len = _vsnprintf(NULL, NULL, (size_t)-1, format, va); + + void *buffer = __libqasan_malloc(len + 1); + *strp = buffer; + const int ret = _vsnprintf(_out_buffer, buffer, len + 1, format, va); + return ret; +} + +int __libqasan_vsnprintf(char *buffer, size_t count, const char *format, + va_list va) { + return _vsnprintf(_out_buffer, buffer, count, format, va); +} + +int __libqasan_fctprintf(void (*out)(char character, void *arg), void *arg, + const char *format, ...) { + va_list va; + va_start(va, format); + const out_fct_wrap_type out_fct_wrap = {out, arg}; + const int ret = _vsnprintf(_out_fct, (char *)(uintptr_t)&out_fct_wrap, + (size_t)-1, format, va); + va_end(va); + return ret; +} + +//////////////////////////////// libqasan internal output buffer putchar + +#include +#include +#include + +static ssize_t reliable_write(int fd, const void *buf, size_t count) { + ssize_t total_written = 0; + ssize_t bytes_written; + + while (total_written < count) { + bytes_written = + syscall(SYS_write, fd, buf + total_written, count - total_written); + + if (bytes_written == -1) { + if (errno == EINTR) { + continue; + } else { + return -1; + } + } else if (bytes_written == 0) { + break; + } else { + total_written += bytes_written; + } + } + + return total_written; +} + +#define INTERNAL_BUF_SIZE 4096 + +static char output_internal_buf[INTERNAL_BUF_SIZE]; +static size_t output_internal_bug_idx = 0; + +void __libqasan_putchar(char character) { + if (output_internal_bug_idx >= INTERNAL_BUF_SIZE) __libqasan_flush(); + + output_internal_buf[output_internal_bug_idx++] = character; +} + +void __libqasan_flush(void) { + reliable_write(2, output_internal_buf, output_internal_bug_idx); + output_internal_bug_idx = 0; +} diff --git a/libafl_qemu/libqasan/printf/printf.h b/crates/libafl_qemu/libqasan/printf/printf.h similarity index 97% rename from libafl_qemu/libqasan/printf/printf.h rename to crates/libafl_qemu/libqasan/printf/printf.h index dc85409af3b..d3b3c52a304 100644 --- a/libafl_qemu/libqasan/printf/printf.h +++ b/crates/libafl_qemu/libqasan/printf/printf.h @@ -1,126 +1,126 @@ -/////////////////////////////////////////////////////////////////////////////// -// \author (c) Marco Paland (info@paland.com) -// 2014-2019, PALANDesign Hannover, Germany -// -// \license The MIT License (MIT) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -// \brief Tiny printf, sprintf and snprintf implementation, optimized for speed -// on -// embedded systems with a very limited resources. -// Use this instead of bloated standard/newlib printf. -// These routines are thread safe and reentrant. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _PRINTF_H_ -#define _PRINTF_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Output a character to a custom device like UART, used by the printf() - * function This function is declared here only. You have to write your custom - * implementation somewhere \param character Character to output - */ -void __libqasan_putchar(char character); - -/** - * Tiny printf implementation - * You have to implement _putchar if you use printf() - * To avoid conflicts with the regular printf() API it is overridden by macro - * defines and internal underscore-appended functions like printf_() are used - * \param format A string that specifies the format of the output - * \return The number of characters that are written into the array, not - * counting the terminating null character - */ -int __libqasan_printf(const char *format, ...); - -/** - * Tiny sprintf implementation - * Due to security reasons (buffer overflow) YOU SHOULD CONSIDER USING - * (V)SNPRINTF INSTEAD! \param buffer A pointer to the buffer where to store the - * formatted string. MUST be big enough to store the output! \param format A - * string that specifies the format of the output \return The number of - * characters that are WRITTEN into the buffer, not counting the terminating - * null character - */ -int __libqasan_sprintf(char *buffer, const char *format, ...); - -/** - * Tiny snprintf/vsnprintf implementation - * \param buffer A pointer to the buffer where to store the formatted string - * \param count The maximum number of characters to store in the buffer, - * including a terminating null character \param format A string that specifies - * the format of the output \param va A value identifying a variable arguments - * list \return The number of characters that COULD have been written into the - * buffer, not counting the terminating null character. A value equal or larger - * than count indicates truncation. Only when the returned value is non-negative - * and less than count, the string has been completely written. - */ -int __libqasan_snprintf(char *buffer, size_t count, const char *format, ...); -int __libqasan_vsnprintf(char *buffer, size_t count, const char *format, - va_list va); - -/** - * Tiny vprintf implementation - * \param format A string that specifies the format of the output - * \param va A value identifying a variable arguments list - * \return The number of characters that are WRITTEN into the buffer, not - * counting the terminating null character - */ -int __libqasan_vprintf(const char *format, va_list va); - -/** - * Tiny vasprintf implementation - * \param strp This function will write the pointer to the allocated string - * \param format A string that specifies the format of the output - * \param va A value identifying a variable arguments list - * \return The number of characters that are WRITTEN into the buffer, not - * counting the terminating null character - */ -int __libqasan_vasprintf(char **restrict strp, const char *restrict format, - va_list va); - -/** - * printf with output function - * You may use this as dynamic alternative to printf() with its fixed _putchar() - * output \param out An output function which takes one character and an - * argument pointer \param arg An argument pointer for user data passed to - * output function \param format A string that specifies the format of the - * output \return The number of characters that are sent to the output function, - * not counting the terminating null character - */ -int __libqasan_fctprintf(void (*out)(char character, void *arg), void *arg, - const char *format, ...); - -// Flush the internal putchat buffer to stderr -void __libqasan_flush(void); - -#ifdef __cplusplus -} -#endif - -#endif // _PRINTF_H_ +/////////////////////////////////////////////////////////////////////////////// +// \author (c) Marco Paland (info@paland.com) +// 2014-2019, PALANDesign Hannover, Germany +// +// \license The MIT License (MIT) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// \brief Tiny printf, sprintf and snprintf implementation, optimized for speed +// on +// embedded systems with a very limited resources. +// Use this instead of bloated standard/newlib printf. +// These routines are thread safe and reentrant. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _PRINTF_H_ +#define _PRINTF_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Output a character to a custom device like UART, used by the printf() + * function This function is declared here only. You have to write your custom + * implementation somewhere \param character Character to output + */ +void __libqasan_putchar(char character); + +/** + * Tiny printf implementation + * You have to implement _putchar if you use printf() + * To avoid conflicts with the regular printf() API it is overridden by macro + * defines and internal underscore-appended functions like printf_() are used + * \param format A string that specifies the format of the output + * \return The number of characters that are written into the array, not + * counting the terminating null character + */ +int __libqasan_printf(const char *format, ...); + +/** + * Tiny sprintf implementation + * Due to security reasons (buffer overflow) YOU SHOULD CONSIDER USING + * (V)SNPRINTF INSTEAD! \param buffer A pointer to the buffer where to store the + * formatted string. MUST be big enough to store the output! \param format A + * string that specifies the format of the output \return The number of + * characters that are WRITTEN into the buffer, not counting the terminating + * null character + */ +int __libqasan_sprintf(char *buffer, const char *format, ...); + +/** + * Tiny snprintf/vsnprintf implementation + * \param buffer A pointer to the buffer where to store the formatted string + * \param count The maximum number of characters to store in the buffer, + * including a terminating null character \param format A string that specifies + * the format of the output \param va A value identifying a variable arguments + * list \return The number of characters that COULD have been written into the + * buffer, not counting the terminating null character. A value equal or larger + * than count indicates truncation. Only when the returned value is non-negative + * and less than count, the string has been completely written. + */ +int __libqasan_snprintf(char *buffer, size_t count, const char *format, ...); +int __libqasan_vsnprintf(char *buffer, size_t count, const char *format, + va_list va); + +/** + * Tiny vprintf implementation + * \param format A string that specifies the format of the output + * \param va A value identifying a variable arguments list + * \return The number of characters that are WRITTEN into the buffer, not + * counting the terminating null character + */ +int __libqasan_vprintf(const char *format, va_list va); + +/** + * Tiny vasprintf implementation + * \param strp This function will write the pointer to the allocated string + * \param format A string that specifies the format of the output + * \param va A value identifying a variable arguments list + * \return The number of characters that are WRITTEN into the buffer, not + * counting the terminating null character + */ +int __libqasan_vasprintf(char **restrict strp, const char *restrict format, + va_list va); + +/** + * printf with output function + * You may use this as dynamic alternative to printf() with its fixed _putchar() + * output \param out An output function which takes one character and an + * argument pointer \param arg An argument pointer for user data passed to + * output function \param format A string that specifies the format of the + * output \return The number of characters that are sent to the output function, + * not counting the terminating null character + */ +int __libqasan_fctprintf(void (*out)(char character, void *arg), void *arg, + const char *format, ...); + +// Flush the internal putchat buffer to stderr +void __libqasan_flush(void); + +#ifdef __cplusplus +} +#endif + +#endif // _PRINTF_H_ diff --git a/libafl_qemu/libqasan/qasan.h b/crates/libafl_qemu/libqasan/qasan.h similarity index 100% rename from libafl_qemu/libqasan/qasan.h rename to crates/libafl_qemu/libqasan/qasan.h diff --git a/libafl_qemu/libqasan/string.c b/crates/libafl_qemu/libqasan/string.c similarity index 100% rename from libafl_qemu/libqasan/string.c rename to crates/libafl_qemu/libqasan/string.c diff --git a/libafl_qemu/libqasan/uninstrument.c b/crates/libafl_qemu/libqasan/uninstrument.c similarity index 100% rename from libafl_qemu/libqasan/uninstrument.c rename to crates/libafl_qemu/libqasan/uninstrument.c diff --git a/libafl_qemu/runtime/libafl_qemu.h b/crates/libafl_qemu/runtime/libafl_qemu.h similarity index 100% rename from libafl_qemu/runtime/libafl_qemu.h rename to crates/libafl_qemu/runtime/libafl_qemu.h diff --git a/libafl_qemu/runtime/libafl_qemu_arch.h b/crates/libafl_qemu/runtime/libafl_qemu_arch.h similarity index 100% rename from libafl_qemu/runtime/libafl_qemu_arch.h rename to crates/libafl_qemu/runtime/libafl_qemu_arch.h diff --git a/libafl_qemu/runtime/libafl_qemu_defs.h b/crates/libafl_qemu/runtime/libafl_qemu_defs.h similarity index 100% rename from libafl_qemu/runtime/libafl_qemu_defs.h rename to crates/libafl_qemu/runtime/libafl_qemu_defs.h diff --git a/libafl_qemu/runtime/libafl_qemu_impl.h b/crates/libafl_qemu/runtime/libafl_qemu_impl.h similarity index 100% rename from libafl_qemu/runtime/libafl_qemu_impl.h rename to crates/libafl_qemu/runtime/libafl_qemu_impl.h diff --git a/libafl_qemu/runtime/libafl_qemu_stub_bindings.rs b/crates/libafl_qemu/runtime/libafl_qemu_stub_bindings.rs similarity index 100% rename from libafl_qemu/runtime/libafl_qemu_stub_bindings.rs rename to crates/libafl_qemu/runtime/libafl_qemu_stub_bindings.rs diff --git a/libafl_qemu/runtime/libafl_qemu_windows.asm b/crates/libafl_qemu/runtime/libafl_qemu_windows.asm similarity index 100% rename from libafl_qemu/runtime/libafl_qemu_windows.asm rename to crates/libafl_qemu/runtime/libafl_qemu_windows.asm diff --git a/libafl_qemu/runtime/nyx_api.h b/crates/libafl_qemu/runtime/nyx_api.h similarity index 100% rename from libafl_qemu/runtime/nyx_api.h rename to crates/libafl_qemu/runtime/nyx_api.h diff --git a/libafl_qemu/runtime/nyx_stub_bindings.rs b/crates/libafl_qemu/runtime/nyx_stub_bindings.rs similarity index 100% rename from libafl_qemu/runtime/nyx_stub_bindings.rs rename to crates/libafl_qemu/runtime/nyx_stub_bindings.rs diff --git a/libafl_qemu/src/arch/aarch64.rs b/crates/libafl_qemu/src/arch/aarch64.rs similarity index 100% rename from libafl_qemu/src/arch/aarch64.rs rename to crates/libafl_qemu/src/arch/aarch64.rs diff --git a/libafl_qemu/src/arch/arm.rs b/crates/libafl_qemu/src/arch/arm.rs similarity index 100% rename from libafl_qemu/src/arch/arm.rs rename to crates/libafl_qemu/src/arch/arm.rs diff --git a/libafl_qemu/src/arch/hexagon.rs b/crates/libafl_qemu/src/arch/hexagon.rs similarity index 100% rename from libafl_qemu/src/arch/hexagon.rs rename to crates/libafl_qemu/src/arch/hexagon.rs diff --git a/libafl_qemu/src/arch/i386.rs b/crates/libafl_qemu/src/arch/i386.rs similarity index 100% rename from libafl_qemu/src/arch/i386.rs rename to crates/libafl_qemu/src/arch/i386.rs diff --git a/libafl_qemu/src/arch/mips.rs b/crates/libafl_qemu/src/arch/mips.rs similarity index 100% rename from libafl_qemu/src/arch/mips.rs rename to crates/libafl_qemu/src/arch/mips.rs diff --git a/libafl_qemu/src/arch/mod.rs b/crates/libafl_qemu/src/arch/mod.rs similarity index 100% rename from libafl_qemu/src/arch/mod.rs rename to crates/libafl_qemu/src/arch/mod.rs diff --git a/libafl_qemu/src/arch/ppc.rs b/crates/libafl_qemu/src/arch/ppc.rs similarity index 100% rename from libafl_qemu/src/arch/ppc.rs rename to crates/libafl_qemu/src/arch/ppc.rs diff --git a/libafl_qemu/src/arch/riscv.rs b/crates/libafl_qemu/src/arch/riscv.rs similarity index 100% rename from libafl_qemu/src/arch/riscv.rs rename to crates/libafl_qemu/src/arch/riscv.rs diff --git a/libafl_qemu/src/arch/x86_64.rs b/crates/libafl_qemu/src/arch/x86_64.rs similarity index 100% rename from libafl_qemu/src/arch/x86_64.rs rename to crates/libafl_qemu/src/arch/x86_64.rs diff --git a/libafl_qemu/src/breakpoint.rs b/crates/libafl_qemu/src/breakpoint.rs similarity index 100% rename from libafl_qemu/src/breakpoint.rs rename to crates/libafl_qemu/src/breakpoint.rs diff --git a/libafl_qemu/src/command/mod.rs b/crates/libafl_qemu/src/command/mod.rs similarity index 100% rename from libafl_qemu/src/command/mod.rs rename to crates/libafl_qemu/src/command/mod.rs diff --git a/libafl_qemu/src/command/nyx.rs b/crates/libafl_qemu/src/command/nyx.rs similarity index 100% rename from libafl_qemu/src/command/nyx.rs rename to crates/libafl_qemu/src/command/nyx.rs diff --git a/libafl_qemu/src/command/parser/mod.rs b/crates/libafl_qemu/src/command/parser/mod.rs similarity index 100% rename from libafl_qemu/src/command/parser/mod.rs rename to crates/libafl_qemu/src/command/parser/mod.rs diff --git a/libafl_qemu/src/command/parser/nyx.rs b/crates/libafl_qemu/src/command/parser/nyx.rs similarity index 100% rename from libafl_qemu/src/command/parser/nyx.rs rename to crates/libafl_qemu/src/command/parser/nyx.rs diff --git a/libafl_qemu/src/elf.rs b/crates/libafl_qemu/src/elf.rs similarity index 100% rename from libafl_qemu/src/elf.rs rename to crates/libafl_qemu/src/elf.rs diff --git a/libafl_qemu/src/emu/builder.rs b/crates/libafl_qemu/src/emu/builder.rs similarity index 100% rename from libafl_qemu/src/emu/builder.rs rename to crates/libafl_qemu/src/emu/builder.rs diff --git a/libafl_qemu/src/emu/drivers/mod.rs b/crates/libafl_qemu/src/emu/drivers/mod.rs similarity index 100% rename from libafl_qemu/src/emu/drivers/mod.rs rename to crates/libafl_qemu/src/emu/drivers/mod.rs diff --git a/libafl_qemu/src/emu/drivers/nyx.rs b/crates/libafl_qemu/src/emu/drivers/nyx.rs similarity index 100% rename from libafl_qemu/src/emu/drivers/nyx.rs rename to crates/libafl_qemu/src/emu/drivers/nyx.rs diff --git a/libafl_qemu/src/emu/hooks.rs b/crates/libafl_qemu/src/emu/hooks.rs similarity index 100% rename from libafl_qemu/src/emu/hooks.rs rename to crates/libafl_qemu/src/emu/hooks.rs diff --git a/libafl_qemu/src/emu/mod.rs b/crates/libafl_qemu/src/emu/mod.rs similarity index 100% rename from libafl_qemu/src/emu/mod.rs rename to crates/libafl_qemu/src/emu/mod.rs diff --git a/libafl_qemu/src/emu/snapshot.rs b/crates/libafl_qemu/src/emu/snapshot.rs similarity index 100% rename from libafl_qemu/src/emu/snapshot.rs rename to crates/libafl_qemu/src/emu/snapshot.rs diff --git a/libafl_qemu/src/emu/systemmode.rs b/crates/libafl_qemu/src/emu/systemmode.rs similarity index 100% rename from libafl_qemu/src/emu/systemmode.rs rename to crates/libafl_qemu/src/emu/systemmode.rs diff --git a/libafl_qemu/src/emu/usermode.rs b/crates/libafl_qemu/src/emu/usermode.rs similarity index 100% rename from libafl_qemu/src/emu/usermode.rs rename to crates/libafl_qemu/src/emu/usermode.rs diff --git a/libafl_qemu/src/executor.rs b/crates/libafl_qemu/src/executor.rs similarity index 100% rename from libafl_qemu/src/executor.rs rename to crates/libafl_qemu/src/executor.rs diff --git a/libafl_qemu/src/lib.rs b/crates/libafl_qemu/src/lib.rs similarity index 98% rename from libafl_qemu/src/lib.rs rename to crates/libafl_qemu/src/lib.rs index 1a17b91c54a..6a3ad215724 100644 --- a/libafl_qemu/src/lib.rs +++ b/crates/libafl_qemu/src/lib.rs @@ -2,7 +2,7 @@ //! //! __Warning__: The documentation is built by default for `x86_64` in `usermode`. To access the documentation of other architectures or `systemmode`, the documentation must be rebuilt with the right features. /*! */ -#![doc = include_str!("../README.md")] +#![doc = include_str!("../../../README.md")] #![cfg_attr(feature = "document-features", doc = document_features::document_features!())] // libafl_qemu only supports Linux currently #![cfg(target_os = "linux")] diff --git a/libafl_qemu/src/modules/calls.rs b/crates/libafl_qemu/src/modules/calls.rs similarity index 100% rename from libafl_qemu/src/modules/calls.rs rename to crates/libafl_qemu/src/modules/calls.rs diff --git a/libafl_qemu/src/modules/cmplog.rs b/crates/libafl_qemu/src/modules/cmplog.rs similarity index 100% rename from libafl_qemu/src/modules/cmplog.rs rename to crates/libafl_qemu/src/modules/cmplog.rs diff --git a/libafl_qemu/src/modules/drcov.rs b/crates/libafl_qemu/src/modules/drcov.rs similarity index 100% rename from libafl_qemu/src/modules/drcov.rs rename to crates/libafl_qemu/src/modules/drcov.rs diff --git a/libafl_qemu/src/modules/edges/child.rs b/crates/libafl_qemu/src/modules/edges/child.rs similarity index 100% rename from libafl_qemu/src/modules/edges/child.rs rename to crates/libafl_qemu/src/modules/edges/child.rs diff --git a/libafl_qemu/src/modules/edges/classic.rs b/crates/libafl_qemu/src/modules/edges/classic.rs similarity index 100% rename from libafl_qemu/src/modules/edges/classic.rs rename to crates/libafl_qemu/src/modules/edges/classic.rs diff --git a/libafl_qemu/src/modules/edges/full.rs b/crates/libafl_qemu/src/modules/edges/full.rs similarity index 100% rename from libafl_qemu/src/modules/edges/full.rs rename to crates/libafl_qemu/src/modules/edges/full.rs diff --git a/libafl_qemu/src/modules/edges/helpers.rs b/crates/libafl_qemu/src/modules/edges/helpers.rs similarity index 100% rename from libafl_qemu/src/modules/edges/helpers.rs rename to crates/libafl_qemu/src/modules/edges/helpers.rs diff --git a/libafl_qemu/src/modules/edges/mod.rs b/crates/libafl_qemu/src/modules/edges/mod.rs similarity index 100% rename from libafl_qemu/src/modules/edges/mod.rs rename to crates/libafl_qemu/src/modules/edges/mod.rs diff --git a/libafl_qemu/src/modules/logger.rs b/crates/libafl_qemu/src/modules/logger.rs similarity index 100% rename from libafl_qemu/src/modules/logger.rs rename to crates/libafl_qemu/src/modules/logger.rs diff --git a/libafl_qemu/src/modules/mod.rs b/crates/libafl_qemu/src/modules/mod.rs similarity index 100% rename from libafl_qemu/src/modules/mod.rs rename to crates/libafl_qemu/src/modules/mod.rs diff --git a/libafl_qemu/src/modules/systemmode/intel_pt.rs b/crates/libafl_qemu/src/modules/systemmode/intel_pt.rs similarity index 100% rename from libafl_qemu/src/modules/systemmode/intel_pt.rs rename to crates/libafl_qemu/src/modules/systemmode/intel_pt.rs diff --git a/libafl_qemu/src/modules/systemmode/mod.rs b/crates/libafl_qemu/src/modules/systemmode/mod.rs similarity index 100% rename from libafl_qemu/src/modules/systemmode/mod.rs rename to crates/libafl_qemu/src/modules/systemmode/mod.rs diff --git a/libafl_qemu/src/modules/usermode/asan_guest.rs b/crates/libafl_qemu/src/modules/usermode/asan_guest.rs similarity index 100% rename from libafl_qemu/src/modules/usermode/asan_guest.rs rename to crates/libafl_qemu/src/modules/usermode/asan_guest.rs diff --git a/libafl_qemu/src/modules/usermode/asan_host.rs b/crates/libafl_qemu/src/modules/usermode/asan_host.rs similarity index 100% rename from libafl_qemu/src/modules/usermode/asan_host.rs rename to crates/libafl_qemu/src/modules/usermode/asan_host.rs diff --git a/libafl_qemu/src/modules/usermode/injections.rs b/crates/libafl_qemu/src/modules/usermode/injections.rs similarity index 100% rename from libafl_qemu/src/modules/usermode/injections.rs rename to crates/libafl_qemu/src/modules/usermode/injections.rs diff --git a/libafl_qemu/src/modules/usermode/mod.rs b/crates/libafl_qemu/src/modules/usermode/mod.rs similarity index 100% rename from libafl_qemu/src/modules/usermode/mod.rs rename to crates/libafl_qemu/src/modules/usermode/mod.rs diff --git a/libafl_qemu/src/modules/usermode/redirect_stdin.rs b/crates/libafl_qemu/src/modules/usermode/redirect_stdin.rs similarity index 100% rename from libafl_qemu/src/modules/usermode/redirect_stdin.rs rename to crates/libafl_qemu/src/modules/usermode/redirect_stdin.rs diff --git a/libafl_qemu/src/modules/usermode/redirect_stdout.rs b/crates/libafl_qemu/src/modules/usermode/redirect_stdout.rs similarity index 100% rename from libafl_qemu/src/modules/usermode/redirect_stdout.rs rename to crates/libafl_qemu/src/modules/usermode/redirect_stdout.rs diff --git a/libafl_qemu/src/modules/usermode/snapshot.rs b/crates/libafl_qemu/src/modules/usermode/snapshot.rs similarity index 100% rename from libafl_qemu/src/modules/usermode/snapshot.rs rename to crates/libafl_qemu/src/modules/usermode/snapshot.rs diff --git a/libafl_qemu/src/modules/utils/addr2line.rs b/crates/libafl_qemu/src/modules/utils/addr2line.rs similarity index 100% rename from libafl_qemu/src/modules/utils/addr2line.rs rename to crates/libafl_qemu/src/modules/utils/addr2line.rs diff --git a/libafl_qemu/src/modules/utils/filters.rs b/crates/libafl_qemu/src/modules/utils/filters.rs similarity index 100% rename from libafl_qemu/src/modules/utils/filters.rs rename to crates/libafl_qemu/src/modules/utils/filters.rs diff --git a/libafl_qemu/src/modules/utils/mod.rs b/crates/libafl_qemu/src/modules/utils/mod.rs similarity index 100% rename from libafl_qemu/src/modules/utils/mod.rs rename to crates/libafl_qemu/src/modules/utils/mod.rs diff --git a/libafl_qemu/src/qemu/config.rs b/crates/libafl_qemu/src/qemu/config.rs similarity index 100% rename from libafl_qemu/src/qemu/config.rs rename to crates/libafl_qemu/src/qemu/config.rs diff --git a/libafl_qemu/src/qemu/error.rs b/crates/libafl_qemu/src/qemu/error.rs similarity index 100% rename from libafl_qemu/src/qemu/error.rs rename to crates/libafl_qemu/src/qemu/error.rs diff --git a/libafl_qemu/src/qemu/hooks.rs b/crates/libafl_qemu/src/qemu/hooks.rs similarity index 100% rename from libafl_qemu/src/qemu/hooks.rs rename to crates/libafl_qemu/src/qemu/hooks.rs diff --git a/libafl_qemu/src/qemu/mod.rs b/crates/libafl_qemu/src/qemu/mod.rs similarity index 100% rename from libafl_qemu/src/qemu/mod.rs rename to crates/libafl_qemu/src/qemu/mod.rs diff --git a/libafl_qemu/src/qemu/systemmode.rs b/crates/libafl_qemu/src/qemu/systemmode.rs similarity index 100% rename from libafl_qemu/src/qemu/systemmode.rs rename to crates/libafl_qemu/src/qemu/systemmode.rs diff --git a/libafl_qemu/src/qemu/usermode.rs b/crates/libafl_qemu/src/qemu/usermode.rs similarity index 100% rename from libafl_qemu/src/qemu/usermode.rs rename to crates/libafl_qemu/src/qemu/usermode.rs diff --git a/libafl_qemu/src/sync_exit.rs b/crates/libafl_qemu/src/sync_exit.rs similarity index 100% rename from libafl_qemu/src/sync_exit.rs rename to crates/libafl_qemu/src/sync_exit.rs diff --git a/libafl_sugar/Cargo.toml b/crates/libafl_sugar/Cargo.toml similarity index 98% rename from libafl_sugar/Cargo.toml rename to crates/libafl_sugar/Cargo.toml index ea66e85e6f9..49e712d0420 100644 --- a/libafl_sugar/Cargo.toml +++ b/crates/libafl_sugar/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Andrea Fioraldi "] description = "Sugar builders to create common fuzzers with LibAFL" documentation = "https://docs.rs/libafl_sugar" repository = "https://github.com/AFLplusplus/LibAFL/" -readme = "../README.md" +readme = "../../README.md" license = "MIT OR Apache-2.0" keywords = ["fuzzing"] edition = "2024" diff --git a/libafl_sugar/build.rs b/crates/libafl_sugar/build.rs similarity index 100% rename from libafl_sugar/build.rs rename to crates/libafl_sugar/build.rs diff --git a/libafl_sugar/src/forkserver.rs b/crates/libafl_sugar/src/forkserver.rs similarity index 100% rename from libafl_sugar/src/forkserver.rs rename to crates/libafl_sugar/src/forkserver.rs diff --git a/libafl_sugar/src/inprocess.rs b/crates/libafl_sugar/src/inprocess.rs similarity index 100% rename from libafl_sugar/src/inprocess.rs rename to crates/libafl_sugar/src/inprocess.rs diff --git a/libafl_sugar/src/lib.rs b/crates/libafl_sugar/src/lib.rs similarity index 100% rename from libafl_sugar/src/lib.rs rename to crates/libafl_sugar/src/lib.rs diff --git a/libafl_sugar/src/qemu.rs b/crates/libafl_sugar/src/qemu.rs similarity index 100% rename from libafl_sugar/src/qemu.rs rename to crates/libafl_sugar/src/qemu.rs diff --git a/libafl_targets/Cargo.toml b/crates/libafl_targets/Cargo.toml similarity index 99% rename from libafl_targets/Cargo.toml rename to crates/libafl_targets/Cargo.toml index 60eb089fcde..4fec14199dd 100644 --- a/libafl_targets/Cargo.toml +++ b/crates/libafl_targets/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Andrea Fioraldi "] description = "Common code for target instrumentation that can be used combined with LibAFL" documentation = "https://docs.rs/libafl_targets" repository = "https://github.com/AFLplusplus/LibAFL/" -readme = "../README.md" +readme = "../../README.md" license = "MIT OR Apache-2.0" keywords = ["fuzzing", "testing"] edition = "2024" diff --git a/libafl_targets/LICENSE-APACHE b/crates/libafl_targets/LICENSE-APACHE similarity index 100% rename from libafl_targets/LICENSE-APACHE rename to crates/libafl_targets/LICENSE-APACHE diff --git a/libafl_targets/LICENSE-MIT b/crates/libafl_targets/LICENSE-MIT similarity index 100% rename from libafl_targets/LICENSE-MIT rename to crates/libafl_targets/LICENSE-MIT diff --git a/libafl_targets/build.rs b/crates/libafl_targets/build.rs similarity index 100% rename from libafl_targets/build.rs rename to crates/libafl_targets/build.rs diff --git a/libafl_targets/src/android-ashmem.h b/crates/libafl_targets/src/android-ashmem.h similarity index 100% rename from libafl_targets/src/android-ashmem.h rename to crates/libafl_targets/src/android-ashmem.h diff --git a/libafl_targets/src/call.rs b/crates/libafl_targets/src/call.rs similarity index 100% rename from libafl_targets/src/call.rs rename to crates/libafl_targets/src/call.rs diff --git a/libafl_targets/src/cmplog.c b/crates/libafl_targets/src/cmplog.c similarity index 100% rename from libafl_targets/src/cmplog.c rename to crates/libafl_targets/src/cmplog.c diff --git a/libafl_targets/src/cmplog.h b/crates/libafl_targets/src/cmplog.h similarity index 100% rename from libafl_targets/src/cmplog.h rename to crates/libafl_targets/src/cmplog.h diff --git a/libafl_targets/src/cmps/mod.rs b/crates/libafl_targets/src/cmps/mod.rs similarity index 100% rename from libafl_targets/src/cmps/mod.rs rename to crates/libafl_targets/src/cmps/mod.rs diff --git a/libafl_targets/src/cmps/observers/aflpp.rs b/crates/libafl_targets/src/cmps/observers/aflpp.rs similarity index 100% rename from libafl_targets/src/cmps/observers/aflpp.rs rename to crates/libafl_targets/src/cmps/observers/aflpp.rs diff --git a/libafl_targets/src/cmps/observers/cmplog.rs b/crates/libafl_targets/src/cmps/observers/cmplog.rs similarity index 100% rename from libafl_targets/src/cmps/observers/cmplog.rs rename to crates/libafl_targets/src/cmps/observers/cmplog.rs diff --git a/libafl_targets/src/cmps/observers/mod.rs b/crates/libafl_targets/src/cmps/observers/mod.rs similarity index 100% rename from libafl_targets/src/cmps/observers/mod.rs rename to crates/libafl_targets/src/cmps/observers/mod.rs diff --git a/libafl_targets/src/cmps/stages/aflpptracing.rs b/crates/libafl_targets/src/cmps/stages/aflpptracing.rs similarity index 100% rename from libafl_targets/src/cmps/stages/aflpptracing.rs rename to crates/libafl_targets/src/cmps/stages/aflpptracing.rs diff --git a/libafl_targets/src/cmps/stages/mod.rs b/crates/libafl_targets/src/cmps/stages/mod.rs similarity index 100% rename from libafl_targets/src/cmps/stages/mod.rs rename to crates/libafl_targets/src/cmps/stages/mod.rs diff --git a/libafl_targets/src/common.c b/crates/libafl_targets/src/common.c similarity index 100% rename from libafl_targets/src/common.c rename to crates/libafl_targets/src/common.c diff --git a/libafl_targets/src/common.h b/crates/libafl_targets/src/common.h similarity index 100% rename from libafl_targets/src/common.h rename to crates/libafl_targets/src/common.h diff --git a/libafl_targets/src/coverage.c b/crates/libafl_targets/src/coverage.c similarity index 100% rename from libafl_targets/src/coverage.c rename to crates/libafl_targets/src/coverage.c diff --git a/libafl_targets/src/coverage.rs b/crates/libafl_targets/src/coverage.rs similarity index 100% rename from libafl_targets/src/coverage.rs rename to crates/libafl_targets/src/coverage.rs diff --git a/libafl_targets/src/drcov.rs b/crates/libafl_targets/src/drcov.rs similarity index 100% rename from libafl_targets/src/drcov.rs rename to crates/libafl_targets/src/drcov.rs diff --git a/libafl_targets/src/forkserver.rs b/crates/libafl_targets/src/forkserver.rs similarity index 100% rename from libafl_targets/src/forkserver.rs rename to crates/libafl_targets/src/forkserver.rs diff --git a/libafl_targets/src/lib.rs b/crates/libafl_targets/src/lib.rs similarity index 100% rename from libafl_targets/src/lib.rs rename to crates/libafl_targets/src/lib.rs diff --git a/libafl_targets/src/libfuzzer.c b/crates/libafl_targets/src/libfuzzer.c similarity index 100% rename from libafl_targets/src/libfuzzer.c rename to crates/libafl_targets/src/libfuzzer.c diff --git a/libafl_targets/src/libfuzzer/FuzzerInterceptors.cpp b/crates/libafl_targets/src/libfuzzer/FuzzerInterceptors.cpp similarity index 100% rename from libafl_targets/src/libfuzzer/FuzzerInterceptors.cpp rename to crates/libafl_targets/src/libfuzzer/FuzzerInterceptors.cpp diff --git a/libafl_targets/src/libfuzzer/mod.rs b/crates/libafl_targets/src/libfuzzer/mod.rs similarity index 100% rename from libafl_targets/src/libfuzzer/mod.rs rename to crates/libafl_targets/src/libfuzzer/mod.rs diff --git a/libafl_targets/src/libfuzzer/mutators.rs b/crates/libafl_targets/src/libfuzzer/mutators.rs similarity index 100% rename from libafl_targets/src/libfuzzer/mutators.rs rename to crates/libafl_targets/src/libfuzzer/mutators.rs diff --git a/libafl_targets/src/libfuzzer/observers/mod.rs b/crates/libafl_targets/src/libfuzzer/observers/mod.rs similarity index 100% rename from libafl_targets/src/libfuzzer/observers/mod.rs rename to crates/libafl_targets/src/libfuzzer/observers/mod.rs diff --git a/libafl_targets/src/libfuzzer/observers/oom.rs b/crates/libafl_targets/src/libfuzzer/observers/oom.rs similarity index 100% rename from libafl_targets/src/libfuzzer/observers/oom.rs rename to crates/libafl_targets/src/libfuzzer/observers/oom.rs diff --git a/libafl_targets/src/sancov_8bit.rs b/crates/libafl_targets/src/sancov_8bit.rs similarity index 100% rename from libafl_targets/src/sancov_8bit.rs rename to crates/libafl_targets/src/sancov_8bit.rs diff --git a/libafl_targets/src/sancov_cmp.c b/crates/libafl_targets/src/sancov_cmp.c similarity index 100% rename from libafl_targets/src/sancov_cmp.c rename to crates/libafl_targets/src/sancov_cmp.c diff --git a/libafl_targets/src/sancov_cmp.rs b/crates/libafl_targets/src/sancov_cmp.rs similarity index 100% rename from libafl_targets/src/sancov_cmp.rs rename to crates/libafl_targets/src/sancov_cmp.rs diff --git a/libafl_targets/src/sancov_pcguard.rs b/crates/libafl_targets/src/sancov_pcguard.rs similarity index 100% rename from libafl_targets/src/sancov_pcguard.rs rename to crates/libafl_targets/src/sancov_pcguard.rs diff --git a/libafl_targets/src/sanitizer_interfaces.h b/crates/libafl_targets/src/sanitizer_interfaces.h similarity index 100% rename from libafl_targets/src/sanitizer_interfaces.h rename to crates/libafl_targets/src/sanitizer_interfaces.h diff --git a/libafl_targets/src/value_profile.h b/crates/libafl_targets/src/value_profile.h similarity index 100% rename from libafl_targets/src/value_profile.h rename to crates/libafl_targets/src/value_profile.h diff --git a/libafl_targets/src/value_profile.rs b/crates/libafl_targets/src/value_profile.rs similarity index 100% rename from libafl_targets/src/value_profile.rs rename to crates/libafl_targets/src/value_profile.rs diff --git a/libafl_targets/src/windows_asan.c b/crates/libafl_targets/src/windows_asan.c similarity index 100% rename from libafl_targets/src/windows_asan.c rename to crates/libafl_targets/src/windows_asan.c diff --git a/libafl_targets/src/windows_asan.rs b/crates/libafl_targets/src/windows_asan.rs similarity index 100% rename from libafl_targets/src/windows_asan.rs rename to crates/libafl_targets/src/windows_asan.rs diff --git a/libafl_tinyinst/Cargo.toml b/crates/libafl_tinyinst/Cargo.toml similarity index 100% rename from libafl_tinyinst/Cargo.toml rename to crates/libafl_tinyinst/Cargo.toml diff --git a/libafl_tinyinst/README.md b/crates/libafl_tinyinst/README.md similarity index 60% rename from libafl_tinyinst/README.md rename to crates/libafl_tinyinst/README.md index 649e1da19c3..d463404f647 100644 --- a/libafl_tinyinst/README.md +++ b/crates/libafl_tinyinst/README.md @@ -1,4 +1,9 @@ -# Requirements +# LibAFL TinyInst + +`TinyInst` binary-only instrumentation backend for `LibAFL`. + +## Requirements + - `Visual Studio 17 2022`. It's not tested, it *should* work on older versions too. - `cxxbridge-cmd` to generate bridge files between Rust and c++, you can install this with `cargo install cxxbridge-cmd`. -- `cmake` is needed to build tinyinst. \ No newline at end of file +- `cmake` is needed to build tinyinst. diff --git a/libafl_tinyinst/src/executor.rs b/crates/libafl_tinyinst/src/executor.rs similarity index 100% rename from libafl_tinyinst/src/executor.rs rename to crates/libafl_tinyinst/src/executor.rs diff --git a/libafl_tinyinst/src/lib.rs b/crates/libafl_tinyinst/src/lib.rs similarity index 100% rename from libafl_tinyinst/src/lib.rs rename to crates/libafl_tinyinst/src/lib.rs diff --git a/libafl_unicorn/Cargo.toml b/crates/libafl_unicorn/Cargo.toml similarity index 95% rename from libafl_unicorn/Cargo.toml rename to crates/libafl_unicorn/Cargo.toml index d9cbf84bbba..eee563138a8 100644 --- a/libafl_unicorn/Cargo.toml +++ b/crates/libafl_unicorn/Cargo.toml @@ -5,7 +5,7 @@ authors = [""] description = "Unicorn backend library for LibAFL" documentation = "https://docs.rs/" repository = "https://github.com/AFLplusplus/" -readme = "../README.md" +readme = "../../README.md" license = "MIT OR Apache-2.0" keywords = ["fuzzing", "unicorn"] edition = "2024" diff --git a/libafl_unicorn/src/emu.rs b/crates/libafl_unicorn/src/emu.rs similarity index 100% rename from libafl_unicorn/src/emu.rs rename to crates/libafl_unicorn/src/emu.rs diff --git a/libafl_unicorn/src/helper.rs b/crates/libafl_unicorn/src/helper.rs similarity index 100% rename from libafl_unicorn/src/helper.rs rename to crates/libafl_unicorn/src/helper.rs diff --git a/libafl_unicorn/src/hooks.rs b/crates/libafl_unicorn/src/hooks.rs similarity index 100% rename from libafl_unicorn/src/hooks.rs rename to crates/libafl_unicorn/src/hooks.rs diff --git a/libafl_unicorn/src/lib.rs b/crates/libafl_unicorn/src/lib.rs similarity index 100% rename from libafl_unicorn/src/lib.rs rename to crates/libafl_unicorn/src/lib.rs diff --git a/docs/listings/baby_fuzzer/listing-02/Cargo.toml b/docs/listings/baby_fuzzer/listing-02/Cargo.toml index 657aff90a77..e79dd0c4ec4 100644 --- a/docs/listings/baby_fuzzer/listing-02/Cargo.toml +++ b/docs/listings/baby_fuzzer/listing-02/Cargo.toml @@ -8,6 +8,6 @@ edition = "2024" [dependencies] #libafl = { version = ".." } -libafl = { path = "../../../../libafl" } +libafl = { path = "../../../../crates/libafl" } #libafl_bolts = { version = ".." } -libafl_bolts = { path = "../../../../libafl_bolts" } +libafl_bolts = { path = "../../../../crates/libafl_bolts" } diff --git a/docs/listings/baby_fuzzer/listing-03/Cargo.toml b/docs/listings/baby_fuzzer/listing-03/Cargo.toml index 487b1bff771..94d184d2395 100644 --- a/docs/listings/baby_fuzzer/listing-03/Cargo.toml +++ b/docs/listings/baby_fuzzer/listing-03/Cargo.toml @@ -11,6 +11,6 @@ test-panic = [] [dependencies] #libafl = { version = ".." } -libafl = { path = "../../../../libafl" } +libafl = { path = "../../../../crates/libafl" } #libafl_bolts = { version = ".." } -libafl_bolts = { path = "../../../../libafl_bolts" } +libafl_bolts = { path = "../../../../crates/libafl_bolts" } diff --git a/docs/listings/baby_fuzzer/listing-04/Cargo.toml b/docs/listings/baby_fuzzer/listing-04/Cargo.toml index df1b717c8cc..fb9734b8483 100644 --- a/docs/listings/baby_fuzzer/listing-04/Cargo.toml +++ b/docs/listings/baby_fuzzer/listing-04/Cargo.toml @@ -11,6 +11,6 @@ test-panic = [] [dependencies] #libafl = { version = ".." } -libafl = { path = "../../../../libafl" } +libafl = { path = "../../../../crates/libafl" } #libafl_bolts = { version = ".." } -libafl_bolts = { path = "../../../../libafl_bolts" } +libafl_bolts = { path = "../../../../crates/libafl_bolts" } diff --git a/docs/listings/baby_fuzzer/listing-05/Cargo.toml b/docs/listings/baby_fuzzer/listing-05/Cargo.toml index 3ffc824053e..4ea9fdabb18 100644 --- a/docs/listings/baby_fuzzer/listing-05/Cargo.toml +++ b/docs/listings/baby_fuzzer/listing-05/Cargo.toml @@ -11,6 +11,6 @@ test-panic = [] [dependencies] #libafl = { version = ".." } -libafl = { path = "../../../../libafl" } +libafl = { path = "../../../../crates/libafl" } #libafl_bolts = { version = ".." } -libafl_bolts = { path = "../../../../libafl_bolts" } +libafl_bolts = { path = "../../../../crates/libafl_bolts" } diff --git a/docs/listings/baby_fuzzer/listing-06/Cargo.toml b/docs/listings/baby_fuzzer/listing-06/Cargo.toml index 5a319a2987f..67aed0d0a04 100644 --- a/docs/listings/baby_fuzzer/listing-06/Cargo.toml +++ b/docs/listings/baby_fuzzer/listing-06/Cargo.toml @@ -11,6 +11,6 @@ test-panic = [] [dependencies] #libafl = { version = ".." } -libafl = { path = "../../../../libafl" } +libafl = { path = "../../../../crates/libafl" } #libafl_bolts = { version = ".." } -libafl_bolts = { path = "../../../../libafl_bolts" } +libafl_bolts = { path = "../../../../crates/libafl_bolts" } diff --git a/docs/src/message_passing/message_passing.md b/docs/src/message_passing/message_passing.md index c298c887f8c..5dc4cf7ad01 100644 --- a/docs/src/message_passing/message_passing.md +++ b/docs/src/message_passing/message_passing.md @@ -75,7 +75,7 @@ So the outgoing messages flow is like this over the outgoing broadcast `Shmem`: To use `LLMP` in LibAFL, you usually want to use an `LlmpRestartingEventManager` or its restarting variant. They are the default if using LibAFL's `Launcher`. -If you should want to use `LLMP` in its raw form, without any `LibAFL` abstractions, take a look at the `llmp_test` example in [./libafl/examples](https://github.com/AFLplusplus/LibAFL/blob/main/libafl_bolts/examples/llmp_test/main.rs). +If you should want to use `LLMP` in its raw form, without any `LibAFL` abstractions, take a look at the `llmp_test` example in [./crates/libafl/examples](https://github.com/AFLplusplus/LibAFL/blob/main/libafl_bolts/examples/llmp_test/main.rs). You can run the example using `cargo run --example llmp_test` with the appropriate modes, as indicated by its help output. First, you will have to create a broker using `LlmpBroker::new()`. Then, create some `LlmpClient`s in other threads and register them with the main thread using `LlmpBroker::register_client`. diff --git a/fuzzers/baby/baby_fuzzer/Cargo.toml b/fuzzers/baby/baby_fuzzer/Cargo.toml index 973ff8ee3bf..6192692fedd 100644 --- a/fuzzers/baby/baby_fuzzer/Cargo.toml +++ b/fuzzers/baby/baby_fuzzer/Cargo.toml @@ -24,6 +24,6 @@ debug = true [dependencies] env_logger = "0.11.7" -libafl = { path = "../../../libafl", features = ["tui_monitor"] } -libafl_bolts = { path = "../../../libafl_bolts" } +libafl = { path = "../../../crates/libafl", features = ["tui_monitor"] } +libafl_bolts = { path = "../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/baby/baby_fuzzer_custom_executor/Cargo.toml b/fuzzers/baby/baby_fuzzer_custom_executor/Cargo.toml index 3ee6b07e9b4..945c1a07e6f 100644 --- a/fuzzers/baby/baby_fuzzer_custom_executor/Cargo.toml +++ b/fuzzers/baby/baby_fuzzer_custom_executor/Cargo.toml @@ -24,5 +24,5 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl/" } -libafl_bolts = { path = "../../../libafl_bolts/" } +libafl = { path = "../../../crates/libafl/" } +libafl_bolts = { path = "../../../crates/libafl_bolts/" } diff --git a/fuzzers/baby/baby_fuzzer_minimizing/Cargo.toml b/fuzzers/baby/baby_fuzzer_minimizing/Cargo.toml index 68b7faa21c4..cdcd4a0deec 100644 --- a/fuzzers/baby/baby_fuzzer_minimizing/Cargo.toml +++ b/fuzzers/baby/baby_fuzzer_minimizing/Cargo.toml @@ -24,6 +24,6 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl", features = ["prelude"] } -libafl_bolts = { path = "../../../libafl_bolts", features = ["prelude"] } +libafl = { path = "../../../crates/libafl", features = ["prelude"] } +libafl_bolts = { path = "../../../crates/libafl_bolts", features = ["prelude"] } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/baby/baby_fuzzer_swap_differential/Cargo.toml b/fuzzers/baby/baby_fuzzer_swap_differential/Cargo.toml index fffe8838378..b730c46024c 100644 --- a/fuzzers/baby/baby_fuzzer_swap_differential/Cargo.toml +++ b/fuzzers/baby/baby_fuzzer_swap_differential/Cargo.toml @@ -25,9 +25,9 @@ bindgen = "0.71.1" cc = "=1.2.7" # fix me later [dependencies] -libafl = { path = "../../../libafl", features = ["tui_monitor"] } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl", features = ["tui_monitor"] } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "libfuzzer", "sancov_cmplog", @@ -36,7 +36,7 @@ libafl_targets = { path = "../../../libafl_targets", features = [ log = { version = "0.4.22", features = ["release_max_level_info"] } mimalloc = { version = "0.1.43", default-features = false } -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } [[bin]] name = "fuzzer_sd" diff --git a/fuzzers/baby/baby_fuzzer_unicode/Cargo.toml b/fuzzers/baby/baby_fuzzer_unicode/Cargo.toml index 1b0bd0ef83d..f6d12e66d4a 100644 --- a/fuzzers/baby/baby_fuzzer_unicode/Cargo.toml +++ b/fuzzers/baby/baby_fuzzer_unicode/Cargo.toml @@ -23,6 +23,9 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl", features = ["unicode", "tui_monitor"] } -libafl_bolts = { path = "../../../libafl_bolts" } +libafl = { path = "../../../crates/libafl", features = [ + "unicode", + "tui_monitor", +] } +libafl_bolts = { path = "../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/baby/backtrace_baby_fuzzers/c_code_with_fork_executor/Cargo.toml b/fuzzers/baby/backtrace_baby_fuzzers/c_code_with_fork_executor/Cargo.toml index e65f51d7b93..e7523577baa 100644 --- a/fuzzers/baby/backtrace_baby_fuzzers/c_code_with_fork_executor/Cargo.toml +++ b/fuzzers/baby/backtrace_baby_fuzzers/c_code_with_fork_executor/Cargo.toml @@ -15,8 +15,8 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../../libafl" } -libafl_bolts = { path = "../../../../libafl_bolts" } +libafl = { path = "../../../../crates/libafl" } +libafl_bolts = { path = "../../../../crates/libafl_bolts" } libc = "0.2.159" log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/baby/backtrace_baby_fuzzers/c_code_with_inprocess_executor/Cargo.toml b/fuzzers/baby/backtrace_baby_fuzzers/c_code_with_inprocess_executor/Cargo.toml index 18831b85dc5..25700b0fa3d 100644 --- a/fuzzers/baby/backtrace_baby_fuzzers/c_code_with_inprocess_executor/Cargo.toml +++ b/fuzzers/baby/backtrace_baby_fuzzers/c_code_with_inprocess_executor/Cargo.toml @@ -15,8 +15,8 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../../libafl" } -libafl_bolts = { path = "../../../../libafl_bolts" } +libafl = { path = "../../../../crates/libafl" } +libafl_bolts = { path = "../../../../crates/libafl_bolts" } libc = "0.2.159" log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/baby/backtrace_baby_fuzzers/command_executor/Cargo.toml b/fuzzers/baby/backtrace_baby_fuzzers/command_executor/Cargo.toml index f71995fc8b7..3855503e8f5 100644 --- a/fuzzers/baby/backtrace_baby_fuzzers/command_executor/Cargo.toml +++ b/fuzzers/baby/backtrace_baby_fuzzers/command_executor/Cargo.toml @@ -17,6 +17,6 @@ debug = true cc = "1.1.21" [dependencies] -libafl = { path = "../../../../libafl" } -libafl_bolts = { path = "../../../../libafl_bolts" } +libafl = { path = "../../../../crates/libafl" } +libafl_bolts = { path = "../../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/baby/backtrace_baby_fuzzers/forkserver_executor/Cargo.toml b/fuzzers/baby/backtrace_baby_fuzzers/forkserver_executor/Cargo.toml index 4dcfd52c8cd..95cd59b1f8f 100644 --- a/fuzzers/baby/backtrace_baby_fuzzers/forkserver_executor/Cargo.toml +++ b/fuzzers/baby/backtrace_baby_fuzzers/forkserver_executor/Cargo.toml @@ -14,6 +14,6 @@ codegen-units = 1 opt-level = 3 [dependencies] -libafl = { path = "../../../../libafl" } -libafl_bolts = { path = "../../../../libafl_bolts" } +libafl = { path = "../../../../crates/libafl" } +libafl_bolts = { path = "../../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/baby/backtrace_baby_fuzzers/rust_code_with_fork_executor/Cargo.toml b/fuzzers/baby/backtrace_baby_fuzzers/rust_code_with_fork_executor/Cargo.toml index 83209378752..a7f7364d8e1 100644 --- a/fuzzers/baby/backtrace_baby_fuzzers/rust_code_with_fork_executor/Cargo.toml +++ b/fuzzers/baby/backtrace_baby_fuzzers/rust_code_with_fork_executor/Cargo.toml @@ -18,6 +18,6 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../../libafl" } -libafl_bolts = { path = "../../../../libafl_bolts" } +libafl = { path = "../../../../crates/libafl" } +libafl_bolts = { path = "../../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/baby/backtrace_baby_fuzzers/rust_code_with_inprocess_executor/Cargo.toml b/fuzzers/baby/backtrace_baby_fuzzers/rust_code_with_inprocess_executor/Cargo.toml index a382f5d33a7..3a30efb8a4a 100644 --- a/fuzzers/baby/backtrace_baby_fuzzers/rust_code_with_inprocess_executor/Cargo.toml +++ b/fuzzers/baby/backtrace_baby_fuzzers/rust_code_with_inprocess_executor/Cargo.toml @@ -18,6 +18,6 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../../libafl" } -libafl_bolts = { path = "../../../../libafl_bolts" } +libafl = { path = "../../../../crates/libafl" } +libafl_bolts = { path = "../../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/baby/tutorial/Cargo.toml b/fuzzers/baby/tutorial/Cargo.toml index e543c77baaa..56c52b4b0a6 100644 --- a/fuzzers/baby/tutorial/Cargo.toml +++ b/fuzzers/baby/tutorial/Cargo.toml @@ -22,9 +22,12 @@ cc = { version = "1.1.21", features = ["parallel"] } which = "6.0.3" [dependencies] -libafl = { path = "../../../libafl", features = ["default", "rand_trait"] } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl", features = [ + "default", + "rand_trait", +] } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "libfuzzer", "sancov_cmplog", @@ -36,7 +39,7 @@ lain = { version = "0.5.6", features = [ "serde_support", ], git = "https://github.com/AFLplusplus/lain.git", rev = "6ac90a35cfff15e314cf33b098f6cac4691c7ab3" } # We're using a lain fork compatible with libafl's rand version # TODO Include it only when building cc -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } log = { version = "0.4.22", features = ["release_max_level_info"] } [lib] diff --git a/fuzzers/binary_only/frida_executable_libpng/Cargo.toml b/fuzzers/binary_only/frida_executable_libpng/Cargo.toml index ed0f9e34023..bcfbf25638f 100644 --- a/fuzzers/binary_only/frida_executable_libpng/Cargo.toml +++ b/fuzzers/binary_only/frida_executable_libpng/Cargo.toml @@ -18,21 +18,21 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl", features = [ +libafl = { path = "../../../crates/libafl", features = [ "std", "llmp_compression", "llmp_bind_public", "frida_cli", ] } #, "llmp_small_maps", "llmp_debug"]} -libafl_bolts = { path = "../../../libafl_bolts" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } frida-gum = { version = "0.16.7", features = [ "auto-download", "event-sink", "invocation-listener", "script", ] } -libafl_frida = { path = "../../../libafl_frida", features = ["cmplog"] } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl_frida = { path = "../../../crates/libafl_frida", features = ["cmplog"] } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_cmplog", ] } libc = "0.2.159" diff --git a/fuzzers/binary_only/frida_libpng/Cargo.toml b/fuzzers/binary_only/frida_libpng/Cargo.toml index 2d63475c4d9..74daeae72f0 100644 --- a/fuzzers/binary_only/frida_libpng/Cargo.toml +++ b/fuzzers/binary_only/frida_libpng/Cargo.toml @@ -19,22 +19,22 @@ debug = true panic = 'abort' [dependencies] -libafl = { path = "../../../libafl", features = [ +libafl = { path = "../../../crates/libafl", features = [ "std", "llmp_compression", "llmp_bind_public", "frida_cli", "errors_backtrace", ] } #, "llmp_small_maps", "llmp_debug"]} -libafl_bolts = { path = "../../../libafl_bolts" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } frida-gum = { version = "0.16.7", features = [ "auto-download", "event-sink", "invocation-listener", "script", ] } -libafl_frida = { path = "../../../libafl_frida", features = ["cmplog"] } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl_frida = { path = "../../../crates/libafl_frida", features = ["cmplog"] } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_cmplog", ] } libloading = "0.8.5" diff --git a/fuzzers/binary_only/frida_windows_gdiplus/Cargo.toml b/fuzzers/binary_only/frida_windows_gdiplus/Cargo.toml index 43beecf1f25..0dbb574ec06 100644 --- a/fuzzers/binary_only/frida_windows_gdiplus/Cargo.toml +++ b/fuzzers/binary_only/frida_windows_gdiplus/Cargo.toml @@ -15,22 +15,22 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl", features = [ +libafl = { path = "../../../crates/libafl", features = [ "std", "llmp_compression", "llmp_bind_public", "frida_cli", "errors_backtrace", ] } #, "llmp_small_maps", "llmp_debug"]} -libafl_bolts = { path = "../../../libafl_bolts" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } frida-gum = { version = "0.16.7", features = [ "auto-download", "event-sink", "invocation-listener", "script", ] } -libafl_frida = { path = "../../../libafl_frida", features = ["cmplog"] } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl_frida = { path = "../../../crates/libafl_frida", features = ["cmplog"] } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_cmplog", ] } libloading = "0.8.5" diff --git a/fuzzers/binary_only/fuzzbench_fork_qemu/Cargo.toml b/fuzzers/binary_only/fuzzbench_fork_qemu/Cargo.toml index 2fed00429af..19de6c6b89a 100644 --- a/fuzzers/binary_only/fuzzbench_fork_qemu/Cargo.toml +++ b/fuzzers/binary_only/fuzzbench_fork_qemu/Cargo.toml @@ -23,13 +23,13 @@ debug = false strip = true [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_qemu = { path = "../../../libafl_qemu", features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_qemu = { path = "../../../crates/libafl_qemu", features = [ "x86_64", "usermode", ] } -libafl_targets = { path = "../../../libafl_targets" } +libafl_targets = { path = "../../../crates/libafl_targets" } log = { version = "0.4.22", features = ["release_max_level_info"] } clap = { version = "4.5.18", features = ["default"] } diff --git a/fuzzers/binary_only/fuzzbench_qemu/Cargo.toml b/fuzzers/binary_only/fuzzbench_qemu/Cargo.toml index d447ad96024..b528b1a99d8 100644 --- a/fuzzers/binary_only/fuzzbench_qemu/Cargo.toml +++ b/fuzzers/binary_only/fuzzbench_qemu/Cargo.toml @@ -23,13 +23,13 @@ debug = false strip = true [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_qemu = { path = "../../../libafl_qemu", features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_qemu = { path = "../../../crates/libafl_qemu", features = [ "x86_64", "usermode", ] } -libafl_targets = { path = "../../../libafl_targets", version = "0.15.3" } +libafl_targets = { path = "../../../crates/libafl_targets", version = "0.15.3" } env_logger = "0.11.5" log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/binary_only/intel_pt_baby_fuzzer/Cargo.toml b/fuzzers/binary_only/intel_pt_baby_fuzzer/Cargo.toml index c2405c55ce0..3f00781ed75 100644 --- a/fuzzers/binary_only/intel_pt_baby_fuzzer/Cargo.toml +++ b/fuzzers/binary_only/intel_pt_baby_fuzzer/Cargo.toml @@ -12,8 +12,8 @@ edition = "2021" tui = ["libafl/tui_monitor"] [dependencies] -libafl = { path = "../../../libafl/", default-features = false, features = [ +libafl = { path = "../../../crates/libafl/", default-features = false, features = [ "intel_pt", ] } -libafl_bolts = { path = "../../../libafl_bolts" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } proc-maps = "0.4.0" diff --git a/fuzzers/binary_only/intel_pt_command_executor/Cargo.toml b/fuzzers/binary_only/intel_pt_command_executor/Cargo.toml index 6aa937c7a97..69dd70719a8 100644 --- a/fuzzers/binary_only/intel_pt_command_executor/Cargo.toml +++ b/fuzzers/binary_only/intel_pt_command_executor/Cargo.toml @@ -6,9 +6,9 @@ edition = "2021" [dependencies] env_logger = "0.11.5" -libafl = { path = "../../../libafl", default-features = false, features = [ +libafl = { path = "../../../crates/libafl", default-features = false, features = [ "intel_pt", ] } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_intelpt = { path = "../../../libafl_intelpt" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_intelpt = { path = "../../../crates/libafl_intelpt" } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/binary_only/qemu_cmin/Cargo.toml b/fuzzers/binary_only/qemu_cmin/Cargo.toml index bdc888ee162..1c457bf0ec5 100644 --- a/fuzzers/binary_only/qemu_cmin/Cargo.toml +++ b/fuzzers/binary_only/qemu_cmin/Cargo.toml @@ -34,9 +34,9 @@ vergen-git2 = "1.0.1" [dependencies] clap = { version = "4.5.18", features = ["derive", "string"] } env_logger = { version = "0.11.5" } -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_qemu = { path = "../../../libafl_qemu", features = ["usermode"] } -libafl_targets = { path = "../../../libafl_targets" } +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_qemu = { path = "../../../crates/libafl_qemu", features = ["usermode"] } +libafl_targets = { path = "../../../crates/libafl_targets" } log = { version = "0.4.22", features = ["release_max_level_info"] } rangemap = { version = "1.5.1" } diff --git a/fuzzers/binary_only/qemu_coverage/Cargo.toml b/fuzzers/binary_only/qemu_coverage/Cargo.toml index 4641aa3fd8f..d5dbbd8a164 100644 --- a/fuzzers/binary_only/qemu_coverage/Cargo.toml +++ b/fuzzers/binary_only/qemu_coverage/Cargo.toml @@ -32,8 +32,8 @@ vergen-git2 = "1.0.1" [dependencies] clap = { version = "4.5.18", features = ["derive", "string"] } env_logger = { version = "0.11.5" } -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_qemu = { path = "../../../libafl_qemu", features = ["usermode"] } +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_qemu = { path = "../../../crates/libafl_qemu", features = ["usermode"] } log = { version = "0.4.22", features = ["release_max_level_info"] } rangemap = { version = "1.5.1" } diff --git a/fuzzers/binary_only/qemu_launcher/Cargo.toml b/fuzzers/binary_only/qemu_launcher/Cargo.toml index 804d9b76dcb..7ecbe8f4bbe 100644 --- a/fuzzers/binary_only/qemu_launcher/Cargo.toml +++ b/fuzzers/binary_only/qemu_launcher/Cargo.toml @@ -43,15 +43,15 @@ vergen-git2 = "1.0.1" [dependencies] clap = { version = "4.5.18", features = ["derive", "string"] } env_logger = { version = "0.11.5" } -libafl = { path = "../../../libafl", features = ["tui_monitor"] } -libafl_bolts = { path = "../../../libafl_bolts", features = [ +libafl = { path = "../../../crates/libafl", features = ["tui_monitor"] } +libafl_bolts = { path = "../../../crates/libafl_bolts", features = [ "errors_backtrace", ] } -libafl_qemu = { path = "../../../libafl_qemu", features = [ +libafl_qemu = { path = "../../../crates/libafl_qemu", features = [ "usermode", "asan_rust", ] } -libafl_targets = { path = "../../../libafl_targets" } +libafl_targets = { path = "../../../crates/libafl_targets" } log = { version = "0.4.22", features = ["release_max_level_info"] } rangemap = { version = "1.5.1" } readonly = { version = "0.2.12" } diff --git a/fuzzers/binary_only/qemu_tmin/Cargo.toml b/fuzzers/binary_only/qemu_tmin/Cargo.toml index fb9db73700d..601231231bf 100644 --- a/fuzzers/binary_only/qemu_tmin/Cargo.toml +++ b/fuzzers/binary_only/qemu_tmin/Cargo.toml @@ -43,9 +43,9 @@ vergen-git2 = "1.0.1" [dependencies] clap = { version = "4.5.18", features = ["derive", "string"] } env_logger = { version = "0.11.5" } -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_qemu = { path = "../../../libafl_qemu", features = ["usermode"] } -libafl_targets = { path = "../../../libafl_targets" } +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_qemu = { path = "../../../crates/libafl_qemu", features = ["usermode"] } +libafl_targets = { path = "../../../crates/libafl_targets" } log = { version = "0.4.22", features = ["release_max_level_info"] } rangemap = { version = "1.5.1" } diff --git a/fuzzers/binary_only/tinyinst_simple/Cargo.toml b/fuzzers/binary_only/tinyinst_simple/Cargo.toml index c5de25076c1..221139d8d75 100644 --- a/fuzzers/binary_only/tinyinst_simple/Cargo.toml +++ b/fuzzers/binary_only/tinyinst_simple/Cargo.toml @@ -4,9 +4,9 @@ version = "0.15.3" edition = "2021" [dependencies] -libafl = { path = "../../../libafl", features = ["introspection"] } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_tinyinst = { path = "../../../libafl_tinyinst" } +libafl = { path = "../../../crates/libafl", features = ["introspection"] } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_tinyinst = { path = "../../../crates/libafl_tinyinst" } log = { version = "0.4.22", features = ["release_max_level_info"] } [profile.release] diff --git a/fuzzers/forkserver/baby_fuzzer_with_forkexecutor/Cargo.toml b/fuzzers/forkserver/baby_fuzzer_with_forkexecutor/Cargo.toml index 941e0e636ef..e64ceb78307 100644 --- a/fuzzers/forkserver/baby_fuzzer_with_forkexecutor/Cargo.toml +++ b/fuzzers/forkserver/baby_fuzzer_with_forkexecutor/Cargo.toml @@ -22,6 +22,6 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/forkserver/forkserver_capture_stdout/Cargo.toml b/fuzzers/forkserver/forkserver_capture_stdout/Cargo.toml index 1f8aae4c8d3..016b1d6fd3c 100644 --- a/fuzzers/forkserver/forkserver_capture_stdout/Cargo.toml +++ b/fuzzers/forkserver/forkserver_capture_stdout/Cargo.toml @@ -16,8 +16,8 @@ opt-level = 3 [dependencies] clap = { version = "4.5.18", features = ["derive"] } env_logger = "0.11.5" -libafl = { path = "../../../libafl", features = ["std", "derive"] } -libafl_bolts = { path = "../../../libafl_bolts" } +libafl = { path = "../../../crates/libafl", features = ["std", "derive"] } +libafl_bolts = { path = "../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } nix = { version = "0.30.1", features = ["signal"] } serde = "1.0.219" diff --git a/fuzzers/forkserver/forkserver_libafl_cc/Cargo.toml b/fuzzers/forkserver/forkserver_libafl_cc/Cargo.toml index 1648c4e69bf..fb45bbee8a1 100644 --- a/fuzzers/forkserver/forkserver_libafl_cc/Cargo.toml +++ b/fuzzers/forkserver/forkserver_libafl_cc/Cargo.toml @@ -23,10 +23,10 @@ which = { version = "6.0.3" } [dependencies] clap = { version = "4.5.18", features = ["derive"] } nix = { version = "0.30.1", features = ["signal"] } -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_cc = { path = "../../../libafl_cc" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_cc = { path = "../../../crates/libafl_cc" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "libfuzzer", "pointer_maps", diff --git a/fuzzers/forkserver/forkserver_simple/Cargo.toml b/fuzzers/forkserver/forkserver_simple/Cargo.toml index 9b8bcfaada5..2ecf31d8d59 100644 --- a/fuzzers/forkserver/forkserver_simple/Cargo.toml +++ b/fuzzers/forkserver/forkserver_simple/Cargo.toml @@ -18,7 +18,7 @@ opt-level = 3 [dependencies] clap = { version = "4.5.18", features = ["derive"] } env_logger = "0.11.5" -libafl = { path = "../../../libafl", features = ["std", "derive"] } -libafl_bolts = { path = "../../../libafl_bolts" } +libafl = { path = "../../../crates/libafl", features = ["std", "derive"] } +libafl_bolts = { path = "../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } nix = { version = "0.30.1", features = ["signal"] } diff --git a/fuzzers/forkserver/fuzzbench_forkserver/Cargo.toml b/fuzzers/forkserver/fuzzbench_forkserver/Cargo.toml index 9f3a737dafb..b8dc93446d1 100644 --- a/fuzzers/forkserver/fuzzbench_forkserver/Cargo.toml +++ b/fuzzers/forkserver/fuzzbench_forkserver/Cargo.toml @@ -23,9 +23,9 @@ cc = { version = "1.1.22", features = ["parallel"] } which = "6.0.3" [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets" } +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets" } log = { version = "0.4.22", features = ["release_max_level_info"] } clap = { version = "4.5.18", features = ["default"] } diff --git a/fuzzers/forkserver/fuzzbench_forkserver_cmplog/Cargo.toml b/fuzzers/forkserver/fuzzbench_forkserver_cmplog/Cargo.toml index 371237dc952..8789cd5d7ca 100644 --- a/fuzzers/forkserver/fuzzbench_forkserver_cmplog/Cargo.toml +++ b/fuzzers/forkserver/fuzzbench_forkserver_cmplog/Cargo.toml @@ -23,9 +23,9 @@ cc = { version = "1.1.21", features = ["parallel"] } which = "6.0.3" [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets" } +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets" } log = { version = "0.4.22", features = ["release_max_level_info"] } clap = { version = "4.5.18", features = ["default"] } nix = { version = "0.30.1", features = ["signal"] } diff --git a/fuzzers/forkserver/fuzzbench_forkserver_sand/Cargo.toml b/fuzzers/forkserver/fuzzbench_forkserver_sand/Cargo.toml index fb1bbf7aa17..ce46ea6e197 100644 --- a/fuzzers/forkserver/fuzzbench_forkserver_sand/Cargo.toml +++ b/fuzzers/forkserver/fuzzbench_forkserver_sand/Cargo.toml @@ -24,14 +24,14 @@ cc = { version = "1.1.22", features = ["parallel"] } which = "6.0.3" [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "libfuzzer", "pointer_maps", ] } -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } log = { version = "0.4.22", features = ["release_max_level_info"] } clap = { version = "4.5.18", features = ["default"] } nix = { version = "0.30.1", features = ["signal"] } diff --git a/fuzzers/forkserver/libafl-fuzz/Cargo.toml b/fuzzers/forkserver/libafl-fuzz/Cargo.toml index 6f50f15b82e..a1897fd738e 100644 --- a/fuzzers/forkserver/libafl-fuzz/Cargo.toml +++ b/fuzzers/forkserver/libafl-fuzz/Cargo.toml @@ -14,18 +14,18 @@ edition = "2021" [dependencies] clap = { version = "4.5.18", features = ["derive", "env"] } env_logger = "0.11.3" -libafl = { path = "../../../libafl", features = [ +libafl = { path = "../../../crates/libafl", features = [ "std", "derive", "track_hit_feedbacks", "clap", "errors_backtrace", ] } -libafl_bolts = { path = "../../../libafl_bolts", features = [ +libafl_bolts = { path = "../../../crates/libafl_bolts", features = [ "std", "errors_backtrace", ] } -libafl_targets = { path = "../../../libafl_targets" } +libafl_targets = { path = "../../../crates/libafl_targets" } log = { version = "0.4.22", features = ["release_max_level_info"] } memmap2 = "0.9.4" nix = { version = "0.30.1", features = ["fs"] } @@ -33,7 +33,7 @@ regex = "1.10.5" serde = { version = "1.0.117", features = ["derive"] } [target.'cfg(target_os = "linux")'.dependencies] -libafl_nyx = { path = "../../../libafl_nyx", optional = true } +libafl_nyx = { path = "../../../crates/libafl_nyx", optional = true } [features] default = ["track_hit_feedbacks"] diff --git a/fuzzers/forkserver/libafl-fuzz/Justfile b/fuzzers/forkserver/libafl-fuzz/Justfile index f4bcd11e2d6..ad5ad9f7c71 100644 --- a/fuzzers/forkserver/libafl-fuzz/Justfile +++ b/fuzzers/forkserver/libafl-fuzz/Justfile @@ -226,7 +226,7 @@ test_nyx_mode: build_afl build_libafl_fuzz export LIBAFL_DEBUG_OUTPUT=1 AFL_PATH={{AFL_DIR}} {{AFL_CC_PATH}} ./test/test-instr.c -o ./test/out-instr rm -rf ./test/nyx-test - cd ../../../libafl_nyx + cd ../../../crates/libafl_nyx rm -rf packer git clone https://github.com/nyx-fuzz/packer.git python3 packer/packer/nyx_packer.py \ diff --git a/fuzzers/full_system/nyx_launcher/Cargo.toml b/fuzzers/full_system/nyx_launcher/Cargo.toml index a76394b8b6b..593e2d81f76 100644 --- a/fuzzers/full_system/nyx_launcher/Cargo.toml +++ b/fuzzers/full_system/nyx_launcher/Cargo.toml @@ -29,11 +29,11 @@ vergen = { version = "8.2.1", features = [ [dependencies] clap = { version = "4.5.18", features = ["derive", "string"] } -libafl = { path = "../../../libafl", features = ["tui_monitor"] } -libafl_bolts = { path = "../../../libafl_bolts", features = [ +libafl = { path = "../../../crates/libafl", features = ["tui_monitor"] } +libafl_bolts = { path = "../../../crates/libafl_bolts", features = [ "errors_backtrace", ] } -libafl_nyx = { path = "../../../libafl_nyx/" } +libafl_nyx = { path = "../../../crates/libafl_nyx/" } log = { version = "0.4.20" } rangemap = { version = "1.5.1" } readonly = { version = "0.2.12" } diff --git a/fuzzers/full_system/nyx_libxml2_parallel/Cargo.toml b/fuzzers/full_system/nyx_libxml2_parallel/Cargo.toml index c704fc5c14a..fceb1414ae7 100644 --- a/fuzzers/full_system/nyx_libxml2_parallel/Cargo.toml +++ b/fuzzers/full_system/nyx_libxml2_parallel/Cargo.toml @@ -5,10 +5,10 @@ edition = "2021" default-run = "nyx_libxml2_parallel" [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_cc = { path = "../../../libafl_cc" } -libafl_nyx = { path = "../../../libafl_nyx" } +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_cc = { path = "../../../crates/libafl_cc" } +libafl_nyx = { path = "../../../crates/libafl_nyx" } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/full_system/nyx_libxml2_parallel/setup_libxml2.sh b/fuzzers/full_system/nyx_libxml2_parallel/setup_libxml2.sh index f169faa0c7b..85e0080e8b5 100755 --- a/fuzzers/full_system/nyx_libxml2_parallel/setup_libxml2.sh +++ b/fuzzers/full_system/nyx_libxml2_parallel/setup_libxml2.sh @@ -26,7 +26,7 @@ cd ./libxml2/ || exit ./autogen.sh --enable-shared=no || exit make -j || exit cd - || exit -python3 "../../../libafl_nyx/packer/packer/nyx_packer.py" \ +python3 "../../../crates/libafl_nyx/packer/packer/nyx_packer.py" \ ./libxml2/xmllint \ /tmp/nyx_libxml2 \ afl \ @@ -36,4 +36,4 @@ python3 "../../../libafl_nyx/packer/packer/nyx_packer.py" \ --fast_reload_mode \ --purge || exit -python3 ../../../libafl_nyx/packer/packer/nyx_config_gen.py /tmp/nyx_libxml2/ Kernel || exit +python3 ../../../crates/libafl_nyx/packer/packer/nyx_config_gen.py /tmp/nyx_libxml2/ Kernel || exit diff --git a/fuzzers/full_system/nyx_libxml2_standalone/Cargo.toml b/fuzzers/full_system/nyx_libxml2_standalone/Cargo.toml index d6e7db2763d..8918dc49556 100644 --- a/fuzzers/full_system/nyx_libxml2_standalone/Cargo.toml +++ b/fuzzers/full_system/nyx_libxml2_standalone/Cargo.toml @@ -5,10 +5,10 @@ edition = "2021" default-run = "nyx_libxml2_standalone" [dependencies] -libafl = { path = "../../../libafl", features = ["tui_monitor"] } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_cc = { path = "../../../libafl_cc" } -libafl_nyx = { path = "../../../libafl_nyx" } +libafl = { path = "../../../crates/libafl", features = ["tui_monitor"] } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_cc = { path = "../../../crates/libafl_cc" } +libafl_nyx = { path = "../../../crates/libafl_nyx" } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/full_system/nyx_libxml2_standalone/setup_libxml2.sh b/fuzzers/full_system/nyx_libxml2_standalone/setup_libxml2.sh index f169faa0c7b..85e0080e8b5 100755 --- a/fuzzers/full_system/nyx_libxml2_standalone/setup_libxml2.sh +++ b/fuzzers/full_system/nyx_libxml2_standalone/setup_libxml2.sh @@ -26,7 +26,7 @@ cd ./libxml2/ || exit ./autogen.sh --enable-shared=no || exit make -j || exit cd - || exit -python3 "../../../libafl_nyx/packer/packer/nyx_packer.py" \ +python3 "../../../crates/libafl_nyx/packer/packer/nyx_packer.py" \ ./libxml2/xmllint \ /tmp/nyx_libxml2 \ afl \ @@ -36,4 +36,4 @@ python3 "../../../libafl_nyx/packer/packer/nyx_packer.py" \ --fast_reload_mode \ --purge || exit -python3 ../../../libafl_nyx/packer/packer/nyx_config_gen.py /tmp/nyx_libxml2/ Kernel || exit +python3 ../../../crates/libafl_nyx/packer/packer/nyx_config_gen.py /tmp/nyx_libxml2/ Kernel || exit diff --git a/fuzzers/full_system/qemu_baremetal/Cargo.toml b/fuzzers/full_system/qemu_baremetal/Cargo.toml index fc211411fe7..35f29477c1f 100644 --- a/fuzzers/full_system/qemu_baremetal/Cargo.toml +++ b/fuzzers/full_system/qemu_baremetal/Cargo.toml @@ -29,14 +29,14 @@ lto = "fat" codegen-units = 1 [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets" } -libafl_qemu = { path = "../../../libafl_qemu", features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets" } +libafl_qemu = { path = "../../../crates/libafl_qemu", features = [ "systemmode", ], default-features = false } env_logger = "0.11.5" log = { version = "0.4.22", features = ["release_max_level_info"] } [build-dependencies] -libafl_qemu_build = { path = "../../../libafl_qemu/libafl_qemu_build" } +libafl_qemu_build = { path = "../../../crates/libafl_qemu/libafl_qemu_build" } diff --git a/fuzzers/full_system/qemu_linux_kernel/Cargo.toml b/fuzzers/full_system/qemu_linux_kernel/Cargo.toml index 935d0716e22..f6293a7d458 100644 --- a/fuzzers/full_system/qemu_linux_kernel/Cargo.toml +++ b/fuzzers/full_system/qemu_linux_kernel/Cargo.toml @@ -19,16 +19,16 @@ lto = "fat" codegen-units = 1 [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_qemu = { path = "../../../libafl_qemu", default-features = false, features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_qemu = { path = "../../../crates/libafl_qemu", default-features = false, features = [ "x86_64", "systemmode", #"paranoid_debug" ] } -libafl_targets = { path = "../../../libafl_targets" } +libafl_targets = { path = "../../../crates/libafl_targets" } env_logger = "0.11.5" log = "0.4.22" [build-dependencies] -libafl_qemu_build = { path = "../../../libafl_qemu/libafl_qemu_build" } +libafl_qemu_build = { path = "../../../crates/libafl_qemu/libafl_qemu_build" } diff --git a/fuzzers/full_system/qemu_linux_process/Cargo.toml b/fuzzers/full_system/qemu_linux_process/Cargo.toml index d534b81adfa..5bf1f86b950 100644 --- a/fuzzers/full_system/qemu_linux_process/Cargo.toml +++ b/fuzzers/full_system/qemu_linux_process/Cargo.toml @@ -22,16 +22,16 @@ lto = "fat" codegen-units = 1 [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_qemu = { path = "../../../libafl_qemu", default-features = false, features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_qemu = { path = "../../../crates/libafl_qemu", default-features = false, features = [ "x86_64", "systemmode", # "paranoid_debug", ] } env_logger = "0.11.5" -libafl_targets = { path = "../../../libafl_targets" } +libafl_targets = { path = "../../../crates/libafl_targets" } log = "0.4.22" [build-dependencies] -libafl_qemu_build = { path = "../../../libafl_qemu/libafl_qemu_build" } +libafl_qemu_build = { path = "../../../crates/libafl_qemu/libafl_qemu_build" } diff --git a/fuzzers/full_system/unicorn/Cargo.toml b/fuzzers/full_system/unicorn/Cargo.toml index efad8b50716..899bf71478d 100644 --- a/fuzzers/full_system/unicorn/Cargo.toml +++ b/fuzzers/full_system/unicorn/Cargo.toml @@ -10,10 +10,10 @@ code_hook = [] mem_hook = [] [dependencies] -libafl = { path = "../../../libafl/" } -libafl_bolts = { path = "../../../libafl_bolts/" } -libafl_targets = { path = "../../../libafl_targets" } -libafl_unicorn = { path = "../../../libafl_unicorn/" } +libafl = { path = "../../../crates/libafl/" } +libafl_bolts = { path = "../../../crates/libafl_bolts/" } +libafl_targets = { path = "../../../crates/libafl_targets" } +libafl_unicorn = { path = "../../../crates/libafl_unicorn/" } unicorn-engine = "2.1.2" log = "0.4.25" diff --git a/fuzzers/fuzz_anything/baby_fuzzer_wasm/Cargo.toml b/fuzzers/fuzz_anything/baby_fuzzer_wasm/Cargo.toml index 6dc9b1196af..691a338bf0f 100644 --- a/fuzzers/fuzz_anything/baby_fuzzer_wasm/Cargo.toml +++ b/fuzzers/fuzz_anything/baby_fuzzer_wasm/Cargo.toml @@ -15,8 +15,8 @@ js-sys = "0.3.70" log = { version = "0.4.22", features = ["release_max_level_info"] } wasm-bindgen = "0.2.93" -libafl = { path = "../../../libafl", default-features = false } -libafl_bolts = { path = "../../../libafl_bolts", default-features = false } +libafl = { path = "../../../crates/libafl", default-features = false } +libafl_bolts = { path = "../../../crates/libafl_bolts", default-features = false } # The `console_error_panic_hook` crate provides better debugging of panics by # logging them with `console.error`. This is great for development, but requires diff --git a/fuzzers/fuzz_anything/baby_no_std/Cargo.toml b/fuzzers/fuzz_anything/baby_no_std/Cargo.toml index c5aedad3963..94f886ad891 100644 --- a/fuzzers/fuzz_anything/baby_no_std/Cargo.toml +++ b/fuzzers/fuzz_anything/baby_no_std/Cargo.toml @@ -18,8 +18,8 @@ opt-level = 3 debug = true [dependencies] -libafl = { default-features = false, path = "../../../libafl" } -libafl_bolts = { default-features = false, path = "../../../libafl_bolts" } +libafl = { default-features = false, path = "../../../crates/libafl" } +libafl_bolts = { default-features = false, path = "../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } static-alloc = "0.2.3" diff --git a/fuzzers/fuzz_anything/cargo_fuzz/fuzz/Cargo.toml b/fuzzers/fuzz_anything/cargo_fuzz/fuzz/Cargo.toml index 1a4712ffc19..7ce9bf18386 100644 --- a/fuzzers/fuzz_anything/cargo_fuzz/fuzz/Cargo.toml +++ b/fuzzers/fuzz_anything/cargo_fuzz/fuzz/Cargo.toml @@ -15,7 +15,7 @@ cargo-fuzz = true path = ".." [dependencies.libfuzzer-sys] -path = "../../../../libafl_libfuzzer" +path = "../../../../crates/libafl_libfuzzer" package = "libafl_libfuzzer" [[bin]] diff --git a/fuzzers/fuzz_anything/libafl_atheris/Cargo.toml b/fuzzers/fuzz_anything/libafl_atheris/Cargo.toml index 3c660704f8f..6d87a5ecd96 100644 --- a/fuzzers/fuzz_anything/libafl_atheris/Cargo.toml +++ b/fuzzers/fuzz_anything/libafl_atheris/Cargo.toml @@ -22,9 +22,9 @@ cc = { version = "1.1.21", features = ["parallel"] } which = "6.0.3" [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "pointer_maps", "sancov_cmplog", "libfuzzer", diff --git a/fuzzers/fuzz_anything/push_harness/Cargo.toml b/fuzzers/fuzz_anything/push_harness/Cargo.toml index 6f5ee18008e..ee3f30fd58d 100644 --- a/fuzzers/fuzz_anything/push_harness/Cargo.toml +++ b/fuzzers/fuzz_anything/push_harness/Cargo.toml @@ -22,7 +22,7 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } klo-routines = { version = "0.1.0", git = "https://github.com/andreafioraldi/klo-routines.git", rev = "b8e2fb6" } diff --git a/fuzzers/fuzz_anything/push_stage_harness/Cargo.toml b/fuzzers/fuzz_anything/push_stage_harness/Cargo.toml index d083b93785e..9a2c8e96afd 100644 --- a/fuzzers/fuzz_anything/push_stage_harness/Cargo.toml +++ b/fuzzers/fuzz_anything/push_stage_harness/Cargo.toml @@ -22,6 +22,6 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/inprocess/fuzzbench/Cargo.toml b/fuzzers/inprocess/fuzzbench/Cargo.toml index 7dca132b7bf..90002c23161 100644 --- a/fuzzers/inprocess/fuzzbench/Cargo.toml +++ b/fuzzers/inprocess/fuzzbench/Cargo.toml @@ -28,15 +28,15 @@ cc = { version = "1.0.106", features = ["parallel"] } which = "6.0.3" [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "sancov_cmplog", "libfuzzer", ] } # TODO Include it only when building cc -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } log = { version = "0.4.22", features = ["release_max_level_info"] } clap = { version = "4.5.18", features = ["default"] } mimalloc = { version = "0.1.43", default-features = false } diff --git a/fuzzers/inprocess/fuzzbench_ctx/Cargo.toml b/fuzzers/inprocess/fuzzbench_ctx/Cargo.toml index 9d5688c95b2..3e2dec76e6b 100644 --- a/fuzzers/inprocess/fuzzbench_ctx/Cargo.toml +++ b/fuzzers/inprocess/fuzzbench_ctx/Cargo.toml @@ -28,16 +28,16 @@ cc = { version = "1.1.21", features = ["parallel"] } which = "6.0.3" [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "sancov_cmplog", "libfuzzer", "sancov_ctx", ] } # TODO Include it only when building cc -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } log = { version = "0.4.22", features = ["release_max_level_info"] } clap = { version = "4.5.18", features = ["default"] } mimalloc = { version = "0.1.43", default-features = false } diff --git a/fuzzers/inprocess/fuzzbench_text/Cargo.toml b/fuzzers/inprocess/fuzzbench_text/Cargo.toml index ac6c8a39295..c4cbe552e6b 100644 --- a/fuzzers/inprocess/fuzzbench_text/Cargo.toml +++ b/fuzzers/inprocess/fuzzbench_text/Cargo.toml @@ -23,15 +23,15 @@ cc = { version = "1.1.21", features = ["parallel"] } which = "6.0.3" [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "sancov_cmplog", "libfuzzer", ] } # TODO Include it only when building cc -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } log = { version = "0.4.22", features = ["release_max_level_info"] } clap = { version = "4.5.18", features = ["default"] } mimalloc = { version = "0.1.43", default-features = false } diff --git a/fuzzers/inprocess/libafl_libfuzzer_windows/Justfile b/fuzzers/inprocess/libafl_libfuzzer_windows/Justfile index f69091ada14..e8a8686c4e2 100644 --- a/fuzzers/inprocess/libafl_libfuzzer_windows/Justfile +++ b/fuzzers/inprocess/libafl_libfuzzer_windows/Justfile @@ -8,11 +8,11 @@ set unstable [windows] libafl_libfuzzer: - powershell -File ..\..\..\libafl_libfuzzer_runtime\build.ps1 + powershell -File ..\..\..\crates\libafl_libfuzzer_runtime\build.ps1 [windows] harness: libafl_libfuzzer - copy ..\..\..\libafl_libfuzzer_runtime\libFuzzer.lib . + copy ..\..\..\crates\libafl_libfuzzer_runtime\libFuzzer.lib . cl /c /O2 /EHsc /std:c++17 /MDd /fsanitize-coverage=inline-8bit-counters /fsanitize-coverage=edge /fsanitize-coverage=trace-cmp /fsanitize-coverage=trace-div /Fo:harness.obj harness.cc link harness.obj libFuzzer.lib sancov.lib /OUT:libafl_libfuzzer_windows.exe diff --git a/fuzzers/inprocess/libfuzzer_libmozjpeg/Cargo.toml b/fuzzers/inprocess/libfuzzer_libmozjpeg/Cargo.toml index 569550a43d6..8decc1b0820 100644 --- a/fuzzers/inprocess/libfuzzer_libmozjpeg/Cargo.toml +++ b/fuzzers/inprocess/libfuzzer_libmozjpeg/Cargo.toml @@ -18,15 +18,15 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_edges", "sancov_value_profile", "libfuzzer", ] } # TODO Include it only when building cc -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } log = { version = "0.4.22", features = ["release_max_level_info"] } mimalloc = { version = "0.1.43", default-features = false } diff --git a/fuzzers/inprocess/libfuzzer_libpng/Cargo.toml b/fuzzers/inprocess/libfuzzer_libpng/Cargo.toml index f915d94e0dd..9dedf1161bd 100644 --- a/fuzzers/inprocess/libfuzzer_libpng/Cargo.toml +++ b/fuzzers/inprocess/libfuzzer_libpng/Cargo.toml @@ -24,15 +24,15 @@ cc = { version = "1.1.21", features = ["parallel"] } which = "6.0.3" [dependencies] -libafl = { path = "../../../libafl", features = ["default"] } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl", features = ["default"] } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "libfuzzer", "sancov_cmplog", ] } # TODO Include it only when building cc -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } log = { version = "0.4.22", features = ["release_max_level_info"] } mimalloc = { version = "0.1.43", default-features = false } diff --git a/fuzzers/inprocess/libfuzzer_libpng_accounting/Cargo.toml b/fuzzers/inprocess/libfuzzer_libpng_accounting/Cargo.toml index aa14af9d337..9316a0d5986 100644 --- a/fuzzers/inprocess/libfuzzer_libpng_accounting/Cargo.toml +++ b/fuzzers/inprocess/libfuzzer_libpng_accounting/Cargo.toml @@ -22,24 +22,24 @@ cc = { version = "1.1.21", features = ["parallel"] } which = "6.0.3" [dependencies] -libafl = { path = "../../../libafl", features = [ +libafl = { path = "../../../crates/libafl", features = [ "std", "derive", "tcp_manager", "llmp_compression", "introspection", ] } -libafl_bolts = { path = "../../../libafl_bolts", features = [ +libafl_bolts = { path = "../../../crates/libafl_bolts", features = [ "std", "derive", "llmp_compression", ] } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "libfuzzer", ] } # TODO Include it only when building cc -libafl_cc = { path = "../../../libafl_cc/" } +libafl_cc = { path = "../../../crates/libafl_cc/" } clap = { version = "4.5.18", features = ["derive"] } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/inprocess/libfuzzer_libpng_centralized/Cargo.toml b/fuzzers/inprocess/libfuzzer_libpng_centralized/Cargo.toml index 7436ac832a7..4f41993ab3b 100644 --- a/fuzzers/inprocess/libfuzzer_libpng_centralized/Cargo.toml +++ b/fuzzers/inprocess/libfuzzer_libpng_centralized/Cargo.toml @@ -22,7 +22,7 @@ cc = { version = "1.1.21", features = ["parallel"] } which = "6.0.3" [dependencies] -libafl = { path = "../../../libafl", features = [ +libafl = { path = "../../../crates/libafl", features = [ "std", "derive", "rand_trait", @@ -31,15 +31,15 @@ libafl = { path = "../../../libafl", features = [ "gzip", "regex", ] } -libafl_bolts = { path = "../../../libafl_bolts", features = [ +libafl_bolts = { path = "../../../crates/libafl_bolts", features = [ "errors_backtrace", ] } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "libfuzzer", ] } # TODO Include it only when building cc -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } clap = { version = "4.5.18", features = ["derive"] } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/inprocess/libfuzzer_libpng_cmin/Cargo.toml b/fuzzers/inprocess/libfuzzer_libpng_cmin/Cargo.toml index 0122e60f04d..a522f8537de 100644 --- a/fuzzers/inprocess/libfuzzer_libpng_cmin/Cargo.toml +++ b/fuzzers/inprocess/libfuzzer_libpng_cmin/Cargo.toml @@ -25,15 +25,15 @@ cc = { version = "1.1.21", features = ["parallel"] } which = "6.0.3" [dependencies] -libafl = { path = "../../../libafl", features = ["default", "cmin"] } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl", features = ["default", "cmin"] } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "libfuzzer", "sancov_cmplog", ] } # TODO Include it only when building cc -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } env_logger = "0.11.5" log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/inprocess/libfuzzer_libpng_launcher/Cargo.toml b/fuzzers/inprocess/libfuzzer_libpng_launcher/Cargo.toml index 1f40d299b1b..4db77d1ff40 100644 --- a/fuzzers/inprocess/libfuzzer_libpng_launcher/Cargo.toml +++ b/fuzzers/inprocess/libfuzzer_libpng_launcher/Cargo.toml @@ -22,19 +22,19 @@ cc = { version = "1.1.21", features = ["parallel"] } which = "6.0.3" [dependencies] -libafl = { path = "../../../libafl", features = [ +libafl = { path = "../../../crates/libafl", features = [ "std", "derive", "llmp_compression", "introspection", ] } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "libfuzzer", ] } # TODO Include it only when building cc -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } clap = { version = "4.5.18", features = ["derive"] } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/inprocess/libfuzzer_libpng_norestart/Cargo.toml b/fuzzers/inprocess/libfuzzer_libpng_norestart/Cargo.toml index 15c87bc51fa..6184ada909b 100644 --- a/fuzzers/inprocess/libfuzzer_libpng_norestart/Cargo.toml +++ b/fuzzers/inprocess/libfuzzer_libpng_norestart/Cargo.toml @@ -23,16 +23,16 @@ which = "6.0.3" [dependencies] env_logger = "0.11.5" -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts", features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts", features = [ "errors_backtrace", ] } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "libfuzzer", ] } # TODO Include it only when building cc -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } clap = { version = "4.5.18", features = ["derive"] } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/inprocess/libfuzzer_libpng_tcp_manager/Cargo.toml b/fuzzers/inprocess/libfuzzer_libpng_tcp_manager/Cargo.toml index f1857557eba..062a16d2dfd 100644 --- a/fuzzers/inprocess/libfuzzer_libpng_tcp_manager/Cargo.toml +++ b/fuzzers/inprocess/libfuzzer_libpng_tcp_manager/Cargo.toml @@ -24,16 +24,19 @@ cc = { version = "1.1.21", features = ["parallel"] } which = "6.0.3" [dependencies] -libafl = { path = "../../../libafl", features = ["default", "tcp_manager"] } -# libafl = { path = "../../../libafl/", features = ["default"] } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl", features = [ + "default", + "tcp_manager", +] } +# libafl = { path = "../../../crates/libafl/", features = ["default"] } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "libfuzzer", "sancov_cmplog", ] } # TODO Include it only when building cc -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } log = { version = "0.4.22", features = ["release_max_level_info"] } mimalloc = { version = "0.1.43", default-features = false } diff --git a/fuzzers/inprocess/libfuzzer_stb_image/Cargo.toml b/fuzzers/inprocess/libfuzzer_stb_image/Cargo.toml index 2f31e94aa8b..aa648048a41 100644 --- a/fuzzers/inprocess/libfuzzer_stb_image/Cargo.toml +++ b/fuzzers/inprocess/libfuzzer_stb_image/Cargo.toml @@ -18,16 +18,16 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "sancov_cmplog", "libfuzzer", ] } log = { version = "0.4.22", features = ["release_max_level_info"] } mimalloc = { version = "0.1.43", default-features = false } -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } [build-dependencies] cc = { version = "1.1.21", features = ["parallel"] } diff --git a/fuzzers/inprocess/libfuzzer_stb_image_sugar/Cargo.toml b/fuzzers/inprocess/libfuzzer_stb_image_sugar/Cargo.toml index 5c002021dce..33ac971e3c2 100644 --- a/fuzzers/inprocess/libfuzzer_stb_image_sugar/Cargo.toml +++ b/fuzzers/inprocess/libfuzzer_stb_image_sugar/Cargo.toml @@ -25,17 +25,17 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_edges", "sancov_cmplog", "libfuzzer", ] } -libafl_sugar = { path = "../../../libafl_sugar" } +libafl_sugar = { path = "../../../crates/libafl_sugar" } log = { version = "0.4.22", features = ["release_max_level_info"] } mimalloc = { version = "0.1.43", default-features = false } -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } [build-dependencies] cc = { version = "1.1.21", features = ["parallel"] } diff --git a/fuzzers/inprocess/libfuzzer_windows_asan/Cargo.toml b/fuzzers/inprocess/libfuzzer_windows_asan/Cargo.toml index e41049e8b3a..48e4a8cafdd 100644 --- a/fuzzers/inprocess/libfuzzer_windows_asan/Cargo.toml +++ b/fuzzers/inprocess/libfuzzer_windows_asan/Cargo.toml @@ -14,13 +14,13 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "libfuzzer", "sancov_pcguard_edges", ] } -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } log = { version = "0.4.22", features = ["release_max_level_info"] } [build-dependencies] diff --git a/fuzzers/inprocess/sqlite_centralized_multi_machine/Cargo.toml b/fuzzers/inprocess/sqlite_centralized_multi_machine/Cargo.toml index 5cd760ee533..3fa989c9210 100644 --- a/fuzzers/inprocess/sqlite_centralized_multi_machine/Cargo.toml +++ b/fuzzers/inprocess/sqlite_centralized_multi_machine/Cargo.toml @@ -24,7 +24,7 @@ which = "6.0.3" [dependencies] # no llmp compression for now, better perfs. -libafl = { path = "../../../libafl", default-features = false, features = [ +libafl = { path = "../../../crates/libafl", default-features = false, features = [ "std", "derive", "llmp_small_maps", @@ -46,13 +46,13 @@ libafl = { path = "../../../libafl", default-features = false, features = [ "multi_machine", "errors_backtrace", ] } -libafl_bolts = { path = "../../../libafl_bolts", features = ["xxh3"] } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl_bolts = { path = "../../../crates/libafl_bolts", features = ["xxh3"] } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "libfuzzer", ] } # TODO Include it only when building cc -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } clap = { version = "4.5.18", features = ["derive"] } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/structure_aware/baby_fuzzer_custom_input/Cargo.toml b/fuzzers/structure_aware/baby_fuzzer_custom_input/Cargo.toml index 8068461b0c6..a013e0ca1ce 100644 --- a/fuzzers/structure_aware/baby_fuzzer_custom_input/Cargo.toml +++ b/fuzzers/structure_aware/baby_fuzzer_custom_input/Cargo.toml @@ -19,7 +19,7 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } serde = "1.0.210" diff --git a/fuzzers/structure_aware/baby_fuzzer_gramatron/Cargo.toml b/fuzzers/structure_aware/baby_fuzzer_gramatron/Cargo.toml index 447f8f6a7e4..406945d85d4 100644 --- a/fuzzers/structure_aware/baby_fuzzer_gramatron/Cargo.toml +++ b/fuzzers/structure_aware/baby_fuzzer_gramatron/Cargo.toml @@ -22,8 +22,8 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } postcard = { version = "1.0.10", features = [ "alloc", diff --git a/fuzzers/structure_aware/baby_fuzzer_grimoire/Cargo.toml b/fuzzers/structure_aware/baby_fuzzer_grimoire/Cargo.toml index bf90c3222b1..c767963706e 100644 --- a/fuzzers/structure_aware/baby_fuzzer_grimoire/Cargo.toml +++ b/fuzzers/structure_aware/baby_fuzzer_grimoire/Cargo.toml @@ -22,6 +22,6 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/structure_aware/baby_fuzzer_multi/Cargo.toml b/fuzzers/structure_aware/baby_fuzzer_multi/Cargo.toml index 636ccbc510a..1247209890e 100644 --- a/fuzzers/structure_aware/baby_fuzzer_multi/Cargo.toml +++ b/fuzzers/structure_aware/baby_fuzzer_multi/Cargo.toml @@ -24,6 +24,6 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl", features = ["multipart_inputs"] } -libafl_bolts = { path = "../../../libafl_bolts" } +libafl = { path = "../../../crates/libafl", features = ["multipart_inputs"] } +libafl_bolts = { path = "../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/structure_aware/baby_fuzzer_nautilus/Cargo.toml b/fuzzers/structure_aware/baby_fuzzer_nautilus/Cargo.toml index 24dad8c60c8..4322c02d015 100644 --- a/fuzzers/structure_aware/baby_fuzzer_nautilus/Cargo.toml +++ b/fuzzers/structure_aware/baby_fuzzer_nautilus/Cargo.toml @@ -22,6 +22,6 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl", features = ["default", "nautilus"] } -libafl_bolts = { path = "../../../libafl_bolts" } +libafl = { path = "../../../crates/libafl", features = ["default", "nautilus"] } +libafl_bolts = { path = "../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/structure_aware/baby_fuzzer_tokens/Cargo.toml b/fuzzers/structure_aware/baby_fuzzer_tokens/Cargo.toml index 9dff6399c64..c928c4a12e8 100644 --- a/fuzzers/structure_aware/baby_fuzzer_tokens/Cargo.toml +++ b/fuzzers/structure_aware/baby_fuzzer_tokens/Cargo.toml @@ -22,6 +22,6 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl" } -libafl_bolts = { path = "../../../libafl_bolts" } +libafl = { path = "../../../crates/libafl" } +libafl_bolts = { path = "../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } diff --git a/fuzzers/structure_aware/forkserver_simple_nautilus/Cargo.toml b/fuzzers/structure_aware/forkserver_simple_nautilus/Cargo.toml index 5afc153f10b..ec2170a2305 100644 --- a/fuzzers/structure_aware/forkserver_simple_nautilus/Cargo.toml +++ b/fuzzers/structure_aware/forkserver_simple_nautilus/Cargo.toml @@ -18,7 +18,11 @@ opt-level = 3 [dependencies] clap = { version = "4.5.18", features = ["derive"] } env_logger = "0.11.5" -libafl = { path = "../../../libafl", features = ["std", "derive", "nautilus"] } -libafl_bolts = { path = "../../../libafl_bolts" } +libafl = { path = "../../../crates/libafl", features = [ + "std", + "derive", + "nautilus", +] } +libafl_bolts = { path = "../../../crates/libafl_bolts" } log = { version = "0.4.22", features = ["release_max_level_info"] } nix = { version = "0.30.1", features = ["signal"] } diff --git a/fuzzers/structure_aware/libfuzzer_stb_image_concolic/fuzzer/Cargo.toml b/fuzzers/structure_aware/libfuzzer_stb_image_concolic/fuzzer/Cargo.toml index efad74d2447..042d4c21a7d 100644 --- a/fuzzers/structure_aware/libfuzzer_stb_image_concolic/fuzzer/Cargo.toml +++ b/fuzzers/structure_aware/libfuzzer_stb_image_concolic/fuzzer/Cargo.toml @@ -20,9 +20,11 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../../libafl", features = ["concolic_mutation"] } -libafl_bolts = { path = "../../../../libafl_bolts" } -libafl_targets = { path = "../../../../libafl_targets", features = [ +libafl = { path = "../../../../crates/libafl", features = [ + "concolic_mutation", +] } +libafl_bolts = { path = "../../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../../crates/libafl_targets", features = [ "sancov_pcguard_edges", "sancov_cmplog", "libfuzzer", @@ -35,4 +37,4 @@ mimalloc = { version = "0.1.43", default-features = false } cc = { version = "1.1.22", features = ["parallel"] } cmake = "0.1.51" which = "6.0.3" -symcc_libafl = { path = "../../../../libafl_concolic/symcc_libafl" } +symcc_libafl = { path = "../../../../crates/libafl_concolic/symcc_libafl" } diff --git a/fuzzers/structure_aware/libfuzzer_stb_image_concolic/runtime/Cargo.toml b/fuzzers/structure_aware/libfuzzer_stb_image_concolic/runtime/Cargo.toml index 1064d1b8f13..e21158a3cd8 100644 --- a/fuzzers/structure_aware/libfuzzer_stb_image_concolic/runtime/Cargo.toml +++ b/fuzzers/structure_aware/libfuzzer_stb_image_concolic/runtime/Cargo.toml @@ -21,4 +21,4 @@ panic = "abort" [dependencies] log = { version = "0.4.22", features = ["release_max_level_info"] } -symcc_runtime = { path = "../../../../libafl_concolic/symcc_runtime" } +symcc_runtime = { path = "../../../../crates/libafl_concolic/symcc_runtime" } diff --git a/fuzzers/structure_aware/nautilus_sync/Cargo.toml b/fuzzers/structure_aware/nautilus_sync/Cargo.toml index e639d941df4..669071bfdc2 100644 --- a/fuzzers/structure_aware/nautilus_sync/Cargo.toml +++ b/fuzzers/structure_aware/nautilus_sync/Cargo.toml @@ -23,14 +23,14 @@ opt-level = 3 debug = true [dependencies] -libafl = { path = "../../../libafl", features = ["default", "nautilus"] } -libafl_bolts = { path = "../../../libafl_bolts" } -libafl_targets = { path = "../../../libafl_targets", features = [ +libafl = { path = "../../../crates/libafl", features = ["default", "nautilus"] } +libafl_bolts = { path = "../../../crates/libafl_bolts" } +libafl_targets = { path = "../../../crates/libafl_targets", features = [ "sancov_pcguard_hitcounts", "libfuzzer", ] } # TODO Include it only when building cc -libafl_cc = { path = "../../../libafl_cc" } +libafl_cc = { path = "../../../crates/libafl_cc" } clap = { version = "4.5.18", features = ["derive"] } mimalloc = { version = "0.1.43", default-features = false } diff --git a/just/README.md b/just/README.md index 272f7c50853..957207a15a8 100644 --- a/just/README.md +++ b/just/README.md @@ -3,4 +3,4 @@ Here is stored the common library used by our example fuzzers. It mainly consists of boilerplate definitions and convenient functions. -One of these files should always be included in final `Justfile`s. \ No newline at end of file +One of these files should always be included in final `Justfile`s. diff --git a/libafl_intelpt/README.md b/libafl_intelpt/README.md deleted file mode 100644 index 237d591a8b1..00000000000 --- a/libafl_intelpt/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Intel Processor Trace (PT) low level code - -This module is a wrapper around the IntelPT kernel driver, exposing functionalities specifically crafted for libafl. - -At the moment only linux hosts are supported. diff --git a/scripts/clippy.ps1 b/scripts/clippy.ps1 index c498f16f513..62c29b1af3f 100644 --- a/scripts/clippy.ps1 +++ b/scripts/clippy.ps1 @@ -31,12 +31,12 @@ function Run-Clippy { # Define projects for Windows $AllProjects = @( - "libafl_concolic/test/dump_constraints", - "libafl_concolic/test/runtime_test", - "libafl_libfuzzer", - "libafl_nyx", - "libafl_sugar", - "libafl_tinyinst" + "crates/libafl_concolic/test/dump_constraints", + "crates/libafl_concolic/test/runtime_test", + "crates/libafl_libfuzzer", + "crates/libafl_nyx", + "crates/libafl_sugar", + "crates/libafl_tinyinst" "utils/build_and_test_fuzzers", "utils/deexit", "utils/libafl_benches", diff --git a/scripts/clippy.sh b/scripts/clippy.sh index bccaa080872..3464862ee69 100755 --- a/scripts/clippy.sh +++ b/scripts/clippy.sh @@ -22,26 +22,26 @@ run_clippy() { # Define projects based on the operating system if [[ "$OSTYPE" == "linux-gnu"* ]]; then ALL_PROJECTS=( - "libafl" - "libafl_bolts" - "libafl_cc" - "libafl_concolic/symcc_runtime" - "libafl_concolic/symcc_libafl" - "libafl_frida" - "libafl_libfuzzer" - "libafl_libfuzzer_runtime" - "libafl_qemu" - "libafl_tinyinst" - "libafl_qemu/libafl_qemu_build" - "libafl_qemu/libafl_qemu_sys" - "libafl_nyx" - "libafl_intelpt" + "crates/libafl" + "crates/libafl_bolts" + "crates/libafl_cc" + "crates/libafl_concolic/symcc_runtime" + "crates/libafl_concolic/symcc_libafl" + "crates/libafl_frida" + "crates/libafl_libfuzzer" + "crates/libafl_libfuzzer_runtime" + "crates/libafl_qemu" + "crates/libafl_tinyinst" + "crates/libafl_qemu/libafl_qemu_build" + "crates/libafl_qemu/libafl_qemu_sys" + "crates/libafl_nyx" + "crates/libafl_intelpt" ) fi # Do not use --all-features for the following projects NO_ALL_FEATURES=( - "libafl_qemu" + "crates/libafl_qemu" ) if [ "$#" -eq 0 ]; then diff --git a/scripts/createAliases.sh b/scripts/createAliases.sh deleted file mode 100755 index 1e89dae157e..00000000000 --- a/scripts/createAliases.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# creates a symbolic link from bin-x.x to bin -# This just strips off last 3 characters when creating a link - -LLVMFILES="/usr/bin/llvm*" -CLANGFILES="/usr/bin/clang*" -LLC=/usr/bin/llc-$1 -OPT=/usr/bin/opt-$1 -LLD=/usr/bin/lld-$1 - -for f in $LLVMFILES $CLANGFILES $LLC $OPT $LLD -do - link=${f::-3} - echo "linking" "$f" "to" "$link" - ln -s "$f" "$link" - if [ -e "$f" ] - then cp "$link" /usr/local/bin/ - fi -done diff --git a/scripts/dummy.rs b/scripts/dummy.rs deleted file mode 100644 index 464dee6f2e6..00000000000 --- a/scripts/dummy.rs +++ /dev/null @@ -1,5 +0,0 @@ -/// Dummy file for Docker build caching - -/// Just here as dummy in docker -#[expect(dead_code)] -fn main() { panic!("This is the CI dummy file - it should never run!") } \ No newline at end of file diff --git a/scripts/publish.sh b/scripts/publish.sh index df2ab26298c..0caabed59c3 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -4,71 +4,71 @@ cd "$SCRIPT_DIR/.." || exit 1 set -e -cd libafl_derive +pushd crates/libafl_derive cargo publish "$@" -cd .. || exit 1 +popd || exit 1 sleep 20 -cd libafl_cc +pushd crates/libafl_cc cargo publish "$@" -cd .. || exit 1 +popd || exit 1 sleep 20 -cd libafl_bolts +pushd crates/libafl_bolts cargo publish "$@" -cd .. || exit 1 +popd || exit 1 sleep 20 -cd libafl_intelpt +pushd crates/libafl_intelpt cargo publish "$@" -cd .. || exit 1 +popd || exit 1 sleep 20 -cd libafl +pushd crates/libafl cargo publish "$@" -cd .. || exit 1 +popd || exit 1 sleep 20 -cd libafl_targets +pushd crates/libafl_targets cargo publish "$@" -cd .. || exit 1 +popd || exit 1 sleep 20 -cd libafl_frida +pushd crates/libafl_frida cargo publish "$@" -cd .. || exit 1 +popd || exit 1 sleep 20 -cd libafl_qemu +pushd crates/libafl_qemu -cd libafl_qemu_build +pushd libafl_qemu_build cargo publish "$@" -cd .. -cd libafl_qemu_sys +popd +pushd libafl_qemu_sys cargo publish "$@" -cd .. +popd cargo publish "$@" -cd .. || exit 1 +popd || exit 1 sleep 20 -cd libafl_sugar +pushd crates/libafl_sugar cargo publish "$@" -cd .. || exit 1 +popd || exit 1 sleep 20 -cd libafl_concolic/symcc_libafl +pushd crates/libafl_concolic/symcc_libafl cargo publish "$@" -cd ../.. || exit 1 +popd || exit 1 sleep 20 @@ -79,46 +79,46 @@ if git submodule status | grep "^-">/dev/null ; then \ git submodule update; \ fi -cd libafl_concolic/symcc_runtime +pushd crates/libafl_concolic/symcc_runtime cargo publish "$@" --allow-dirty -cd ../.. || exit 1 +popd || exit 1 -cd libafl_libfuzzer +pushd crates/libafl_libfuzzer cargo publish "$@" -cd .. || exit 1 +popd || exit 1 sleep 20 -cd libafl_asan +pushd crates/libafl_asan cargo publish "$@" -cd .. || exit 1 +popd || exit 1 sleep 20 -cd libafl_asan/libafl_asan_libc +pushd crates/libafl_asan/libafl_asan_libc cargo publish "$@" -cd ../.. || exit 1 +popd || exit 1 sleep 20 -cd libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest +pushd crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_guest cargo publish "$@" -cd ../../.. || exit 1 +popd || exit 1 sleep 20 -cd libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host +pushd crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_host cargo publish "$@" -cd ../../.. || exit 1 +popd || exit 1 sleep 20 -cd libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc +pushd crates/libafl_qemu/libafl_qemu_asan/libafl_qemu_asan_nolibc cargo publish "$@" -cd ../../.. || exit 1 +popd || exit 1 sleep 20 -cd libafl_qemu/libafl_qemu_runner +pushd crates/libafl_qemu/libafl_qemu_runner cargo publish "$@" -cd ../.. || exit 1 \ No newline at end of file +popd || exit 1 \ No newline at end of file diff --git a/utils/README.md b/utils/README.md index c79d7a570f0..0723fe85e89 100644 --- a/utils/README.md +++ b/utils/README.md @@ -11,9 +11,9 @@ Abort, on the other hand, raises an error LibAFL's inprocess executor will be ab ## Gramatron: gramatron grammars and preprocessing utils -See https://github.com/HexHive/Gramatron +See ## libafl_benches This folder contains benchmarks for various things in LibAFL, like hash speeds and RNGs. -Run with `cargo bench` \ No newline at end of file +Run with `cargo bench` diff --git a/utils/gdb_qemu/README.md b/utils/gdb_qemu/README.md index f36ccfc6a3d..ac129bd629d 100644 --- a/utils/gdb_qemu/README.md +++ b/utils/gdb_qemu/README.md @@ -1,14 +1,30 @@ # GDB-QEMU + `gdb-qemu` is a launcher for running `qemu-user` within `gdb`. -# Test -``` +## About + +`qemu-gdb` does the following: + +* Creates two pipes for the target program to send its `stdout`, `stderr`. +* Forks a child process and sets the `stdout` and `stderr` using `dup2`. +* Exec's the target program (passing the provided arguments). +* Connects to the specified TCP debug port on the target program. +* Forwards data from `gdb-qemu`'s `stdin` and `stdout` to the TCP port. +* Forwards data from the target program's `stdout` and `stderr` to `gdb-qemu`s `stderr`. +* Optionally logs to the specified log file. +* Optionally logs trace information of the data transferred by the message pumps. + +## Test + +```sh rustup target add powerpc-unknown-linux-gnu $ just gdb ``` -# Example -``` +## Example + +```sh gdb-multiarch \ -ex "set architecture powerpc:MPC8XX" \ -ex "set pagination off" \ @@ -17,19 +33,9 @@ gdb-multiarch \ -ex "target remote | gdb-qemu -p 1234 qemu-ppc -- -L /usr/powerpc-linux-gnu -g 1234 demo ``` -# About -`qemu-gdb` does the following: -* Creates two pipes for the target program to send its `stdout`, `stderr`. -* Forks a child process and sets the `stdout` and `stderr` using `dup2`. -* Exec's the target program (passing the provided arguments). -* Connects to the specified TCP debug port on the target program. -* Forwards data from `gdb-qemu`'s `stdin` and `stdout` to the TCP port. -* Forwards data from the target program's `stdout` and `stderr` to `gdb-qemu`s `stderr`. -* Optionally logs to the specified log file. -* Optionally logs trace information of the data transferred by the message pumps. +## Usage -# Usage -``` +```sh Tool launching qemu-user for debugging Usage: gdb-qemu [OPTIONS] --port [-- ...] diff --git a/utils/gramatron/README.md b/utils/gramatron/README.md index fb202fea690..792bf3a0562 100644 --- a/utils/gramatron/README.md +++ b/utils/gramatron/README.md @@ -8,7 +8,7 @@ Then use the output as input of the `construct_automata` crate. Here an example using the Ruby grammar: -``` +```sh ./gnf_converter.py --gf grammars/ruby_grammar.json --out ruby_gnf.json --start PROGRAM cd construct_automata RUSTFLAGS="-C target-cpu=native" cargo run --release -- --gf ../ruby_gnf.json --out ../ruby_automaton.postcard diff --git a/utils/noaslr/README.md b/utils/noaslr/README.md index 2a7925aec5d..07420360452 100644 --- a/utils/noaslr/README.md +++ b/utils/noaslr/README.md @@ -1,4 +1,5 @@ # NOASLR + `noaslr` is a launcher for running applications with ASLR disabled without having to disable the feature system-wide. @@ -10,31 +11,37 @@ file passed as its single argument. By passing `/proc/self/maps` as its argument it can be observed that the application loads at the same default address each time it is run. -# Test -## App -``` -$ just run -``` -## Library +## Test -``` -$ just runlib -``` +### App -# Example -## App +```sh +just run ``` -$ ./target/debug/noaslr ./target/debug/demo -- /proc/self/maps + +### Library + +```sh +just runlib ``` -## Library +## Example + +### App + +```sh +./target/debug/noaslr ./target/debug/demo -- /proc/self/maps ``` -$ LD_PRELOAD=target/debug/libnoaslr.so ./target/debug/demo /proc/self/maps + +### Library + +```sh +LD_PRELOAD=target/debug/libnoaslr.so ./target/debug/demo /proc/self/maps ``` -## Output -... +### Output +```sh 555555554000-55555556d000 r--p 00000000 fd:03 78381550 /home/jon/git/LibAFL/utils/noaslr/target/debug/demo 55555556d000-5555556a1000 r-xp 00019000 fd:03 78381550 /home/jon/git/LibAFL/utils/noaslr/target/debug/demo 5555556a1000-5555556ee000 r--p 0014d000 fd:03 78381550 /home/jon/git/LibAFL/utils/noaslr/target/debug/demo @@ -80,14 +87,19 @@ ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsysca ``` -# About -## APP +## About + +### APP + `noaslr` does the following: + * Uses the `personality` API to set the flag `ADDR_NO_RANDOMIZE`. * Uses the `execve` API to launch the child application. -## Lib +### Lib + `libnoasl` does the following: + * Uses rusts `ctor` crate to define a function as `__attribute__((constructor))` * Uses the `personality` API to determine if the flag `ADDR_NO_RANDOMIZE` is set * If the flag is set, the constructor returns, otherwise... @@ -96,8 +108,10 @@ ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsysca * Reads the program environment variables from `/proc/self/environ` * Uses the `execvpe` API to re-launch the application -# Usage -``` +## Usage + +```sh + Tool launching applications with ASLR disabled Usage: noaslr [-- ...] @@ -115,4 +129,5 @@ Options: -V, --version Print version + ```