Skip to content

ext/reflection causes stack overflow under valgrind when CC=clang #11713

@ju1ius

Description

@ju1ius

Description

Please refer to this reproducer repository.

Using php compiled with CC=clang and --enable-debug --with-valgrind, instanciating any Reflection object causes valgrind to crash.

Here's an exerpt of the gdb backtrace:

... the rest is just an infinite loop
0x0000000000a00f01 in object_init_ex (arg=0x1ffeffd5b8, class_type=0x4c96f20) at Zend/zend_API.c:1794
0x0000000000b06622 in zend_throw_exception_zstr (exception_ce=0x4c96f20, message=0x4dec7d0, code=0) at Zend/zend_exceptions.c:828
0x0000000000b02b06 in zend_throw_exception (exception_ce=0x4c96f20, message=0x4dec6b0 "Cannot instantiate abstract class Error", code=0) at Zend/zend_exceptions.c:848
0x00000000009f86e6 in zend_throw_error (exception_ce=0x4c96f20, format=0xd569e6 "Cannot instantiate abstract class %s") at Zend/zend.c:1714
0x0000000000a00d6c in _object_and_properties_init (arg=0x1ffeffd888, class_type=0x4c96f20, properties=0x0) at Zend/zend_API.c:1755
0x0000000000a00f01 in object_init_ex (arg=0x1ffeffd5b8, class_type=0x4c96f20) at Zend/zend_API.c:1794
0x0000000000b06622 in zend_throw_exception_zstr (exception_ce=0x4c96f20, message=0x4dec7d0, code=0) at Zend/zend_exceptions.c:828
0x0000000000b02b06 in zend_throw_exception (exception_ce=0x4c96f20, message=0x4dec6b0 "Cannot instantiate abstract class Error", code=0) at Zend/zend_exceptions.c:848
0x00000000009f86e6 in zend_throw_error (exception_ce=0x4c96f20, format=0xd569e6 "Cannot instantiate abstract class %s") at Zend/zend.c:1714
0x0000000000a00d6c in _object_and_properties_init (arg=0x1ffeffd888, class_type=0x4c96f20, properties=0x0) at Zend/zend_API.c:1755
0x0000000000a00f01 in object_init_ex (arg=0x1ffeffd888, class_type=0x4c96f20) at Zend/zend_API.c:1794
0x0000000000b06622 in zend_throw_exception_zstr (exception_ce=0x4c96f20, message=0x4dec630, code=0) at Zend/zend_exceptions.c:828
0x0000000000b02b06 in zend_throw_exception (exception_ce=0x4c96f20, message=0x4dec510 "Cannot instantiate abstract class Error", code=0) at Zend/zend_exceptions.c:848
0x00000000009f86e6 in zend_throw_error (exception_ce=0x4c96f20, format=0xd569e6 "Cannot instantiate abstract class %s") at Zend/zend.c:1714
0x0000000000a00d6c in _object_and_properties_init (arg=0x1ffeffdb58, class_type=0x4c96f20, properties=0x0) at Zend/zend_API.c:1755
0x0000000000a00f01 in object_init_ex (arg=0x1ffeffdb58, class_type=0x4c96f20) at Zend/zend_API.c:1794
0x0000000000b06622 in zend_throw_exception_zstr (exception_ce=0x4c96f20, message=0x4dec490, code=0) at Zend/zend_exceptions.c:828
0x0000000000b02b06 in zend_throw_exception (exception_ce=0x4c96f20, message=0x4dec370 "Class \"ReflectionFunction\" not found", code=0) at Zend/zend_exceptions.c:848
0x00000000009f86e6 in zend_throw_error (exception_ce=0x4c96f20, format=0xd32947 "%s") at Zend/zend.c:1714
0x00000000009dbed6 in zend_throw_or_error (fetch_type=512, exception_ce=0x0, format=0xcb23e2 "Class \"%s\" not found") at Zend/zend_execute_API.c:241
0x00000000009dc00c in report_class_fetch_error (class_name=0x4debdb0, fetch_type=512) at Zend/zend_execute_API.c:1635
0x00000000009dc1fe in zend_fetch_class_by_name (class_name=0x4debdb0, key=0x4debe20, fetch_type=512) at Zend/zend_execute_API.c:1724
0x0000000000a87861 in ZEND_NEW_SPEC_CONST_UNUSED_HANDLER (execute_data=0x4d91300) at Zend/zend_vm_execute.h:10482
0x0000000000a3a049 in execute_ex (ex=0x4d91300) at Zend/zend_vm_execute.h:56856
0x0000000000a3a3da in zend_execute (op_array=0x4deb1f0, return_value=0x0) at Zend/zend_vm_execute.h:61445
0x00000000009f920c in zend_execute_scripts (type=8, retval=0x0, file_count=3) at Zend/zend.c:1864
0x0000000000933561 in php_execute_script (primary_file=0x1fff0008f8) at main/main.c:2482
0x0000000000bc4b33 in do_cli (argc=2, argv=0x4bba7c0) at sapi/cli/php_cli.c:963
0x0000000000bc3cb9 in main (argc=2, argv=0x4bba7c0) at sapi/cli/php_cli.c:1337

PHP Version

PHP 8.3-dev

Operating System

Debian bullseye and sid

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions