Skip to content

Commit

Permalink
(travis) Add a couple AddressSANitizer-instrumented jobs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ribasushi committed Mar 24, 2018
1 parent 6beebbc commit 2e629b8
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 5 deletions.
57 changes: 57 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions maint/travis-ci_scripts/30_before_script.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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::[email protected] JSON SQL::Translator File::Which Class::DBI::Plugin git://github.com/ribasushi/patchup-Perl5-PPerl.git
parallel_installdeps_notest SQL::Abstract Moose Module::[email protected] 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 )
Expand All @@ -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


Expand Down
4 changes: 3 additions & 1 deletion maint/travis-ci_scripts/50_after_success.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion maint/travis-ci_scripts/common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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 ============================
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2e629b8

Please sign in to comment.