php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5542 Binary Cores with shm_attach
Submitted: 2000-07-12 19:38 UTC Modified: 2000-09-29 09:13 UTC
From: justin at trailbreaker dot com Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 4.0.1pl2 OS: RH Linux 6.1
Private report: No CVE-ID: None
 [2000-07-12 19:38 UTC] justin at trailbreaker dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-31 12:44 UTC] sniper@php.net
Have you tried without zend-optimizer?
And with php4.0.2 ?

I can not reproduce this with php4.0.2 (but I don't have zend-optimizer)


--Jani
 [2000-09-29 09:13 UTC] sniper@php.net
No feedback.

--Jani
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Mon Jul 06 09:00:01 2026 UTC