Commit Graph

7589 Commits

Author SHA1 Message Date
af0d023b3a Merge pull request #2466 from e-kwsm/python2
refactor!: drop python2
2025-06-09 10:41:14 +02:00
0975c8ddde refactor!: drop python2 2025-06-09 15:21:57 +09:00
7d017f1cb1 chore: modify help strings 2025-06-09 15:21:57 +09:00
f9afbc822c Merge pull request #2464 from alexandredoyen29/warnf_for_setting_scheduling_for_main_fuzzer
WARNF for setting scheduling for main fuzzer instead of FATAL
2025-06-06 11:52:14 +02:00
1c7176bd96 Better message 2025-06-06 11:39:02 +02:00
ad44e30cbf Replace FATAL by WARNF when using another power scheduling with -M 2025-06-06 11:25:17 +02:00
0d495e0471 Merge pull request #2463 from jwpconsulting/mipsel-persistent-hook
Update test code and documentation for afl-fuzz qemu_mode on mipsel
2025-06-05 08:03:36 +02:00
9951c38515 Document QEMU persistent hook on mipsel
This adds a new persistent hook library `mipsel_read_into_a0.c`. With
it, you can test the persistent hook on the *mipsel* architecture.

I'm also updating the README in `utils/qemu_persistent_hook` and
Makefile and explain how to test the persistent hook on *mipsel*.

This all works thanks to qemuafl already having the correct CPU struct
for *mipsel* in `qemuafl/api.h`.

This patch also updates the root `.gitignore` file to ignore the two
test binaries `test` and `mipsel_test`.
2025-06-05 10:00:45 +09:00
ee480aeb7a Enable qemu persistent mode tests for mipsel
qemuafl now supports persistent mode for *mipsel* targets. This patch
changes the `SYS` variable tests and runs the persistent qemu_mode
tests for *mipsel* as well.

This also adds an optional environment variable called `CPU_TARGET_CC`
that you can pass to the `./test-qemu-mode.sh` test script.

This allows you to specify a cross-compiler for the target platform. The
test script then it uses to compile `test-instr.c` and `test-compcov.c`.

Example usage:

```
CPU_TARGET_CC=mipsel-linux-gnu-cc CPU_TARGET=mipsel ./test-qemu-mode.sh
```

The output should look something like this:

```
[*] Using environment variable CPU_TARGET=mipsel for SYS
[*] starting AFL++ test framework ...
[*] Testing: qemu_mode
[*] Using mipsel-linux-gnu-cc as compiler for target
[*] running afl-fuzz for qemu_mode, this will take approx 10 seconds
[+] afl-fuzz is working correctly with qemu_mode
[*] running afl-fuzz for qemu_mode AFL_ENTRYPOINT, this will take approx 6 seconds
[+] afl-fuzz is working correctly with qemu_mode AFL_ENTRYPOINT
[-] not an intel or arm platform, cannot test qemu_mode compcov
[-] not an intel or arm platform, cannot test qemu_mode cmplog
[*] running afl-fuzz for persistent qemu_mode, this will take approx 10 seconds
[+] afl-fuzz is working correctly with persistent qemu_mode
[+] persistent qemu_mode was noticeable faster than standard qemu_mode
[*] running afl-fuzz for persistent qemu_mode with AFL_QEMU_PERSISTENT_EXITS, this will take approx 10 seconds
[+] afl-fuzz is working correctly with persistent qemu_mode and AFL_QEMU_PERSISTENT_EXITS
[+] persistent qemu_mode with AFL_QEMU_PERSISTENT_EXITS was noticeable faster than standard qemu_mode
[-] we cannot test qemu_mode unsigaction library (32 bit) because it is not present
[+] qemu_mode unsigaction library (64 bit) ignores signals
[*] 1 test cases completed.
[-] not all test cases were executed
[+] all tests were successful :-)
```
2025-06-05 09:51:55 +09:00
d25efff179 Merge pull request #2461 from jwpconsulting/env-user-variable
Let user pass their own CPU_TARGET in test-pre.sh
2025-06-04 08:39:33 +02:00
91974bfae2 Clean up test-pre.sh bash syntax
shellcheck pointed out a few command substition (backtick vs. $(...))
and quoting issues. This patch fixes them.
2025-06-04 09:33:03 +09:00
8618fbc0c2 Let user pass their own CPU_TARGET in test-pre.sh
The target system might be different from the host system. For example,
you can fuzz Linux binaries compiled for *mipsel*, while your host is
*x86_64*.

Some of the tests depend on specific platforms to run correctly.
For example, the afl-fuzz qemu_mode cmplog test only works on Intel or
ARM systems. The `SYS` variable is populated using `uname -m` and the
test cases then consult this variable to decide whether to run the test
or not.

If you want to test afl-fuzz for qemu_mode on mipsel, you might
want to make sure that Intel or ARM tests don't run. With this
patch, you can supply your own `CPU_TARGET` environment variable and skip
platform specific tests. `SYS` then contains the value of `CPU_TARGET`.

This allows you to add tests for *mipsel* or other niche platforms in
the future as well.

Sample usage:

```
$ cd qemu_mode && env CPU_TARGET=mipsel ./build_qemu_support.sh
$ cd ../test && env CPU_TARGET=mipsel ./test-qemu-mode.sh
[*] Using environment variable CPU_TARGET=mipsel for SYS
[*] starting AFL++ test framework ...
[*] Testing: qemu_mode
...
```
2025-06-04 09:31:13 +09:00
16cc444ae5 Merge pull request #2460 from AFLplusplus/dev
update frida
2025-05-30 18:14:52 +02:00
a9900f02cb Merge pull request #2459 from WorksButNotTested/update-frida
Update FRIDA again
2025-05-29 22:36:07 +02:00
e82de006a7 Update FRIDA again 2025-05-29 17:33:39 +01:00
4a923e59fd Update FRIDA (#2458) 2025-05-28 22:52:27 +02:00
20348a63bd Merge pull request #2455 from AFLplusplus/dev
enable llvm 21
2025-05-27 15:11:16 +02:00
cafcb343b1 enable llvm 21 2025-05-27 13:35:04 +02:00
588dda3e84 Merge pull request #2453 from AFLplusplus/dev
push to stable
2025-05-26 11:20:25 +02:00
a17d1daab8 deepwiki 2025-05-26 11:19:04 +02:00
affe7cf5b4 set errno=0 when no afl-fuzz present 2025-05-25 11:38:05 +02:00
fa1ac051eb Merge pull request #2451 from kcwu/revise-map-resize
Revise map resize
2025-05-25 11:08:05 +02:00
f21cc2da58 nit 2025-05-25 11:05:01 +02:00
8c1ab19ebe add libaflppdesock 2025-05-25 11:04:00 +02:00
2e7f191f3b extract function to resize map buffers 2025-05-25 09:33:34 +08:00
8090c82c63 fix resize afl->top_rated 2025-05-24 23:36:54 +08:00
f610f53838 remove redundent code
these field are already copied in afl_fsrv_init_dup
2025-05-24 22:28:26 +08:00
0012f710d8 Merge pull request #2450 from AFLplusplus/dev
push to stable
2025-05-24 13:24:03 +02:00
be00ea9f00 Merge pull request #2446 from kcwu/fix-save_if_interesting
fix save_if_interesting
2025-05-24 12:43:26 +02:00
d0df78f07a use functions instead of macros 2025-05-24 16:39:31 +08:00
7e1dc85450 nit 2025-05-23 09:19:42 +02:00
8152def40e changelog 2025-05-23 09:18:55 +02:00
e6ed31d550 Merge pull request #2449 from AFLplusplus/hidden
instrument all hidden edges
2025-05-23 09:16:17 +02:00
77758a1343 nits in calibrate_case 2025-05-23 08:50:37 +02:00
ea1fbb75b3 Merge pull request #2448 from kcwu/setup-ld-preload
Refactor and simplify handling of AFL_PRELOAD
2025-05-23 08:22:03 +02:00
d62a885f0f simplify code 2025-05-23 10:48:56 +08:00
55d534cd6d extract function afl_fsrv_setup_preload 2025-05-23 10:39:03 +08:00
cee764689c fix save_if_interesting
The value of `classified`, `bits_new`, and `cksum`, were not always
correctly maintained.
 1. In the past, `afl->queue_top->exec_cksum` was always assigned when
    `add_to_queue`, however it became conditional since cd57641705.
    This doesn't change correctness because calibrate_case() will
    calculate the checksum. However, this mean one calibration run is
    wasted.

 2. Sometimes `classified` is set incorrectly.
    For example, this code snippet
    ```
    new_bits = has_new_bits_unclassified(afl, afl->virgin_bits);
    classified = 1;
    ```
    should be changed to
    ```
    new_bits = has_new_bits_unclassified(afl, afl->virgin_bits);
    if (new_bits) classified = 1;
    ```

This commit fixed above issues and use macros to make the code easier to
understand. This should prevent to forget to set classified in the
future (like the bug fixed by 30c93d1321).

The macros also defers the calculations to where the values are really
needed. This could save cpu if the code returns earlier. For example,
if a case is timeout first and not timeout the second time, the current
code does classify_counts, which is not always needed.
2025-05-22 23:14:40 +08:00
d02390e62e add desock option 2025-05-22 17:08:12 +02:00
1f878f1b7c Merge pull request #2438 from AFLplusplus/dev
push to stable
2025-05-22 12:00:37 +02:00
ff1e0580b0 changelog 2025-05-22 12:00:10 +02:00
4730fa4226 Merge pull request #2444 from AFLplusplus/better_sync
Better sync
2025-05-22 11:55:53 +02:00
50fb923691 nit 2025-05-22 11:55:39 +02:00
300fc1f002 fix startup check 2025-05-21 11:52:57 +02:00
4ff40ee6fd add comment 2025-05-20 17:09:52 +02:00
c3d5f3f471 skip entried synced from us if we have not restarted 2025-05-20 17:07:30 +02:00
45a7d65207 Merge pull request #2433 from kcwu/not-sync-known-case
skip known case if the file is actually coming from us
2025-05-20 16:09:14 +02:00
b8d1f16979 Merge pull request #2441 from abhisen7/fix/afl-cmin
Execute ASan targets without leak checks to read AFL_MAP_SIZE
2025-05-19 14:11:00 +02:00
c699aa252d reduce overhead 2025-05-19 18:53:22 +08:00
7c27fc7cfe skip known case if the file is actually coming from us
Assume we have one main node and N secondary nodes in a parallel
fuzzing campaign. Every time the main node found a new case, the case
will be synced to all secondary nodes. Later when the main node sync,
the main node need to run the file again to see if the file is
interesting because they are "new" cases on the secondary nodes.

In other words, for one new case, the main node has to run the redundent
test N times. This is wasteful and slowed down the progress of main
node.

The wasteful issue on secondary nodes is acceptable because we can run
more secondary nodes to mitigate the inefficiency. OTOH, increasing the
number of secondary nodes slow down the main node further.
2025-05-19 18:50:22 +08:00