2103 Commits

Author SHA1 Message Date
87b9dc4ba0 Merge pull request #1702 from schumilo/dev
add Nyx support in afl-showmap, afl-tmin, afl-cmin and afl-analyze
2023-04-16 12:24:10 +02:00
d0b86bf055 pass absolute paths to libnyx 2023-04-16 06:23:38 +02:00
61aeb44863 remove redundant access() call 2023-04-16 05:19:09 +02:00
059d470e8d improved Nyx tmp dir handling (additional sanity checks) 2023-04-16 04:42:09 +02:00
47833bcf9e fix remove_nyx_tmp_workdir function 2023-04-16 04:28:19 +02:00
8f6d9d66ef fix post_process 2023-04-15 09:11:33 +02:00
c34c3e2f5f add some sanity checks and remove duplicate nyx_shutdown calls 2023-04-14 06:24:46 +02:00
4f6ec6cb08 add NYX_REUSE_SNAPSHOT env-var option 2023-04-14 06:21:43 +02:00
a96cdc649f switch to latest libnyx API 2023-04-14 05:59:12 +02:00
eefd98f374 add Nyx support in various tools (like afl-cmin) 2023-04-14 02:25:33 +02:00
f756734ad2 fix attempt at post_process implementation 2023-04-13 12:07:27 +02:00
6cc8d607fb remove -z option, use -p mmopt instead 2023-04-13 11:44:39 +02:00
a5a122a533 Merge pull request #1698 from neuschaefer/nodefer
afl-cc: Don't offer __AFL_INIT() etc. in GCC/CLANG modes
2023-04-10 17:50:11 +02:00
9e3e1a5512 afl-cc: Don't offer __AFL_INIT() etc. in GCC/CLANG modes
instrumentation/README.persistent_mode.md documents in the section about
deferred forkserver initialization:

> With the location selected, add this code in the appropriate spot:
>
> ```c
> #ifdef __AFL_HAVE_MANUAL_CONTROL
>   __AFL_INIT();
> #endif
> ```
>
> You don't need the #ifdef guards, but including them ensures that the program
> will keep working normally when compiled with a tool other than afl-clang-fast/
> afl-clang-lto/afl-gcc-fast.
>
> Finally, recompile the program with afl-clang-fast/afl-clang-lto/afl-gcc-fast
> (afl-gcc or afl-clang will *not* generate a deferred-initialization binary) -
> and you should be all set!


This strongly implies that you can compile a program that uses __AFL_INIT()
under an `#ifdef __AFL_HAVE_MANUAL_CONTROL` guard with afl-gcc/-clang.

However, this currently fails:

  $ cat example.c
  #include <stdio.h>

  int main(void) {
  #ifdef __AFL_HAVE_MANUAL_CONTROL
  	__AFL_INIT();
  #endif

  	puts("Hello");
  }
  $ afl-gcc example.c -o example
  afl-cc++4.06a by Michal Zalewski, Laszlo Szekeres, Marc Heuse - mode: GCC-GCC
  [!] WARNING: You are using outdated instrumentation, install LLVM and/or gcc-plugin and use afl-clang-fast/afl-clang-lto/afl-gcc-fast instead!
  afl-as++4.06a by Michal Zalewski
  [+] Instrumented 1 locations (64-bit, non-hardened mode, ratio 100%).
  /usr/bin/ld: /tmp/ccuJHcpt.o: in function `main':
  /home/jn/dev/fuzz/AFLplusplus/example.c:5: undefined reference to `__afl_manual_init'
  collect2: error: ld returned 1 exit status


The issue here is an inconsistency in afl-gcc (i.e. afl-cc operating in GCC mode):

 - afl-cc defines __AFL_HAVE_MANUAL_CONTROL and __AFL_INIT unconditionally
 - __AFL_INIT relies on __afl_manual_init, which is defined in afl-compiler-rt.o
 - afl-cc doesn't link afl-compiler-rt in GCC or CLANG mode


Since afl-gcc/-clang is documented as not supporting deferred forkserver
initialization, this patch omits the definitions of __AFL_HAVE_MANUAL_CONTROL
and related macros in GCC/CLANG mode.

This restores the ability to compile a deferred-forkserver program under
afl-gcc, if it can also be compiled under gcc.

[ In case someone reads this an feels adventurous enough (as I did) to
  think about enabling deferred forkserver under afl-gcc: Whether the
  deferred forkserver actually works can be verified by placing a
  usleep(100000) or similar at the start of main (before __AFL_INIT()),
  and watching the execution speed. It doesn't work. ]
2023-04-10 13:47:19 +02:00
0782ed3841 remove pointer to removed doc 2023-04-09 10:33:39 +02:00
0eace0212e afl-cc: Avoid casts of string literals to char*, in definition of __AFL_INIT() etc.
With the right -W options, compilers may complain about the cast of
string literals (for PERSIST_SIG and DEFER_SIG) to (char*), and they're
right to do so, because string literals are constant. Since some
projects enable -Werror, this can lead to a broken build with afl-cc.

Let's simply cast to (const char *), which preserves the constness of
the string literal.
2023-04-08 17:24:02 +02:00
75d7a09469 show custom mutator name in UI 2023-04-08 13:48:07 +02:00
f9851dbfbb hopefully better -z algorithm 2023-04-08 13:00:57 +02:00
400c5e92cb renaming 2023-04-07 09:41:22 +02:00
fcb5eda5d0 nit 2023-04-05 16:34:08 +02:00
d67ee17778 fix 2023-04-05 13:30:06 +02:00
dba93705a7 better new weighting 2023-04-05 13:07:22 +02:00
36127fb197 add -z switch 2023-04-05 12:59:20 +02:00
a74561b0e7 implement switch mode 2023-04-05 12:12:05 +02:00
e313180e4d fix for clang 2023-04-05 10:32:37 +02:00
1fc0731604 stack pow 2023-04-05 09:42:27 +02:00
53b70ef104 mut changes 2023-04-05 09:33:09 +02:00
3ab18d2861 mode switch 2023-04-04 19:44:12 +02:00
fcd2125678 prepare for strategies 2023-04-04 15:47:53 +02:00
635da39bd1 preparation for mutation arrays 2023-04-03 14:41:52 +02:00
71e2aa5d2b more fix 2023-04-02 13:42:08 +02:00
21203c2ea6 fix 2023-04-02 12:39:02 +02:00
319b2e8e6f fix ui layout with slow targets in pizza mode 2023-04-02 12:08:54 +02:00
e46e0bce44 allow pizza mode to be disabled 2023-04-02 12:03:45 +02:00
4d02d8e43d fix buffer overflow in pizza mode :( 2023-04-02 11:52:36 +02:00
be96253f52 nits 2023-03-31 11:02:27 +02:00
9eed60d105 nit 2023-03-31 08:12:32 +02:00
8f17c81691 less mutation 2023-03-30 22:41:02 +02:00
74baebd93e fix 2023-03-30 20:02:59 +02:00
506f6b1349 nits 2023-03-30 19:28:59 +02:00
145748a7e0 prepare new mutation strategies 2023-03-30 14:00:45 +02:00
7893347e13 final touches 2023-03-29 22:56:12 +02:00
5218c0b187 all mutation strategies 2023-03-29 22:53:15 +02:00
48816417ee introspection 2023-03-29 10:13:18 +02:00
5d9c1bc3a3 [afs-as] Allow debugging arguments after the input file
Clang may call as with extra debugging arguments after the input file,
e.g. as --64 -o /tmp/hello-617ff5.o /tmp/hello-6b6f52.s -g -gdwarf-4
2023-03-28 12:15:20 -03:00
01236f47bc nits 2023-03-28 16:50:05 +02:00
b1bfc1ae76 time_wo_finds in fuzzer_stats 2023-03-27 17:52:01 +02:00
2d3c5cc6d8 Clarify confusing version message
When running, the following gets printed in quick succession on startup:

    afl-fuzz++4.00c based on afl by Michal Zalewski and a large online community
    [...]
    [+] NOTE: This is v3.x which changes defaults and behaviours - see README.md

Don't assert that this is v3, just that v3+ changes defaults and
behaviours.
2023-03-26 20:44:57 -04:00
19f9612910 fix frida mode 2023-03-26 12:14:35 +02:00
e24ae96361 add likely() to cksum check 2023-03-25 09:45:02 +00:00