AFLplusplus / qemuafl

This fork of QEMU enables fuzzing userspace ELF binaries under AFL++.

Home Page:https://aflplus.plus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

qemuafl does not build with meson 0.57 and later

bennofs opened this issue · comments

Two commits from upstream qemu fix this:

commit f35d3cd44e34f993ddaa1ec4f64ec8e7bce92595 (HEAD)
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Tue Mar 9 16:15:30 2021 +0100

    hexagon: do not specify Python scripts as inputs

    Python scripts are not inputs, and putting them in @INPUT@.  This
    puts requirements on the command line format, keeping all inputs
    close to the name of the script.  Avoid that by not including the
    script in the command and not in the inputs.

    Also wrap "PYTHONPATH" usage with "env", since setting the environment
    this way is not valid under Windows.

    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

commit 3a682e7d32eaf89c8e09749eca464121d9a97914
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Tue Mar 9 16:15:30 2021 +0100

    hexagon: do not specify executables as inputs

    gen_semantics is an executable, not an input.  Meson 0.57 special cases
    the first argument and @INPUT@ is not expanded there.  Fix that by
    not including it in the input, only in the command.

    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Can approve it.

Program scripts/decodetree.py found: YES (/usr/bin/python3 /opt/wokr/FUZZING/AFLplusplus/qemu_mode/qemuafl/scripts/decodetree.py)
Program @INPUT@ found: NO

../target/hexagon/meson.build:33:0: ERROR: Program '@INPUT@' not found

A full log can be found at /opt/wokr/FUZZING/AFLplusplus/qemu_mode/qemuafl/build/meson-logs/meson-log.txt

ERROR: meson setup failed

meson --version
0.58.999

you have to report this upstream to qemu itself, the meson setup is by them. until this is fixed and we then update from qemu you will have to install an older version or find a workaround.

@kotee4ko do not post your issues to completely different items!

Since this is still present in the current version, here's a rather simple workaround based on the patches pointed out by @bennofs:

  1. Run build_qemu_support.sh until it fails with the Program '@INPUT@' not found error above. I'm assuming you're now in the qemu_mode folder of AFLplusplus.
  2. cd qemuafl
  3. curl 'https://pastebin.com/raw/i4xw9uNM' | tr -d '\r' > qemu-meson-workaround.patch (this is just a merged version of the two commits; if you'd rather not trust me, manually merge them)
  4. patch -p1 < qemu-meson-workaround.patch
  5. cd ..
  6. NO_CHECKOUT=1 ./build_qemu_support.sh

The NO_CHECKOUT flag must be set to any nonempty string. Otherwise, build_qemu_support.sh will simply checkout qemuafl again, immediately overwriting your patch.
Tested (compiles, not tested if it works) on a6758d1.