summaryrefslogtreecommitdiff
path: root/lib/fuzzing
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2019-12-04 22:52:06 +1300
committerAndrew Bartlett <abartlet@samba.org>2019-12-11 02:55:32 +0000
commit0be0c044b6769da39b0feb8d7b655a2760413086 (patch)
tree89edc676bfa32358d99024b08e8335a0461eb220 /lib/fuzzing
parentd349d344f8872e25526fdb76a38523477baa4366 (diff)
downloadsamba-0be0c044b6769da39b0feb8d7b655a2760413086.tar.gz
autobuild: extend autobuild with samba-fuzz job to build the fuzzers in AFL mode using oss-fuzz scripts
This helps ensure the build_samba.sh file keeps working and the fuzzers build (because they are excluded from the main build). This is not in the default autobuild because it uses too much space on sn-devel (4GB). Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@samba.org>
Diffstat (limited to 'lib/fuzzing')
-rwxr-xr-xlib/fuzzing/oss-fuzz/build_samba.sh7
-rwxr-xr-xlib/fuzzing/oss-fuzz/check_build.sh25
2 files changed, 31 insertions, 1 deletions
diff --git a/lib/fuzzing/oss-fuzz/build_samba.sh b/lib/fuzzing/oss-fuzz/build_samba.sh
index e4783442b20..63b81af0810 100755
--- a/lib/fuzzing/oss-fuzz/build_samba.sh
+++ b/lib/fuzzing/oss-fuzz/build_samba.sh
@@ -11,6 +11,9 @@
#
# CFLAGS are supplied by the caller, eg the oss-fuzz compile command
#
+# Additional arguments are passed to configure, to allow this to be
+# tested in autobuild.py
+#
ADDITIONAL_CFLAGS="$CFLAGS"
export ADDITIONAL_CFLAGS
CFLAGS=""
@@ -42,7 +45,9 @@ esac
--disable-warnings-as-errors \
--abi-check-disable \
--fuzz-target-ldflags="$LIB_FUZZING_ENGINE" \
- --nonshared-binary=ALL LINK_CC="$CXX"
+ --nonshared-binary=ALL \
+ "$@" \
+ LINK_CC="$CXX"
make -j
diff --git a/lib/fuzzing/oss-fuzz/check_build.sh b/lib/fuzzing/oss-fuzz/check_build.sh
new file mode 100755
index 00000000000..cc69cf26418
--- /dev/null
+++ b/lib/fuzzing/oss-fuzz/check_build.sh
@@ -0,0 +1,25 @@
+#!/bin/sh -eux
+#
+# A very simple check script to confirm we still provide binaries
+# that look like the targets oss-fuzz wants.
+#
+# A much stronger check is availble in oss-fuzz via
+# infra/helper.py check_build samba
+#
+
+# oss-fuzz provides an OUT variable, so for clarity this script
+# uses the same. See build_samba.sh
+OUT=$1
+
+# build_samba.sh will have put a non-zero number of fuzzers here. If
+# there are none, this will fail as it becomes literally fuzz_*
+for bin in $OUT/fuzz_*
+do
+ # Confirm that the chrpath was reset to lib/ in the same directory
+ # as the binary
+ chrpath -l $bin | grep 'RUNPATH=$ORIGIN/lib'
+
+ # Confirm that we link to at least some libraries in this
+ # directory (shows that the libraries were found and copied).
+ ldd $bin | grep "$OUT/lib"
+done