|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2003-02-13 15:56 UTC] alan at pair dot com
 I've reproduced this bug with PHP versions 4.2.2, and the STABLE PHP dated Feb 13, 2003. FreeBSD 4.6-stable PHP 4.2.2 --with-curl curl --with-ssl, versions 7.9.8 and 7.10.3 Apache 1.3.27 mod_ssl OpenSSL 0.9.7, and a variety of flavors of 0.9.6. To reproduce the bug: * start apache * send a HUP signal to apache's parent process (to restart it) The server needn't serve any pages (php or otherwise) before the HUP is sent. Apache crashes, I believe while trying to reinitialize the mod_ssl module. Running the same version of everything, but curl compiled --without-ssl makes it work correctly: the apache parent kills off its children and spawns new ones without the parent segfaulting. It seems to be dying inside SSL_CTX_ctrl (via SSL_CTX_set_options) when called from apache's ssl_init_ConfigureServer, at this line: SSL_CTX_set_options(ctx, SSL_OP_ALL); Unfortunately, by the time it segfaults, the stack has been corrupted, and it gets really difficult to debug. Alan PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 16:00:01 2025 UTC | 
Here's a stack dump when it segfaults: Program received signal SIGSEGV, Segmentation fault. 0x81df50c in SSL_CTX_ctrl () (gdb) bt #0 0x81df50c in SSL_CTX_ctrl () #1 0x81793f4 in ssl_init_Module (s=0x830b038, p=0x830b010) #2 0x8179741 in ssl_init_Module (s=0x830b038, p=0x830b010) at ssl_engine_init.c:304 #3 0x8195dd0 in ap_init_modules (p=0x830b010, s=0x830b038) at http_config.c:1703 #4 0x81a059e in standalone_main (argc=5, argv=0xbfbffa54) at http_main.c:5172 #5 0x81a0ec0 in main (argc=5, argv=0xbfbffa54) at http_main.c:5566 #6 0x807f72d in _start () (gdb) However, as I mentioned before, that's not completely accurate. Stepping through the code, here's a bit more detail as to where it's crashing: (gdb)n 585 ctx = SSL_CTX_new(SSLv23_server_method()); /* be more flexible */ (gdb) bt #0 ssl_init_ConfigureServer (s=0x830b038, p=0x830b010, sc=0x830b3e0) at ssl_engine_init.c:585 #1 0x8179741 in ssl_init_Module (s=0x830b038, p=0x830b010) at ssl_engine_init.c:304 #2 0x8195dd0 in ap_init_modules (p=0x830b010, s=0x830b038) at http_config.c:1703 #3 0x81a059e in standalone_main (argc=5, argv=0xbfbffa54) at http_main.c:5172 #4 0x81a0ec0 in main (argc=5, argv=0xbfbffa54) at http_main.c:5566 #5 0x807f72d in _start () (gdb) n 586 SSL_CTX_set_options(ctx, SSL_OP_ALL); (gdb) Program received signal SIGSEGV, Segmentation fault. 0x81df50c in SSL_CTX_ctrl () (gdb) bt #0 0x81df50c in SSL_CTX_ctrl () #1 0x81793f4 in ssl_init_Module (s=0x830b038, p=0x830b010) #2 0x8179741 in ssl_init_Module (s=0x830b038, p=0x830b010) at ssl_engine_init.c:304 #3 0x8195dd0 in ap_init_modules (p=0x830b010, s=0x830b038) at http_config.c:1703 #4 0x81a059e in standalone_main (argc=5, argv=0xbfbffa54) at http_main.c:5172 #5 0x81a0ec0 in main (argc=5, argv=0xbfbffa54) at http_main.c:5566 #6 0x807f72d in _start () (gdb) This particular version is compiled with PHP 4.3.0, Apache 1.3.27, mod_ssl 2.8.12, and curl 7.10.3. But I've been able to reproduce it with different versions of curl and PHP. If I run the same compiled executable without SSL turned on, it does not segfault when it receives HUP. If I compile curl --without-ssl, and compile php against this version of curl, apache does not segfault when it receives SIGHUP even when modssl is turned on. If I compile PHP without curl, apache does not segfault when it receives SIGHUP. I don't know that it's curl's fault. I just know that the problem goes away when PHP isn't using curl, or when curl isn't using SSL. Thanks, Alan