Skip to content

Commit 0dfca74

Browse files
committed
Setup msan on azure
This uses a separate job template, because msan requires all used libraries (apart from glibc) to be instrumented, so we can't link any external libraries unless we recompile them. As such, we need a much more minimal configure.
1 parent 59522c5 commit 0dfca74

File tree

4 files changed

+83
-0
lines changed

4 files changed

+83
-0
lines changed

azure-pipelines.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,8 @@ jobs:
6464
LDFLAGS='-fsanitize=undefined,address'
6565
runTestsParameters: --asan
6666
timeoutInMinutes: 120
67+
- template: azure/msan_job.yml
68+
parameters:
69+
configurationName: DEBUG_ZTS_MSAN
70+
configurationParameters: '--enable-debug --enable-maintainer-zts'
71+
runTestsParameters: --asan

azure/apt.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ steps:
3434
libargon2-0-dev \
3535
postgresql \
3636
postgresql-contrib \
37+
llvm \
3738
${{ parameters.packages }}
3839
displayName: 'APT'

azure/msan_job.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
parameters:
2+
configurationName: ''
3+
configurationParameters: ''
4+
runTestsParameters: ''
5+
timeoutInMinutes: 60
6+
7+
jobs:
8+
- job: ${{ parameters.configurationName }}
9+
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
10+
pool:
11+
vmImage: 'ubuntu-latest'
12+
steps:
13+
- template: apt.yml
14+
- script: |
15+
export CC=clang
16+
export CXX=clang++
17+
export CFLAGS="-fsanitize=memory -DZEND_TRACK_ARENA_ALLOC"
18+
export LDFLAGS="-fsanitize=memory"
19+
./buildconf --force
20+
# msan requires all used libraries to be instrumented,
21+
# so we should avoiding linking against anything but libc here
22+
./configure ${{ parameters.configurationParameters }} \
23+
--prefix=/usr \
24+
--without-sqlite3 \
25+
--without-pdo-sqlite \
26+
--without-libxml \
27+
--disable-dom \
28+
--disable-simplexml \
29+
--disable-xml \
30+
--disable-xmlreader \
31+
--disable-xmlwriter \
32+
--without-pcre-jit \
33+
--enable-phpdbg \
34+
--enable-fpm \
35+
--with-pdo-mysql=mysqlnd \
36+
--with-mysqli=mysqlnd \
37+
--without-pear \
38+
--enable-exif \
39+
--enable-sysvsem \
40+
--enable-sysvshm \
41+
--enable-shmop \
42+
--enable-pcntl \
43+
--enable-mbstring \
44+
--disable-mbregex \
45+
--enable-sockets \
46+
--enable-bcmath \
47+
--enable-calendar \
48+
--enable-ftp \
49+
--enable-zend-test \
50+
--enable-werror \
51+
--with-config-file-path=/etc \
52+
--with-config-file-scan-dir=/etc/php.d
53+
displayName: 'Configure Build'
54+
- script: make -j$(/usr/bin/nproc) >/dev/null
55+
displayName: 'Make Build'
56+
- script: |
57+
sudo make install
58+
sudo mkdir /etc/php.d
59+
sudo chmod 777 /etc/php.d
60+
echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini
61+
echo pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/pdo_mysql.ini
62+
displayName: 'Install Build'
63+
- script: |
64+
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
65+
displayName: 'Setup'
66+
- template: test.yml
67+
parameters:
68+
configurationName: ${{ parameters.configurationName }}
69+
runTestsParameters: ${{ parameters.runTestsParameters }}
70+
- template: test.yml
71+
parameters:
72+
configurationName: ${{ parameters.configurationName }}
73+
runTestsName: 'OpCache'
74+
runTestsParameters: >-
75+
${{ parameters.runTestsParameters }}
76+
-d zend_extension=opcache.so -d opcache.enable_cli=1

azure/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ steps:
1212
export TEST_PHP_JUNIT=junit.xml
1313
export REPORT_EXIT_STATUS=no
1414
export SKIP_IO_CAPTURE_TESTS=1
15+
export MSAN_SYMBOLIZER_PATH=/usr/lib/llvm-3.8/bin/llvm-symbolizer
1516
rm -rf junit.xml | true
1617
php run-tests.php -P -q \
1718
-j$(/usr/bin/nproc) \

0 commit comments

Comments
 (0)