Add --enable-memory-sanitizer flag

This flag enabled msan late in the pipeline, so that it does
not affect configure checks.

Otherwise we get a false positive report for openpty availability
without -lutil, which will then result in infinite recursion if
actually called.

This also sets origin tracking to 2, so bump the timeout to 90
minutes.
This commit is contained in:
Nikita Popov 2020-05-20 15:21:01 +02:00
parent c85ded7632
commit e852944f63
3 changed files with 16 additions and 3 deletions

View File

@ -75,6 +75,7 @@ jobs:
configurationName: DEBUG_ZTS_MSAN
configurationParameters: '--enable-debug --enable-zts'
runTestsParameters: --asan
timeoutInMinutes: 90
- template: azure/community_job.yml
parameters:
configurationName: COMMUNITY

View File

@ -14,8 +14,7 @@ jobs:
- script: |
export CC=clang
export CXX=clang++
export CFLAGS="-fsanitize=memory -DZEND_TRACK_ARENA_ALLOC"
export LDFLAGS="-fsanitize=memory"
export CFLAGS="-DZEND_TRACK_ARENA_ALLOC"
./buildconf --force
# msan requires all used libraries to be instrumented,
# so we should avoiding linking against anything but libc here
@ -50,6 +49,7 @@ jobs:
--enable-ftp \
--enable-zend-test \
--enable-werror \
--enable-memory-sanitizer \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d
displayName: 'Configure Build'

View File

@ -974,6 +974,11 @@ PHP_ARG_ENABLE([werror],,
[Enable -Werror])],
[no],
[no])
PHP_ARG_ENABLE([memory-sanitizer],,
[AS_HELP_STRING([--enable-memory-sanitizer],
[Enable memory sanitizer (clang only)])],
[no],
[no])
dnl Extension configuration.
dnl ----------------------------------------------------------------------------
@ -1369,9 +1374,16 @@ if test "$PHP_THREAD_SAFETY" = "yes" && test -n "$ac_cv_pthreads_cflags"; then
CPPFLAGS="$CPPFLAGS $ac_cv_pthreads_cflags"
fi
dnl Enable -Werror late, because it may break configure checks throwing warnings.
if test "$PHP_WERROR" = "yes"; then
CFLAGS="$CFLAGS -Werror"
CPPFLAGS="$CPPFLAGS -Werror"
CXXFLAGS="$CXXFLAGS -Werror"
fi
dnl Enable -fsanitize=memory late, because interceptors may break linking detection.
if test "$PHP_MEMORY_SANITIZER" = "yes"; then
CFLAGS="$CFLAGS -fsanitize=memory -fsanitize-memory-track-origins"
CXXFLAGS="$CXXFLAGS -fsanitize=memory -fsanitize-memory-track-origins"
fi
dnl