Skip to content

Commit 2e629b8

Browse files
committed
(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.
1 parent 6beebbc commit 2e629b8

File tree

4 files changed

+70
-5
lines changed

4 files changed

+70
-5
lines changed

.travis.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,61 @@ matrix:
211211
###
212212
# Start of the allow_failures block
213213

214+
# ASan-instrumented threaded latest 5.24 with blead CPAN, no tests on depchain ( run only DBICs tests )
215+
- perl: "devcpan_5.24.3_thr_asan"
216+
sudo: required
217+
dist: trusty
218+
env:
219+
- CLEANTEST=false
220+
- DEVREL_DEPS=true
221+
- BREWVER=5.24.3
222+
# FIXME - something in perl confuses ASan, do no trace leaks for now
223+
# https://www.nntp.perl.org/group/perl.perl5.porters/2018/03/msg250024.html
224+
# https://www.nntp.perl.org/group/perl.perl5.porters/2018/03/msg250022.html
225+
- ASAN_OPTIONS=detect_leaks=0
226+
- ASAN_FLAGS_COMMON="-fsanitize=address -fuse-ld=gold -fno-omit-frame-pointer -g -O2"
227+
# FIXME - need to switch to gcc-7 for -fsanitize-address-use-after-scope,
228+
# https://github.com/travis-ci/apt-package-whitelist/issues/3933
229+
# https://travis-ci.org/Perl5/DBIx-Class/jobs/356823605#L3479-L3926
230+
- BREWOPTS="-Duseithreads -Dcc=gcc-6 -Accflags='$ASAN_FLAGS_COMMON' -Aldflags='$ASAN_FLAGS_COMMON'"
231+
addons:
232+
apt:
233+
sources:
234+
- ubuntu-toolchain-r-test
235+
packages:
236+
- libc6
237+
- libc6:i386
238+
- binutils
239+
- gcc-6
240+
241+
# ASan-instrumented threaded bleadperl with blead CPAN, full depchain test ( but only DBD::SQLite is used )
242+
- perl: "devcpan_bleadperl_thr_mb_asan"
243+
sudo: required
244+
dist: trusty
245+
env:
246+
- CLEANTEST=true
247+
- DEVREL_DEPS=true
248+
# FIXME - temp workaround for https://github.com/gugod/App-perlbrew/issues/606
249+
- BREWVER=5.27.10
250+
# FIXME - something in perl confuses ASan, do no trace leaks for now
251+
# https://www.nntp.perl.org/group/perl.perl5.porters/2018/03/msg250024.html
252+
# https://www.nntp.perl.org/group/perl.perl5.porters/2018/03/msg250022.html
253+
- ASAN_OPTIONS=detect_leaks=0
254+
- ASAN_FLAGS_COMMON="-fsanitize=address -fuse-ld=gold -fno-omit-frame-pointer -g -O2"
255+
# FIXME - need to switch to gcc-7 for -fsanitize-address-use-after-scope,
256+
# https://github.com/travis-ci/apt-package-whitelist/issues/3933
257+
# https://travis-ci.org/Perl5/DBIx-Class/jobs/356823605#L3479-L3926
258+
- BREWOPTS="-Duseithreads -Dusemorebits -Dcc=gcc-6 -Accflags='$ASAN_FLAGS_COMMON' -Aldflags='$ASAN_FLAGS_COMMON'"
259+
addons:
260+
apt:
261+
sources:
262+
- ubuntu-toolchain-r-test
263+
packages:
264+
- libc6
265+
- libc6:i386
266+
- binutils
267+
- gcc-6
268+
214269
# bleadperl with blead CPAN, single thread
215270
- perl: "devcpan_bleadperl_thr_mb"
216271
sudo: required
@@ -312,6 +367,8 @@ matrix:
312367
allow_failures:
313368

314369
# these run with various dev snapshots - allowed to fail
370+
- perl: devcpan_5.24.3_thr_asan
371+
- perl: devcpan_bleadperl_thr_mb_asan
315372
- perl: devcpan_bleadperl_thr_mb
316373
- perl: bleadperl
317374
- perl: devcpan_5.8.1_thr_mb

maint/travis-ci_scripts/30_before_script.bash

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ else
135135
parallel_installdeps_notest Test::Warn B::Hooks::EndOfScope Test::Differences HTTP::Status
136136
parallel_installdeps_notest Test::Pod::Coverage Test::EOL Devel::GlobalDestruction Sub::Name MRO::Compat Class::XSAccessor URI::Escape HTML::Entities
137137
parallel_installdeps_notest YAML LWP Class::Trigger Class::Accessor::Grouped Package::Variant
138-
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
138+
parallel_installdeps_notest SQL::Abstract Moose Module::[email protected] JSON SQL::Translator File::Which Class::DBI::Plugin
139139

140140
# FIXME - work around DateTime* bumping their minimal version for no reason ( RT#117959 )
141141
# ( multiple instances of this line throughout, re-grep when removing )
@@ -153,12 +153,16 @@ else
153153
parallel_installdeps_notest git://github.com/ribasushi/patchup-Perl5-DBD-InterBase.git
154154
fi
155155

156-
# SCGI does not install under < 5.8.8 perls nor under parallel make
156+
# SCGI does not install under ASan nor < 5.8.8 perls nor under parallel make
157157
# FIXME: The 5.8.8 thing is likely fixable, something to do with
158158
# #define speedy_new(s,n,t) Newx(s,n,t)
159-
if perl -M5.008008 -e 1 &>/dev/null ; then
159+
if perl -M5.008008 -e 1 &>/dev/null && ! ASan_enabled ; then
160160
MAKEFLAGS="" bash -c "parallel_installdeps_notest git://github.com/ribasushi/patchup-Perl5-CGI-SpeedyCGI.git"
161161
fi
162+
163+
# PPerl does not work very will with ASan either
164+
ASan_enabled || parallel_installdeps_notest git://github.com/ribasushi/patchup-Perl5-PPerl.git
165+
162166
fi
163167

164168

maint/travis-ci_scripts/50_after_success.bash

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
# this file is executed in a subshell - set up the common stuff
44
source maint/travis-ci_scripts/common.bash
55

6-
if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] || [[ "$TRAVIS_PULL_REQUEST" != "false" ]] ; then exit 0 ; fi
6+
if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] || [[ "$TRAVIS_PULL_REQUEST" != "false" ]] || ASan_enabled; then
7+
exit 0
8+
fi
79

810
# this part needs to run in parallel unconditionally
911
export VCPU_USE="$VCPU_AVAILABLE"

maint/travis-ci_scripts/common.bash

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ CPAN_supports_BUILDPL() { perl -MCPAN\ 1.9205 -e1 &>/dev/null; }
2626

2727
have_sudo() { sudo /bin/true &>/dev/null ; }
2828

29+
ASan_enabled() { perl -V:config_args | grep -q fsanitize=address ; }
30+
2931
ci_vm_state_text() {
3032
echo "
3133
========================== CI System information ============================
@@ -176,7 +178,7 @@ parallel_installdeps_notest() {
176178
"
177179
}
178180

179-
export -f parallel_installdeps_notest run_or_err echo_err tstamp have_sudo CPAN_is_sane CPAN_supports_BUILDPL
181+
export -f parallel_installdeps_notest run_or_err echo_err tstamp have_sudo ASan_enabled CPAN_is_sane CPAN_supports_BUILDPL
180182

181183
installdeps() {
182184
if [[ -z "$@" ]] ; then return; fi

0 commit comments

Comments
 (0)