diff --git a/Dockerfile b/Dockerfile index 3a4a42e..55ebc58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,10 +4,6 @@ ENV DEBIAN_FRONTEND=noninteractive ENV CC=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/" @@ -34,7 +30,7 @@ RUN true \ systemtap-sdt-dev libssl-dev \ 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 \ && ./configure --prefix=/usr \ @@ -50,6 +46,11 @@ RUN true \ --with-password-argon2=/usr --with-external-pcre --with-mhash=/usr --with-libxml \ --enable-session --with-sodium --with-zlib=/usr --with-zlib-dir=/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 install \ diff --git a/README.md b/README.md new file mode 100644 index 0000000..81d861f --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# A repo full of reproducer for PHP JIT bugs. + +Run using `./run.sh`. + +Edit the branch in `Dockerfile:33` \ No newline at end of file diff --git a/bugs/1_psalm.sh b/bugs/1_psalm.sh index dbe9f25..e92b42f 100755 --- a/bugs/1_psalm.sh +++ b/bugs/1_psalm.sh @@ -10,6 +10,8 @@ export PSALM_ALLOW_XDEBUG=1 composer i --ignore-platform-reqs +echo "About to run phpunit" + php vendor/bin/phpunit --debug tests/MagicMethodAnnotationTest.php echo "OK, no bugs!" \ No newline at end of file diff --git a/bugs/2_infection.sh b/bugs/2_infection.sh index 4ec966d..e116204 100755 --- a/bugs/2_infection.sh +++ b/bugs/2_infection.sh @@ -10,8 +10,12 @@ git checkout 2789fdd689689b0c85f2c0ae9db50c8d2b39fb92 composer i --ignore-platform-reqs +echo "About to run the standalone test" + php /app/2_infection.php +echo "About to run the testsuite" + vendor/bin/phpunit echo "OK, no bugs!" \ No newline at end of file diff --git a/bugs/3_psalm_new.sh b/bugs/3_psalm_new.sh index 9edbb78..36fcd84 100755 --- a/bugs/3_psalm_new.sh +++ b/bugs/3_psalm_new.sh @@ -10,6 +10,8 @@ export PSALM_ALLOW_XDEBUG=1 composer i --ignore-platform-reqs +echo "About to run psalm" + ./psalm --no-cache echo "OK, no bugs!" \ No newline at end of file diff --git a/run.sh b/run.sh index 8c1bafd..8887179 100755 --- a/run.sh +++ b/run.sh @@ -2,7 +2,7 @@ docker build . -t asan_tests -for f in bugs/*; do +for f in bugs/*sh; do f=$(basename $f) docker run -v $PWD/bugs:/app --rm --privileged -it asan_tests /app/$f || echo "!!! $f failed !!!" done \ No newline at end of file