From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: ARC-Seal: i=1; a=rsa-sha256; t=1520846472; cv=none; d=google.com; s=arc-20160816; b=n+9j8Vaw4+lhE58/ZCd2OhlV0MS0JMmXHWkAZQeB2mq1G4juzzX5xQNOXe9Q7azfz8 EegS4A/tx4kHNrwyikKfU0pv/TnS0J+VT7nM+YYw6SutZejN5d9UjOgBLB8kIy8mYPwz ippKgDgwlPcWXiR4txDeptdcLtvhvu3o4YNUZN9q3NlXRMZr3jwb0vkjohRCq4Mse+M8 u6iviFHRMJ9Tq96c6W0R7K7UpJRju1PEhEC9GK8SBOiqwdWmakfLv1T7J9TZC9WkdZfU eZ1RhgEiwHMpPALwtbW7l9OAP1Go0vYKZyvyDoVZeVjLwkGRZEbqoyU3gUVf9+Jpag6t 4Seg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:sender:dkim-signature :arc-authentication-results; bh=5eDp9N11AbWKW5YLi8Uzq9r3HAE6vvFesVfXfsXMVjM=; b=Q9McxKM0hiSxWkAqN+aMGDBFOIp70gUt9NXOLTsR+Fh3EAbXVzZ1HHtNPw1a8HMcr9 cqdjAftsFpNs4pwW1ObdGPJ5vGvPJr2bCymb8Huu5d2skurwYOh74Uea/FO39RsH5dWZ wExLtpKFMC3k2iqEj5M57juPPJJd5d+ElRm9xHb4Sp6FBa5nplZrsZ4mlyVzYYIln7ln ZdAZh//ITJ0DC+zSbuT63x3gDDZl1Lj5GWc7BHNU/jcl7Mpy4b7jnFzfMh4iY5rCc+kt rA0QR2uEf3Z63lIIutYN24vTBTwhbx/dTIhMwt+WVZE8S/gvfNFm5Gvn6fSLrE9qZpD8 89eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QBe1ADpJ; spf=pass (google.com: domain of mingo.kernel.org@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=mingo.kernel.org@gmail.com Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QBe1ADpJ; spf=pass (google.com: domain of mingo.kernel.org@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=mingo.kernel.org@gmail.com X-Google-Smtp-Source: AG47ELvAWpwYKVGaexj3sIei8eZ8sE7XwRydZprwTBeSRdErmnT0JtzRqcD5rg0WXJpnudgcoPcqfw== Sender: Ingo Molnar Date: Mon, 12 Mar 2018 10:21:08 +0100 From: Ingo Molnar To: Ard Biesheuvel Cc: Linus Torvalds , Steven Rostedt , Arnd Bergmann , Daniel Micay , Kees Cook , Dave Hansen , Alexander Popov , Kernel Hardening , PaX Team , Brad Spengler , Andy Lutomirski , Tycho Andersen , Laura Abbott , Mark Rutland , Borislav Petkov , Richard Sandiford , Thomas Gleixner , "H . Peter Anvin" , Peter Zijlstra , "Dmitry V . Levin" , Emese Revfy , Jonathan Corbet , Andrey Ryabinin , "Kirill A . Shutemov" , Thomas Garnier , Andrew Morton , Alexei Starovoitov , Josef Bacik , Masami Hiramatsu , Nicholas Piggin , Al Viro , "David S . Miller" , Ding Tianhong , David Woodhouse , Josh Poimboeuf , Dominik Brodowski , Juergen Gross , Greg Kroah-Hartman , Dan Williams , Mathias Krause , Vikas Shivappa , Kyle Huey , Dmitry Safonov , Will Deacon , X86 ML , LKML Subject: Re: [PATCH RFC v9 4/7] x86/entry: Erase kernel stack in syscall_trace_enter() Message-ID: <20180312092108.d4ajuj7dk2jxgkon@gmail.com> References: <20180306163616.7e3b6e0e@vmware.local.home> <20180312082226.ciggxv37cgcazs3j@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1593947986518331727?= X-GMAIL-MSGID: =?utf-8?q?1594723111477183367?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: * Ard Biesheuvel wrote: > > Is it possible to implement this "safe automatic variable initialization" language > > feature via a GCC plugin robustly, while still keeping code generation sane? (i.e. > > no forced allocation of stack slots, etc.) It should be a superset of > > CONFIG_GCC_PLUGIN_STRUCTLEAK=y. > > I think that should be feasible, yes. > > It would be worth trying whether the current code can be simplified, though: it > currently takes care not to add such an initialization if it can already spot > one, but I wonder whether just blindly adding one at the start and letting the > compiler optimize it away again is safer. Absolutely - followed by: - a good look at the resulting code generation with a reasonably uptodate GCC - a look at the resulting code with older GCCs, to make sure there's no pathological code generation ... because IMHO in the end it is the practical effects that will make (or break) any such attempt. ( BTW., initializing all automatic variables might even speed up certain optimization passes, FWIIW. ) Thanks, Ingo