From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id B6CE0385783D for ; Wed, 23 Jun 2021 06:05:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B6CE0385783D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 6C67721968; Wed, 23 Jun 2021 06:05:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1624428311; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=L21cNI+rsIa6TBJLRXmEkSsgCVleODQRYz7Ucsyg9fQ=; b=NaiSsHV83H53srMrGiLLFZTvBFWwi5WFUB8Vj7EA9rYp9dDKmRZAylE9hlmy/gvwuyRkcT eWqI56AGk5dpDWr+7XUEiKjcWxCIb0/Orymf/pCI2CpevdjOcfydkfmALmabswAyaC4KVv pa54yukIflolUA+jkAHK87FCX58bYZQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1624428311; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=L21cNI+rsIa6TBJLRXmEkSsgCVleODQRYz7Ucsyg9fQ=; b=STfCXM1phpFZYWCl5JWcCvfbbgHL0gD5F+YMrI9O7X2GKo0eU6vElYOjGLdkxEYzNN4KkV Gn5ZWftUTYMfxHAw== Received: from murzim.suse.de (murzim.suse.de [10.160.4.192]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 60DDAA3B91; Wed, 23 Jun 2021 06:05:11 +0000 (UTC) Date: Wed, 23 Jun 2021 08:05:11 +0200 (CEST) From: Richard Biener To: Qing Zhao cc: Richard Sandiford , Kees cook , gcc-patches Qing Zhao via Subject: Re: [PATCH][version 3]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc In-Reply-To: <863F3F50-F44A-466D-8CE8-8CB8B3FBF33E@oracle.com> Message-ID: References: <25A77D77-5251-46EC-8E46-2F19B8BC510A@oracle.com> <42063D5B-FD16-47A0-833C-7730B0E0B700@oracle.com> <24CC2004-E379-4988-AC38-0EAAD9892862@oracle.com> <202106181644.1AF193B2@keescook> <202106210916.DCC72C72@keescook> <202106221049.F541638@keescook> <863F3F50-F44A-466D-8CE8-8CB8B3FBF33E@oracle.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jun 2021 06:05:14 -0000 On Tue, 22 Jun 2021, Qing Zhao wrote: > Okay. > > Now, I believe that we agreed on the following: > > For this current patch: > > 1. Use byte-repeatable pattern for pattern-initialization; > 2. Use one pattern for all types; > 3. Use “0xFE” for the byte pattern value. Ack. Richard. > Possible future improvement: > > 1. Type specific patterns if needed; > 2. User-specified pattern if needed; (add a new option for user to change the patterns). > 3. Make the code generation part a target hook if needed. > > Let me know if I miss anything. > > Thanks. > > Qing > > > On Jun 22, 2021, at 1:18 PM, Richard Sandiford wrote: > > > > Kees Cook writes: > >> On Tue, Jun 22, 2021 at 09:25:57AM +0100, Richard Sandiford wrote: > >>> Kees Cook writes: > >>>> On Mon, Jun 21, 2021 at 03:39:45PM +0000, Qing Zhao wrote: > >>>>> So, if “pattern value” is “0xFFFFFFFFFFFFFFFF”, then it’s a valid canonical virtual memory address. However, for most OS, “0xFFFFFFFFFFFFFFFF” should be not in user space. > >>>>> > >>>>> My question is, is “0xFFFFFFFFFFFFFFFFF” good for pointer? Or “0xAAAAAAAAAAAAAAAA” better? > >>>> > >>>> I think 0xFF repeating is fine for this version. Everything else is a > >>>> "nice to have" for the pattern-init, IMO. :) > >>> > >>> Sorry to be awkward, but 0xFF seems worse than 0xAA to me. > >>> > >>> For integer types, all values are valid representations, and we're > >>> relying on the pattern being “obviously” wrong in context. 0xAAAA… > >>> is unlikely to be a correct integer but 0xFFFF… would instead be a > >>> “nice” -1. It would be difficult to tell in a debugger that a -1 > >>> came from pattern init rather than a deliberate choice. > >> > >> I can live with 0xAA. On x86_64, this puts it nicely in the middle of > >> the middle of the non-canonical space: > >> > >> 0x800000000000 - 0xffff7fffffffffff > >> > >> The only trouble is with 32-bit, where the value 0xAAAAAAAA is a > >> legitimate allocatable userspace address. If we want some kind-of middle > >> ground, how about 0xFE? That'll be non-canonical on x86_64, and at the > >> high end of the i386 kernel address space. > > > > Sounds good to me FWIW. That'd give float -1.694739530317379e+38 > > (suspiciously big even for astrophysics, I hope!) and would still > > look unusual in an integer context. > > > >>> I agree that, all other things being equal, it would be nice to use NaNs > >>> for floats. But relying on wrong numerical values for floats doesn't > >>> seem worse than doing that for integers. > >>> > >>> 0xAA… for float is (if I've got this right) -3.0316488252093987e-13, > >>> which admittedly doesn't stand out as wrong. But I'm not sure we > >>> should sacrifice integer debugging for float debugging here. > >> > >> In some future version type-specific patterns would be a nice improvement, > >> but I don't want that to block getting the zero-init portion landed. :) > > > > Yeah. > > > > Thanks, > > Richard > > -- Richard Biener SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)