Skip to content

Commit dfe7f90

Browse files
committed
Merge with upstream/main at 0.15.0. Dependent on the fix of frida glib functions. Only frida_windows_gdiplus tested. Linux not tested
2 parents 19b6a43 + 5002336 commit dfe7f90

File tree

358 files changed

+11021
-8951
lines changed

Some content is hidden

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

358 files changed

+11021
-8951
lines changed

.github/workflows/build_and_test.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ jobs:
276276
- ./fuzzers/forkserver/baby_fuzzer_with_forkexecutor
277277

278278
# Full-system
279+
- ./fuzzers/full_system/nyx_launcher
279280
- ./fuzzers/full_system/nyx_libxml2_standalone
280281
- ./fuzzers/full_system/nyx_libxml2_parallel
281282

@@ -343,7 +344,7 @@ jobs:
343344
- 'libafl_bolts/**'
344345
- 'libafl_targets/**'
345346
- 'libafl_qemu/**'
346-
- 'fuzzers/*qemu*/**'
347+
- 'fuzzers/**/*qemu*/**'
347348
348349
fuzzers-qemu:
349350
needs:
@@ -360,8 +361,8 @@ jobs:
360361

361362
# Full-system
362363
- ./fuzzers/full_system/qemu_baremetal
363-
# - ./fuzzers/full_system/qemu_linux_kernel
364-
#- ./fuzzers/full_system/qemu_linux_process
364+
- ./fuzzers/full_system/qemu_linux_kernel
365+
- ./fuzzers/full_system/qemu_linux_process
365366

366367
runs-on: [ self-hosted, qemu ]
367368
container: registry.gitlab.com/qemu-project/qemu/qemu/ubuntu2204:latest

CONTRIBUTING.md

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,36 +27,55 @@ Before making your pull requests, try to see if your code follows these rules.
2727
- `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
2828
- Wherever possible, trait implementations with lifetime specifiers should use '_ lifetime elision.
2929
- Complex constructors should be replaced with `typed_builder`, or write code in the builder pattern for yourself.
30-
- 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 contraint is really necessary.
30+
- 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.
3131
```rust
3232
pub struct X<A>
3333
where
3434
A: P // <- Do not add contraints here
3535
{
3636
fn ...
3737
}
38-
3938
```
40-
- Reduce generics to the least restrictive necessary. __Never overspecify the contraints__. There's no automated tool to check the useless constraints, so you have to verify this manually.
39+
- 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.
4140
```rust
4241
pub struct X<A>
4342
where
4443
A: P + Q // <- Try to use the as smallest set of constraints as possible. If the code still compiles after deleting Q, then remove it.
4544
{
4645
fn ...
4746
}
47+
```
48+
49+
- 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.
4850

51+
Try not to write this:
52+
```rust
53+
pub trait X
54+
{
55+
type A;
56+
57+
fn a(&self) -> Self::A;
58+
}
4959
```
50-
- Traits which have an associated type 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.
60+
Try to write this instead:
5161
```rust
52-
pub trait X
62+
pub trait X<A>
5363
{
54-
type A; // <- You should(can) define it as long as you have a getter to it.
5564
fn a(&self) -> A;
5665
}
66+
```
5767

68+
- 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.
69+
```rust
70+
pub trait X
71+
{
72+
type A; // <- You should(can) define it as long as you have a getter to it.
73+
74+
fn a(&self) -> Self::A;
75+
}
5876
```
59-
- __Ideally__ the types used in the the arguments of methods in traits should have the same as the types defined on the traits.
77+
78+
- __Ideally__ the types used in the arguments of methods in traits should have the same as the types defined on the traits.
6079
```rust
6180
pub trait X<A, B, C> // <- this trait have 3 generics, A, B, and C
6281
{
@@ -65,11 +84,54 @@ pub trait X<A, B, C> // <- this trait have 3 generics, A, B, and C
6584
fn do_other_stuff(&self, a: A, b: B); // <- this is not ideal because it does not have C.
6685
}
6786
```
87+
- Generic naming should be consistent. Do NOT use multiple name for the same generic, it just makes things more confusing. Do:
88+
```rust
89+
pub struct X<A> {
90+
phantom: PhanomData<A>,
91+
}
92+
93+
impl<A> X<A> {}
94+
```
95+
But not:
96+
```rust
97+
pub struct X<A> {
98+
phantom: PhanomData<A>,
99+
}
100+
101+
impl<B> X<B> {} // <- Do NOT do that, use A instead of B
102+
```
68103
- Always alphabetically order the type generics. Therefore,
69104
```rust
70105
pub struct X<E, EM, OT, S, Z> {}; // <- Generics are alphabetically ordered
71106
```
72107
But not,
73108
```rust
74109
pub struct X<S, OT, Z, EM, E> {}; // <- Generics are not ordered
75-
```
110+
```
111+
- Similarly, generic bounds in `where` clauses should be alphabetically sorted. Prefer:
112+
```rust
113+
pub trait FooA {}
114+
pub trait FooB {}
115+
116+
pub struct X<A, B>;
117+
118+
impl<A, B> X<A, B>
119+
where
120+
A: FooA,
121+
B: FooB,
122+
{}
123+
```
124+
Over:
125+
```rust
126+
pub trait FooA {}
127+
pub trait FooB {}
128+
129+
pub struct X<A, B>;
130+
131+
impl<A, B> X<A, B>
132+
where
133+
B: FooB, // <-|
134+
// | Generic bounds are not alphabetically ordered.
135+
A: FooA, // <-|
136+
{}
137+
```

Cargo.toml

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -49,35 +49,35 @@ exclude = [
4949
]
5050

5151
[workspace.package]
52-
version = "0.14.1"
52+
version = "0.15.0"
5353
license = "MIT OR Apache-2.0"
5454

5555
[workspace.dependencies]
5656
# Internal deps
57-
libafl = { path = "./libafl", version = "0.14.1", default-features = false }
58-
libafl_bolts = { path = "./libafl_bolts", version = "0.14.1", default-features = false }
59-
libafl_cc = { path = "./libafl_cc", version = "0.14.1", default-features = false }
60-
symcc_runtime = { path = "./libafl_concolic/symcc_runtime", version = "0.14.1", default-features = false }
61-
symcc_libafl = { path = "./libafl_concolic/symcc_libafl", version = "0.14.1", default-features = false }
62-
libafl_derive = { path = "./libafl_derive", version = "0.14.1", default-features = false }
63-
libafl_frida = { path = "./libafl_frida", version = "0.14.1", default-features = false }
64-
libafl_intelpt = { path = "./libafl_intelpt", version = "0.14.1", default-features = false }
65-
libafl_libfuzzer = { path = "./libafl_libfuzzer", version = "0.14.1", default-features = false }
66-
libafl_nyx = { path = "./libafl_nyx", version = "0.14.1", default-features = false }
67-
libafl_targets = { path = "./libafl_targets", version = "0.14.1", default-features = false }
68-
libafl_tinyinst = { path = "./libafl_tinyinst", version = "0.14.1", default-features = false }
69-
libafl_qemu = { path = "./libafl_qemu", version = "0.14.1", default-features = false }
70-
libafl_qemu_build = { path = "./libafl_qemu/libafl_qemu_build", version = "0.14.1", default-features = false }
71-
libafl_qemu_sys = { path = "./libafl_qemu/libafl_qemu_sys", version = "0.14.1", default-features = false }
72-
libafl_sugar = { path = "./libafl_sugar", version = "0.14.1", default-features = false }
73-
dump_constraints = { path = "./libafl_concolic/test/dump_constraints", version = "0.14.1", default-features = false }
74-
runtime_test = { path = "./libafl_concolic/test/runtime_test", version = "0.14.1", default-features = false }
75-
build_and_test_fuzzers = { path = "./utils/build_and_test_fuzzers", version = "0.14.1", default-features = false }
76-
deexit = { path = "./utils/deexit", version = "0.14.1", default-features = false }
77-
drcov_utils = { path = "./utils/drcov_utils", version = "0.14.1", default-features = false }
78-
construct_automata = { path = "./utils/gramatron/construct_automata", version = "0.14.1", default-features = false }
79-
libafl_benches = { path = "./utils/libafl_benches", version = "0.14.1", default-features = false }
80-
libafl_jumper = { path = "./utils/libafl_jumper", version = "0.14.1", default-features = false }
57+
libafl = { path = "./libafl", version = "0.15.0", default-features = false }
58+
libafl_bolts = { path = "./libafl_bolts", version = "0.15.0", default-features = false }
59+
libafl_cc = { path = "./libafl_cc", version = "0.15.0", default-features = false }
60+
symcc_runtime = { path = "./libafl_concolic/symcc_runtime", version = "0.15.0", default-features = false }
61+
symcc_libafl = { path = "./libafl_concolic/symcc_libafl", version = "0.15.0", default-features = false }
62+
libafl_derive = { path = "./libafl_derive", version = "0.15.0", default-features = false }
63+
libafl_frida = { path = "./libafl_frida", version = "0.15.0", default-features = false }
64+
libafl_intelpt = { path = "./libafl_intelpt", version = "0.15.0", default-features = false }
65+
libafl_libfuzzer = { path = "./libafl_libfuzzer", version = "0.15.0", default-features = false }
66+
libafl_nyx = { path = "./libafl_nyx", version = "0.15.0", default-features = false }
67+
libafl_targets = { path = "./libafl_targets", version = "0.15.0", default-features = false }
68+
libafl_tinyinst = { path = "./libafl_tinyinst", version = "0.15.0", default-features = false }
69+
libafl_qemu = { path = "./libafl_qemu", version = "0.15.0", default-features = false }
70+
libafl_qemu_build = { path = "./libafl_qemu/libafl_qemu_build", version = "0.15.0", default-features = false }
71+
libafl_qemu_sys = { path = "./libafl_qemu/libafl_qemu_sys", version = "0.15.0", default-features = false }
72+
libafl_sugar = { path = "./libafl_sugar", version = "0.15.0", default-features = false }
73+
dump_constraints = { path = "./libafl_concolic/test/dump_constraints", version = "0.15.0", default-features = false }
74+
runtime_test = { path = "./libafl_concolic/test/runtime_test", version = "0.15.0", default-features = false }
75+
build_and_test_fuzzers = { path = "./utils/build_and_test_fuzzers", version = "0.15.0", default-features = false }
76+
deexit = { path = "./utils/deexit", version = "0.15.0", default-features = false }
77+
drcov_utils = { path = "./utils/drcov_utils", version = "0.15.0", default-features = false }
78+
construct_automata = { path = "./utils/gramatron/construct_automata", version = "0.15.0", default-features = false }
79+
libafl_benches = { path = "./utils/libafl_benches", version = "0.15.0", default-features = false }
80+
libafl_jumper = { path = "./utils/libafl_jumper", version = "0.15.0", default-features = false }
8181

8282
# External deps
8383
ahash = { version = "0.8.11", default-features = false } # The hash function already used in hashbrown
@@ -126,12 +126,15 @@ z3 = "0.12.1"
126126

127127

128128
[workspace.lints.rust]
129+
# Deny
130+
warnings = { level = "deny", priority = -1 }
131+
129132
# Forbid
130133
unexpected_cfgs = "forbid"
131134

132135
# Allow
133136
incomplete_features = "allow"
134-
ambiguous_glob_reexports = "allow"
137+
# ambiguous_glob_reexports = "allow"
135138

136139

137140
[workspace.lints.clippy]
@@ -142,9 +145,10 @@ cargo_common_metadata = "deny"
142145

143146
# Warn
144147
cargo = { level = "warn", priority = -1 }
145-
negative_feature_names = "warn"
146148

147149
# Allow
150+
negative_feature_names = "allow" # TODO: turn into 'warn' when working
151+
multiple_crate_versions = "allow" # TODO: turn into `warn` when working
148152
unreadable_literal = "allow"
149153
type_repetition_in_bounds = "allow"
150154
missing_errors_doc = "allow"

MIGRATION.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,18 @@
1010
- `Qemu` cannot be used to initialize `Emulator` directly anymore. Instead, `Qemu` should be initialized through `Emulator` systematically if `Emulator` should be used.
1111
- Related: `EmulatorBuilder` uses a single function to provide a `Qemu` initializer: `EmulatorBuilder::qemu_parameters`. For now, it can be either a `Vec<String>` or a `QemuConfig` instance.
1212
- Related: Qemu's `AsanModule` does not need any special call to `Qemu` init methods anymore. It is now possible to simply initialize `AsanModule` (or `AsanGuestModule`) with a reference to the environment as parameter.
13+
- `CustomBufHandlers` has been deleted. Please use `EventManagerHooksTuple` from now on.
14+
- Trait restrictions have been simplified
15+
- The `UsesState` and `UsesInput` traits have been removed in favor of regular Generics.
16+
- For the structs/traits that used to use `UsesState`, we bring back the generic for the state.
17+
- `Input` is now only accessible through generic. `Input` associated types have been definitely removed.
18+
- `HasCorpus` bound has been removed in many places it was unused before.
19+
- `StdMutationalStage::transforming` must now explicitly state the Inputs types. As a result, `StdMutationalStage::transforming` must be written `StdMutationalStage::<_, _, FirstInputType, SecondInputType, _, _, _>::transforming`.
20+
- The `State` trait is now private in favour of individual and more specific traits
21+
- Restrictions from certain schedulers and stages that required their inner observer to implement `MapObserver` have been lifted in favor of requiring `Hash`
22+
- Related: removed `hash_simple` from `MapObserver`
1323

14-
# 0.14.0 -> 0.14.1
24+
# 0.14.0 -> 0.15.0
1525
- Removed `with_observers` from `Executor` trait.
1626
- `MmapShMemProvider::new_shmem_persistent` has been removed in favour of `MmapShMem::persist`. You probably want to do something like this: `let shmem = MmapShMemProvider::new()?.new_shmem(size)?.persist()?;`
1727

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,13 @@ LibAFL is written and maintained by
7878
* [Addison Crump](https://github.com/addisoncrump) <[email protected]>
7979
* [Romain Malmain](https://github.com/rmalmain) <[email protected]>
8080

81-
Please check out [CONTRIBUTING.md](CONTRIBUTING.md) for the contributing guideline.
81+
## Contributing
82+
83+
Please check out **[CONTRIBUTING.md](CONTRIBUTING.md)** for the contributing guideline.
84+
85+
## Debugging
86+
87+
Your fuzzer doesn't work as expected? Try reading [DEBUGGING.md](./docs/src/DEBUGGING.md) to understand how to debug your problems.
8288

8389
## Cite
8490
If you use LibAFL for your academic work, please cite the following paper:

bindings/pylibafl/Cargo.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "pylibafl"
33
description = "Python bindings for LibAFL"
4-
version = "0.14.1"
4+
version = "0.15.0"
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/AFLplusplus/LibAFL/"
77
keywords = ["fuzzing", "testing", "security", "python"]
@@ -11,15 +11,15 @@ categories = ["development-tools::testing", "emulators", "embedded", "os"]
1111
[dependencies]
1212
pyo3 = { workspace = true, features = ["extension-module"] }
1313
pyo3-log = { version = "0.12.0" }
14-
libafl_sugar = { path = "../../libafl_sugar", version = "0.14.1", features = [
14+
libafl_sugar = { path = "../../libafl_sugar", version = "0.15.0", features = [
1515
"python",
1616
] }
17-
libafl_bolts = { path = "../../libafl_bolts", version = "0.14.1", features = [
17+
libafl_bolts = { path = "../../libafl_bolts", version = "0.15.0", features = [
1818
"python",
1919
] }
2020

2121
[target.'cfg(target_os = "linux")'.dependencies]
22-
libafl_qemu = { path = "../../libafl_qemu", version = "0.14.1", features = [
22+
libafl_qemu = { path = "../../libafl_qemu", version = "0.15.0", features = [
2323
"python",
2424
] }
2525

@@ -30,5 +30,7 @@ pyo3-build-config = { workspace = true }
3030
name = "pylibafl"
3131
crate-type = ["cdylib"]
3232

33-
[profile.dev]
34-
panic = "abort"
33+
# TODO: find a way to fix this when a solution is found
34+
# https://github.com/rust-lang/cargo/issues/9330
35+
# [profile.dev]
36+
# panic = "abort"

bindings/pylibafl/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "maturin"
44

55
[project]
66
name = "PyLibAFL"
7-
version = "0.14.1"
7+
version = "0.15.0"
88
description = "Advanced Fuzzing Library for Python"
99
readme = "README.md"
1010
requires-python = ">=3.8"

docs/listings/baby_fuzzer/listing-01/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "baby_fuzzer_listing_01"
3-
version = "0.14.1"
3+
version = "0.15.0"
44
authors = ["Your Name <[email protected]>"]
55
edition = "2018"
66

docs/listings/baby_fuzzer/listing-02/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "baby_fuzzer_listing_02"
3-
version = "0.14.1"
3+
version = "0.15.0"
44
authors = ["Your Name <[email protected]>"]
55
edition = "2018"
66

docs/listings/baby_fuzzer/listing-03/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "baby_fuzzer_listing_03"
3-
version = "0.14.1"
3+
version = "0.15.0"
44
authors = ["Your Name <[email protected]>"]
55
edition = "2018"
66

docs/listings/baby_fuzzer/listing-04/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "baby_fuzzer_listing_04"
3-
version = "0.14.1"
3+
version = "0.15.0"
44
authors = ["Your Name <[email protected]>"]
55
edition = "2018"
66

docs/listings/baby_fuzzer/listing-05/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "baby_fuzzer_listing_05"
3-
version = "0.14.1"
3+
version = "0.15.0"
44
authors = ["Your Name <[email protected]>"]
55
edition = "2018"
66

docs/listings/baby_fuzzer/listing-06/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "baby_fuzzer_listing_06"
3-
version = "0.14.1"
3+
version = "0.15.0"
44
authors = ["Your Name <[email protected]>"]
55
edition = "2018"
66

docs/src/DEBUGGING.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ You should *never* use the `EDGES_MAP`'s size as this is just the size of the al
2525
## Q. I still have problems with my fuzzer.
2626
Finally, if you really have no idea what is going on, run your fuzzer with logging enabled. (You can use `env_logger`, `SimpleStdoutLogger`, `SimpleStderrLogger` from `libafl_bolts`. `fuzzbench_text` has an example to show how to use it.) (Don't forget to enable stdout and stderr), and you can open an issue or ask us in Discord.
2727

28-
## Q. My fuzzer died of ``Storing state in crashed fuzzer instance did not work''.
28+
## Q. My fuzzer died of `Storing state in crashed fuzzer instance did not work`.
2929
If the exit code is zero, then this is because either your harness exited or you are using fuzzer_loop_for and forgot to add `mgr.on_restart` at the end of the fuzzer. In the first case, you should patch your harness not to exit. (or use `utils/deexit`).
3030

3131
## Q. I can't leave the TUI screen
32-
Type `q` then you leave TUI.
32+
Type `q` then you leave TUI.
33+
34+
## Q. I see `QEMU internal SIGSEGV {code=MAPERR, addr=0x48}` and my QEMU fuzzer doesn't run.
35+
Are you running QEMU fuzzer on WSL? You have to enable vsyscall https://github.com/microsoft/WSL/issues/4694#issuecomment-556095344.

docs/src/message_passing/message_passing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ So the outgoing messages flow is like this over the outgoing broadcast `Shmem`:
7272
[client0] [client1] ... [clientN]
7373
```
7474

75-
To use `LLMP` in LibAFL, you usually want to use an `LlmpEventManager` or its restarting variant.
75+
To use `LLMP` in LibAFL, you usually want to use an `LlmpRestartingEventManager` or its restarting variant.
7676
They are the default if using LibAFL's `Launcher`.
7777

7878
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).

0 commit comments

Comments
 (0)