From: Nick Piggin <npiggin@suse.de>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: hch@lst.de, viro@ZenIV.linux.org.uk, linux-fsdevel@vger.kernel.org
Subject: Re: [patch v2] fix truncate inode time modification breakage
Date: Thu, 3 Jun 2010 21:49:57 +1000 [thread overview]
Message-ID: <20100603114957.GJ6822@laptop> (raw)
In-Reply-To: <E1OK87y-0007RX-5Q@pomaz-ex.szeredi.hu>
On Thu, Jun 03, 2010 at 12:58:22PM +0200, Miklos Szeredi wrote:
> On Thu, 3 Jun 2010, Nick Piggin wrote:
> > You'll have to be careful, truncate will pass other things down like
> > mode to get rid of suid.
>
> Oh, right.
>
> > If you just wanted to ignore mtime changes on truncate, then masking
> > it off would be the way to go I think.
> >
> > if (valid & ATTR_SIZE)
> > valid &= ~ATTR_SIZE;
> >
> > Would you also want to do the same thing with suid kill bits from
> > truncate, then? Mask off ATTR_MODE and just read it back from the
> > server too?
>
> That would be logical, but no, it didn't used to do that, and now it
> can't start doing it for fear of creating a security hole.
OK.
> Also suid removal happens very rarely compared to mtime update, so a
> rare additional chmod request (which might be superfluous for some
> filesystems) in addition to write and truncate is I think acceptable.
Yeah no big deal. One little thing to put on the list if you ever need
bump the protocol version.
> (In fact I think it would be cleanest if truncate/ftruncate was a
> separate operation from setattr on all levels, but that's a different
> story.)
Well it's possible. It is a combination of inode and address space
operation really. Because you really want to update mtime/ctime and
suid bits iff the truncate succeeds.
We did consider a new API for it, but it didn't seem to be an
obvious improvement. A filesystem can easily branch into another
function for ATTR_SIZE immediately on setattr entry.
> So for now something like
>
> if (valid & ATTR_SIZE)
> valid &= ~(ATTR_MTIME | ATTR_CTIME);
>
> would work?
That should do the trick, yes. But I think CTIME would just confuse
things seeing as you ignore it everywhere else.
next prev parent reply other threads:[~2010-06-03 11:50 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-01 13:39 [patch] fix truncate inode time modification breakage Nick Piggin
2010-06-01 13:48 ` Christoph Hellwig
2010-06-01 13:56 ` Nick Piggin
2010-06-02 19:55 ` [patch v2] " Nick Piggin
2010-06-02 20:08 ` Filesystem setattr/truncate notes and problems Nick Piggin
2010-06-03 7:28 ` Christoph Hellwig
2010-06-03 7:32 ` Christoph Hellwig
2010-06-03 9:50 ` Nick Piggin
2010-06-03 9:18 ` Nick Piggin
2010-06-03 9:26 ` Nick Piggin
2010-06-03 8:18 ` [patch v2] fix truncate inode time modification breakage Miklos Szeredi
2010-06-03 8:40 ` Boaz Harrosh
2010-06-03 9:05 ` Miklos Szeredi
2010-06-03 12:13 ` Boaz Harrosh
2010-06-03 9:14 ` Nick Piggin
2010-06-03 9:28 ` Miklos Szeredi
2010-06-03 10:07 ` Nick Piggin
2010-06-03 10:58 ` Miklos Szeredi
2010-06-03 11:09 ` Christoph Hellwig
2010-06-03 12:01 ` [patch v3] " Nick Piggin
2010-06-03 11:49 ` Nick Piggin [this message]
2010-06-03 12:03 ` [patch v2] " Miklos Szeredi
2010-06-01 14:10 ` [patch] " Boaz Harrosh
2010-06-01 14:32 ` Nick Piggin
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=20100603114957.GJ6822@laptop \
--to=npiggin@suse.de \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--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;
as well as URLs for NNTP newsgroup(s).