Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89892 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42840 invoked from network); 26 Dec 2015 05:30:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Dec 2015 05:30:49 -0000 Authentication-Results: pb1.pair.com header.from=laruence@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=xinchen.h@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.213.50 as permitted sender) X-PHP-List-Original-Sender: xinchen.h@zend.com X-Host-Fingerprint: 209.85.213.50 mail-vk0-f50.google.com Received: from [209.85.213.50] ([209.85.213.50:34892] helo=mail-vk0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 00/75-51216-8062E765 for ; Sat, 26 Dec 2015 00:30:49 -0500 Received: by mail-vk0-f50.google.com with SMTP id k1so34411353vkb.2 for ; Fri, 25 Dec 2015 21:30:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=CByq38n0c9qRjP/MlxPQ2Cmu7Wt17Fo7sE87gSs+ylk=; b=iijoz3L5gAfbDqcsk+kZfMhTT3L25liMvbGkfelv4MTQ9hX6ahmeMXj9lme1vis6Es +7TyGBYyuEqOMHbvWCH9ip0xuTAY3asQCVPlUUSI02hs5mgeqH81zzBaXOr5qGl6UscG 11w9pGLFHMMkKJ/8Q8A8h+kKr9akaZLHlmG+M/kE/WoML+PXGfoORNJfMqQDdfBWosto jV8Pe0qOrx7KD3PaIE7j4IckELIMvSKuNF8K6OasTi+S5iFnJ9pUzxNxsob4MONhsrTt HLpmsNpfkTJ8Q47dSW7xxSI2RVJEAT2nrZEMDhL/qb5QwjebNwztxx/hVUwJB7+Z97qm UHEQ== X-Gm-Message-State: ALoCoQmNy8YU529WK/h24Ym05dYNuNDlFJSALRvURK2T228eIHm4aqDAHDmzGm8o/2hN71E0vLYXT5WN34JMqH2pv81EZopS+SIyNKh4ctlPRYa1J60Y5BZvjRPwaJ2YqoGHD3SisZwaDohhooOq3H4RY1q70vfqy6MqI/R2p100Egj4IwyOdEI/97lTbGOeWA1xTaKAg98/ X-Received: by 10.31.60.82 with SMTP id j79mr28871641vka.43.1451107845866; Fri, 25 Dec 2015 21:30:45 -0800 (PST) Received: from mail-vk0-f50.google.com (mail-vk0-f50.google.com. [209.85.213.50]) by smtp.gmail.com with ESMTPSA id 11sm6251287vkh.17.2015.12.25.21.30.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Dec 2015 21:30:45 -0800 (PST) Received: by mail-vk0-f50.google.com with SMTP id a188so162674669vkc.0 for ; Fri, 25 Dec 2015 21:30:45 -0800 (PST) X-Received: by 10.31.1.215 with SMTP id 206mr22180917vkb.101.1451107844958; Fri, 25 Dec 2015 21:30:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.31.128.143 with HTTP; Fri, 25 Dec 2015 21:30:25 -0800 (PST) In-Reply-To: <291D5EE7BC9867498082E6D9A81BA0D504C124EE@C111NTDEMBX52.ERF.thomson.com> References: <291D5EE7BC9867498082E6D9A81BA0D504C124EE@C111NTDEMBX52.ERF.thomson.com> Date: Sat, 26 Dec 2015 13:30:25 +0800 X-Gmail-Original-Message-ID: Message-ID: To: akin.ocal@thomsonreuters.com Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a113dc588a133230527c65f5f Subject: Re: [PHP-DEV] PHP7 Zend Heap validation From: laruence@php.net (Xinchen Hui) --001a113dc588a133230527c65f5f Content-Type: text/plain; charset=UTF-8 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 > > 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/> > -- Xinchen Hui @Laruence http://www.laruence.com/ --001a113dc588a133230527c65f5f--