php / php/php-src

stack overflow in JIT

Open
#23,114 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Category: JIT Status: Verified
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

The following code:

<?php
class N { public $n; }
$o=null;
for($i=0;$i<1000000;$i++){ $x=new N; $x->n=$o; $o=$x; }
$o=null;

Resulted in this output:

_store_del /home/php-src/Zend/zend_objects_API.c:193
    #344 0x55ed1181d414 in zend_object_dtor_property /home/php-src/Zend/zend_objects.c:64
    #345 0x55ed1181d414 in zend_object_std_dtor /home/php-src/Zend/zend_objects.c:94
    #346 0x55ed1181c2b8 in zend_objects_store_del /home/php-src/Zend/zend_objects_API.c:193
    #347 0x55ed1181d414 in zend_object_dtor_property /home/php-src/Zend/zend_objects.c:64
    #348 0x55ed1181d414 in zend_object_std_dtor /home/php-src/Zend/zend_objects.c:94
    #349 0x55ed1181c2b8 in zend_objects_store_del /home/php-src/Zend/zend_objects_API.c:193
    #350 0x55ed1181d414 in zend_object_dtor_property /home/php-src/Zend/zend_objects.c:64
    #351 0x55ed1181d414 in zend_object_std_dtor /home/php-src/Zend/zend_objects.c:94
    #352 0x55ed1181c2b8 in zend_objects_store_del /home/php-src/Zend/zend_objects_API.c:193
    #353 0x55ed1181d414 in zend_object_dtor_property /home/php-src/Zend/zend_objects.c:64
    #354 0x55ed1181d414 in zend_object_std_dtor /home/php-src/Zend/zend_objects.c:94
    #355 0x55ed1181c2b8 in zend_objects_store_del /home/php-src/Zend/zend_objects_API.c:193
    #356 0x55ed1181d414 in zend_object_dtor_property /home/php-src/Zend/zend_objects.c:64
    #357 0x55ed1181d414 in zend_object_std_dtor /home/php-src/Zend/zend_objects.c:94
    #358 0x55ed1181c2b8 in zend_objects_store_del /home/php-src/Zend/zend_objects_API.c:193
    #359 0x55ed1181d414 in zend_object_dtor_property /home/php-src/Zend/zend_objects.c:64
    #360 0x55ed1181d414 in zend_object_std_dtor /home/php-src/Zend/zend_objects.c:94
    #361 0x55ed1181c2b8 in zend_objects_store_del /home/php-src/Zend/zend_objects_API.c:193
    #362 0x55ed1181d414 in zend_object_dtor_property /home/php-src/Zend/zend_objects.c:64
    #363 0x55ed1181d414 in zend_object_std_dtor /home/php-src/Zend/zend_objects.c:94
    #364 0x55ed1181c2b8 in zend_objects_store_del /home/php-src/Zend/zend_objects_API.c:193
    #365 0x55ed1181d414 in zend_object_dtor_property /home/php-src/Zend/zend_objects.c:64
    #366 0x55ed1181d414 in zend_object_std_dtor /home/php-src/Zend/zend_objects.c:94
    #367 0x55ed1181c2b8 in zend_objects_store_del /home/php-src/Zend/zend_objects_API.c:193
    #368 0x55ed1181d414 in zend_object_dtor_property /home/php-src/Zend/zend_objects.c:64
    #369 0x55ed1181d414 in zend_object_std_dtor /home/php-src/Zend/zend_objects.c:94
    #370 0x55ed1181c2b8 in zend_objects_store_del /home/php-src/Zend/zend_objects_API.c:193
    #371 0x55ed1181d414 in zend_object_dtor_property /home/php-src/Zend/zend_objects.c:64
    #372 0x55ed1181d414 in zend_object_std_dtor /home/php-src/Zend/zend_objects.c:94

SUMMARY: AddressSanitizer: stack-overflow /home/php-src/Zend/zend_objects.c:77 in zend_object_std_dtor
==34==ABORTING
USE_ZEND_ALLOC=0 .php -d "opcache.enable=1" -d "opcache.enable_cli=1" -d "opcache.jit=tracing" -d "opcache.jit_hot_loop=1" -d "opcache.jit_hot_func=1" poc.php
PHP Version
8.6.0
Operating System

ubuntu 22.04

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the stack overflow with the supplied PHP program and JIT command. Read Zend/zend_objects.c around line 77 and Zend/zend_objects_API.c around line 193, where the sanitizer trace repeats. Done means the reproducer no longer aborts with a stack overflow and the object-destruction behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, php
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.