-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Labels
Description
Description
Hello PHP team,
I encountered a memory leak issue while running make test after building PHP with AddressSanitizer enabled. The leak was detected in the zend_extension_startup function, with a total of 32,800 bytes leaked in one allocation.
Steps to Reproduce
- Configure PHP with AddressSanitizer and coverage flags:
./configure CXX="clang++" CC="clang" CFLAGS="-g -fPIC -fsanitize=address,fuzzer-no-link -fsanitize-coverage=edge,indirect-calls" CXXFLAGS="-g -fPIC -fsanitize=address,fuzzer-no-link -fsanitize-coverage=edge,indirect-calls"
Build PHP:
make -j5 Run the test suite:
make test Error Output
=================================================================
==275758==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 32800 byte(s) in 1 object(s) allocated from:
#0 0x6b4e17 in malloc /home/xjy/fuzz/else/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
#1 0x2012f94 in __zend_malloc /home/xjy/fuzz/workspace/php-src/Zend/zend_alloc.c:3280:14
#2 0x71b454e0c87f (<unknown module>)
#3 0x71b454e09c97 (<unknown module>)
#4 0x27e2efa in zend_extension_startup /home/xjy/fuzz/workspace/php-src/Zend/zend_extensions.c:196:7
#5 0x29ef0a2 in zend_llist_apply_with_del /home/xjy/fuzz/workspace/php-src/Zend/zend_llist.c:171:7
#6 0x27e2e12 in zend_startup_extensions /home/xjy/fuzz/workspace/php-src/Zend/zend_extensions.c:218:2
#7 0x1be1d17 in php_module_startup /home/xjy/fuzz/workspace/php-src/main/main.c:2299:2
#8 0x2b1b528 in php_cli_startup /home/xjy/fuzz/workspace/php-src/sapi/cli/php_cli.c:399:9
#9 0x2b138f1 in main /home/xjy/fuzz/workspace/php-src/sapi/cli/php_cli.c:1315:6
#10 0x71b45a829d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
SUMMARY: AddressSanitizer: 32800 byte(s) leaked in 1 allocation(s).
which also can be seen in php-src/tests/run-test/test001.log
Thank you for looking into this issue!
Best regards,
Elinor
PHP Version
commit hash: 1ae2c871d0
Operating System
- OS: Ubuntu 22.04.05 (Linux kernel 6.10.11) - Compiler: clang 14.0.0 - Architecture: x86_64