Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59366 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51601 invoked from network); 6 Apr 2012 12:32:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Apr 2012 12:32:34 -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.220.170 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vx0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:35921] helo=mail-vx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CA/11-43775-062EE7F4 for ; Fri, 06 Apr 2012 08:32:32 -0400 Received: by vcbfo14 with SMTP id fo14so854584vcb.29 for ; Fri, 06 Apr 2012 05:32:29 -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=Wz+WyBmm+jw3fo+XTjaeFWDNxnvIdY1Sy/Sd7nwCV7I=; b=vJPoCFW8jpT2rPoJb4ERrnO4NOD3RLSyjQktBWgHph4S07HTzs5sxXBLpvP8fozFKl vw2GLr+8ANrjowhqqc6eNbwfUDyV6zknyX5khtrx6ZtgO3uiSNUJThIb+c8f3s4fMiC7 YVGJ2umTPkMCfcsJqlD9NSi+vDwIKJ3fw2pwlm/iS+5D+j4+RaIShbSSMF53IigUuurV kznZ3EPXwYG0yKZso0/yi1isnKFHRLU9mUnLD4WvHScyzTLnVB3i9+JkFpz1c/Z9i3/x Syjz2jix/2+YdN9e98qnXH1OPEOoqxcvxkWFzipc7t9YW8xy/pCZqUQYjmBN+xykle/W KDVA== Received: by 10.52.95.212 with SMTP id dm20mr2201018vdb.85.1333715549723; Fri, 06 Apr 2012 05:32:29 -0700 (PDT) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.220.18.194 with HTTP; Fri, 6 Apr 2012 05:32:09 -0700 (PDT) In-Reply-To: References: Date: Fri, 6 Apr 2012 20:32:09 +0800 X-Google-Sender-Auth: hojJOb0EiEIOZh5YaGaVjgDBwsc Message-ID: To: Dmitry Stogov , Dmitry Stogov Cc: 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) Hi: and, yes, extension can change their code to alloc a zend_gc_info size(what I do now). however, I think, it's no need for zend_gc care about persistent memorys, right? thanks On Fri, Apr 6, 2012 at 8:21 PM, Laruence wrote: > Hi Dmitry: > > =C2=A0 zend gc was introducted in 5.3 > > thinking of a zval which is a Hashtable allocated by a extension in persi= stent, > 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_hashta= ble), > ***).. > > 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 arra= y 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 pollu= ted. > > then when the extension try to free the block, =C2=A0a warning will be sh= ow 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/