This commit is contained in:
Daniil Gentili 2023-10-23 22:10:11 +02:00
parent b0d687f1b2
commit 46d5033166
6 changed files with 20 additions and 6 deletions

View File

@ -4,10 +4,6 @@ ENV DEBIAN_FRONTEND=noninteractive
ENV CC=clang-16 ENV CC=clang-16
ENV CXX=clang++-16 ENV CXX=clang++-16
ENV CFLAGS='-g -fsanitize=address -shared-libasan -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC'
ENV CPPFLAGS='-g -fsanitize=address -shared-libasan -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC'
ENV CXXFLAGS='-g -fsanitize=address -shared-libasan -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC'
ENV LDFLAGS='-g -fsanitize=address -shared-libasan -Wl,-rpath=/usr/lib/llvm-16/lib/clang/16/lib/linux/'
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/lib/llvm-16/lib/clang/16/lib/linux/" ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/lib/llvm-16/lib/clang/16/lib/linux/"
@ -34,7 +30,7 @@ RUN true \
systemtap-sdt-dev libssl-dev \ systemtap-sdt-dev libssl-dev \
libpcre2-dev libargon2-dev libedit-dev libsodium-dev llvm-16 \ libpcre2-dev libargon2-dev libedit-dev libsodium-dev llvm-16 \
\ \
&& git clone --depth 1 https://github.com/php/php-src -b PHP-8.2 && cd php-src \ && git clone --depth 1 https://github.com/php/php-src && cd php-src \
\ \
&& ./buildconf \ && ./buildconf \
&& ./configure --prefix=/usr \ && ./configure --prefix=/usr \
@ -50,6 +46,11 @@ RUN true \
--with-password-argon2=/usr --with-external-pcre --with-mhash=/usr --with-libxml \ --with-password-argon2=/usr --with-external-pcre --with-mhash=/usr --with-libxml \
--enable-session --with-sodium --with-zlib=/usr --with-zlib-dir=/usr \ --enable-session --with-sodium --with-zlib=/usr --with-zlib-dir=/usr \
--enable-pcntl --with-libedit=shared,/usr \ --enable-pcntl --with-libedit=shared,/usr \
\
&& export CFLAGS='-g -fsanitize=address -shared-libasan -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC' \
&& export CPPFLAGS='-g -fsanitize=address -shared-libasan -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC' \
&& export CXXFLAGS='-g -fsanitize=address -shared-libasan -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC' \
&& export LDFLAGS='-g -fsanitize=address -shared-libasan -Wl,-rpath=/usr/lib/llvm-16/lib/clang/16/lib/linux/' \
\ \
&& make -j100 \ && make -j100 \
&& make install \ && make install \

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# A repo full of reproducer for PHP JIT bugs.
Run using `./run.sh`.
Edit the branch in `Dockerfile:33`

View File

@ -10,6 +10,8 @@ export PSALM_ALLOW_XDEBUG=1
composer i --ignore-platform-reqs composer i --ignore-platform-reqs
echo "About to run phpunit"
php vendor/bin/phpunit --debug tests/MagicMethodAnnotationTest.php php vendor/bin/phpunit --debug tests/MagicMethodAnnotationTest.php
echo "OK, no bugs!" echo "OK, no bugs!"

View File

@ -10,8 +10,12 @@ git checkout 2789fdd689689b0c85f2c0ae9db50c8d2b39fb92
composer i --ignore-platform-reqs composer i --ignore-platform-reqs
echo "About to run the standalone test"
php /app/2_infection.php php /app/2_infection.php
echo "About to run the testsuite"
vendor/bin/phpunit vendor/bin/phpunit
echo "OK, no bugs!" echo "OK, no bugs!"

View File

@ -10,6 +10,8 @@ export PSALM_ALLOW_XDEBUG=1
composer i --ignore-platform-reqs composer i --ignore-platform-reqs
echo "About to run psalm"
./psalm --no-cache ./psalm --no-cache
echo "OK, no bugs!" echo "OK, no bugs!"

2
run.sh
View File

@ -2,7 +2,7 @@
docker build . -t asan_tests docker build . -t asan_tests
for f in bugs/*; do for f in bugs/*sh; do
f=$(basename $f) f=$(basename $f)
docker run -v $PWD/bugs:/app --rm --privileged -it asan_tests /app/$f || echo "!!! $f failed !!!" docker run -v $PWD/bugs:/app --rm --privileged -it asan_tests /app/$f || echo "!!! $f failed !!!"
done done