aboutsummaryrefslogtreecommitdiff
path: root/scripts/oss-fuzz
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-08-21 12:42:49 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-08-21 12:42:49 +0100
commit7fd51e68c34fcefdb4d6fd646ed3346f780f89f4 (patch)
treeb4c90dc51c2babb9850d29d0e3349891b2988172 /scripts/oss-fuzz
parent1d806cef0e38b5db8347a8e12f214d543204a314 (diff)
parenta14f0bf1657adef0328a3a756637b93f53ec0220 (diff)
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging
New build system, with "fake in-tree builds" support. Missing: * converting configure tests * converting unit tests * converting some remaining parts of the installation # gpg: Signature made Fri 21 Aug 2020 11:33:35 BST # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini-gitlab/tags/for-upstream: (152 commits) docs: convert build system documentation to rST meson: update build-system documentation meson: avoid unstable module warning with Meson 0.56.0 or newer meson: convert po/ meson: convert VNC and dependent libraries to meson meson: move SDL and SDL-image detection to meson meson: convert sample plugins meson: replace create-config with meson configure_file rules.mak: drop unneeded macros meson: convert check-block meson: build texi doc docs: automatically track manual dependencies meson: sphinx-build remove Makefile.target rules.mak: remove version.o meson: convert systemtap files configure: place compatibility symlinks in target directories meson: link emulators without Makefile.target meson: plugins meson: cpu-emu ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts/oss-fuzz')
-rwxr-xr-xscripts/oss-fuzz/build.sh32
1 files changed, 14 insertions, 18 deletions
diff --git a/scripts/oss-fuzz/build.sh b/scripts/oss-fuzz/build.sh
index a07b3022e8..f0b7442c96 100755
--- a/scripts/oss-fuzz/build.sh
+++ b/scripts/oss-fuzz/build.sh
@@ -20,7 +20,7 @@
# e.g.
# $CXX $CXXFLAGS -std=c++11 -Iinclude \
# /path/to/name_of_fuzzer.cc -o $OUT/name_of_fuzzer \
-# $LIB_FUZZING_ENGINE /path/to/library.a
+# -fsanitize=fuzzer /path/to/library.a
fatal () {
echo "Error : ${*}, exiting."
@@ -54,10 +54,6 @@ mkdir -p $OSS_FUZZ_BUILD_DIR || fatal "mkdir $OSS_FUZZ_BUILD_DIR failed"
cd $OSS_FUZZ_BUILD_DIR || fatal "cd $OSS_FUZZ_BUILD_DIR failed"
-if [ -z ${LIB_FUZZING_ENGINE+x} ]; then
- LIB_FUZZING_ENGINE="-fsanitize=fuzzer"
-fi
-
if [ -z ${OUT+x} ]; then
DEST_DIR=$(realpath "./DEST_DIR")
else
@@ -67,27 +63,27 @@ fi
mkdir -p "$DEST_DIR/lib/" # Copy the shared libraries here
# Build once to get the list of dynamic lib paths, and copy them over
-../configure --disable-werror --cc="$CC" --cxx="$CXX" \
+../configure --disable-werror --cc="$CC" --cxx="$CXX" --enable-fuzzing \
+ --prefix="$DEST_DIR" --bindir="$DEST_DIR" --datadir="$DEST_DIR/data/" \
--extra-cflags="$EXTRA_CFLAGS" --target-list="i386-softmmu"
-if ! make CONFIG_FUZZ=y CFLAGS="$LIB_FUZZING_ENGINE" "-j$(nproc)" \
- i386-softmmu/fuzz; then
+if ! make "-j$(nproc)" qemu-fuzz-i386; then
fatal "Build failed. Please specify a compiler with fuzzing support"\
- "using the \$CC and \$CXX environemnt variables, or specify a"\
- "\$LIB_FUZZING_ENGINE compatible with your compiler"\
+ "using the \$CC and \$CXX environemnt variables"\
"\nFor example: CC=clang CXX=clang++ $0"
fi
-for i in $(ldd ./i386-softmmu/qemu-fuzz-i386 | cut -f3 -d' '); do
+for i in $(ldd ./qemu-fuzz-i386 | cut -f3 -d' '); do
cp "$i" "$DEST_DIR/lib/"
done
-rm ./i386-softmmu/qemu-fuzz-i386
+rm qemu-fuzz-i386
# Build a second time to build the final binary with correct rpath
-../configure --bindir="$DEST_DIR" --datadir="$DEST_DIR/data/" --disable-werror \
- --cc="$CC" --cxx="$CXX" --extra-cflags="$EXTRA_CFLAGS" \
- --extra-ldflags="-Wl,-rpath,'\$\$ORIGIN/lib'"
-make CONFIG_FUZZ=y CFLAGS="$LIB_FUZZING_ENGINE" "-j$(nproc)" i386-softmmu/fuzz
+../configure --disable-werror --cc="$CC" --cxx="$CXX" --enable-fuzzing \
+ --prefix="$DEST_DIR" --bindir="$DEST_DIR" --datadir="$DEST_DIR/data/" \
+ --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="-Wl,-rpath,'\$\$ORIGIN/lib'" \
+ --target-list="i386-softmmu"
+make "-j$(nproc)" qemu-fuzz-i386 V=1
# Copy over the datadir
cp -r ../pc-bios/ "$DEST_DIR/pc-bios"
@@ -96,9 +92,9 @@ cp -r ../pc-bios/ "$DEST_DIR/pc-bios"
# of available fuzz-targets. Copy over the qemu-fuzz-i386, naming it according
# to each available fuzz target (See 05509c8e6d fuzz: select fuzz target using
# executable name)
-for target in $(./i386-softmmu/qemu-fuzz-i386 | awk '$1 ~ /\*/ {print $2}');
+for target in $(./qemu-fuzz-i386 | awk '$1 ~ /\*/ {print $2}');
do
- cp ./i386-softmmu/qemu-fuzz-i386 "$DEST_DIR/qemu-fuzz-i386-target-$target"
+ cp qemu-fuzz-i386 "$DEST_DIR/qemu-fuzz-i386-target-$target"
done
echo "Done. The fuzzers are located in $DEST_DIR"