PHP 4.0 Bug #5542: Binary Cores with shm_attach
| From: | justin at trailbreaker dot com | Date: | Wed, 12 Jul 2000 23:38:39 +0000 |
| Subject: | PHP 4.0 Bug #5542: Binary Cores with shm_attach | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-24245@lists.php.net to get a copy of this message | ||
From: justin@trailbreaker.com
Operating system: RH Linux 6.1
PHP version: 4.0.1pl2
PHP Bug Type: Reproduceable crash
Bug description: Binary Cores with shm_attach
the code below works find when run via the apache module but when I run it via the php binary I get
a Sementation fault (core dumped).
I am running PHP/4.0.1pl2 on RH Linux 6.1 with the Zend Engine v1.0.1 and Apache/1.3.9.
The binary was configured/compiled like this: ./configure --with-mysql --enable-sysvshm
and the apache module like this:
./configure --with-mysql --with-apxs --enable-sysvshm
File: test.php
----------------------
<?php
$key=9876;
$data="hello123hello123";
$mem_id=shm_attach($key, 1000000 ,0600);
print "the id is ".$mem_id." <BR>";
shm_put_var($mem_id, 200, $data);
$whatswhat=shm_get_var($mem_id, 200);
print "Now in shared memory is $whatswhat ";
shm_detach($mem_id);
?>
-----------GDB Output-----------
Core was generated by `php test.php'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libgdbm.so.2...done.
Reading symbols from /lib/libpam.so.0...done.
Reading symbols from /lib/libdl.so.2...done.
Reading symbols from /usr/lib/libttf.so.2...done.
Reading symbols from /usr/lib/libgd.so.1...done.
Reading symbols from /lib/libresolv.so.2...done.
Reading symbols from /lib/libm.so.6...done.
Reading symbols from /lib/libcrypt.so.1...done.
Reading symbols from /lib/libnsl.so.1...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
Reading symbols from /usr/local/Zend/lib/ZendOptimizer.so...done.
Reading symbols from /lib/libnss_files.so.2...done.
#0 0x80bf2eb in php_if_shm_attach (ht=3, return_value=0x8173db4, this_ptr=0x0, return_value_used=1)
at sysvshm.c:134
134 if(strcmp((char*)&(chunk_ptr->magic),"PHP_SM")!=0) {
(gdb) bt
#0 0x80bf2eb in php_if_shm_attach (ht=3, return_value=0x8173db4, this_ptr=0x0, return_value_used=1)
at sysvshm.c:134
#1 0x401ea023 in zend_oe_ex () from /usr/local/Zend/lib/ZendOptimizer.so
#2 0x401e0ef3 in zend_oe () from /usr/local/Zend/lib/ZendOptimizer.so
#3 0x805fe07 in php_execute_script (primary_file=0xbffffc74) at main.c:1157
#4 0x805e3c9 in main (argc=2, argv=0xbffffcd4) at cgi_main.c:661
(gdb) quit