about summary refs log tree commit diff
path: root/src/afl-cc.c
AgeCommit message (Collapse)Author
2023-04-24document new env varKeno Hassler
2023-04-10afl-cc: Don't offer __AFL_INIT() etc. in GCC/CLANG modesJonathan Neuschäfer
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-08afl-cc: Avoid casts of string literals to char*, in definition of ↵Jonathan Neuschäfer
__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-02-13AFL_LLVM_DICT2FILE_NO_MAIN supportvanhauser-thc
2023-01-23nitvanhauser-thc
2023-01-23add CFI variant for gccvanhauser-thc
2023-01-03welcome 2023vanhauser-thc
2022-11-10Merge pull request #1576 from AFLplusplus/persistent_mode_alwaysvan Hauser
Persistent mode always
2022-11-10more llvm16 fixesvanhauser-thc
2022-11-10try llvm 16 fixvanhauser-thc
2022-11-09Didn't mean to change thatDominik Maier
2022-11-09fmtDominik Maier
2022-11-09Always enable persistent mode, no env/bincheck neededDominik Maier
2022-10-20Fix -rpath argumentEdward J. Schwartz
2022-10-07auto shmem fuzzing (#1541)van Hauser
* auto shmem fuzzing * print warning when forcing shmem fuzzing * typos * Shmem always * typo fix * fixes Co-authored-by: Dominik Maier <dmnk@google.com>
2022-09-17fix docsvanhauser-thc
2022-09-14Fix loading and registeration of LTO pass for new pass managerNikita Popov
2022-08-25fix gcc_mode cmplogvanhauser-thc
2022-08-19add malloc checkvanhauser-thc
2022-08-15filter pipe in gcc_modevanhauser-thc
2022-08-14better handling of -fsanitize=..,...,.. listsvanhauser-thc
2022-07-12clang format 14vanhauser-thc
2022-07-07fix double free on exit for -c 0 on src cmplogvanhauser-thc
2022-07-04cmplog support for gcc_plugin by adacorevanhauser-thc
2022-06-20nitsvanhauser-thc
2022-04-25code formatvanhauser-thc
2022-04-20fix instrumentation for -Werror,-Wunused-but-set-variableJesse Schwartzentruber
`used` is so it isn't optimized out. `unused` is to avoid the warning.
2022-04-20use passthrough mode for wasmJesse Schwartzentruber
2022-03-31Some scan-build fixesDominik Maier
2022-03-30fix instrumentlist for LTO with clang < 13vanhauser-thc
2022-03-18fix LTO with cmplog and lafvanhauser-thc
2022-03-18our own PCGUARD mode not for llvm 10.0.1vanhauser-thc
2022-03-18fix split pass loadingvanhauser-thc
2022-03-17merge fixesvanhauser-thc
2022-03-17Merge branch 'dev' into newpm2van Hauser
2022-03-17make LTO pass work too plus some fixesvanhauser-thc
2022-03-17make pcguard workvanhauser-thc
2022-03-01code formatvanhauser-thc
2022-03-01Revert "Merge branch 'newpm2' into dev"vanhauser-thc
This reverts commit fee1acf7e6096533f1aa8cd74035bed21c90fdf6, reversing changes made to 675d17d737ee5dee88766d9c181567771592c94c.
2022-02-22Merge branch 'newpm2' into devvan Hauser
2022-02-22LLVM 14 fixesRaphael Isemann
2022-02-21todo listvanhauser-thc
2022-02-20Revert "remove new llvm pass manager :("vanhauser-thc
This reverts commit 55ed2a443c5c61baba37415d4087164454d8a2a8.
2022-02-09Adapt to my MacOSDominik Maier
2022-02-08remove debug msgvanhauser-thc
2022-02-08import mozilla afl-cc patchvanhauser-thc
2022-01-21fixvanhauser-thc
2022-01-19nits and code formatvanhauser-thc
2022-01-19Revert "fix classify counts"vanhauser-thc
This reverts commit 4217a6606c92f6a88ab577ae8f91823dd731562d.
2022-01-15fix classify countsvanhauser-thc