php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59720 when setting /tmp/apc.XXXXXX php / apc crashes
Submitted: 2011-04-19 05:17 UTC Modified: 2011-04-20 10:00 UTC
From: stefan at prie dot be Assigned:
Status: Not a bug Package: APC (PECL)
PHP Version: 5.2.17 OS: Debian
Private report: No CVE-ID: None
 [2011-04-19 05:17 UTC] stefan at prie dot be
Description:
------------
Hi,

i wanted to achieve that mmap is using /tmp/apc.XXXXXX by default without setting this mask in the php.ini.

Todo that i changed one line of the code in php_apc.c
Replaced:
STD_PHP_INI_ENTRY("apc.mmap_file_mask",  NULL,  PHP_INI_SYSTEM, OnUpdateString,         mmap_file_mask,   zend_apc_globals, apc_globals)

by

STD_PHP_INI_ENTRY("apc.mmap_file_mask",  "/tmp/apc.XXXXXX",  PHP_INI_SYSTEM, OnUpdateString,         mmap_file_mask,   zend_apc_globals, apc_globals)

APC sadly crashes on startup then see backtrace below.

When i insert 
apc.mmap_file_mask="/tmp/apc.XXXXXX"
in php.ini it works fine.


Actual result:
--------------
(gdb) run
Starting program: /usr/local/php5/bin/php 
[Thread debugging using libthread_db enabled]
[New Thread 0xb715bb00 (LWP 25650)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb715bb00 (LWP 25650)]
0xb73d9abd in ?? () from /lib/libc.so.6
(gdb) bt
#0  0xb73d9abd in ?? () from /lib/libc.so.6
#1  0xb74458cd in mkstemp () from /lib/libc.so.6
#2  0xb70475a3 in apc_mmap (file_mask=0xb704ed3e "/tmp/apc.XXXXXX", size=16777216) at /usr/local/src/APC-3.1.7/apc_mmap.c:111
#3  0xb704839c in apc_sma_init (numseg=1, segsize=16777216, mmap_file_mask=0xb704ed3e "/tmp/apc.XXXXXX")
    at /usr/local/src/APC-3.1.7/apc_sma.c:371
#4  0xb70460f6 in apc_module_init (module_number=46) at /usr/local/src/APC-3.1.7/apc_main.c:805
#5  0xb703c18b in zm_startup_apc (type=1, module_number=46) at /usr/local/src/APC-3.1.7/php_apc.c:349
#6  0x083d8a8f in zend_startup_module_ex (module=0xa0a51f8) at /usr/local/src/php-5.2.17/Zend/zend_API.c:1472
#7  0x083dd703 in zend_hash_apply (ht=0x86e3cc0, apply_func=0x83d8a20 <zend_startup_module_ex>)
    at /usr/local/src/php-5.2.17/Zend/zend_hash.c:673
#8  0x083d74ce in zend_startup_modules () at /usr/local/src/php-5.2.17/Zend/zend_API.c:1519
#9  0x08392c3a in php_module_startup (sf=0x86d8ba8, additional_modules=0x86d8bc0, num_additional_modules=1)
    at /usr/local/src/php-5.2.17/main/main.c:1855
#10 0x08441091 in php_cgi_startup (sapi_module=0x86d8b20) at /usr/local/src/php-5.2.17/sapi/cgi/cgi_main.c:714
#11 0x08441932 in main (argc=1, argv=0xbf9c2be4) at /usr/local/src/php-5.2.17/sapi/cgi/cgi_main.c:1500
(gdb) 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-19 09:04 UTC] rasmus@php.net
You are filing a bug on your own code?
man mkstemp
 [2011-04-19 09:17 UTC] stefan at prie dot be
Sorry for that. I just wanted to make file mmap default instead of anonymous memory alloc which results in segfaults every now and then for me.

I expected that inserting /tmp/apc.XXXXXX is the same like putting apc.mmap_file_mask="/tmp/apc.XXXXXX" in the php.ini. What is wrong about my thought?
 [2011-04-20 10:00 UTC] stefan at prie dot be
@rasmus
could you please me to my failure? i can't find it.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Apr 17 09:01:24 2021 UTC