All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: security@kernel.org, linux-fsdevel@vger.kernel.org,
	tomoyo-users-en@lists.sourceforge.jp,
	Kentaro Takeda <takedakn@nttdata.co.jp>
Subject: Re: [Security] time_attrs argument for security_path_truncate
Date: Wed, 2 Jun 2010 03:24:25 +1000	[thread overview]
Message-ID: <20100601172425.GC9453@laptop> (raw)
In-Reply-To: <alpine.LFD.2.00.1006010953170.3637@i5.linux-foundation.org>

On Tue, Jun 01, 2010 at 10:04:13AM -0700, Linus Torvalds wrote:
> 
> 
> On Wed, 2 Jun 2010, Nick Piggin wrote:
> >
> > It appears like the time_attrs parameter of security_path_truncate is
> > unused by any security module, so I wonder if we can remove it?
> 
> I think we should aggressively remove interfaces that aren't used. The VFS 
> side has been complicated several times because of the security hooks, and 
> if they ended up not getting used and just complicates logic, we should 
> remove it.

OK, good. I'll put a patch at the head of my queue.

> > We cannot really get it right for truncate(2) calls anyway without
> > holding i_mutex over the call (because ATTR_MTIME|ATTR_CTIME is
> > effectively set iff size changes). So the meaning of this parameter
> > today is misleading anyway.
> 
> Why do we pass it in to do_truncate() at all, btw? Especially as we seem 
> to be a bit confused about it. A regular 'truncate()' passes in a 
> time_attrs of '0', while a 'ftruncate()' passes ATTR_MTIME|ATTR_CTIME.

Yes, and then it relies on the filesystems to update MTIME and CTIME
if size has changed. Many get it wrong (and in my confusion I also
just broke a couple more). So I'm working on fixing it for everyone.

http://marc.info/?l=linux-fsdevel&m=127539956932537&w=2

 
> That doesn't sound right. And if it is (because I can well imagine some 
> strange and subtle POSIX rule wrt ftruncate() and mtime/ctime), I think we 
> should add a comment on it, since I've clearly forgotten the reason.

Yeah a comment would have really helped, since it seems stupid it
must be a typo in the standards document.

6e656be899993f450a765056cdc8d87e58906508

 
> Btw, right now we pass in ATTR_OPEN too to the security_path_truncate() 
> call. Which again doesn't seem to be _used_ by any security thing, and 
> which also violates the naming of that argument. So there's some 
> additional strangeness going on there.
> 
> (That ATTR_OPEN case was introduced in commit be6d3e56a6 ("introduce new 
> LSM hooks where vfsmount is available"), for what its worth. The ATTR_OPEN 
> bit seems to have been copied from the do_truncate() call below it, I 
> think it's just a copy-paste error).

Good point. That'll get nuked when we remove the parameter.


  reply	other threads:[~2010-06-01 17:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-01 15:50 time_attrs argument for security_path_truncate Nick Piggin
2010-06-01 17:04 ` [Security] " Linus Torvalds
2010-06-01 17:24   ` Nick Piggin [this message]
2010-06-01 17:52     ` Linus Torvalds
2010-06-02  3:28       ` [PATCH] LSM: Remove unused time_attrs argument Tetsuo Handa
2010-06-02  3:50         ` Nick Piggin
2010-06-02  3:59           ` Nick Piggin
2010-06-02  4:24           ` Tetsuo Handa
2010-06-02  4:41             ` Nick Piggin
2010-06-02  5:22             ` James Morris

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=20100601172425.GC9453@laptop \
    --to=npiggin@suse.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=security@kernel.org \
    --cc=takedakn@nttdata.co.jp \
    --cc=tomoyo-users-en@lists.sourceforge.jp \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.