PHP7 Zend Heap validation
| From: | akin dot ocal at thomsonreuters dot com | Date: | Sat, 26 Dec 2015 05:01:21 +0000 |
| Subject: | PHP7 Zend Heap validation | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-89891@lists.php.net to get a copy of this message | ||
Hi everyone,
I am working on porting a pre-PHP7 database driver extension to PHP7 for Windows platforms.
( I am using PHP 7.0.1 master branch code and targeting non-ZTS 32 bit PHP7 on Windows Server 2012
R2 )
And currently as I did mechanical bits of porting ( compilation issues, getting functionality
working
mostly followed https://wiki.php.net/phpng-upgrading ) , my
extension is only crash-free if I run it with
USE_ZEND_ALLOC=0.
However with USE_ZEND_ALLOC=1 , I am getting crashes inside zend_mm_alloc_small. As checked with
Windbg :
...
if (EXPECTED(heap->free_slot[bin_num] != NULL) )
{
zend_mm_free_slot *p = heap->free_slot[bin_num];
if ( p->next_free_slot != NULL )
Above , p->next_free_slot is not readable. I believe , currently I am getting the Zend heap
corrupt.
I am running a test script and I tried disabling many things ,and enabling one by one to have an
idea, from the looks of it , I am getting this issue
around a zend_register_resource call but to me that one looks legitimate so I can`t easily pinpoint
where the Zend heap gets corrupt.
Diffrently from pre-PHP7 where we had full_mem_check , now I can see ZEND_MM_CHECK is placed in
memory manager functions.
I wanted to ask if there is any chance if we can have a heap integrity checker function , or what
would you advise
regarding to track down the places in our code corrupting the Zend MM ?
Regards,
Akin Ocal
________________________________
This e-mail is for the sole use of the intended recipient and contains information that may be
privileged and/or confidential. If you are not an intended recipient, please notify the sender by
return e-mail and delete this e-mail and any attachments. Certain required legal entity disclosures
can be accessed on our website.<http://site.thomsonreuters.com/site/disclosures/>