From: Miklos Szeredi <miklos@szeredi.hu>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: miklos@szeredi.hu, miklos@szeredi.hu, akpm@linux-foundation.org,
viro@ZenIV.linux.org.uk, dhowells@redhat.com, hch@infradead.org,
adilger@sun.com, mtk.manpages@gmail.com,
torvalds@linux-foundation.org, drepper@gmail.com,
jamie@shareable.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 resend] vfs: new O_NODE open flag
Date: Thu, 05 Nov 2009 16:24:51 +0100 [thread overview]
Message-ID: <E1N64Ch-0003C6-Rn@pomaz-ex.szeredi.hu> (raw)
In-Reply-To: <20091105145054.11f36b35@lxorguk.ukuu.org.uk> (message from Alan Cox on Thu, 5 Nov 2009 14:50:54 +0000)
On Thu, 5 Nov 2009, Alan Cox wrote:
> The examples on the list are not entirely theoretical but based on
> accepted and normal behaviour for application programming and Unix
> security models -so they are a security bug, minor or otherwise.
>
> Fortunately you can patch it by hand.
How do you patch it by hand?
> > And as for reopening O_NODE files with increased permission: that's
> > feature people actually expressed interest in, so it's hardly a
> > security hole, is it?
>
> Its a very unexpected semantic particularly for a passed file handle.
All of this is about new and unexpected semantics. I don't think
anything more needs to be done than document it in the manpage:
"A file descriptor opened with O_NODE | O_NOACCESS may be used to
re-open the same file later with increased permissions
(e.g. O_RDWR) if the access mode allows. This is true even if the
permissions on the path leading up to the file would prevent it"
> > > Wrong way around. The defailt should be that O_NODE fails for any handle
> > > which has not specifically added support.
> >
> > Why? O_NODE can be nicely implemented without any filesystem support.
>
> So that you audit the behaviour for unexpected surprises as you go. And
> in most filesystem cases that consists of "dum de dum, nothing to see,
> add default handler, tick".
>
> But that isn't the case for some things - consider CIFS and other network
> file systems.
Why?
Why would the server need to know anything about that? O_NODE is
similar to a chdir() in this respect, and chdir doesn't have a handler
either.
> > > You also need to address the open with no permissions pinning a removable
> > > device question.
> >
> > The whole point of O_NODE is that it doesn't do that, it only goes as
> > far as the mnt/dentry for the filesystem node and not further. It
> > does not get to touch the device at all, so it can't pin it or have
> > any other side effect.
>
> You have a reference to the mnt/dentry pinned so how will you unmount the
> volume ?
Oh, I see what you are getting at. So the situation is this: the root
of the volume does not allow any access to the user, so normal
open/chdir won't work. Yet open(O_NODE) will and so user can pin the
volume.
However, there's not all that much difference between the above and
doing "stat()" on the mountpoint in a tight loop, except the former is
a more reliable way to prevent unmounting.
I don't see this as a huge issue, but ideas about handling it better
are welcome.
Thanks,
Miklos
next prev parent reply other threads:[~2009-11-05 15:25 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-05 11:23 Miklos Szeredi
2009-11-05 13:15 ` Alan Cox
2009-11-05 14:27 ` Miklos Szeredi
2009-11-05 14:50 ` Alan Cox
2009-11-05 15:24 ` Miklos Szeredi [this message]
2009-11-05 15:56 ` Alan Cox
2009-11-05 16:52 ` Miklos Szeredi
2009-11-05 18:25 ` Alan Cox
2009-11-06 11:10 ` Miklos Szeredi
2009-11-06 1:40 ` Jamie Lokier
2009-11-06 11:31 ` Miklos Szeredi
2009-11-06 14:17 ` Pavel Machek
2009-11-06 20:55 ` Eric W. Biederman
2009-11-07 7:49 ` Miklos Szeredi
2009-11-07 11:09 ` Eric W. Biederman
2009-11-07 11:31 ` Miklos Szeredi
2009-11-07 11:48 ` Eric W. Biederman
2009-11-08 17:01 ` Pavel Machek
2009-11-16 11:50 ` Miklos Szeredi
2009-11-07 17:58 ` Pavel Machek
2009-11-09 8:58 ` 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=E1N64Ch-0003C6-Rn@pomaz-ex.szeredi.hu \
--to=miklos@szeredi.hu \
--cc=adilger@sun.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=dhowells@redhat.com \
--cc=drepper@gmail.com \
--cc=hch@infradead.org \
--cc=jamie@shareable.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@ZenIV.linux.org.uk \
/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
all inboxes | Powered by JetHome®