Skip to content

Commit

Permalink
Merge pull request #255 from mrc0mmand/workaround-issue-247
Browse files Browse the repository at this point in the history
vagrant: use LDFLAGS="-Wl,--no-as-needed" in sanitizer runs
  • Loading branch information
mrc0mmand authored May 15, 2020
2 parents 800b173 + 18b7044 commit 4b8715f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
4 changes: 2 additions & 2 deletions jenkins/runners/systemd-cron-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ ARGS=
git clone https://github.com/systemd/systemd-centos-ci
cd systemd-centos-ci

#./agent-control.py --version 8 --no-index --vagrant arch-sanitizers-gcc $ARGS
./agent-control.py --version 8 --no-index --vagrant arch-sanitizers-clang $ARGS
./agent-control.py --version 8 --no-index --vagrant arch-sanitizers-gcc $ARGS
#./agent-control.py --version 8 --no-index --vagrant arch-sanitizers-clang $ARGS
4 changes: 2 additions & 2 deletions jenkins/runners/systemd-pr-build-vagrant-sanitizers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ fi
git clone https://github.com/systemd/systemd-centos-ci
cd systemd-centos-ci

./agent-control.py --version 8 --no-index --vagrant arch-sanitizers-gcc $ARGS
#./agent-control.py --version 8 --no-index --vagrant arch-sanitizers-clang $ARGS
#./agent-control.py --no-index --vagrant arch-sanitizers-gcc $ARGS
./agent-control.py --version 8 --no-index --vagrant arch-sanitizers-clang $ARGS
13 changes: 13 additions & 0 deletions vagrant/bootstrap_scripts/arch-sanitizers-clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ export CC=clang
export CXX=clang++
export CFLAGS="-shared-libasan"
export CXXFLAGS="-shared-libasan"
# FIXME
# Since version 10, both gcc and clang started to ignore certain linker errors
# when compiling with -fsanitize=address. This eventually leads up to -lcrypt
# not being correctly propagated, but the fact is masked by the aforementioned
# issue. However, when the binary attempts to load a symbol from the libcrypt
# binary, it crashes since it's not linked correctly against it.
# Negating the -Wl,--as-needed used by default by -Wl,--no-as-needed seems to
# help in this case.
#
# See:
# https://bugzilla.redhat.com/show_bug.cgi?id=1827338#c3
# https://github.com/systemd/systemd-centos-ci/issues/247
export LDFLAGS="-Wl,--no-as-needed"

meson "$BUILD_DIR" \
--werror \
Expand Down
15 changes: 15 additions & 0 deletions vagrant/bootstrap_scripts/arch-sanitizers-gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ rm -fr "$BUILD_DIR"
# Build phase
# Compile systemd with the Address Sanitizer (ASan) and Undefined Behavior
# Sanitizer (UBSan)

# FIXME
# Since version 10, both gcc and clang started to ignore certain linker errors
# when compiling with -fsanitize=address. This eventually leads up to -lcrypt
# not being correctly propagated, but the fact is masked by the aforementioned
# issue. However, when the binary attempts to load a symbol from the libcrypt
# binary, it crashes since it's not linked correctly against it.
# Negating the -Wl,--as-needed used by default by -Wl,--no-as-needed seems to
# help in this case.
#
# See:
# https://bugzilla.redhat.com/show_bug.cgi?id=1827338#c3
# https://github.com/systemd/systemd-centos-ci/issues/247
export LDFLAGS="-Wl,--no-as-needed"

meson "$BUILD_DIR" \
--werror \
-Dc_args='-fno-omit-frame-pointer -ftrapv' \
Expand Down
10 changes: 1 addition & 9 deletions vagrant/vagrant-test-sanitizers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,9 @@ if [[ $NSPAWN_EC -eq 0 ]]; then
## be somewhat sure the 'base' systemd components work).
INTEGRATION_TESTS=(
test/TEST-04-JOURNAL # systemd-journald
test/TEST-46-HOMED # systemd-homed & friends
)

# FIXME: LLVM 10 has an interesting issue, which breaks library detection
# when -fsanitize=address is used, causing ASan to segfault during
# TEST-46-HOMED. Let's disable it for now (only for LLVM runs) until it's
# fixed, so we can still use the rest of the LLVM run.
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1827338
# FIXME#2: GCC 10 picked up the issue as well, I'll need to come up with
# a workaround
#[[ -z "$_clang_asan_rt_name" ]] && INTEGRATION_TESTS+=(test/TEST-46-HOMED) # systemd-homed & friends

for t in "${INTEGRATION_TESTS[@]}"; do
# Set the test dir to something predictable so we can refer to it later
export TESTDIR="/var/tmp/systemd-test-${t##*/}"
Expand Down

0 comments on commit 4b8715f

Please sign in to comment.