From: Jeff Layton <jlayton@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] Re: [PATCH 00/25] move handling of setuid/gid bits from VFS into individual setattr functions (RESEND)
Date: Wed, 8 Aug 2007 08:54:35 -0400 [thread overview]
Message-ID: <20070808085435.722f2b10.jlayton@redhat.com> (raw)
In-Reply-To: <20070807171501.e31c4a97.akpm@linux-foundation.org>
On Tue, 7 Aug 2007 17:15:01 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Mon, 6 Aug 2007 09:54:03 -0400
> Jeff Layton <jlayton@redhat.com> wrote:
>
> > Apologies for the resend, but the original sending had the date in the
> > email header and it caused some of these to bounce...
> >
> > ( Please consider trimming the Cc list if discussing some aspect of this
> > that doesn't concern everyone.)
> >
> > When an unprivileged process attempts to modify a file that has the
> > setuid or setgid bits set, the VFS will attempt to clear these bits. The
> > VFS will set the ATTR_KILL_SUID or ATTR_KILL_SGID bits in the ia_valid
> > mask, and then call notify_change to clear these bits and set the mode
> > accordingly.
> >
> > With a networked filesystem (NFS in particular but most likely others),
> > the client machine may not have credentials that allow for the clearing
> > of these bits. In some situations, this can lead to file corruption, or
> > to an operation failing outright because the setattr fails.
> >
> > In this situation, we'd like to just leave the handling of this to
> > the server and ignore these bits. The problem is that by the time
> > nfs_setattr is called, the VFS has already reinterpreted the ATTR_KILL_*
> > bits into a mode change. We can't fix this in the filesystems where
> > this is a problem, as doing so would leave us having to second-guess
> > what the VFS wants us to do. So we need to change it so that filesystems
> > have more flexibility in how to interpret the ATTR_KILL_* bits.
> >
> > The first patch in the following patchset moves this logic into a helper
> > function, and then only calls this helper function for inodes that do
> > not have a setattr operation defined. The subsequent patches fix up
> > individual filesystem setattr functions to call this helper function.
> >
> > The upshot of this is that with this change, filesystems that define
> > a setattr inode operation are now responsible for handling the ATTR_KILL
> > bits as well. They can trivially do so by calling the helper, but they
> > must do so.
> >
> > Some of the follow-on patches may not be strictly necessary, but I
> > decided that it was better to take the conservative approach and call
> > the helper when I wasn't sure. I've tried to CC the maintainers
> > for the individual filesystems as well where I could find them,
> > please let me know if there are others who should be informed.
> >
> > Comments and suggestions appreciated...
> >
>
> From a purely practical standpoint: it's a concern that all filesytems need
> patching to continue to correctly function after this change. There might
> be filesystems which you missed, and there are out-of-tree filesystems
> which won't be updated.
>
> And I think the impact upon the out-of-tree filesystems would be fairly
> severe: they quietly and subtly get their secutiry guarantees broken (I
> think?)
>
Yep. Any filesystem that declares a setattr op will have to deal with
the ATTR_KILL_S* flags themselves. The breakage will be silent too.
> Is there any way in which we can prevent these problems? Say
>
> - rename something so that unconverted filesystems will reliably fail to
> compile?
>
I suppose we could rename the .setattr inode operation to something
else, but then we'll be stuck with it for at least a while. That seems
sort of kludgey too...
> - leave existing filesystems alone, but add a new
> inode_operations.setattr_jeff, which the networked filesytems can
> implement, and teach core vfs to call setattr_jeff in preference to
> setattr?
>
> Something else?
There's also the approach suggested by Miklos: Add a new inode flag that
tells notify_change not to convert ATTR_KILL_S* flags into a mode
change. Basically, allow filesystems to "opt out" of that behavior.
I'd definitly pick that over a new inode op. That would also allow the
default case be for the VFS to continue handling these flags.
Everything would continue to work but filesystems that need to handle
these flags differently would be able to do so.
Thoughts?
--
Jeff Layton <jlayton@redhat.com>
next prev parent reply other threads:[~2007-08-08 12:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-06 13:54 [Cluster-devel] [PATCH 00/25] move handling of setuid/gid bits from VFS into individual setattr functions (RESEND) Jeff Layton
2007-08-07 20:49 ` [Cluster-devel] " Christoph Hellwig
2007-08-07 22:13 ` Jeff Layton
2007-08-08 0:15 ` Andrew Morton
2007-08-08 0:45 ` Trond Myklebust
2007-08-08 0:54 ` Andrew Morton
2007-08-10 20:47 ` Jeff Layton
2007-08-11 2:57 ` Christoph Hellwig
2007-08-13 12:01 ` Jeff Layton
2007-08-13 12:36 ` Jeff Layton
2007-08-08 12:54 ` Jeff Layton [this message]
2007-08-08 16:48 ` Andrew Morton
[not found] ` <Pine.LNX.4.64.0708082204210.10387@fbirervta.pbzchgretzou.qr>
2007-08-09 11:55 ` [Cluster-devel] Re: [fuse-devel] " Jeff Layton
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=20070808085435.722f2b10.jlayton@redhat.com \
--to=jlayton@redhat.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 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).