summaryrefslogtreecommitdiff
path: root/lib/fuzzing
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2020-10-22 12:05:29 +1300
committerDouglas Bagnall <dbagnall@samba.org>2020-10-22 12:47:37 +0000
commit048725080b608d0d714f133a15e09dda6b6dd8ca (patch)
treef0f320b80dda93b787e716005f6a318b0eee28ab /lib/fuzzing
parent7b52c2db264a92ea77bcb7e45e016ea03f699393 (diff)
downloadsamba-048725080b608d0d714f133a15e09dda6b6dd8ca.tar.gz
fuzzing: Improve robustness and documentation of the ldd-base library copy
This tries to make progress towards understanding why we sometime see errors like Step #6: Error occured while running fuzz_reg_parse: Step #6: /workspace/out/coverage/fuzz_reg_parse: error while loading shared libraries: libavahi-common.so.3: cannot open shared object file: No such file or directory in the previously failing coverage builds. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'lib/fuzzing')
-rwxr-xr-xlib/fuzzing/oss-fuzz/build_samba.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/fuzzing/oss-fuzz/build_samba.sh b/lib/fuzzing/oss-fuzz/build_samba.sh
index 5980f88ad02..c9a5162f801 100755
--- a/lib/fuzzing/oss-fuzz/build_samba.sh
+++ b/lib/fuzzing/oss-fuzz/build_samba.sh
@@ -94,12 +94,25 @@ mkdir -p $OUT/lib
for x in bin/fuzz_*
do
+ # Copy any system libraries needed by this fuzzer to $OUT/lib.
+
+ # We run ldd on $x, the fuzz_binary in bin/ which has not yet had
+ # the RUNPATH altered. This is clearer for debugging in local
+ # development builds as $OUT is not cleaned between runs.
+ #
+ # Otherwise trying to re-run this can see cp can fail with:
+ # cp: '/out/lib/libgcc_s.so.1' and '/out/lib/libgcc_s.so.1' are the same file
+ # which is really confusing!
+
+ # The cut for ( and ' ' removes the special case references to:
+ # linux-vdso.so.1 => (0x00007ffe8f2b2000)
+ # /lib64/ld-linux-x86-64.so.2 (0x00007fc63ea6f000)
+
+ ldd $x | cut -f 2 -d '>' | cut -f 1 -d \( | cut -f 2 -d ' ' | xargs -i cp \{\} $OUT/lib/
+
cp $x $OUT/
bin=`basename $x`
- # Copy any system libraries needed by this fuzzer to $OUT/lib
- ldd $OUT/$bin | cut -f 2 -d '>' | cut -f 1 -d \( | cut -f 2 -d ' ' | xargs -i cp \{\} $OUT/lib/
-
# Change any RPATH to RUNPATH.
#
# We use ld.bfd for the coverage builds, rather than the faster ld.gold.