Skip to content

Commit 5b70fe4

Browse files
committed
Merge branch 'pr/rebase-with-upstream' into main
2 parents bc2c6d4 + cff29c5 commit 5b70fe4

File tree

210 files changed

+8804
-2919
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+8804
-2919
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Thank you for making LibAFL better!
1313

1414
**Describe the bug**
1515
A clear and concise description of what the bug is.
16+
If you want to present the backtrace, don't forget to run with `errors_backtrace` feature and log from `RUST_LOG`
17+
In addition, please tell us what is your fuzzer's Cargo.toml
1618

1719
**To Reproduce**
1820
Steps to reproduce the behavior:

.github/workflows/build_and_test.yml

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
merge_group:
1010
env:
1111
CARGO_TERM_COLOR: always
12+
CARGO_NET_GIT_FETCH_WITH_CLI: true
1213
concurrency:
1314
group: ${{ github.workflow }}-${{ github.ref }}
1415
cancel-in-progress: true
@@ -116,7 +117,7 @@ jobs:
116117
- uses: actions/checkout@v3
117118
- uses: ./.github/workflows/ubuntu-prepare
118119
- uses: Swatinem/rust-cache@v2
119-
- name: Add nightly rustfmt and clippy
120+
- name: Add nightly clippy
120121
run: rustup toolchain install nightly --component miri --allow-downgrade
121122
# --- miri undefined behavior test --
122123
- name: Run miri tests
@@ -135,22 +136,19 @@ jobs:
135136
run: sudo apt purge llvm* clang* lld* lldb* opt*
136137
- name: Install and cache deps
137138
run: sudo apt update && sudo apt install ninja-build shellcheck libgtk-3-dev gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libslirp-dev libz3-dev
138-
- name: Add nightly rustfmt and clippy
139-
run: rustup toolchain install nightly --component rustfmt --component clippy --component miri --allow-downgrade
139+
- name: Add nightly clippy
140+
run: rustup toolchain install nightly --component clippy --component miri --allow-downgrade
140141
- uses: actions/checkout@v3
141142
- uses: Swatinem/rust-cache@v2
142143
with: { shared-key: "ubuntu" }
143144
- name: Install LLVM and Clang
144-
uses: KyleMayes/install-llvm-action@v1
145+
uses: KyleMayes/install-llvm-action@v2
145146
with:
146147
directory: ${{ runner.temp }}/llvm
147148
version: 17
148-
# ---- format check ----
149149
# pcguard edges and pcguard hitcounts are not compatible and we need to build them seperately
150150
- name: Check pcguard edges
151151
run: cargo check --features=sancov_pcguard_edges
152-
- name: Run clang-format style check for C/C++ programs.
153-
run: clang-format -n -Werror --style=file $(find . -type f \( -name '*.cpp' -o -iname '*.hpp' -o -name '*.cc' -o -name '*.cxx' -o -name '*.cc' -o -name '*.h' \) | grep -v '/target/' | grep -v 'libpng-1\.6\.37' | grep -v 'stb_image\.h' | grep -v 'dlmalloc\.c' | grep -v 'QEMU-Nyx')
154152
- name: run shellcheck
155153
run: shellcheck ./scripts/*.sh
156154
# ---- build normal and examples ----
@@ -171,36 +169,22 @@ jobs:
171169

172170
- name: Install and cache deps
173171
run: sudo apt update && sudo apt install ninja-build shellcheck libgtk-3-dev gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libslirp-dev libz3-dev
174-
- name: Add nightly rustfmt and clippy
172+
- name: Add nightly clippy
175173
run: rustup toolchain install nightly --component clippy --allow-downgrade && rustup default nightly
176174
- uses: actions/checkout@v3
177175
- uses: Swatinem/rust-cache@v2
178176
with: { shared-key: "ubuntu" }
179177
- name: Install LLVM and Clang
180-
uses: KyleMayes/install-llvm-action@v1
178+
uses: KyleMayes/install-llvm-action@v2
181179
with:
182180
directory: ${{ runner.temp }}/llvm
183181
version: 17
184182
- name: Run clippy
185183
run: ./scripts/clippy.sh
186-
187184
# --- test embedding the libafl_libfuzzer_runtime library
188185
# Fix me plz
189186
# - name: Test Build libafl_libfuzzer with embed
190187
# run: cargo +nightly test --features=embed-runtime --manifest-path libafl_libfuzzer/Cargo.toml
191-
ubuntu-check-nightly:
192-
runs-on: ubuntu-22.04
193-
needs: ubuntu
194-
steps:
195-
- uses: actions/checkout@v3
196-
- uses: ./.github/workflows/ubuntu-prepare
197-
- uses: Swatinem/rust-cache@v2
198-
with: { shared-key: "ubuntu" }
199-
# ---- build and feature check ----
200-
# cargo-hack's --feature-powerset would be nice here but libafl has a too many knobs
201-
- name: Check nightly features
202-
run: cargo +nightly check --features=agpl && cargo +nightly check --features=nautilus
203-
204188

205189
ubuntu-check:
206190
runs-on: ubuntu-22.04
@@ -217,7 +201,6 @@ jobs:
217201
# cargo-hack's --feature-powerset would be nice here but libafl has a too many knobs
218202
- name: Check each feature
219203
# Skipping `python` as it has to be built with the `maturin` tool
220-
# `agpl`, `nautilus` require nightly
221204
# `sancov_pcguard_edges` is tested seperatelyc
222205
run: python3 ./scripts/parallellize_cargo_check.py ${{ matrix.instance_idx }}
223206

@@ -247,7 +230,7 @@ jobs:
247230
- name: Remove existing clang and LLVM
248231
run: sudo apt purge llvm* clang*
249232
- name: Install LLVM and Clang
250-
uses: KyleMayes/install-llvm-action@v1
233+
uses: KyleMayes/install-llvm-action@v2
251234
with:
252235
directory: ${{ runner.temp }}/llvm
253236
version: 17
@@ -272,8 +255,15 @@ jobs:
272255
override: true
273256
components: rustfmt
274257
- uses: actions/checkout@v3
258+
- name: Remove existing clang and LLVM
259+
run: sudo apt purge llvm* clang*
260+
- name: Install LLVM and Clang
261+
uses: KyleMayes/install-llvm-action@v2
262+
with:
263+
directory: ${{ runner.temp }}/llvm
264+
version: 17
275265
- name: Format Check
276-
run: cargo fmt -- --check
266+
run: ./scripts/fmt_all.sh check
277267

278268
fuzzers-preflight:
279269
runs-on: ubuntu-latest
@@ -344,6 +334,8 @@ jobs:
344334
- ./fuzzers/backtrace_baby_fuzzers/forkserver_executor
345335
- ./fuzzers/backtrace_baby_fuzzers/c_code_with_inprocess_executor
346336
- ./fuzzers/backtrace_baby_fuzzers/rust_code_with_fork_executor
337+
- ./fuzzers/toolbox
338+
# - ./fuzzers/frida_simple_exe
347339
runs-on: ${{ matrix.os }}
348340
steps:
349341
- uses: actions/checkout@v3
@@ -399,7 +391,7 @@ jobs:
399391
profile: minimal
400392
toolchain: nightly
401393
override: true
402-
components: rustfmt, rust-src
394+
components: rust-src
403395
- uses: actions/checkout@v3
404396
- uses: Swatinem/rust-cache@v2
405397
- name: Add targets
@@ -419,7 +411,7 @@ jobs:
419411
profile: minimal
420412
toolchain: nightly
421413
override: true
422-
components: rustfmt, clippy, rust-src
414+
components: clippy, rust-src
423415
- uses: actions/checkout@v3
424416
- uses: Swatinem/rust-cache@v2
425417
- name: Add targets
@@ -488,11 +480,11 @@ jobs:
488480
profile: minimal
489481
toolchain: stable
490482
- uses: actions/checkout@v3
483+
- uses: ./.github/workflows/windows-tester-prepare
491484
- uses: Swatinem/rust-cache@v2
492-
- name: Run clippy
493-
uses: actions-rs/cargo@v1
494-
with:
495-
command: clippy
485+
- name: Run real clippy, not the fake one
486+
shell: pwsh
487+
run: .\scripts\clippy.ps1
496488

497489
macos:
498490
runs-on: macOS-latest
@@ -501,8 +493,8 @@ jobs:
501493
with:
502494
profile: minimal
503495
toolchain: stable
504-
- name: Add nightly rustfmt and clippy
505-
run: rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade && rustup default nightly
496+
- name: Add nightly clippy
497+
run: rustup toolchain install nightly --component clippy --allow-downgrade && rustup default nightly
506498
- name: Install deps
507499
run: brew install z3 gtk+3
508500
- name: Install cxxbridge
@@ -516,7 +508,7 @@ jobs:
516508
- name: Run Tests
517509
run: cargo test
518510
- name: Clippy
519-
run: cargo +nightly clippy --tests --all
511+
run: cargo +nightly clippy --tests --all --exclude libafl_nyx --exclude symcc_runtime --exclude runtime_test
520512

521513
ios:
522514
runs-on: macOS-latest

.github/workflows/fuzzer-tester-prepare/action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ runs:
1313
with:
1414
profile: minimal
1515
toolchain: stable
16-
- name: Add stable rustfmt and clippy
16+
- name: Add stable clippy
1717
shell: bash
18-
run: rustup toolchain install stable --component rustfmt --component clippy --allow-downgrade
19-
- name: Add nightly rustfmt and clippy
18+
run: rustup toolchain install stable --component clippy --allow-downgrade
19+
- name: Add nightly clippy
2020
shell: bash
21-
run: rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade
21+
run: rustup toolchain install nightly --component clippy --allow-downgrade
2222
- name: Add no_std toolchain
2323
shell: bash
2424
run: rustup toolchain install nightly-x86_64-unknown-linux-gnu ; rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
@@ -30,7 +30,7 @@ runs:
3030
shell: bash
3131
run: sudo apt purge -y llvm* clang*
3232
- name: Install LLVM and Clang
33-
uses: KyleMayes/install-llvm-action@v1
33+
uses: KyleMayes/install-llvm-action@v2
3434
with:
3535
directory: ${{ runner.temp }}/llvm
3636
version: 17

.github/workflows/qemu-fuzzer-tester-prepare/action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ runs:
1616
with:
1717
profile: minimal
1818
toolchain: stable
19-
- name: Add stable rustfmt and clippy
19+
- name: Add stable clippy
2020
shell: bash
21-
run: rustup toolchain install stable --component rustfmt --component clippy --allow-downgrade
22-
- name: Add nightly rustfmt and clippy
21+
run: rustup toolchain install stable --component clippy --allow-downgrade
22+
- name: Add nightly clippy
2323
shell: bash
24-
run: rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade
24+
run: rustup toolchain install nightly --component clippy --allow-downgrade
2525
- name: Remove obsolete llvm (Linux)
2626
if: runner.os == 'Linux'
2727
shell: bash
2828
run: sudo apt purge -y llvm* clang*
2929
- name: Install LLVM and Clang
30-
uses: KyleMayes/install-llvm-action@v1
30+
uses: KyleMayes/install-llvm-action@v2
3131
with:
3232
directory: ${{ runner.temp }}/llvm
3333
version: 17

.github/workflows/ubuntu-prepare/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ runs:
2121
shell: bash
2222
run: rustup toolchain install nightly --allow-downgrade
2323
- name: Install LLVM and Clang
24-
uses: KyleMayes/install-llvm-action@v1
24+
uses: KyleMayes/install-llvm-action@v2
2525
with:
2626
directory: ${{ runner.temp }}/llvm
2727
version: 17

.github/workflows/windows-tester-prepare/action.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ runs:
99
toolchain: stable
1010
- uses: actions/checkout@v3
1111
- uses: Swatinem/rust-cache@v2
12-
- name: Windows Build
13-
shell: pwsh
14-
run: cargo build --verbose
1512
- name: Build docs
1613
shell: pwsh
1714
run: cargo doc

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: local
5+
hooks:
6+
- id: fmt
7+
name: fmt
8+
entry: scripts/fmt_all.sh check
9+
language: script

CONTRIBUTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# How to Contribute to LibAFL
2+
3+
For bugs, feel free to open issues or contact us directly. Thank you for your support. <3
4+
5+
## Pull Request guideline
6+
7+
Even though we will gladly assist you in finishing up your PR, try to
8+
- keep all the crates compiling with *stable* rust (hide the eventual non-stable code under [`cfg`s](https://github.com/AFLplusplus/LibAFL/blob/main/libafl/build.rs#L26))
9+
- run `cargo +nightly fmt` on your code before pushing
10+
- check the output of `cargo clippy --all` or `./clippy.sh`
11+
- run `cargo build --no-default-features` to check for `no_std` compatibility (and possibly add `#[cfg(feature = "std")]`) to hide parts of your code.
12+
13+
Some of the parts in this list may be hard, don't be afraid to open a PR if you cannot fix them by yourself, so we can help.
14+
15+
### Pre-commit hooks
16+
17+
Some of these checks can be performed automatically during commit using [pre-commit](https://pre-commit.com/).
18+
Once the package is installed, simply run `pre-commit install` to enable the hooks, the checks will run automatically before the commit becomes effective.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ exclude = [
3535
"libafl_qemu/libafl_qemu_sys",
3636
"utils/noaslr",
3737
"utils/gdb_qemu",
38+
"utils/libafl_fmt",
3839
"scripts",
3940
]
4041

README.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,7 @@ The best-tested fuzzer is [`./fuzzers/libfuzzer_libpng`](./fuzzers/libfuzzer_lib
116116

117117
## Contributing
118118

119-
For bugs, feel free to open issues or contact us directly. Thank you for your support. <3
120-
121-
Even though we will gladly assist you in finishing up your PR, try to
122-
- keep all the crates compiling with *stable* rust (hide the eventual non-stable code under [`cfg`s](https://github.com/AFLplusplus/LibAFL/blob/main/libafl/build.rs#L26))
123-
- run `cargo +nightly fmt` on your code before pushing
124-
- check the output of `cargo clippy --all` or `./clippy.sh`
125-
- run `cargo build --no-default-features` to check for `no_std` compatibility (and possibly add `#[cfg(feature = "std")]`) to hide parts of your code.
126-
127-
Some of the parts in this list may be hard, don't be afraid to open a PR if you cannot fix them by yourself, so we can help.
119+
Please check out [CONTRIBUTING.md](CONTRIBUTING.md) for the contributing guideline.
128120

129121
## Cite
130122

@@ -157,11 +149,3 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
157149
for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
158150
be dual licensed as above, without any additional terms or conditions.
159151
</sub>
160-
161-
<br>
162-
163-
<sub>
164-
Dependencies under more restrictive licenses, such as GPL or AGPL, can be enabled
165-
using the respective feature in each crate when it is present, such as the
166-
'agpl' feature of the libafl crate.
167-
</sub>

fuzzers/baby_fuzzer_nautilus/rust-toolchain

Lines changed: 0 additions & 1 deletion
This file was deleted.

fuzzers/baby_fuzzer_unicode/src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ use libafl::{
1313
feedbacks::{CrashFeedback, MaxMapFeedback},
1414
fuzzer::{Fuzzer, StdFuzzer},
1515
inputs::{BytesInput, HasTargetBytes},
16-
mutators::{StdScheduledMutator, StringCategoryRandMutator, StringSubcategoryRandMutator},
16+
mutators::{StdScheduledMutator, UnicodeCategoryRandMutator, UnicodeSubcategoryRandMutator},
1717
observers::StdMapObserver,
1818
schedulers::QueueScheduler,
19-
stages::{mutational::StdMutationalStage, StringIdentificationStage},
19+
stages::{mutational::StdMutationalStage, UnicodeIdentificationStage},
2020
state::StdState,
2121
Evaluator,
2222
};
@@ -121,14 +121,14 @@ pub fn main() {
121121

122122
// Setup a mutational stage with a basic bytes mutator
123123
let mutator = StdScheduledMutator::new(tuple_list!(
124-
StringCategoryRandMutator,
125-
StringSubcategoryRandMutator,
126-
StringSubcategoryRandMutator,
127-
StringSubcategoryRandMutator,
128-
StringSubcategoryRandMutator
124+
UnicodeCategoryRandMutator,
125+
UnicodeSubcategoryRandMutator,
126+
UnicodeSubcategoryRandMutator,
127+
UnicodeSubcategoryRandMutator,
128+
UnicodeSubcategoryRandMutator
129129
));
130130
let mut stages = tuple_list!(
131-
StringIdentificationStage::new(),
131+
UnicodeIdentificationStage::new(),
132132
StdMutationalStage::transforming(mutator)
133133
);
134134

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![no_main]
22

3-
use libfuzzer_sys::fuzz_target;
43
use cargo_fuzz_test::do_thing;
4+
use libfuzzer_sys::fuzz_target;
55

66
fuzz_target!(|data: &[u8]| do_thing(data));

fuzzers/dynamic_analysis/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "fuzzbench"
2+
name = "dynamic_analysis"
33
version = "0.12.0"
44
authors = ["Andrea Fioraldi <[email protected]>", "Dominik Maier <[email protected]>"]
55
edition = "2021"
@@ -22,18 +22,18 @@ strip = true
2222

2323
[build-dependencies]
2424
cc = { version = "1.0", features = ["parallel"] }
25-
which = "4.4"
25+
which = "6.0"
2626

2727
[dependencies]
28-
env_logger = "0.10"
28+
env_logger = "0.11"
2929
once_cell = "1.19"
3030
libafl = { path = "../../libafl/" }
3131
libafl_bolts = { path = "../../libafl_bolts/" }
3232
libafl_targets = { path = "../../libafl_targets/", features = ["sancov_pcguard_hitcounts", "sancov_cmplog", "libfuzzer", "function-logging"] }
3333
# TODO Include it only when building cc
3434
libafl_cc = { path = "../../libafl_cc/" }
3535
clap = { version = "4.0", features = ["default"] }
36-
nix = { version = "0.27", features = ["fs"] }
36+
nix = { version = "0.29", features = ["fs"] }
3737
mimalloc = { version = "*", default-features = false }
3838

3939
[lib]

0 commit comments

Comments
 (0)