diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-05-20 15:21:01 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-05-20 16:46:28 +0200 |
commit | e852944f630a1e3df16148b308c116590057663d (patch) | |
tree | 0a44429740c66d4175ead76ca1c9e6a28aef4dd1 | |
parent | c85ded763222295f9d24f8550b9428259bc36e86 (diff) | |
download | php-git-e852944f630a1e3df16148b308c116590057663d.tar.gz |
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.
-rw-r--r-- | azure-pipelines.yml | 1 | ||||
-rw-r--r-- | azure/msan_job.yml | 4 | ||||
-rw-r--r-- | configure.ac | 14 |
3 files changed, 16 insertions, 3 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 40cfbb8232..178558ab11 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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 diff --git a/azure/msan_job.yml b/azure/msan_job.yml index 3c58fa7c7a..399a664f5e 100644 --- a/azure/msan_job.yml +++ b/azure/msan_job.yml @@ -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' diff --git a/configure.ac b/configure.ac index 5278718f1a..2c3928b6a9 100644 --- a/configure.ac +++ b/configure.ac @@ -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 |