[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/31] scripts/oss-fuzz: use hardlinks instead of copying
From: |
Thomas Huth |
Subject: |
[PULL 24/31] scripts/oss-fuzz: use hardlinks instead of copying |
Date: |
Mon, 26 Oct 2020 11:06:25 +0100 |
From: Alexander Bulekov <alxndr@bu.edu>
Prior to this, fuzzers in the output oss-fuzz directory were exactly
the same executable, with a different name to do argv[0]-based
fuzz-target selection. This is a waste of space, especially since these
binaries can weigh many MB.
Instead of copying, use hard links, to cut down on wasted space. We need
to place the primary copy of the executable into DEST_DIR, since this is
a separate file-system on oss-fuzz. We should not place it directly into
$DEST_DIR, since oss-fuzz will treat it as an independent fuzzer and try
to run it for fuzzing. Instead, we create a DEST_DIR/bin directory to
store the primary copy.
Suggested-by: Darren Kenny <darren.kenny@oracle.com>
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Message-Id: <20201023150746.107063-17-alxndr@bu.edu>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
scripts/oss-fuzz/build.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/scripts/oss-fuzz/build.sh b/scripts/oss-fuzz/build.sh
index 0c3ca9e06f..0ce2867732 100755
--- a/scripts/oss-fuzz/build.sh
+++ b/scripts/oss-fuzz/build.sh
@@ -62,6 +62,9 @@ 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/" \
@@ -88,13 +91,16 @@ 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/"
+
# 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}');
do
- cp qemu-fuzz-i386 "$DEST_DIR/qemu-fuzz-i386-target-$target"
+ ln "$DEST_DIR/bin/qemu-fuzz-i386" \
+ "$DEST_DIR/qemu-fuzz-i386-target-$target"
done
echo "Done. The fuzzers are located in $DEST_DIR"
--
2.18.2
- [PULL 12/31] fuzz: Add DMA support to the generic-fuzzer, (continued)
- [PULL 12/31] fuzz: Add DMA support to the generic-fuzzer, Thomas Huth, 2020/10/26
- [PULL 15/31] fuzz: Add support for custom crossover functions, Thomas Huth, 2020/10/26
- [PULL 14/31] fuzz: Add fuzzer callbacks to DMA-read functions, Thomas Huth, 2020/10/26
- [PULL 19/31] scripts/oss-fuzz: Add crash trace minimization script, Thomas Huth, 2020/10/26
- [PULL 16/31] fuzz: add a DISABLE_PCI op to generic-fuzzer, Thomas Huth, 2020/10/26
- [PULL 20/31] fuzz: Add instructions for using generic-fuzz, Thomas Huth, 2020/10/26
- [PULL 21/31] fuzz: add an "opaque" to the FuzzTarget struct, Thomas Huth, 2020/10/26
- [PULL 17/31] fuzz: add a crossover function to generic-fuzzer, Thomas Huth, 2020/10/26
- [PULL 18/31] scripts/oss-fuzz: Add script to reorder a generic-fuzzer trace, Thomas Huth, 2020/10/26
- [PULL 22/31] fuzz: add generic-fuzz configs for oss-fuzz, Thomas Huth, 2020/10/26
- [PULL 24/31] scripts/oss-fuzz: use hardlinks instead of copying,
Thomas Huth <=
- [PULL 13/31] fuzz: Declare DMA Read callback function, Thomas Huth, 2020/10/26
- [PULL 23/31] fuzz: register predefined generic-fuzz configs, Thomas Huth, 2020/10/26
- [PULL 25/31] scripts/oss-fuzz: ignore the generic-fuzz target, Thomas Huth, 2020/10/26
- [PULL 27/31] test/acceptance: Remove the CONTINUOUS_INTEGRATION tags, Thomas Huth, 2020/10/26
- [PULL 26/31] tests/acceptance/ppc_prep_40p: Fix the URL to the NetBSD-4.0 archive, Thomas Huth, 2020/10/26
- [PULL 28/31] tests/acceptance: Enable AVOCADO_ALLOW_UNTRUSTED_CODE in the gitlab-CI, Thomas Huth, 2020/10/26
- [PULL 29/31] test/docker/dockerfiles: Add missing packages for acceptance tests, Thomas Huth, 2020/10/26
- [PULL 30/31] tests/acceptance: Remove unused import, Thomas Huth, 2020/10/26
- [PULL 31/31] tests/acceptance: Use .ppm extention for Portable PixMap files, Thomas Huth, 2020/10/26
- Re: [PULL 00/31] qtests and gitlab-CI/acceptance patches, Peter Maydell, 2020/10/26