[php-src] Issue #11291: Seg fault observed while loading dl with RTLD_DEEPBIND

From: Date: Mon, 22 May 2023 11:06:16 +0000
Subject: [php-src] Issue #11291: Seg fault observed while loading dl with RTLD_DEEPBIND
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244502@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/11291 Author: aswingit ### Description **Issue**: I encountered a segmentation fault when attempting to load a hello_world module using the dl() function. The seg fault does not occur when I remove the RTLD_DEEPBIND mode in the dlopen() function from zend_portability.h. **Version**: I'm using PHP version 8.1.3. **Setup**: Here's the setup I have: a) I have a hello world module that is built as a dynamic library. b) I'm loading the dynamic library using the dl() function in PHP and invoking the hello_world function. However, I'm experiencing a segmentation fault with the following stack trace: ``` #0 0x00000000 in ?? () #1 0xf3d7b672 in zend_vspprintf (pbuf=0xffff9c4c, max_len=0, ``` ``` #include <php.h> ZEND_BEGIN_ARG_INFO(arginfo_hello_world, 0) ZEND_END_ARG_INFO() static PHP_FUNCTION(hello_world) { TSRMLS_FETCH(); php_printf("Hello, World!\n"); } static zend_function_entry hello_functions[] = { PHP_FE(hello_world, arginfo_hello_world) PHP_FE_END }; zend_module_entry hello_module_entry = { STANDARD_MODULE_HEADER, "hello", hello_functions, NULL, NULL, NULL, NULL, NULL, NO_VERSION_YET, STANDARD_MODULE_PROPERTIES }; #ifdef COMPILE_DL_HELLO ZEND_TSRMLS_CACHE_EXTERN() #endif ZEND_GET_MODULE(hello) PHP_MINIT_FUNCTION(hello) { return SUCCESS; } PHP_MSHUTDOWN_FUNCTION(hello) { return SUCCESS; } PHP_RINIT_FUNCTION(hello) { #if defined(COMPILE_DL_HELLO) && defined(ZTS) ZEND_TSRMLS_CACHE_UPDATE(); #endif return SUCCESS; } PHP_RSHUTDOWN_FUNCTION(hello) { return SUCCESS; } PHP_MINFO_FUNCTION(hello) { php_info_print_table_start(); php_info_print_table_header(2, "hello support", "enabled"); php_info_print_table_end(); } ``` ### PHP Version PHP 8.1.3 ### Operating System _No response_

« previous php.bugs (#244502) next »