From 2e629b86f1e83b25e9ab92747ffaac7b87155693 Mon Sep 17 00:00:00 2001 From: Peter Rabbitson Date: Thu, 22 Mar 2018 08:11:33 +0100 Subject: [PATCH] (travis) Add a couple AddressSANitizer-instrumented jobs While *much* slower (~2.5x) to run, it provides invaluable insights into various instances of memory corruption within te perl VM itself and more importantly various XS libs. With an excellent UX to top it off. This is especially relevant now that *BSD is cranking up its in-kernel enabled-by-default memory checks and things that seem to work fine elsewhere end up throwing SIGBUS/SIGSEGV left and right: http://matrix.cpantesters.org/?dist=DBIx-Class+0.082841;os=openbsd;reports=1#sl=0,0 CHangeset based on work leading to the diagnosis of https://metacpan.org/diff/file?source=ISHIGAKI/DBD-SQLite-1.56&target=ISHIGAKI/DBD-SQLite-1.57_01#dbdimp.c As of this commit we still expect things to fail, as we hard-froze DBD::SQLite at its broken state. Subsequent commits will fix this and other issues. --- .travis.yml | 57 +++++++++++++++++++ maint/travis-ci_scripts/30_before_script.bash | 10 +++- maint/travis-ci_scripts/50_after_success.bash | 4 +- maint/travis-ci_scripts/common.bash | 4 +- 4 files changed, 70 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index c82968eb1..57d6a21e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -211,6 +211,61 @@ matrix: ### # Start of the allow_failures block + # ASan-instrumented threaded latest 5.24 with blead CPAN, no tests on depchain ( run only DBICs tests ) + - perl: "devcpan_5.24.3_thr_asan" + sudo: required + dist: trusty + env: + - CLEANTEST=false + - DEVREL_DEPS=true + - BREWVER=5.24.3 + # FIXME - something in perl confuses ASan, do no trace leaks for now + # https://www.nntp.perl.org/group/perl.perl5.porters/2018/03/msg250024.html + # https://www.nntp.perl.org/group/perl.perl5.porters/2018/03/msg250022.html + - ASAN_OPTIONS=detect_leaks=0 + - ASAN_FLAGS_COMMON="-fsanitize=address -fuse-ld=gold -fno-omit-frame-pointer -g -O2" + # FIXME - need to switch to gcc-7 for -fsanitize-address-use-after-scope, + # https://github.com/travis-ci/apt-package-whitelist/issues/3933 + # https://travis-ci.org/Perl5/DBIx-Class/jobs/356823605#L3479-L3926 + - BREWOPTS="-Duseithreads -Dcc=gcc-6 -Accflags='$ASAN_FLAGS_COMMON' -Aldflags='$ASAN_FLAGS_COMMON'" + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - libc6 + - libc6:i386 + - binutils + - gcc-6 + + # ASan-instrumented threaded bleadperl with blead CPAN, full depchain test ( but only DBD::SQLite is used ) + - perl: "devcpan_bleadperl_thr_mb_asan" + sudo: required + dist: trusty + env: + - CLEANTEST=true + - DEVREL_DEPS=true + # FIXME - temp workaround for https://github.com/gugod/App-perlbrew/issues/606 + - BREWVER=5.27.10 + # FIXME - something in perl confuses ASan, do no trace leaks for now + # https://www.nntp.perl.org/group/perl.perl5.porters/2018/03/msg250024.html + # https://www.nntp.perl.org/group/perl.perl5.porters/2018/03/msg250022.html + - ASAN_OPTIONS=detect_leaks=0 + - ASAN_FLAGS_COMMON="-fsanitize=address -fuse-ld=gold -fno-omit-frame-pointer -g -O2" + # FIXME - need to switch to gcc-7 for -fsanitize-address-use-after-scope, + # https://github.com/travis-ci/apt-package-whitelist/issues/3933 + # https://travis-ci.org/Perl5/DBIx-Class/jobs/356823605#L3479-L3926 + - BREWOPTS="-Duseithreads -Dusemorebits -Dcc=gcc-6 -Accflags='$ASAN_FLAGS_COMMON' -Aldflags='$ASAN_FLAGS_COMMON'" + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - libc6 + - libc6:i386 + - binutils + - gcc-6 + # bleadperl with blead CPAN, single thread - perl: "devcpan_bleadperl_thr_mb" sudo: required @@ -312,6 +367,8 @@ matrix: allow_failures: # these run with various dev snapshots - allowed to fail + - perl: devcpan_5.24.3_thr_asan + - perl: devcpan_bleadperl_thr_mb_asan - perl: devcpan_bleadperl_thr_mb - perl: bleadperl - perl: devcpan_5.8.1_thr_mb diff --git a/maint/travis-ci_scripts/30_before_script.bash b/maint/travis-ci_scripts/30_before_script.bash index 144a34d9e..2b7bb10e3 100755 --- a/maint/travis-ci_scripts/30_before_script.bash +++ b/maint/travis-ci_scripts/30_before_script.bash @@ -135,7 +135,7 @@ else parallel_installdeps_notest Test::Warn B::Hooks::EndOfScope Test::Differences HTTP::Status parallel_installdeps_notest Test::Pod::Coverage Test::EOL Devel::GlobalDestruction Sub::Name MRO::Compat Class::XSAccessor URI::Escape HTML::Entities parallel_installdeps_notest YAML LWP Class::Trigger Class::Accessor::Grouped Package::Variant - parallel_installdeps_notest SQL::Abstract Moose Module::Install@1.15 JSON SQL::Translator File::Which Class::DBI::Plugin git://github.com/ribasushi/patchup-Perl5-PPerl.git + parallel_installdeps_notest SQL::Abstract Moose Module::Install@1.15 JSON SQL::Translator File::Which Class::DBI::Plugin # FIXME - work around DateTime* bumping their minimal version for no reason ( RT#117959 ) # ( multiple instances of this line throughout, re-grep when removing ) @@ -153,12 +153,16 @@ else parallel_installdeps_notest git://github.com/ribasushi/patchup-Perl5-DBD-InterBase.git fi - # SCGI does not install under < 5.8.8 perls nor under parallel make + # SCGI does not install under ASan nor < 5.8.8 perls nor under parallel make # FIXME: The 5.8.8 thing is likely fixable, something to do with # #define speedy_new(s,n,t) Newx(s,n,t) - if perl -M5.008008 -e 1 &>/dev/null ; then + if perl -M5.008008 -e 1 &>/dev/null && ! ASan_enabled ; then MAKEFLAGS="" bash -c "parallel_installdeps_notest git://github.com/ribasushi/patchup-Perl5-CGI-SpeedyCGI.git" fi + + # PPerl does not work very will with ASan either + ASan_enabled || parallel_installdeps_notest git://github.com/ribasushi/patchup-Perl5-PPerl.git + fi diff --git a/maint/travis-ci_scripts/50_after_success.bash b/maint/travis-ci_scripts/50_after_success.bash index 39ac98896..868bfd5d9 100755 --- a/maint/travis-ci_scripts/50_after_success.bash +++ b/maint/travis-ci_scripts/50_after_success.bash @@ -3,7 +3,9 @@ # this file is executed in a subshell - set up the common stuff source maint/travis-ci_scripts/common.bash -if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] || [[ "$TRAVIS_PULL_REQUEST" != "false" ]] ; then exit 0 ; fi +if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] || [[ "$TRAVIS_PULL_REQUEST" != "false" ]] || ASan_enabled; then + exit 0 +fi # this part needs to run in parallel unconditionally export VCPU_USE="$VCPU_AVAILABLE" diff --git a/maint/travis-ci_scripts/common.bash b/maint/travis-ci_scripts/common.bash index bbe8e59d8..eabfcee2f 100755 --- a/maint/travis-ci_scripts/common.bash +++ b/maint/travis-ci_scripts/common.bash @@ -26,6 +26,8 @@ CPAN_supports_BUILDPL() { perl -MCPAN\ 1.9205 -e1 &>/dev/null; } have_sudo() { sudo /bin/true &>/dev/null ; } +ASan_enabled() { perl -V:config_args | grep -q fsanitize=address ; } + ci_vm_state_text() { echo " ========================== CI System information ============================ @@ -176,7 +178,7 @@ parallel_installdeps_notest() { " } -export -f parallel_installdeps_notest run_or_err echo_err tstamp have_sudo CPAN_is_sane CPAN_supports_BUILDPL +export -f parallel_installdeps_notest run_or_err echo_err tstamp have_sudo ASan_enabled CPAN_is_sane CPAN_supports_BUILDPL installdeps() { if [[ -z "$@" ]] ; then return; fi