Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59365 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49055 invoked from network); 6 Apr 2012 12:21:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Apr 2012 12:21:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; 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:33188] helo=mail-vb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/90-43775-3DFDE7F4 for ; Fri, 06 Apr 2012 08:21:39 -0400 Received: by vbjk13 with SMTP id k13so1393136vbj.29 for ; Fri, 06 Apr 2012 05:21:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:x-google-sender-auth:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=tEjWoO6SwEXi3mya2Vyh5JohGjH8sj+eo/NMumAQqfw=; b=obhCsBsaGk3dVkJe7tDFgjR5OXQc8rJfm8TicwAOF2F642WsPtZMeuZrj+w/ADfQ7U cU84T+lwpLX7EnDYxK3CVnQWKsHohPFR9DY8qXjRQsOygBhqkvGvFb7GBGKDGv8TfKNM kb5/jewdwFS0fWDv+bKq1TwuYrweDXuEuU1sgq8QwBD/EkHvZ4jWiZVFA/3WU+pmvZoD uyPm0gqJ29Dq/QJcBLXUPOZnLjuDr0POo+pOGDhOG25W5NjhLBNTvPlfMpXhrNInS9gV jcSF0crxg0ztzbwLUchT/lw292qDOuiPtznjBShGrLl+e3Y0I0pdOuI7TwRkwA+6Xloj haTA== Received: by 10.52.175.231 with SMTP id cd7mr2216636vdc.68.1333714896473; Fri, 06 Apr 2012 05:21:36 -0700 (PDT) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.220.18.194 with HTTP; Fri, 6 Apr 2012 05:21:15 -0700 (PDT) Date: Fri, 6 Apr 2012 20:21:15 +0800 X-Google-Sender-Auth: txSxkbtgkVPHA6mX1iX6O1wl0_M Message-ID: To: Dmitry Stogov , Dmitry Stogov Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Bug #61649] zend gc should not mark persistent hashtable From: laruence@php.net (Laruence) Hi Dmitry: zend gc was introducted in 5.3 thinking of a zval which is a Hashtable allocated by a extension in persist= ent, 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_hashtabl= e), ***).. since zval_copy_ctor does shallow copy, so the persistent array return to t= he 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) { .................. if (GC_ZVAL_GET_COLOR(zv) !=3D GC_PURPLE) { GC_ZVAL_SET_PURPLE(zv); .................. then the malloc info of the block(not sure before or after) will be pollute= d. then when the extension try to free the block, a 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, I will commit it to all branches, thanks --=20 Laruence =C2=A0Xinchen Hui http://www.laruence.com/