agroce / afl-compiler-fuzzer

Variation of american fuzzy lop for testing compilers
http://lcamtuf.coredump.cx/afl/
Apache License 2.0
115 stars 11 forks source link

Build environment #3

Open turbolent opened 2 years ago

turbolent commented 2 years ago

I'm trying to build this fork of AFL on Fedora 36, specifically the binary-only mode based on QEMU, but am running into the following errors:

$ PYTHON=python2.7 ./build_qemu_support.sh

...
/home/bastian/Documents/afl-compiler-fuzzer/qemu_mode/qemu-2.10.0/linux-user/syscall.c:261:16: error: static declaration of ‘gettid’ follows non-static declaration
  261 | _syscall0(int, gettid)
      |                ^~~~~~
/home/bastian/Documents/afl-compiler-fuzzer/qemu_mode/qemu-2.10.0/linux-user/syscall.c:191:13: note: in definition of macro ‘_syscall0’
  191 | static type name (void)                 \
      |             ^~~~
In file included from /usr/include/unistd.h:1218,
                 from /home/bastian/Documents/afl-compiler-fuzzer/qemu_mode/qemu-2.10.0/include/qemu/osdep.h:75,
                 from /home/bastian/Documents/afl-compiler-fuzzer/qemu_mode/qemu-2.10.0/linux-user/syscall.c:20:
/usr/include/bits/unistd_ext.h:34:16: note: previous declaration of ‘gettid’ with type ‘__pid_t(void)’ {aka ‘int(void)’}
   34 | extern __pid_t gettid (void) __THROW;
      |                ^~~~~~
/home/bastian/Documents/afl-compiler-fuzzer/qemu_mode/qemu-2.10.0/linux-user/ioctls.h:173:9: error: ‘SIOCGSTAMP’ undeclared here (not in a function); did you mean ‘SIOCSRARP’?
  173 |   IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
      |         ^~~~~~~~~~
/home/bastian/Documents/afl-compiler-fuzzer/qemu_mode/qemu-2.10.0/linux-user/syscall.c:5597:23: note: in definition of macro ‘IOCTL’
 5597 |     { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
      |                       ^~~
/home/bastian/Documents/afl-compiler-fuzzer/qemu_mode/qemu-2.10.0/linux-user/ioctls.h:174:9: error: ‘SIOCGSTAMPNS’ undeclared here (not in a function); did you mean ‘SIOCGSTAMP_OLD’?
  174 |   IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
      |         ^~~~~~~~~~~~
/home/bastian/Documents/afl-compiler-fuzzer/qemu_mode/qemu-2.10.0/linux-user/syscall.c:5597:23: note: in definition of macro ‘IOCTL’
 5597 |     { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
      |                       ^~~
/home/bastian/Documents/afl-compiler-fuzzer/qemu_mode/qemu-2.10.0/linux-user/syscall.c: In function ‘do_open_by_handle_at’:
/home/bastian/Documents/afl-compiler-fuzzer/qemu_mode/qemu-2.10.0/linux-user/syscall.c:7248:5: warning: ‘g_memdup’ is deprecated: Use 'g_memdup2' instead [-Wdeprecated-declarations]
 7248 |     fh = g_memdup(target_fh, total_size);
      |     ^~
In file included from /usr/include/glib-2.0/glib.h:82,
                 from /home/bastian/Documents/afl-compiler-fuzzer/qemu_mode/qemu-2.10.0/include/glib-compat.h:19,
                 from /home/bastian/Documents/afl-compiler-fuzzer/qemu_mode/qemu-2.10.0/include/qemu/osdep.h:107:
/usr/include/glib-2.0/glib/gstrfuncs.h:257:23: note: declared here
  257 | gpointer              g_memdup         (gconstpointer mem,
      |                       ^~~~~~~~
make[1]: *** [/home/bastian/Documents/afl-compiler-fuzzer/qemu_mode/qemu-2.10.0/rules.mak:66: linux-user/syscall.o] Error 1
make: *** [Makefile:326: subdir-x86_64-linux-user] Error 2

Could you please provide more details on what distribution/version this project can be used? Thank you!

agroce commented 2 years ago

At a guess, these look like things that aren't in our code at all. Looking at things committed to google's baseline AFL (https://github.com/google/AFL/commits/master) since I forked off, I don't know if anything is relevant to any of this, so whatever Google AFL builds/works on we should build/work on, for the most part. We didn't touch any QEMU-related code, and I haven't used it on a compiler in QEMU mode.

Maybe try to get plain google afl to build on same, and if that works then there is an issue here, otherwise it's really a Google issue.

And, yes, maybe AFL++ integration might fix this!