Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89286 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61529 invoked from network); 21 Nov 2015 01:11:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Nov 2015 01:11:08 -0000 Authentication-Results: pb1.pair.com smtp.mail=francois@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=francois@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 212.27.42.2 as permitted sender) X-PHP-List-Original-Sender: francois@php.net X-Host-Fingerprint: 212.27.42.2 smtp2-g21.free.fr Received: from [212.27.42.2] ([212.27.42.2:29556] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 55/E0-50392-CA4CF465 for ; Fri, 20 Nov 2015 20:11:08 -0500 Received: from [127.0.0.1] (unknown [82.240.16.115]) by smtp2-g21.free.fr (Postfix) with ESMTPS id 04F934B0047; Sat, 21 Nov 2015 02:10:45 +0100 (CET) To: Dan Ackroyd References: <563BEF66.4050202@php.net> Cc: PHP internals , Dmitry Stogov Message-ID: <564FC498.2040300@php.net> Date: Sat, 21 Nov 2015 02:10:48 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Antivirus: avast! (VPS 151120-1, 20/11/2015), Outbound message X-Antivirus-Status: Clean Subject: Re: [PHP-DEV] PHP 7 : Cannot use stream wrappers during MINIT From: francois@php.net (=?UTF-8?Q?Fran=c3=a7ois_Laupretre?=) Le 09/11/2015 16:41, Dan Ackroyd a écrit : > On 6 November 2015 at 00:08, François Laupretre wrote: >> Hi, >> >> An uninitialized HashTable generally is >> filled with 0s. Today, using an uninitialized HashTable goes undetected, >> even in debug mode (because HT_OK == 0), and is very hard to track. > Uninitialized variables should be pretty easy to check by setting > `export USE_ZEND_ALLOC=0` to make allocs go straight through to malloc > and then running the program through valgrind. That should report all > uninitialized data. Additionally using the --malloc-fill=255 (or > appropriate value) should make the code blow up pretty quickly. > > I'd be interested to know if that's doesn't report the issues for you > - as that's the backup to check that I haven't forgotten to initialize > anything, and if that's not reliable....I might need to check some > stuff. > > cheers > Dan Your method works for dynamically allocated data but, in my case, the uninitialized HashTable is EG(regular_list), which is not dynamically allocated in non-ZTS mode. For data coming from the data or bss sections of the executable, I think that valgrind cannot detect anything (not sure for bss, not tested). The problem with uninitialized hash struct is that, for various reasons, the issue may remain unnoticed during a long time before the final crash and, because of this delay, it is quite hard to go back to the primary cause. That's why I propose to add an assert. This is not perfect but, in many cases, this will avoid the program to return happily from a failed operation on an uninitialized hash. Regards François