Date: Tue, 6 Mar 2018 20:07:20 +0100 From: Peter Zijlstra Subject: Re: [PATCH RFC v9 4/7] x86/entry: Erase kernel stack in syscall_trace_enter() Message-ID: <20180306190720.GK25181@hirez.programming.kicks-ass.net> References: <1520107232-14111-1-git-send-email-alex.popov@linux.com> <1520107232-14111-5-git-send-email-alex.popov@linux.com> <20180306080855.phtgl2bzqm5hnthu@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: To: Linus Torvalds Cc: Daniel Micay , Ingo Molnar , Kees Cook , Dave Hansen , Alexander Popov , Kernel Hardening , PaX Team , Brad Spengler , Andy Lutomirski , Tycho Andersen , Laura Abbott , Mark Rutland , Ard Biesheuvel , Borislav Petkov , Richard Sandiford , Thomas Gleixner , "H . Peter Anvin" , "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 , Steven Rostedt , Dominik Brodowski , Juergen Gross , Greg Kroah-Hartman , Dan Williams , Mathias Krause , Vikas Shivappa , Kyle Huey , Dmitry Safonov , Will Deacon , Arnd Bergmann , X86 ML , LKML List-ID: On Tue, Mar 06, 2018 at 10:56:58AM -0800, Linus Torvalds wrote: > On Tue, Mar 6, 2018 at 7:16 AM, Daniel Micay wrote: > > > > Zeroing locals isn't very expensive because the compiler has a chance > > to optimize it out when it can figure out it isn't needed and they're > > almost always used. > > I thought I saw Kees with some stats, and it wasn't even noticeable. > But maybe I mis-remember. > > I definitely like the "zero local variables", and would actually > prefer something even stronger than GCC_PLUGIN_STRUCTLEAK_BYREF_ALL > (although I can't actually read gcc plugins, so I'm just going by > name). > > It's not necessarily just struct, it can very much be arrays and > regular automatic variables too. > > And yes, we might want to have some override switch for individual > variables ("I really know what I'm doing and I promise I fill it > myself, but the compiler doesn't understand me, look here:"). Right, I have one case in perf where we very carefully pass a partially initialized structure around for performance raisins. So I would definitely like to have that attribute that allows us to over-ride that BYREF_ALL thing.