php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57264 APC destroys reserved memory
Submitted: 2006-09-29 09:20 UTC Modified: 2006-10-25 15:28 UTC
From: sesser@php.net Assigned:
Status: Closed Package: APC (PECL)
PHP Version: Irrelevant OS: irrelevant
Private report: No CVE-ID: None
 [2006-09-29 09:20 UTC] sesser@php.net
Description:
------------
In APC 3.0.12 code was introduced that uses the reserved part of an op_array.

http://cvs.php.net/viewvc.cgi/pecl/apc/apc_compile.c?r1=3.51&r2=3.52

You CANNOT use this area unless you register the usage with PHP otherwise you overwrite the data of other PHP extensions.

You need to call ZEND_API int zend_get_resource_handle(zend_extension *extension) in your MINIT and retrieve the index of the reserved field, that you are allowed to use.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-05 17:56 UTC] gopalv82 at yahoo dot com
Do you require op_array->reserved data to be preserved across processes ?

Right now that memory area is only utilized when the op_array is in cache and can be cleared when I copy it out of cache in local process memory. 

Is that is satisfactory or do I need to take a more pedantic approach ?
 [2006-10-05 18:30 UTC] s dot esser at e-matters dot de
Previous versions of APC did copy op_arrays first with memcpy and then later filled fields...

That of course copied all reserved fields.

Of course when you create your own op_array from a cache you have to restore the content of reserved. Otherwise you will create lots of problems I guess ;) I don't know but in future APC is supposed to be shipped with PHP by default, that could cause lots of problems with other Zend Extensions if you destroy the content of reserved.
 [2006-10-11 05:39 UTC] gopalv82 at yahoo dot com
apc is not a zend extension. 

There doesn't seem to be any zend_extension* to reserve a slot with.
 [2006-10-25 15:28 UTC] gopalv82 at yahoo dot com
Hopefully the following "fix" should help :-

http://cvs.php.net/viewvc.cgi/pecl/apc/apc_zend.c?r1=3.10&r2=3.11
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 12:01:29 2024 UTC