1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

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>
This commit is contained in:
Andrew Bartlett 2020-10-22 12:05:29 +13:00 committed by Douglas Bagnall
parent 7b52c2db26
commit 048725080b

View File

@ -94,12 +94,25 @@ mkdir -p $OUT/lib
for x in bin/fuzz_* for x in bin/fuzz_*
do 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/ cp $x $OUT/
bin=`basename $x` 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. # Change any RPATH to RUNPATH.
# #
# We use ld.bfd for the coverage builds, rather than the faster ld.gold. # We use ld.bfd for the coverage builds, rather than the faster ld.gold.