From 6129d0592234cefd12624e55f6cf03ed5901fb4d Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Thu, 1 Aug 2019 00:09:34 +0200 Subject: [PATCH] Make failmalloc disable itself on program exit. Something in the Travis build environment has changed recently to cause failmalloc runs to crash while exiting due to a NULL pointer dereference in the coverage writing code. This fix causes failmalloc to automatically disable itself once main() exits so subsequent memory requests always succeed. Since the application (and library) have no control over what happens during exit cleanup anyway, this does not affect its functionality. --- .travis.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index be28883..3ed8491 100644 --- a/.travis.yml +++ b/.travis.yml @@ -150,7 +150,11 @@ install: curl -fsSORL --retry 8 https://download.savannah.nongnu.org/releases/failmalloc/failmalloc-1.0.tar.gz tar xaf failmalloc-1.0.tar.gz cd failmalloc-1.0 + # Fix compiling with modern glibc sed -i -e 's/\(__malloc_initialize_hook\)/volatile \1/' failmalloc.c + # Disable failmalloc on program exit so system code can run unimpeded + sed -i -e '/failmalloc_init/,${/failmalloc_install/aatexit(failmalloc_uninstall); + }' failmalloc.c ./configure --prefix="$HOME/failmalloc" --disable-dependency-tracking make make install @@ -172,11 +176,11 @@ script: - if [ "$CONFIG" = "musl" ] ; then CFLAGS='-Wall -Wextra -O3'; export CC=musl-gcc; CONFIGURE_OPTS='--disable-shared'; fi - if [ "$CONFIG" = "sanitize" ] ; then CFLAGS='-g -Wall -Wextra -fsanitize=address -fsanitize=undefined -fsanitize-address-use-after-scope'; export CC=clang-8; export ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:detect_leaks=1; fi - if [ "$CONFIG" = "coverage" ] ; then cd "$HOME"/libexif-testsuite; CFLAGS=--coverage; CONFIGURE_OPTS="LDFLAGS=--coverage --with-failmalloc=$HOME/failmalloc/lib" ; fi - - ./configure --prefix="$HOME"/install --disable-dependency-tracking CFLAGS="$CFLAGS" $CONFIGURE_OPTS || { tail -300 config.log; false; } + - ./configure --prefix="$HOME"/install --disable-dependency-tracking CFLAGS="$CFLAGS" $CONFIGURE_OPTS || { tail -n 300 config.log; false; } - make V=1 # Skip tests when cross compiling. - - if [ "$CONFIG" != "arm-cross" ] ; then make V=1 check || { tail -300 test*/test-suite.log; false; }; fi + - if [ "$CONFIG" != "arm-cross" ] ; then make V=1 check || { tail -n 300 test*/test-suite.log src/libexif/test*/test-suite.log; false; }; fi - make V=1 install - if [ "$CONFIG" = "coverage" ] ; then cd "$TRAVIS_BUILD_DIR"; fi -- 2.7.4