On Thu, 2016-03-03 at 13:43 +0100, Ingo Molnar wrote: > it would be absolutely fantastic if one of these solutions existed on GCC:> > > - emit a warning if a structure is passed around uninitialized. A new GCC > __attribute__((struct_fully_initialized)) could be used to annotate extern > function arguments which fully initialize input arguments. > > (I'd personally migrate both tools/perf and kernel side code to use it, > module > by module.) > > - or memset() to zero all on-stack structures that GCC cannot prove are > initialized fully. > > The first solution takes extra work on the source level, the latter takes > extra > runtime profiling to find where the extra memset()s matter to performance. > Any of > these would be fantastic tools for C robustness and security.
Maybe memset any alignment padding between automatic variables too.