From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Andrew Lutomirski <luto@mit.edu>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] vfs: new O_NODE open flag
Date: Mon, 7 Dec 2009 17:16:38 +0000 [thread overview]
Message-ID: <20091207171638.1cfbbb97@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <cb0375e10912070703j4e5769c7tec6090378248a187@mail.gmail.com>
> > while(1)
> > fchmod(fd, 0666);
> >
> > wait for device to unload, reload and be intended for another user
> > Race udev to a real open. You have a similar problem with vhangup() and
> > ttys.
>
> Huh? I would've thought that udev would (and already does?), on
> device unload, chown to 0:0, then chmod to 0000, then unlink, in which
> case that attack doesn't work.
udev doesn't control the device unload/reload. It responds to messages
from the kernel which are to some extent asynchronous to actual events.
It may be ok if udev is very careful but the fact it requires a close
inspection of the kernel and user space sides doesn't bode well (with or
without O_NODE). The fact we currently have an implied revoke by the
device refcounts is a big helper at the moment.
The tty cases using vhangup() assume that the handle is killed and would
also need addressing.
> Would you be okay with a patch that prevented opening
> /proc/self/fd/xxx on O_NODE handles? I personally don't care about
I'd like to see what Al Viro has to say on the subject first.
The /proc/self stuff bothers me less - I've not seen a convincing
description of it being misuable where ptrace wouldn't allow the same
actions. Even the constructed scenarios share that property.
> O_NODE all that much, but I'd like a decent in-kernel AFS
> implementation (and a decent revoke() implementation, and especially
> the ability to revoke whole filesystems would be really nice too).
The AFS case is probably the easier one - its things like device files
where one handle can change completely what it references (due to device
loads/unloads and dynamic major/minor assignment) that make it evil.
CIFS/SMB is horrible for different reasons (a handle open on some piece
of namespace isn't going to always been the same actual file) but you
could simply decide CIFS/SMB and any other problematic cases don't
support it.
I don't really have a problem with it providing its restricted to
ordinary files on a file system where having a local inode reference
means you have a stable reference to an object on the remote system or
the local media.
The way to start this is firstly to convince Al Viro (always a good
sanity check), and then to start with the obviously safe cases only -
regular files, only file systems with stable inode references.
Devices are hard - why do we need O_NODE on devices anyway ?
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-12-07 17:14 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-02 16:16 [PATCH v3] vfs: new O_NODE open flag Miklos Szeredi
2009-12-02 19:15 ` Alan Cox
2009-12-02 20:13 ` Miklos Szeredi
2009-12-02 20:48 ` Alan Cox
2009-12-03 5:46 ` Miklos Szeredi
2009-12-05 14:42 ` Andy Lutomirski
2009-12-05 19:40 ` Miklos Szeredi
2009-12-05 20:28 ` Alan Cox
2009-12-05 20:35 ` Miklos Szeredi
2009-12-05 23:13 ` Alan Cox
2009-12-07 6:08 ` Miklos Szeredi
2009-12-07 12:23 ` Alan Cox
2009-12-07 12:41 ` Miklos Szeredi
2009-12-07 12:47 ` Miklos Szeredi
2009-12-07 13:03 ` Alan Cox
2009-12-07 13:08 ` Miklos Szeredi
2009-12-07 13:15 ` Alan Cox
2009-12-07 13:16 ` Miklos Szeredi
2009-12-07 14:13 ` Alan Cox
2009-12-07 14:25 ` Miklos Szeredi
2009-12-07 14:46 ` Alan Cox
2009-12-07 15:11 ` Miklos Szeredi
2009-12-07 17:40 ` Alan Cox
2009-12-07 15:03 ` Andrew Lutomirski
2009-12-07 15:50 ` Miklos Szeredi
2009-12-07 17:16 ` Alan Cox [this message]
2009-12-10 7:39 ` Pavel Machek
2009-12-06 8:46 ` Pavel Machek
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=20091207171638.1cfbbb97@lxorguk.ukuu.org.uk \
--to=alan@lxorguk.ukuu.org.uk \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@mit.edu \
--cc=miklos@szeredi.hu \
/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).