Date: Tue, 6 Mar 2018 16:36:16 -0500 From: Steven Rostedt Subject: Re: [PATCH RFC v9 4/7] x86/entry: Erase kernel stack in syscall_trace_enter() Message-ID: <20180306163616.7e3b6e0e@vmware.local.home> In-Reply-To: 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-Transfer-Encoding: 7bit To: Linus Torvalds Cc: Arnd Bergmann , Ard Biesheuvel , Daniel Micay , Ingo Molnar , 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 List-ID: On Tue, 6 Mar 2018 13:01:20 -0800 Linus Torvalds wrote: > Then the optimization passes will just remove the initialization in > 99.9% of all cases. Only very occasionally - when gcc cannot see it > being overwritten - would it remain. And those are exactly the cases > where you *want* it to remain. You mean have gcc fill in the variables that it thinks is used uninitialized with zeros? As long as it still warns about it, because that usually catches some real bugs where zeroing the variable doesn't actually fix the bug. I also tried the example Arnd posted with: int g(int c) { int i; if (c) /* gcc optimizes out the condition as nothing else sets i */ i = 1; return i; } And he's right. -O2 doesn't warn :-( I think that it should. -- Steve