Skip to content

use_tls=0 on MSAN #10851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,88 @@ jobs:
run: .github/scripts/windows/build.bat
- name: Test
run: .github/scripts/windows/test.bat
MSAN:
name: "MSAN"
runs-on: ubuntu-22.04
steps:
- name: git checkout
uses: actions/checkout@v3
- name: apt
uses: ./.github/actions/apt-x64
- name: ./configure
run: |
export CC=clang
export CXX=clang++
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
./configure \
--enable-debug \
--enable-zts \
--enable-option-checking=fatal \
--prefix=/usr \
--without-sqlite3 \
--without-pdo-sqlite \
--without-libxml \
--disable-dom \
--disable-simplexml \
--disable-xml \
--disable-xmlreader \
--disable-xmlwriter \
--without-pcre-jit \
--disable-opcache-jit \
--enable-phpdbg \
--enable-fpm \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--disable-mysqlnd-compression-support \
--without-pear \
--enable-exif \
--enable-sysvsem \
--enable-sysvshm \
--enable-shmop \
--enable-pcntl \
--enable-mbstring \
--disable-mbregex \
--enable-sockets \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-zend-test \
--enable-werror \
--enable-memory-sanitizer \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--enable-dl-test=shared
- name: make
run: make -j$(/usr/bin/nproc) >/dev/null
- name: make install
run: |
sudo make install
sudo mkdir /etc/php.d
sudo chmod 777 /etc/php.d
echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini
echo pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/pdo_mysql.ini
- name: Setup
run: |
set -x
sudo service mysql start
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
# Ensure local_infile tests can run.
mysql -uroot -proot -e "SET GLOBAL local_infile = true"
sudo locale-gen de_DE
- name: Test
uses: ./.github/actions/test-linux
with:
runTestsParameters: >-
--msan
- name: Test Opcache
uses: ./.github/actions/test-linux
with:
runTestsParameters: >-
--msan
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Verify generated files are up to date
uses: ./.github/actions/verify-generated-files
14 changes: 11 additions & 3 deletions run-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,14 +580,22 @@ function main(): void
$environment['USE_TRACKED_ALLOC'] = 1;
$environment['SKIP_ASAN'] = 1;
$environment['SKIP_PERF_SENSITIVE'] = 1;
$lsan_options = [];
if ($switch === '--msan') {
$environment['SKIP_MSAN'] = 1;
// use_tls=0 is a workaround for MSAN crashing with "Tracer caught signal 11" (SIGSEGV),
// which seems to be an issue with TLS support in newer glibc versions under virtualized
// environments. Follow https://github.com/google/sanitizers/issues/1342 and
// https://github.com/google/sanitizers/issues/1409 to track this issue.
$lsan_options[] = 'use_tls=0';
}

$lsanSuppressions = __DIR__ . '/.github/lsan-suppressions.txt';
if (file_exists($lsanSuppressions)) {
$environment['LSAN_OPTIONS'] = 'suppressions=' . $lsanSuppressions
. ':print_suppressions=0';
$lsan_options[] = 'suppressions=' . $lsanSuppressions;
$lsan_options[] = 'print_suppressions=0';
}
if (!empty($lsan_options)) {
$environment['LSAN_OPTIONS'] = join(':', $lsan_options);
}
break;
case '--repeat':
Expand Down