Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59497 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70592 invoked from network); 9 Apr 2012 10:56:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Apr 2012 10:56:28 -0000 Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.42 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.212.42 mail-vb0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:57303] helo=mail-vb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 47/D2-56433-950C28F4 for ; Mon, 09 Apr 2012 06:56:28 -0400 Received: by vbjk13 with SMTP id k13so2545130vbj.29 for ; Mon, 09 Apr 2012 03:56:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=hgGyix4gMVT/cZXr97TtK/5E2v43ESF/WgMThqWCuAU=; b=Bvw5c57cnJ4dFOI1w7tJnYM4ebCFqONDTCrf8naOH/x02Dh2nSPyPjFN4nXS55WKWY N2e/DWqrB+tr4qvrbLUhieC4+XKWRCF+ACUyeVQNlLm2FDxqBQ4U0lTrVHJYqnAHuada zf4cJ5ygOyftNMIICLcPgd0qTR90/svngtCw4u7Xgqwhbd2XuKLUkJeOwHweXNVDxfSM d0BCryaMwuXjiRpvtbgBLC9iCn/HbH8E50q8Ahd0Acn8/7+qUWkIzj93fAC/RtqSeIOn 1qEDBFu+AB490F6Pc5prqqlmB0RuROmbJ2xUpjDNC4ANolKiL2FjER22AKLw+LSgin/i D0Gg== Received: by 10.220.107.208 with SMTP id c16mr3345573vcp.65.1333968982704; Mon, 09 Apr 2012 03:56:22 -0700 (PDT) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.220.18.194 with HTTP; Mon, 9 Apr 2012 03:56:02 -0700 (PDT) In-Reply-To: <4F828B43.3090308@zend.com> References: <4F828B43.3090308@zend.com> Date: Mon, 9 Apr 2012 18:56:02 +0800 X-Google-Sender-Auth: iDBT4BmkpzkSWCrTUpNavwbDhGo Message-ID: To: Dmitry Stogov Cc: Dmitry Stogov , PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Bug #61649] zend gc should not mark persistent hashtable From: laruence@php.net (Laruence) On Mon, Apr 9, 2012 at 3:09 PM, Dmitry Stogov wrote: > Hi Laruence, > > I think your patch is right, but I've never seen this problem before. > Is it related to your own extension? What does it do? Why we didn't see t= his > problem with other extensions? a persistent configure extension, it loads all ini configure file at MINIT= . > > Finally, I think that such persistent HashTables must be very rare, so > introducing additional check would slowdown the engine. So allocating > zend_gc_info may be a better solution. okey, it's really rare usages :) thanks > > Thanks. Dmitry. > > > On 04/06/2012 04:32 PM, Laruence wrote: >> >> Hi: >> =C2=A0 =C2=A0and, yes, =C2=A0extension can change their code to alloc a = zend_gc_info >> size(what I do now). >> >> =C2=A0 =C2=A0however, I think, it's no need for zend_gc care about persi= stent >> memorys, right? >> >> thanks >> >> >> On Fri, Apr 6, 2012 at 8:21 PM, Laruence =C2=A0wrote: >>> >>> Hi Dmitry: >>> >>> =C2=A0 zend gc was introducted in 5.3 >>> >>> thinking of a zval which is a Hashtable allocated by a extension in >>> persistent, >>> and it also has hashtable children in it, >>> >>> then , if the extension return this to php script: >>> >>> array_init(return_value); >>> zend_hash_copy(Z_ARRVAL_P(return_value), >>> Z_ARRVAL_P(persitent_zval_hashtable), >>> ***).. >>> >>> since zval_copy_ctor does shallow copy, so the persistent array return = to >>> the >>> php >>> script. >>> >>> >>> then if it happen to be parsed by zval_ptr_dtor, then the persistent >>> array will >>> be >>> parsed by gc_zval_possible_root, >>> >>> ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC) >>> { >>> >>> .................. >>> >>> =C2=A0 =C2=A0if (GC_ZVAL_GET_COLOR(zv) !=3D GC_PURPLE) { >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0GC_ZVAL_SET_PURPLE(zv); >>> .................. >>> >>> then the malloc info of the block(not sure before or after) will be >>> polluted. >>> >>> then when the extension try to free the block, =C2=A0a warning will be = show >>> like: >>> >>> munmap_chunk(): invalid pointer 0x******* >>> >>> >>> I have make a patch for this(https://bugs.php.net/bug.php?id=3D61649), >>> if you think it's okey, =C2=A0I will commit it to all branches, >>> >>> thanks >>> >>> -- >>> Laruence =C2=A0Xinchen Hui >>> http://www.laruence.com/ >> >> >> >> > --=20 Laruence =C2=A0Xinchen Hui http://www.laruence.com/