linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Eric W. Biederman" <ebiederm@aristanetworks.com>,
	linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [RFC] breakage in sysfs_readdir() and s_instances abuse in sysfs
Date: Sat, 4 Jun 2011 23:23:45 +0100	[thread overview]
Message-ID: <20110604222345.GZ11521@ZenIV.linux.org.uk> (raw)
In-Reply-To: <BANLkTikChZuG4pOZ_ipDYaEv8VQ8omh-YQ@mail.gmail.com>

On Sun, Jun 05, 2011 at 06:55:12AM +0900, Linus Torvalds wrote:
> On Sun, Jun 5, 2011 at 6:22 AM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> >
> > Are you OK with the sketch above? ?I can probably cook a patch along those
> > lines by tomorrow...
> 
> I'm ok with the sketch, but might think otherwise when actually seeing
> the patch. And I wish some namespace person would look at this issue.
> And the networking people would seem to need to be aware of it too,
> but you've only cc'd fsdevel, so they are entirely unaware of the
> whole thread..

Eh...  The question had been to Eric, unless that pile is actually yours...
netdev Cc'd, and I'll forward the previous posting there in a few.

FWIW, reproducing that is trivial: on a box with netns enabled:

dizzy:~# unshare -n -- sh -c "mount -t sysfs none /mnt; ls -l /mnt/class/net; ls
 -l /mnt/class/net/eth0"                                                        
[ 1301.429755] IPv4 FIB: Using LC-trie version 0.409                            
total 0                                                                         
lrwxrwxrwx 1 root root 0 Jun  4 18:16 lo -> ../../devices/virtual/net/lo        
lrwxrwxrwx 1 root root 0 Jun  4 18:16 sit0 -> ../../devices/virtual/net/sit0    
ls: cannot access /mnt/class/net/eth0: No such file or directory                
dizzy:~# ls -l /mnt/class/net/; ls -l /mnt/class/net/eth0                       
total 0                                                                         
lrwxrwxrwx 1 root root 0 Jun  4 18:17 /mnt/class/net/eth0 -> ../../devices/pci00
00:00/0000:00:09.0/net/eth0                                                     

IOW, while netns is alive we get sane behaviour - lookup for class/net/eth0
fails, since there's no such object in that netns.  Once it's gone, we get
class/net in that sysfs instance empty on readdir *and* lookup for
class/net/eth0 succeeds giving us an object from another netns.

Apologies for not adding netdev - it started as sysfs-internal race, so the
beginning of that thread went to fsdevel...

  reply	other threads:[~2011-06-04 22:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-04  0:15 [RFC] breakage in sysfs_readdir() and s_instances abuse in sysfs Al Viro
2011-06-04 21:22 ` Al Viro
2011-06-04 21:55   ` Linus Torvalds
2011-06-04 22:23     ` Al Viro [this message]
2011-06-06 19:03 ` Eric W. Biederman
2011-06-07 21:58   ` Al Viro
2011-06-07 22:59     ` Al Viro
2011-06-09  1:26       ` Al Viro
2011-06-12  7:15         ` Eric W. Biederman
2011-06-12 17:59           ` Linus Torvalds
2011-06-12 18:17             ` Al Viro
2011-06-12 18:35           ` Al Viro
  -- strict thread matches above, loose matches on Subject: below --
2011-06-04 22:25 Al Viro

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=20110604222345.GZ11521@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=ebiederm@aristanetworks.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).