All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org>
To: Rob Landley <rlandley-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
Cc: Kir Kolyshkin <kir-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>,
	Tim Spriggs <tims-DAzCR1AAk2Rg9hUCZPvPmw@public.gmane.org>,
	Pavel Emelyanov <xemul-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	Trond Myklebust
	<Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 3/3] Compare namespaces when comparing addresses in auth_unix cache.
Date: Mon, 11 Apr 2011 08:36:02 -0500	[thread overview]
Message-ID: <20110411133602.GA5321__23499.4588107385$1302529003$gmane$org@hallyn.com> (raw)
In-Reply-To: <4DA30222.5040902-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>

Quoting Rob Landley (rlandley-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org):
> On 04/08/2011 10:08 AM, Rob Landley wrote:
> > On 04/04/2011 10:46 PM, Serge E. Hallyn wrote:
> >> Does this need to take a reference?  Or is there no way for an
> >> entry to outlive its netns?  It sort of looks like
> >> svcauth_unix_info_release will ensure that doesn't happen, but
> >> I'm not convinced because other parts of the kernel can get
> >> to ip_map_init through the struct cache_detail.
> > 
> > When I wrote this I thought the transport's get_net() and put_net()
> > would pin it, but after re-reading, the sunrpc code is disgustingly
> > convoluted enough that I can't easily reconstruct my earlier reasoning.
> >  I'll add a get_net() and put_net() just to not have to worry about it.
> 
> Ah-ha!
> 
> Stanislav Kinsbursky helped me reconstruct some of the reasoning: we
> don't need to take a reference because we never actually dereference the
> struct net *, all we do is feed them to net_eq() which just compares the
> pointers for equality.  (The inline function exists so it can compile to
> a constant "return 1" when configured out.)
> 
> So if the network context did go away (which still shouldn't happen
> between the rpc_xprt and the struct nfs_client having references to it)
> we still wouldn't have a use-after-free problem because we're not
> looking at the memory, just the pointer.

Besides use-after-free, the other concern is an invalid net_eq()
result due to the * being re-used for a new netns.  I assume that's
deemed "super-duper impossible" again bc of the rpc_xprt/nfs_client
references to it?

> So I shouldn't need to add get_net() and put_net() to the cache.  Sound
> about right?

thanks,
-serge

  parent reply	other threads:[~2011-04-11 13:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-31  7:48 [PATCH 3/3] Compare namespaces when comparing addresses in auth_unix cache Rob Landley
     [not found] ` <4D9431B3.2070305-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2011-04-05  3:46   ` Serge E. Hallyn
2011-04-05  3:46 ` Serge E. Hallyn
     [not found]   ` <20110405034641.GC6764-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org>
2011-04-08 15:08     ` Rob Landley
2011-04-08 15:08   ` Rob Landley
     [not found]     ` <4D9F24F2.9020603-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2011-04-11 13:29       ` Rob Landley
2011-04-11 13:29     ` Rob Landley
     [not found]       ` <4DA30222.5040902-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2011-04-11 13:36         ` Serge E. Hallyn [this message]
2011-04-11 13:36       ` Serge E. Hallyn
2011-04-11 13:57         ` Alexey Dobriyan
     [not found]           ` <BANLkTi=sh1CB+e1EhU-c-Bs3BCszWEBTMA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-04-11 17:45             ` Rob Landley
2011-04-11 17:45           ` Rob Landley
     [not found]         ` <20110411133602.GA5321-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org>
2011-04-11 13:57           ` Alexey Dobriyan
2011-03-31  7:48 Rob Landley

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='20110411133602.GA5321__23499.4588107385$1302529003$gmane$org@hallyn.com' \
    --to=serge-a9i7lubdfnhqt0dzr+alfa@public.gmane.org \
    --cc=Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=kir-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rlandley-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org \
    --cc=tims-DAzCR1AAk2Rg9hUCZPvPmw@public.gmane.org \
    --cc=xemul-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org \
    /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.