Set up asan+ubsan scheduled build on azure

Also adds an --asan flag to run-tests.php to setup all the necessary
environment variables. Some tests are marked as skipped because they
are incompatible with asan or too slow.

I'm basing this on the DEBUG_ZTS build, which seems to give us the
most mileage.
This commit is contained in:
Nikita Popov 2019-06-20 16:51:14 +02:00
parent ca6f41aa5a
commit 54dd762f59
21 changed files with 78 additions and 5 deletions

View file

@ -1,7 +1,10 @@
--TEST-- --TEST--
Concatenating many small strings should not slowdown allocations Concatenating many small strings should not slowdown allocations
--SKIPIF-- --SKIPIF--
<?php if (PHP_DEBUG) { die ("skip debug version is slow"); } ?> <?php
if (PHP_DEBUG) { die ("skip debug version is slow"); }
if (getenv('SKIP_PERF_SENSITIVE')) die("skip performance sensitive test");
?>
--FILE-- --FILE--
<?php <?php

View file

@ -55,3 +55,12 @@ jobs:
parameters: parameters:
configurationName: MACOS_RELEASE_ZTS configurationName: MACOS_RELEASE_ZTS
configurationParameters: '--disable-debug --enable-maintainer-zts' configurationParameters: '--disable-debug --enable-maintainer-zts'
- template: azure/job.yml
parameters:
configurationName: DEBUG_ZTS_ASAN_UBSAN
configurationParameters: >-
--enable-debug --enable-maintainer-zts
CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC'
LDFLAGS='-fsanitize=undefined,address'
runTestsParameters: --asan
timeoutInMinutes: 120

View file

@ -1,9 +1,12 @@
parameters: parameters:
configurationName: '' configurationName: ''
configurationParameters: '' configurationParameters: ''
runTestsParameters: ''
timeoutInMinutes: 60
jobs: jobs:
- job: ${{ parameters.configurationName }} - job: ${{ parameters.configurationName }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
pool: pool:
vmImage: 'ubuntu-latest' vmImage: 'ubuntu-latest'
steps: steps:
@ -80,8 +83,11 @@ jobs:
- template: test.yml - template: test.yml
parameters: parameters:
configurationName: ${{ parameters.configurationName }} configurationName: ${{ parameters.configurationName }}
runTestsParameters: ${{ parameters.runTestsParameters }}
- template: test.yml - template: test.yml
parameters: parameters:
configurationName: ${{ parameters.configurationName }} configurationName: ${{ parameters.configurationName }}
runTestsName: 'OpCache' runTestsName: 'OpCache'
runTestsParameters: -d zend_extension=opcache.so -d opcache.enable_cli=1 runTestsParameters: >-
${{ parameters.runTestsParameters }}
-d zend_extension=opcache.so -d opcache.enable_cli=1

View file

@ -0,0 +1 @@
leak:acommon::DictInfoList::elements

View file

@ -4,6 +4,8 @@ Bug #66731: file: extensive backtraking, with pcre.jit=0
<?php <?php
if (defined("PHP_DEBUG") && PHP_DEBUG) if (defined("PHP_DEBUG") && PHP_DEBUG)
die("skip not suitable for debug build"); die("skip not suitable for debug build");
if (getenv('SKIP_PERF_SENSITIVE'))
die("skip performance sensitive test");
if (!class_exists('finfo')) if (!class_exists('finfo'))
die('skip no fileinfo extension'); die('skip no fileinfo extension');
?> ?>

View file

@ -12,7 +12,10 @@ opcache.file_cache_fallback=0
opcache.memory_consumption=999999999 opcache.memory_consumption=999999999
opcache.log_verbosity_level=-1 opcache.log_verbosity_level=-1
--SKIPIF-- --SKIPIF--
<?php require_once('skipif.inc'); ?> <?php
require_once('skipif.inc');
if (getenv('SKIP_ASAN')) die('xfail Startup failure leak');
?>
--FILE-- --FILE--
<?php <?php
var_dump("Script should fail"); var_dump("Script should fail");

View file

@ -6,7 +6,10 @@ opcache.enable_cli=1
opcache.optimization_level=-1 opcache.optimization_level=-1
opcache.preload={PWD}/preload_inheritance_error_ind.inc opcache.preload={PWD}/preload_inheritance_error_ind.inc
--SKIPIF-- --SKIPIF--
<?php require_once('skipif.inc'); ?> <?php
require_once('skipif.inc');
if (getenv('SKIP_ASAN')) die('xfail Startup failure leak');
?>
--FILE-- --FILE--
<?php <?php
echo "Foobar\n"; echo "Foobar\n";

View file

@ -6,6 +6,7 @@ if (!extension_loaded("pcntl")) die("skip");
if (!extension_loaded("posix")) die("skip posix extension not available"); if (!extension_loaded("posix")) die("skip posix extension not available");
if (!function_exists("pcntl_unshare")) die("skip pcntl_unshare is not available"); if (!function_exists("pcntl_unshare")) die("skip pcntl_unshare is not available");
if (!defined("CLONE_NEWPID")) die("skip flag unavailable"); if (!defined("CLONE_NEWPID")) die("skip flag unavailable");
if (getenv("SKIP_ASAN")) die("skip asan chokes on this");
if (posix_getuid() !== 0 && if (posix_getuid() !== 0 &&
(!defined("CLONE_NEWUSER") || (!defined("CLONE_NEWUSER") ||
(pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM))) { (pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM))) {

View file

@ -1,5 +1,9 @@
--TEST-- --TEST--
Bug #72685: Same string is UTF-8 validated repeatedly Bug #72685: Same string is UTF-8 validated repeatedly
--SKIPIF--
<?php
if (getenv('SKIP_PERF_SENSITIVE')) die("skip performance sensitive test");
?>
--FILE-- --FILE--
<?php <?php

View file

@ -4,6 +4,7 @@ pspell configs
<?php <?php
if (!extension_loaded('pspell')) die('skip'); if (!extension_loaded('pspell')) die('skip');
if (!@pspell_new('en')) die('skip English dictionary is not available'); if (!@pspell_new('en')) die('skip English dictionary is not available');
if (getenv('SKIP_ASAN')) die('skip pspell leaks memory for invalid dicationaries');
?> ?>
--FILE-- --FILE--
<?php <?php

View file

@ -5,6 +5,8 @@ Francesco Fullone ff@ideato.it
#PHPTestFest Cesena Italia on 2009-06-20 #PHPTestFest Cesena Italia on 2009-06-20
--INI-- --INI--
magic_quotes_gpc=1 magic_quotes_gpc=1
--SKIPIF--
<?php if (getenv('SKIP_ASAN')) die('xfail Startup failure leak'); ?>
--FILE-- --FILE--
<?php <?php
echo "*** Test by calling method or function with deprecated option ***\n"; echo "*** Test by calling method or function with deprecated option ***\n";

View file

@ -1,7 +1,10 @@
--TEST-- --TEST--
Bug #33853 (php:function call __autoload with lowercase param) Bug #33853 (php:function call __autoload with lowercase param)
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded('xsl')) die('skip xsl not loaded'); ?> <?php
if (!extension_loaded('xsl')) die('skip xsl not loaded');
if (getenv('SKIP_ASAN')) die('xfail bailing out across foreign C code');
?>
--FILE-- --FILE--
<?php <?php

View file

@ -517,6 +517,18 @@ NO_PROC_OPEN_ERROR;
case '--shuffle': case '--shuffle':
$shuffle = true; $shuffle = true;
break; break;
case '--asan':
$environment['USE_ZEND_ALLOC'] = 0;
$environment['USE_TRACKED_ALLOC'] = 1;
$environment['SKIP_ASAN'] = 1;
$environment['SKIP_PERF_SENSITIVE'] = 1;
$lsanSuppressions = __DIR__ . '/azure/lsan-suppressions.txt';
if (file_exists($lsanSuppressions)) {
$environment['LSAN_OPTIONS'] = 'suppressions=' . $lsanSuppressions
. ':print_suppressions=0';
}
break;
//case 'w' //case 'w'
case '-': case '-':
// repeat check with full switch // repeat check with full switch

View file

@ -25,6 +25,10 @@ if (empty($enough_free_ram)) {
if (getenv('TRAVIS')) { if (getenv('TRAVIS')) {
die("skip Fails intermittently on travis"); die("skip Fails intermittently on travis");
} }
if (getenv('SKIP_PERF_SENSITIVE')) {
die("skip Test may be very slow if PHP is instrumented");
}
?> ?>
--FILE-- --FILE--
<?php <?php

View file

@ -3,6 +3,7 @@ FPM: bug68381 - Log messages with warning level only
--SKIPIF-- --SKIPIF--
<?php <?php
include "skipif.inc"; include "skipif.inc";
if (getenv("SKIP_ASAN")) die("skip Often fails on azure with asan for unknown reason");
?> ?>
--FILE-- --FILE--
<?php <?php

View file

@ -5,6 +5,9 @@ Test simple recursive watchpoint
if (PHP_INT_SIZE == 4) { if (PHP_INT_SIZE == 4) {
die("xfail There may be flaws in the implementation of watchpoints that cause failures"); die("xfail There may be flaws in the implementation of watchpoints that cause failures");
} }
if (getenv('SKIP_ASAN')) {
die("skip intentionally causes segfaults");
}
?> ?>
--INI-- --INI--
opcache.optimization_level=0 opcache.optimization_level=0

View file

@ -5,6 +5,9 @@ Test simple array watchpoint with replace
if (PHP_INT_SIZE == 4) { if (PHP_INT_SIZE == 4) {
die("xfail There may be flaws in the implementation of watchpoints that cause failures"); die("xfail There may be flaws in the implementation of watchpoints that cause failures");
} }
if (getenv('SKIP_ASAN')) {
die("skip intentionally causes segfaults");
}
?> ?>
--PHPDBG-- --PHPDBG--
b 6 b 6

View file

@ -5,6 +5,9 @@ Test simple watchpoint with replace
if (PHP_INT_SIZE == 4) { if (PHP_INT_SIZE == 4) {
die("xfail There may be flaws in the implementation of watchpoints that cause failures"); die("xfail There may be flaws in the implementation of watchpoints that cause failures");
} }
if (getenv('SKIP_ASAN')) {
die("skip intentionally causes segfaults");
}
?> ?>
--PHPDBG-- --PHPDBG--
b 6 b 6

View file

@ -5,6 +5,9 @@ Test detection of inline string manipulations on zval watch
if (PHP_INT_SIZE == 4) { if (PHP_INT_SIZE == 4) {
die("xfail There may be flaws in the implementation of watchpoints that cause failures"); die("xfail There may be flaws in the implementation of watchpoints that cause failures");
} }
if (getenv('SKIP_ASAN')) {
die("skip intentionally causes segfaults");
}
?> ?>
--INI-- --INI--
opcache.optimization_level=0 opcache.optimization_level=0

View file

@ -5,6 +5,9 @@ Test proper watch comparisons when having multiple levels of indirection from a
if (PHP_INT_SIZE == 4) { if (PHP_INT_SIZE == 4) {
die("xfail There may be flaws in the implementation of watchpoints that cause failures"); die("xfail There may be flaws in the implementation of watchpoints that cause failures");
} }
if (getenv('SKIP_ASAN')) {
die("skip intentionally causes segfaults");
}
?> ?>
--PHPDBG-- --PHPDBG--
b 3 b 3

View file

@ -5,6 +5,9 @@ Test multiple watch elements pointing to the same watchpoint
if (PHP_INT_SIZE == 4) { if (PHP_INT_SIZE == 4) {
die("xfail There may be flaws in the implementation of watchpoints that cause failures"); die("xfail There may be flaws in the implementation of watchpoints that cause failures");
} }
if (getenv('SKIP_ASAN')) {
die("skip intentionally causes segfaults");
}
?> ?>
--PHPDBG-- --PHPDBG--
b 4 b 4