Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix memleak / crashes #327

Merged
merged 1 commit into from
Oct 21, 2024
Merged

fix memleak / crashes #327

merged 1 commit into from
Oct 21, 2024

Conversation

realFlowControl
Copy link
Collaborator

@realFlowControl realFlowControl commented Oct 17, 2024

Should fix #316

I need to understand this a bit more. The hint from @arnaud-lb works from PHP 8.2, 8.3 and 8.4-rc but fails in PHP 8.1.
Switching from ZEND_MAP_PTR_NEW to ZEND_MAP_PTR_INIT(function->op_array.run_time_cache, NULL) makes PHP 8.0 and 8.1 segfault in the tests

@realFlowControl
Copy link
Collaborator Author

PHP 8.1.30 without OPcache

ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0xaaaadc558d88 bp 0xffff7620a5e0 sp 0xffff7620a5e0 T5)
==22746==The signal is caused by a READ memory access.
==22746==Hint: address points to the zero page.
    #0 0xaaaadc558d88 in zend_gc_addref /usr/src/php/Zend/zend_types.h:1191
    #1 0xaaaadc558d88 in _object_properties_init /usr/src/php/Zend/zend_API.c:1522
    #2 0xaaaadc558d88 in _object_and_properties_init /usr/src/php/Zend/zend_API.c:1665
    #3 0xaaaadc558d88 in object_init_ex /usr/src/php/Zend/zend_API.c:1682
    #4 0xaaaadc8306fc in ZEND_NEW_SPEC_VAR_UNUSED_HANDLER /usr/src/php/Zend/zend_vm_execute.h:28924
    #5 0xaaaadc9d845c in execute_ex /usr/src/php/Zend/zend_vm_execute.h:58485
    #6 0xffff893cb7a8 in php_parallel_scheduler_run /parallel/src/scheduler.c:337
    #7 0xffff893cbd14 in php_parallel_thread /parallel/src/scheduler.c:507
    #8 0xffff8cc6ee2c  (/lib/aarch64-linux-gnu/libc.so.6+0x7ee2c)
    #9 0xffff8ccd7ad8  (/lib/aarch64-linux-gnu/libc.so.6+0xe7ad8)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /usr/src/php/Zend/zend_types.h:1191 in zend_gc_addref
Thread T5 created by T1 here:
    #0 0xffff8da4a234 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:207
    #1 0xffff893cc020 in php_parallel_scheduler_start /parallel/src/scheduler.c:525
    #2 0xffff893cb220 in php_parallel_runtime_construct /parallel/src/runtime.c:35
    #3 0xffff893ca7e8 in php_parallel_runtimes_fetch /parallel/src/parallel.c:103
    #4 0xffff893ca7e8 in php_parallel_run /parallel/src/parallel.c:131
    #5 0xaaaadc99765c in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /usr/src/php/Zend/zend_vm_execute.h:1297
    #6 0xaaaadc99765c in execute_ex /usr/src/php/Zend/zend_vm_execute.h:55816
    #7 0xffff893cb7a8 in php_parallel_scheduler_run /parallel/src/scheduler.c:337
    #8 0xffff893cbd14 in php_parallel_thread /parallel/src/scheduler.c:507
    #9 0xffff8cc6ee2c  (/lib/aarch64-linux-gnu/libc.so.6+0x7ee2c)
    #10 0xffff8ccd7ad8  (/lib/aarch64-linux-gnu/libc.so.6+0xe7ad8)

Thread T1 created by T0 here:
    #0 0xffff8da4a234 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:207
    #1 0xffff893cc020 in php_parallel_scheduler_start /parallel/src/scheduler.c:525
    #2 0xffff893cb220 in php_parallel_runtime_construct /parallel/src/runtime.c:35
    #3 0xffff893ca7e8 in php_parallel_runtimes_fetch /parallel/src/parallel.c:103
    #4 0xffff893ca7e8 in php_parallel_run /parallel/src/parallel.c:131
    #5 0xaaaadc99765c in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /usr/src/php/Zend/zend_vm_execute.h:1297
    #6 0xaaaadc99765c in execute_ex /usr/src/php/Zend/zend_vm_execute.h:55816
    #7 0xaaaadc9f6b88 in zend_execute /usr/src/php/Zend/zend_vm_execute.h:60188
    #8 0xaaaadc540888 in zend_execute_scripts /usr/src/php/Zend/zend.c:1857
    #9 0xaaaadc2d5d94 in php_execute_script /usr/src/php/main/main.c:2551
    #10 0xaaaadcd3ae00 in do_cli /usr/src/php/sapi/cli/php_cli.c:965
    #11 0xaaaadcd3dfdc in main /usr/src/php/sapi/cli/php_cli.c:1367
    #12 0xffff8cc1773c  (/lib/aarch64-linux-gnu/libc.so.6+0x2773c)
    #13 0xffff8cc17814 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x27814)
    #14 0xaaaadb5c0aac in _start (/usr/local/bin/php+0x410aac)

==22746==ABORTING

@realFlowControl realFlowControl merged commit 8b61354 into develop Oct 21, 2024
51 of 54 checks passed
@realFlowControl realFlowControl deleted the florian/fix-316 branch November 4, 2024 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segfault on PHP 8.1 and following
1 participant