Skip to content

Null dereference because cache_slot is null #11614

Closed
@danog

Description

@danog

Description

We've recently enabled coredump reporting in production, and we've been getting loads of coredumps, here's one of them.

This seems to be caused by a null pointer dereference in zend_fetch_ce_from_cache_slot (if (EXPECTED(HAVE_CACHE_SLOT && *cache_slot)) {:

Gdb backtrace:

#0  zend_fetch_ce_from_cache_slot (type=0x5643d29e5de8, cache_slot=0x0) at ./Zend/zend_execute.c:1092
#1  zend_check_type_slow (is_internal=false, is_return_type=false, cache_slot=0x0, ref=0x0, arg=0x7f8a68615f00, type=0x5643d29e5de8) at ./Zend/zend_execute.c:1092
#2  zend_check_type (is_internal=false, is_return_type=false, scope=0x5643d29e6d80, cache_slot=0x0, arg=0x7f8a68615f00, type=0x5643d29e5de8) at ./Zend/zend_execute.c:1144
#3  zend_verify_recv_arg_type (cache_slot=0x0, arg=0x7f8a68615f00, arg_num=1, zf=0x5643d29e7058) at ./Zend/zend_execute.c:1162
#4  zend_verify_recv_arg_type_helper_SPEC (op_1=0x7f8a68615f00) at ./Zend/zend_vm_execute.h:2576
#5  0x00005643cc33a7b6 in ZEND_RECV_SPEC_UNUSED_HANDLER () at ./Zend/zend_vm_execute.h:3918
#6  execute_ex (ex=0x7f8a68615f00) at ./Zend/zend_vm_execute.h:56204
#7  0x00005643cc33d701 in zend_execute (op_array=0x7f8a6867e000, return_value=0x0) at ./Zend/zend_vm_execute.h:60396
#8  0x00005643cc2cae55 in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at ./Zend/zend.c:1827
#9  0x00005643cc2663fa in php_execute_script (primary_file=<optimized out>) at ./main/main.c:2542
#10 0x00005643cc3b450a in do_cli (argc=9, argv=0x5643ccd23170) at ./sapi/cli/php_cli.c:964
#11 0x00005643cc0f6c5b in main (argc=9, argv=0x5643ccd23170) at ./sapi/cli/php_cli.c:1333

zbacktrace:

[0x7f8a68615eb0] CuyZ\Valinor\Definition\FunctionsContainer->__construct(object[0x7f8a68615f00], array(0)[0x7f8a68615f10])
/zoon/zoon/vendor/cuyz/valinor/src/Definition/FunctionsContainer.php:23
[0x7f8a68615e00] CuyZ\Valinor\Library\Container->CuyZ\Valinor\Library\{closure}() /zoon/zoon/vendor/cuyz/valinor/src/Library/Container.php:160
[0x7f8a68615d70] CuyZ\Valinor\Library\Container->get("CuyZ\Valinor\Mapper\Object\Factory\ObjectBuilderFactory") /zoon/zoon/vendor/cuyz/valinor/src/Library/Container.php:248
[0x7f8a68615bb0] CuyZ\Valinor\Library\Container->CuyZ\Valinor\Library\{closure}() /zoon/zoon/vendor/cuyz/valinor/src/Library/Container.php:108
[0x7f8a68615b20] CuyZ\Valinor\Library\Container->get("CuyZ\Valinor\Mapper\Tree\Builder\NodeBuilder") /zoon/zoon/vendor/cuyz/valinor/src/Library/Container.php:248
[0x7f8a68615a50] CuyZ\Valinor\Library\Container->CuyZ\Valinor\Library\{closure}() /zoon/zoon/vendor/cuyz/valinor/src/Library/Container.php:91
// lots of other frames

ref: compressed_coredump-php.97977.1688702525

Feel free to tag me if further inspection of the coredump is needed.

PHP Version

PHP 8.2.7

Operating System

Ubuntu 20.04, ondrej repos

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions