From dc68b1981660e5c8543c3b06adb62e70190b10a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= Date: Fri, 16 Dec 2022 13:38:50 +0100 Subject: [PATCH 1/8] CI: rename master to main --- .github/workflows/linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 2f3a10c1..86476689 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -3,10 +3,10 @@ name: Linux CI on: push: branches: - - master + - main pull_request: branches: - - master + - main jobs: build64: From 208fa9becf4ad2acf1e3fe7aa252d78bbcec6a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= Date: Fri, 16 Dec 2022 14:57:45 +0100 Subject: [PATCH 2/8] CI: install dependencies for Predator libc6-dev-i386 was removed since it is already included in gcc-multilib. --- .github/workflows/linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 86476689..97102558 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -68,8 +68,8 @@ jobs: run: | sudo apt update sudo apt install ccache cmake clang-${{matrix.llvm}} \ - llvm-${{matrix.llvm}}-dev libc6-dev-i386 \ - libz3-dev + gcc-multilib llvm-${{matrix.llvm}}-dev \ + libboost-dev libz3-dev - name: Set environment id: env From a2b33fb9ca53c04126e313ab3f1d774dc63b8a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= Date: Thu, 6 Oct 2022 22:30:38 +0200 Subject: [PATCH 3/8] CI: set LD_LIBRARY_PATH to Clang's compiler-rt dir globally --- .github/workflows/linux.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 97102558..3198b0d2 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -100,6 +100,10 @@ jobs: CFLAGS="-shared-libasan $CFLAGS" CXXFLAGS="-shared-libasan $CXXFLAGS" + # Dynamic compiler-rt libraries are not in /usr/lib + tmp="$(clang-${{matrix.llvm}} -print-file-name=libclang_rt.asan-x86_64.so)" + LD_LIBRARY_PATH="$(dirname "$tmp")" + # Force coloured output CFLAGS="-fcolor-diagnostics $CFLAGS" CXXFLAGS="-fcolor-diagnostics $CXXFLAGS" @@ -119,6 +123,7 @@ jobs: echo "CFLAGS=$CFLAGS" >> $GITHUB_ENV echo "CXXFLAGS=$CXXFLAGS" >> $GITHUB_ENV echo "LDFLAGS=$LDFLAGS" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV # Set up ccache sudo /usr/sbin/update-ccache-symlinks @@ -152,11 +157,9 @@ jobs: if: matrix.llvm < 11 run: | if [[ "${{matrix.compiler}}" = "clang" ]]; then - # * libclang_rt.asan-x86_64.so must be loaded as the first library - # * other compiler_rt libraries are not in /usr/lib + # libclang_rt.asan-x86_64.so must be loaded as the first library # See https://systemd.io/TESTING_WITH_SANITIZERS for details. export LD_PRELOAD="$(clang-${{matrix.llvm}} -print-file-name=libclang_rt.asan-x86_64.so)" - export LD_LIBRARY_PATH="$(dirname $LD_PRELOAD)" else export LD_PRELOAD="$(gcc -print-file-name=libasan.so)" fi From 94fdaa252ead719329760aacd3d45e4a336bf1d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= Date: Fri, 16 Dec 2022 23:42:15 +0100 Subject: [PATCH 4/8] build: respect CC and CXX variables set by the user --- build.sh | 2 +- system-build.sh | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 4590b612..f088ab9b 100755 --- a/build.sh +++ b/build.sh @@ -831,7 +831,7 @@ if [ $FROM -le 6 -a "$BUILD_PREDATOR" = "yes" ]; then pushd predator-${LLVM_VERSION} if [ ! -f cl_build/CMakeCache.txt ]; then - CXX=clang++ ./switch-host-llvm.sh ${ABS_SRCDIR}/llvm-${LLVM_VERSION}/build/${LLVM_CMAKE_CONFIG_DIR} + ./switch-host-llvm.sh ${ABS_SRCDIR}/llvm-${LLVM_VERSION}/build/${LLVM_CMAKE_CONFIG_DIR} fi build || exitmsg "Building Predator" diff --git a/system-build.sh b/system-build.sh index bce94885..6232600f 100755 --- a/system-build.sh +++ b/system-build.sh @@ -407,9 +407,7 @@ if [ $FROM -le 6 -a "$BUILD_PREDATOR" = "yes" ]; then pushd predator-${LLVM_VERSION} if [ ! -f cl_build/CMakeCache.txt ]; then - which "$LLVM_BIN_DIR/clang++" # plain clang has already been tested above - CC="$LLVM_BIN_DIR/clang" CXX="$LLVM_BIN_DIR/clang++" \ - ./switch-host-llvm.sh "$LLVM_DIR" + ./switch-host-llvm.sh "$LLVM_DIR" fi build || exitmsg "Failed building Predator" From d3c2b978034b64b2745aa2f55f35f0c3c544f0fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= Date: Sun, 18 Dec 2022 09:22:58 +0100 Subject: [PATCH 5/8] CI: set ASAN and UBSAN setting globally --- .github/workflows/linux.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 3198b0d2..79c0992f 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -117,6 +117,14 @@ jobs: CXXFLAGS="-fdiagnostics-color $CXXFLAGS" fi + # Due to LD_PRELOAD above, leak sanitizer was reporting leaks + # literally in everything that was executed, e.g. make, shell, + # python and other tools that are not under our control. + ASAN_OPTIONS=detect_leaks=0 + + # Make UBSAN print whole stack traces + UBSAN_OPTIONS="print_stacktrace=1" + # Save the environment echo "CC=$CC" >> $GITHUB_ENV echo "CXX=$CXX" >> $GITHUB_ENV @@ -124,6 +132,8 @@ jobs: echo "CXXFLAGS=$CXXFLAGS" >> $GITHUB_ENV echo "LDFLAGS=$LDFLAGS" >> $GITHUB_ENV echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV + echo "ASAN_OPTIONS=$ASAN_OPTIONS" >> "$GITHUB_ENV" + echo "UBSAN_OPTIONS=$UBSAN_OPTIONS" >> "$GITHUB_ENV" # Set up ccache sudo /usr/sbin/update-ccache-symlinks @@ -172,10 +182,7 @@ jobs: # in PATH. export PATH="$(llvm-config-${{matrix.llvm}} --bindir):$PATH" - # Due to LD_PRELOAD above, leak sanitizer was reporting leaks - # literally in everything that was executed, e.g. make, shell, - # python and other tools that are not under our control. - ASAN_OPTIONS=detect_leaks=0 make -C tests + make -C tests - name: ccache statistics run: ccache -s From a0f05da8ec870799336c468a1f6d5945db1e21d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= Date: Sun, 18 Dec 2022 10:25:51 +0100 Subject: [PATCH 6/8] system-build: remove dependency on curl since it is unused It is used only by the build.sh script and, somehow, curl freezes when run under preloaded libasan.so. --- system-build.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/system-build.sh b/system-build.sh index 6232600f..f3fb34d4 100755 --- a/system-build.sh +++ b/system-build.sh @@ -166,11 +166,6 @@ mkdir -p $PREFIX/include check() { MISSING="" - if ! curl --version &>/dev/null; then - echo "Need curl to download files" - MISSING="curl" - fi - if ! which true ; then echo "Need 'which' command." MISSING="which" From 6193eee9d1d31a74a3996530c906c68d3f8e3720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= Date: Sun, 18 Dec 2022 17:50:31 +0100 Subject: [PATCH 7/8] system-build.sh: add a temporary workaround for sanitizers and Predator --- system-build.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/system-build.sh b/system-build.sh index f3fb34d4..2ef7365c 100755 --- a/system-build.sh +++ b/system-build.sh @@ -402,7 +402,19 @@ if [ $FROM -le 6 -a "$BUILD_PREDATOR" = "yes" ]; then pushd predator-${LLVM_VERSION} if [ ! -f cl_build/CMakeCache.txt ]; then - ./switch-host-llvm.sh "$LLVM_DIR" + if [ -n "$CI" ]; then + # FIXME: This is an ugly hack that won't be, hopefully, + # needed when Predator implements a proper support for + # compilation with ASAN because the LD_PRELOAD hack + # does not work on Ubuntu 22.04. For an unknown reason, + # anything curl-related just freezes on this system. + CFLAGS="${CFLAGS//address,/}" \ + CXXFLAGS="${CXXFLAGS//address,/}" \ + LDFLAGS="${LDFLAGS//address,/}" \ + ./switch-host-llvm.sh "$LLVM_DIR" + else + ./switch-host-llvm.sh "$LLVM_DIR" + fi fi build || exitmsg "Failed building Predator" From 1b28d3c4dac8ce2df2985a7eb1f44067504448f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= Date: Sun, 18 Dec 2022 17:50:56 +0100 Subject: [PATCH 8/8] DO NOT MERGE: test compilation with rebased predator --- system-build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system-build.sh b/system-build.sh index 2ef7365c..3b72800b 100755 --- a/system-build.sh +++ b/system-build.sh @@ -61,7 +61,7 @@ OPTS= ARCHIVE="no" FULL_ARCHIVE="no" BUILD_KLEE="yes" -BUILD_PREDATOR="no" +BUILD_PREDATOR="yes" BUILD_LLVM2C='yes' LLVM_CONFIG= @@ -396,7 +396,7 @@ if [ -d predator-${LLVM_VERSION} ]; then fi if [ $FROM -le 6 -a "$BUILD_PREDATOR" = "yes" ]; then if [ ! -d predator-${LLVM_VERSION} ]; then - git_clone_or_pull "https://github.com/staticafi/predator" -b svcomp21-v1 predator-${LLVM_VERSION} + git_clone_or_pull "https://github.com/lzaoral/predator" -b upstream-rebase predator-${LLVM_VERSION} fi pushd predator-${LLVM_VERSION}