[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1481881178.27953.16.camel@sipsolutions.net>
Date: Fri, 16 Dec 2016 10:39:38 +0100
From: Johannes Berg <johannes@...solutions.net>
To: Fubo Chen <fubo.chen@...il.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>
Cc: Dmitry Torokhov <dmitry.torokhov@...il.com>,
Jakub Kicinski <kubakici@...pl>,
Linux Kernel <linux-kernel@...r.kernel.org>,
Kees Cook <keescook@...omium.org>,
Maciej Żenczykowski <zenczykowski@...il.com>
Subject: Re: [PATCH] userns: suppress kmemleak message
> > I can't see the using kmemleak_not_leak is possibly good form. I
> > would much rather have suggestions about constructs that won't
> > confuse kmemleak and won't need ugly annotations that serve no
> > purpose but to appease a tool. Perhaps the user_header variable
> > needs to be moved out of user_namespace_sysctl_init.
The user_header variable is probably (rightfully so) optimised away by
the compiler since it can't ever be read. Therefore, it simply doesn't
exist in the resulting binary (and it really shouldn't either) and the
kmemleak_not_leak() really is the only way to resolve that, I'd say.
> The only alternative I see is to use WRITE_ONCE() instead of "=" to
> set "user_header" such that the compiler cannot optimize that
> variable away. Which of these two approaches do you prefer?
That seems really wrong - forcing the linker/compiler to retain a
variable in the image that can never possibly be read (by anything
other than kmemleak) is just a complete waste of space.
johannes
Powered by blists - more mailing lists