[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 03 Mar 2016 04:49:25 -0800
From: Joe Perches <joe@...ches.com>
To: Ingo Molnar <mingo@...nel.org>,
Måns Rullgård <mans@...sr.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Colin King <colin.king@...onical.com>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
Richard Henderson <rth@...ddle.net>,
Jakub Jelinek <jakub@...hat.com>,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: Q: why didn't GCC warn about this uninitialized variable?
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.
Powered by blists - more mailing lists