All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Fubo Chen <fubo.chen@gmail.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>
Cc: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Jakub Kicinski" <kubakici@wp.pl>,
	"Linux Kernel" <linux-kernel@vger.kernel.org>,
	"Kees Cook" <keescook@chromium.org>,
	"Maciej Żenczykowski" <zenczykowski@gmail.com>
Subject: Re: [PATCH] userns: suppress kmemleak message
Date: Fri, 16 Dec 2016 10:39:38 +0100	[thread overview]
Message-ID: <1481881178.27953.16.camel@sipsolutions.net> (raw)
In-Reply-To: <CAJAFBLAx1G_AYCWrjnJ_NXLNr0-BTaLtORj9J87Q8YnKVB7bwQ@mail.gmail.com> (sfid-20161215_131610_038741_C2E14B11)


> > 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

  reply	other threads:[~2016-12-16  9:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-03  5:39 [PATCH] userns: suppress kmemleak message Dmitry Torokhov
2016-11-03 14:04 ` Jakub Kicinski
2016-11-03 14:54 ` Eric W. Biederman
2016-11-03 15:06   ` Jakub Kicinski
2016-12-15 12:16   ` Fubo Chen
2016-12-16  9:39     ` Johannes Berg [this message]
2016-12-16 13:52       ` Fubo Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1481881178.27953.16.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=dmitry.torokhov@gmail.com \
    --cc=ebiederm@xmission.com \
    --cc=fubo.chen@gmail.com \
    --cc=keescook@chromium.org \
    --cc=kubakici@wp.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zenczykowski@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.