LSan improvements and fixes (#2672)
* LSan: remove GLib suppression * LSan: disable the fast unwinder to get full stacktraces * Move ASan/UBSan fuzzer options to CI configuration * LSan: remove EOLed python2.7 suppression * LSan: remove libstdc++ suppression * LSan: add libx265 to suppression file * Try to reproduce small memleak * Try a possible patch * Skip test if `im_benchmark` is not available * CI: upgrade Clang version to 13 * CI: correct job names * Meson: increase the timeout for tests * README.md: correct Meson invocation
This commit is contained in:
parent
094e84d6d1
commit
3da7caee6c
49
.github/workflows/ci.yml
vendored
49
.github/workflows/ci.yml
vendored
@ -10,17 +10,17 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: "Linux x64 (Ubuntu 20.04) - GCC 10"
|
||||
- name: "Linux x64 (Ubuntu 20.04) - GCC 9"
|
||||
os: ubuntu-20.04
|
||||
build: { cc: gcc, cxx: g++, linker: ld }
|
||||
shell: bash
|
||||
|
||||
- name: "Linux x64 (Ubuntu 20.04) - Clang 12 with ASan and UBSan"
|
||||
- name: "Linux x64 (Ubuntu 20.04) - Clang 13 with ASan and UBSan"
|
||||
os: ubuntu-20.04
|
||||
build: { cc: clang-12, cxx: clang++-12, linker: ld.lld-12, sanitize: true }
|
||||
build: { cc: clang-13, cxx: clang++-13, linker: ld.lld-13, sanitize: true }
|
||||
shell: bash
|
||||
|
||||
- name: "macOS (11.5) - Xcode 12.5.1"
|
||||
- name: "macOS (11.6) - Xcode 13.2.1"
|
||||
os: macos-11
|
||||
build: { cc: clang, cxx: clang++, linker: ld.lld }
|
||||
shell: bash
|
||||
@ -86,11 +86,13 @@ jobs:
|
||||
brew tap lovell/cgif-packaging https://github.com/lovell/cgif-packaging.git
|
||||
brew install --build-bottle lovell/cgif-packaging/cgif
|
||||
|
||||
- name: Install Clang 12
|
||||
if: runner.os == 'Linux' && matrix.build.cc == 'clang-12'
|
||||
run:
|
||||
sudo -E apt-get install --fix-missing -qq -o Acquire::Retries=3
|
||||
clang-12 libomp-12-dev lld-12 llvm-12
|
||||
- name: Install Clang 13
|
||||
if: runner.os == 'Linux' && matrix.build.cc == 'clang-13'
|
||||
run: |
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo add-apt-repository -y "deb http://apt.llvm.org/$(lsb_release -sc)/ llvm-toolchain-$(lsb_release -sc)-13 main"
|
||||
sudo -E apt-get install --fix-missing -qq -o Acquire::Retries=3 \
|
||||
clang-13 libomp-13-dev lld-13 llvm-13
|
||||
|
||||
- name: Prepare Ubuntu environment
|
||||
if: runner.os == 'Linux'
|
||||
@ -105,40 +107,43 @@ jobs:
|
||||
- name: Prepare sanitizers
|
||||
if: matrix.build.sanitize
|
||||
env:
|
||||
LLVM_PREFIX: /usr/lib/llvm-12
|
||||
LLVM_PREFIX: /usr/lib/llvm-13
|
||||
run: |
|
||||
ASAN_DSO=`$CC -print-file-name=libclang_rt.asan-x86_64.so`
|
||||
echo "LDSHARED=$CC -shared" >> $GITHUB_ENV
|
||||
echo "CPPFLAGS=-g -fsanitize=address,undefined -fno-omit-frame-pointer -fopenmp -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" >> $GITHUB_ENV
|
||||
echo "LDFLAGS=-g -fsanitize=address,undefined -shared-libasan -fopenmp=libomp" >> $GITHUB_ENV
|
||||
echo "ASAN_DSO=$ASAN_DSO" >> $GITHUB_ENV
|
||||
echo "ASAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/asan.supp" >> $GITHUB_ENV
|
||||
echo "LSAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/lsan.supp" >> $GITHUB_ENV
|
||||
# Glib is built without -fno-omit-frame-pointer. We need
|
||||
# to disable the fast unwinder to get full stacktraces.
|
||||
echo "ASAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/asan.supp:fast_unwind_on_malloc=0:allocator_may_return_null=1" >> $GITHUB_ENV
|
||||
echo "LSAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/lsan.supp:fast_unwind_on_malloc=0" >> $GITHUB_ENV
|
||||
echo "TSAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/tsan.supp" >> $GITHUB_ENV
|
||||
echo "UBSAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/ubsan.supp:halt_on_error=1:abort_on_error=1" >> $GITHUB_ENV
|
||||
# Ensure UBSan issues causes the program to abort.
|
||||
echo "UBSAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/ubsan.supp:halt_on_error=1:abort_on_error=1:print_stacktrace=1" >> $GITHUB_ENV
|
||||
echo "LD_LIBRARY_PATH=$LLVM_PREFIX/lib:`dirname $ASAN_DSO`" >> $GITHUB_ENV
|
||||
echo "$LLVM_PREFIX/bin" >> $GITHUB_PATH
|
||||
# workaround for https://github.com/google/sanitizers/issues/89
|
||||
# otherwise libIlmImf-2_3.so ends up as <unknown module>
|
||||
# Workaround for https://github.com/google/sanitizers/issues/89
|
||||
# otherwise libIlmImf-2_3.so ends up as <unknown module>.
|
||||
echo "DLCLOSE_PRELOAD=${{ github.workspace }}/dlclose.so" >> $GITHUB_ENV
|
||||
echo -e '#include <stdio.h>\nint dlclose(void*handle){return 0;}' | $CC -shared -xc -odlclose.so -
|
||||
|
||||
- name: Configure libvips
|
||||
run:
|
||||
meson setup build
|
||||
-Ddebug=true
|
||||
-Ddeprecated=false
|
||||
-Dintrospection=false
|
||||
meson setup build
|
||||
-Ddebug=true
|
||||
-Ddeprecated=false
|
||||
-Dintrospection=false
|
||||
|| (cat build/meson-logs/meson-log.txt && exit 1)
|
||||
|
||||
- name: Build libvips
|
||||
run: cd build && ninja
|
||||
run: ninja -C build
|
||||
|
||||
- name: Check libvips
|
||||
run: cd build && ninja test
|
||||
run: ninja -C build test
|
||||
|
||||
- name: Install libvips
|
||||
run: cd build && sudo ninja install
|
||||
run: sudo ninja -C build install
|
||||
|
||||
- name: Rebuild the shared library cache
|
||||
if: runner.os == 'Linux'
|
||||
|
@ -77,7 +77,7 @@ of the libvips optional dependencies.
|
||||
cd libvips-x.y.x
|
||||
meson setup build-dir --prefix=/aaa/bbb/ccc
|
||||
cd build-dir
|
||||
meson build
|
||||
meson compile
|
||||
meson test
|
||||
meson install
|
||||
```
|
||||
|
@ -37,4 +37,7 @@ test(
|
||||
depends: [
|
||||
fuzz_execs,
|
||||
],
|
||||
# Increase the timeout as running the tests with sanitizers
|
||||
# enabled could be slower than the default 30 seconds.
|
||||
timeout: 60,
|
||||
)
|
||||
|
@ -5,11 +5,6 @@ set -e
|
||||
|
||||
. ../test/variables.sh
|
||||
|
||||
# Glib is built without -fno-omit-frame-pointer. We need
|
||||
# to disable the fast unwinder to get full stacktraces.
|
||||
export ASAN_OPTIONS="$ASAN_OPTIONS:fast_unwind_on_malloc=0:allocator_may_return_null=1"
|
||||
export UBSAN_OPTIONS="$UBSAN_OPTIONS:print_stacktrace=1"
|
||||
|
||||
# Hide all warning messages from vips.
|
||||
export VIPS_WARNING=0
|
||||
|
||||
|
@ -962,7 +962,7 @@ static char *
|
||||
extract_prefix( const char *dir, const char *name )
|
||||
{
|
||||
char edir[VIPS_PATH_MAX];
|
||||
char vname[VIPS_PATH_MAX];
|
||||
static char vname[VIPS_PATH_MAX];
|
||||
int i;
|
||||
|
||||
g_info( "trying for dir = \"%s\", name = \"%s\"", dir, name );
|
||||
@ -1011,7 +1011,7 @@ extract_prefix( const char *dir, const char *name )
|
||||
|
||||
g_info( "found \"%s\"", vname );
|
||||
|
||||
return( vips_strdup( NULL, vname ) );
|
||||
return( vname );
|
||||
}
|
||||
|
||||
/* Search a path for a file ... we overwrite the PATH string passed in.
|
||||
|
@ -1,8 +1,6 @@
|
||||
leak:python2.7
|
||||
leak:python3
|
||||
leak:bash
|
||||
leak:libfontconfig.so
|
||||
leak:libglib-2.0.so
|
||||
leak:libIlmImf-2_3.so
|
||||
leak:libIlmThread-2_3.so
|
||||
leak:libstdc++.so
|
||||
leak:libx265.so
|
||||
|
@ -20,7 +20,10 @@ script_tests = [
|
||||
foreach script_test : script_tests
|
||||
test(script_test,
|
||||
files('test_' + script_test + '.sh'),
|
||||
workdir: meson.current_build_dir()
|
||||
workdir: meson.current_build_dir(),
|
||||
# Increase the timeout as running the tests with sanitizers
|
||||
# enabled could be slower than the default 30 seconds.
|
||||
timeout: 60,
|
||||
)
|
||||
endforeach
|
||||
|
||||
|
@ -4,6 +4,13 @@
|
||||
|
||||
. ./variables.sh
|
||||
|
||||
exit_code=0
|
||||
$vips im_benchmarkn || exit_code=$?
|
||||
if [ $exit_code -ne 0 ]; then
|
||||
echo "im_benchmark is not available, skipping test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
chain=1
|
||||
|
||||
# im_benchmark needs a labq
|
||||
|
Loading…
x
Reference in New Issue
Block a user