266 Commits

Author SHA1 Message Date
vincenzo MEZZELA
6c04d4cc80 fixing -Wl,-rpath=<LLVM_LIBDIR> 2023-12-05 13:53:09 +01:00
vincenzo MEZZELA
0e7afb75dd removing options "-Wl,-rpath" "LLVM_LIBDIR" when using gcc 2023-12-04 16:46:30 +01:00
vanhauser-thc
f7fab79155 code format 2023-10-24 11:52:02 +02:00
Jesse Schwartzentruber
cf458a7d25 Add an env to afl-clang-fast to disable setting rpath if LLVM path isn't
recognized
2023-10-23 21:57:21 -04:00
vanhauser-thc
5f7c3a1ee0 fix afl-cc help output 2023-09-27 16:32:55 +02:00
vanhauser-thc
88ca5c7563 nit 2023-08-31 14:42:08 +02:00
vanhauser-thc
f37c4c8662 update llvm recommendations 2023-07-05 13:03:17 +02:00
vanhauser-thc
da33510855 nits 2023-07-04 11:34:22 +02:00
Eli Kobrin
0966957631 Fix max_params define. 2023-07-03 18:09:36 +03:00
Siqi Chen
32d5ccb92d Increase the number of afl-cc supported params 2023-06-27 01:20:24 +08:00
vanhauser-thc
9324f3f628 rewrote PCGUARD 2023-06-01 12:19:45 +02:00
vanhauser-thc
22837b5ad2 response file fix 2023-05-23 12:14:58 +02:00
vanhauser-thc
dd736126dc allow llvm_instrument native 2023-05-23 09:06:29 +02:00
vanhauser-thc
029e039cbc code format 2023-05-21 17:49:14 +02:00
vanhauser-thc
7f636dbfc2 add @responsefile support for afl-cc 2023-05-12 15:58:20 +02:00
vanhauser-thc
93c821aaa3 afl-clang-lto incomptable with -flto=thin 2023-05-12 08:39:11 +02:00
vanhauser-thc
5813a4319c doc, code format 2023-04-28 11:42:21 +02:00
Christian Holler (:decoder)
e956f23a77
Source Code Coverage support for Nyx (Part 1) (#1720)
* Additional source code reformatting in afl-compiler-rt

* Add source code coverage support to afl-compiler-rt (for use with Nyx)
2023-04-28 11:35:22 +02:00
vanhauser-thc
3e84d6a2ae afl++ -> AFL++ 2023-04-27 11:49:00 +02:00
Keno Hassler
7c3c0b26d1
document new env var 2023-04-24 20:32:04 +02:00
Jonathan Neuschäfer
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
Jonathan Neuschäfer
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
vanhauser-thc
80eabd6e8a AFL_LLVM_DICT2FILE_NO_MAIN support 2023-02-13 11:34:14 +01:00
vanhauser-thc
4063a3eb4c nit 2023-01-23 12:50:57 +01:00
vanhauser-thc
8bc7b3cf26 add CFI variant for gcc 2023-01-23 12:45:21 +01:00
vanhauser-thc
35f09e11a4 welcome 2023 2023-01-03 09:38:07 +01:00
van Hauser
c24939e812
Merge pull request #1576 from AFLplusplus/persistent_mode_always
Persistent mode always
2022-11-10 14:46:01 +01:00
vanhauser-thc
b868758cd7 more llvm16 fixes 2022-11-10 12:06:00 +01:00
vanhauser-thc
513a6ce7b6 try llvm 16 fix 2022-11-10 11:55:29 +01:00
Dominik Maier
c1562a7cde
Didn't mean to change that 2022-11-09 03:34:37 +01:00
Dominik Maier
0496390526 fmt 2022-11-09 02:32:13 +00:00
Dominik Maier
d65cf10bad Always enable persistent mode, no env/bincheck needed 2022-11-09 03:28:06 +01:00
Edward J. Schwartz
0e908d5b1e
Fix -rpath argument 2022-10-20 08:26:55 -04:00
van Hauser
2107ece114
auto shmem fuzzing (#1541)
* auto shmem fuzzing

* print warning when forcing shmem fuzzing

* typos

* Shmem always

* typo fix

* fixes

Co-authored-by: Dominik Maier <dmnk@google.com>
2022-10-07 15:40:04 +02:00
vanhauser-thc
0623a73a5c fix docs 2022-09-17 11:56:39 +02:00
Nikita Popov
b27a4a3689 Fix loading and registeration of LTO pass for new pass manager 2022-09-14 15:54:29 +02:00
vanhauser-thc
88ff8aa81e fix gcc_mode cmplog 2022-08-25 08:47:30 +02:00
vanhauser-thc
b4cb3784a5 add malloc check 2022-08-19 13:17:01 +02:00
vanhauser-thc
f00d83afbc filter pipe in gcc_mode 2022-08-15 17:38:53 +02:00
vanhauser-thc
4e98071385 better handling of -fsanitize=..,...,.. lists 2022-08-14 14:40:26 +02:00
vanhauser-thc
b847e0f414 clang format 14 2022-07-12 09:04:54 +02:00
vanhauser-thc
1759859ae2 fix double free on exit for -c 0 on src cmplog 2022-07-07 09:03:46 +02:00
vanhauser-thc
1334851e7c cmplog support for gcc_plugin by adacore 2022-07-04 09:59:47 +02:00
vanhauser-thc
1a4c0d2ecd nits 2022-06-20 17:59:14 +02:00
vanhauser-thc
ee409d18a6 code format 2022-04-25 10:14:04 +02:00
Jesse Schwartzentruber
f53e6a6cf2 fix instrumentation for -Werror,-Wunused-but-set-variable
`used` is so it isn't optimized out. `unused` is to avoid the warning.
2022-04-20 15:39:28 -04:00
Jesse Schwartzentruber
630eb943a5 use passthrough mode for wasm 2022-04-20 15:38:37 -04:00
Dominik Maier
285a5cb38b Some scan-build fixes 2022-03-31 15:36:26 +00:00
vanhauser-thc
a436ef47e5 fix instrumentlist for LTO with clang < 13 2022-03-30 09:16:47 +02:00
vanhauser-thc
fa2b040476 fix LTO with cmplog and laf 2022-03-18 15:00:24 +01:00