[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/19] scripts/oss-fuzz: give all fuzzers -target names
From: |
Thomas Huth |
Subject: |
[PULL 10/19] scripts/oss-fuzz: give all fuzzers -target names |
Date: |
Tue, 10 Nov 2020 12:11:23 +0100 |
From: Alexander Bulekov <alxndr@bu.edu>
We switched to hardlinks in
a942f64cc4 ("scripts/oss-fuzz: use hardlinks instead of copying")
The motivation was to conserve space (50 fuzzers built with ASAN, can
weigh close to 9 GB).
Unfortunately, OSS-Fuzz (partially) treated the underlying copy of the
fuzzer as a standalone fuzzer. To attempt to fix, we tried:
f8b8f37463 ("scripts/oss-fuzz: rename bin/qemu-fuzz-i386")
This was also not a complete fix, because though OSS-Fuzz
ignores the renamed fuzzer, the underlying ClusterFuzz, doesn't:
https://storage.googleapis.com/clusterfuzz-builds/qemu/targets.list.address
https://oss-fuzz-build-logs.storage.googleapis.com/log-9bfb55f9-1c20-4aa6-a49c-ede12864eeb2.txt
(clusterfuzz still lists qemu-fuzz-i386.base as a fuzzer)
This change keeps the hard-links, but makes them all point to a file
with a qemu-fuzz-i386-target-.. name. If we have targets, A, B, C, the
result will be:
qemu-fuzz-i386-target-A (base file)
qemu-fuzz-i386-target-B -> qemu-fuzz-i386-target-A
qemu-fuzz-i386-target-C -> qemu-fuzz-i386-target-A
The result should be that every file that looks like a fuzzer to
OSS-Fuzz/ClusterFuzz, can run as a fuzzer (we don't have a separate base
copy). Unfortunately, there is not simple way to test this locally.
In the future, it might be worth it to link the majority of QEMU in as a
shared-object (see https://github.com/google/oss-fuzz/issues/4575 )
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Message-Id: <20201108171136.160607-1-alxndr@bu.edu>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
scripts/oss-fuzz/build.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/scripts/oss-fuzz/build.sh b/scripts/oss-fuzz/build.sh
index 3b1c82b63d..c1af43fded 100755
--- a/scripts/oss-fuzz/build.sh
+++ b/scripts/oss-fuzz/build.sh
@@ -62,9 +62,6 @@ fi
mkdir -p "$DEST_DIR/lib/" # Copy the shared libraries here
-mkdir -p "$DEST_DIR/bin/" # Copy executables that shouldn't
- # be treated as fuzzers by oss-fuzz here
-
# Build once to get the list of dynamic lib paths, and copy them over
../configure --disable-werror --cc="$CC" --cxx="$CXX" --enable-fuzzing \
--prefix="$DEST_DIR" --bindir="$DEST_DIR" --datadir="$DEST_DIR/data/" \
@@ -91,20 +88,23 @@ make "-j$(nproc)" qemu-fuzz-i386 V=1
# Copy over the datadir
cp -r ../pc-bios/ "$DEST_DIR/pc-bios"
-cp "./qemu-fuzz-i386" "$DEST_DIR/bin/qemu-fuzz-i386.base"
+targets=$(./qemu-fuzz-i386 | awk '$1 ~ /\*/ {print $2}')
+base_copy="$DEST_DIR/qemu-fuzz-i386-target-$(echo "$targets" | head -n 1)"
+
+cp "./qemu-fuzz-i386" "$base_copy"
# Run the fuzzer with no arguments, to print the help-string and get the list
# 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 $(./qemu-fuzz-i386 | awk '$1 ~ /\*/ {print $2}');
+for target in $(echo "$targets" | tail -n +2);
do
# Ignore the generic-fuzz target, as it requires some environment variables
# to be configured. We have some generic-fuzz-{pc-q35, floppy, ...} targets
# that are thin wrappers around this target that set the required
# environment variables according to predefined configs.
if [ "$target" != "generic-fuzz" ]; then
- ln "$DEST_DIR/bin/qemu-fuzz-i386.base" \
+ ln $base_copy \
"$DEST_DIR/qemu-fuzz-i386-target-$target"
fi
done
--
2.18.4
- [PULL 00/19] qtests, gitlab, s390x and misc patches, Thomas Huth, 2020/11/10
- [PULL 01/19] meson: always include contrib/libvhost-user, Thomas Huth, 2020/11/10
- [PULL 03/19] device-crash-test: Check if path is actually an executable file, Thomas Huth, 2020/11/10
- [PULL 04/19] qtest: Fix bad printf format specifiers, Thomas Huth, 2020/11/10
- [PULL 05/19] tests/qtest/tpm: Remove redundant check in the tpm_test_swtpm_test(), Thomas Huth, 2020/11/10
- [PULL 02/19] tests/vm: update openbsd to release 6.8, Thomas Huth, 2020/11/10
- [PULL 06/19] gitlab-ci: Drop generic cache rule, Thomas Huth, 2020/11/10
- [PULL 07/19] MAINTAINERS: Add gitlab-pipeline-status script to GitLab CI section, Thomas Huth, 2020/11/10
- [PULL 11/19] fuzz: Make fork_fuzz.ld compatible with LLVM's LLD, Thomas Huth, 2020/11/10
- [PULL 10/19] scripts/oss-fuzz: give all fuzzers -target names,
Thomas Huth <=
- [PULL 09/19] docs/fuzz: update fuzzing documentation post-meson, Thomas Huth, 2020/11/10
- [PULL 12/19] configure: surface deprecated targets in the help output, Thomas Huth, 2020/11/10
- [PULL 13/19] gitlab: publish the docs built during CI, Thomas Huth, 2020/11/10
- [PULL 14/19] gitlab: force enable docs build in Fedora, Ubuntu, Debian, Thomas Huth, 2020/11/10
- [PULL 08/19] docs/fuzz: rST-ify the fuzzing documentation, Thomas Huth, 2020/11/10
- [PULL 15/19] docs: add "page source" link to sphinx documentation, Thomas Huth, 2020/11/10
- [PULL 16/19] fuzz: add virtio-blk fuzz target, Thomas Huth, 2020/11/10
- [PULL 17/19] qtest: Update references to parse_escape() in comments, Thomas Huth, 2020/11/10
- [PULL 18/19] s390x: fix clang 11 warnings in cpu_models.c, Thomas Huth, 2020/11/10
- [PULL 19/19] s390x: Avoid variable size warning in ipl.h, Thomas Huth, 2020/11/10