Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89894 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48782 invoked from network); 26 Dec 2015 07:07:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Dec 2015 07:07:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.175 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.214.175 mail-ob0-f175.google.com Received: from [209.85.214.175] ([209.85.214.175:35146] helo=mail-ob0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D7/46-51216-59C3E765 for ; Sat, 26 Dec 2015 02:07:02 -0500 Received: by mail-ob0-f175.google.com with SMTP id 18so207216310obc.2 for ; Fri, 25 Dec 2015 23:07:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Xte5FAZT8/Y6mwEU9C9x6c25v9K7jG/1OA1Vhw7O2YE=; b=GMrtAP3PQgZQVhxt0w0u8rqkoujG6Z6S6w17ZW5vo06yj6+k/t334vbx9SfkU6vNfH uTkVWewvS6jwuOO+ux7byQ8vKQfdL/swRVWozk7sE2NaTwYte5iB93VZmXO7RDDcMhJ5 LSV05KxI7W2mJ4cPmtJXPJuamOQvZ24PxGFRKyjmoUf649P8WPdM7CNCTtEJ7l8/KTR8 aEMu5PJdzEM7LvrRULRFvEIoWU7i44kIPy+wWVGDeaa2nWoG6leuTO4IBuQQzi6+05Wz UgZIjYDObv8rSXvukX6E/xGsrJWfo53TyoHTuOkE5OGHqzXwBgc7WXQzoQXVDSGCOVrj wMjA== MIME-Version: 1.0 X-Received: by 10.182.97.161 with SMTP id eb1mr24420626obb.3.1451113618625; Fri, 25 Dec 2015 23:06:58 -0800 (PST) Received: by 10.202.64.136 with HTTP; Fri, 25 Dec 2015 23:06:58 -0800 (PST) Received: by 10.202.64.136 with HTTP; Fri, 25 Dec 2015 23:06:58 -0800 (PST) In-Reply-To: References: <291D5EE7BC9867498082E6D9A81BA0D504C124EE@C111NTDEMBX52.ERF.thomson.com> Date: Sat, 26 Dec 2015 14:06:58 +0700 Message-ID: To: Laruence Cc: akin.ocal@thomsonreuters.com, PHP internals Content-Type: multipart/alternative; boundary=047d7b2e450ec45da80527c7b7e9 Subject: Re: [PHP-DEV] PHP7 Zend Heap validation From: pierre.php@gmail.com (Pierre Joye) --047d7b2e450ec45da80527c7b7e9 Content-Type: text/plain; charset=UTF-8 On Dec 26, 2015 12:30 PM, "Xinchen Hui" wrote: > > Hey: > > On Sat, Dec 26, 2015 at 1:01 PM, wrote: > > > 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 ? > > > I am not familar with windows, but if it can be run in linux > > you could try with "USE_ZEND_ALLOC=0 valgrind --tool=memcheck " > > not sure if there is similar tool on windows > > > thanks > On windows you can use a couple of tools to try to find them: - http://www.softwareverify.com/ (commercial) - the debugger tools (the standalone tools) contain some limited valgrind like features - not directly related but adding --with-static-analyzer=vs is quite useful too. Latest version is Very effective Cheers, --047d7b2e450ec45da80527c7b7e9--