[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0707170054100.2005@cselinux1.cse.iitk.ac.in>
Date: Tue, 17 Jul 2007 01:00:42 +0530 (IST)
From: Satyam Sharma <ssatyam@....iitk.ac.in>
To: Linus Torvalds <torvalds@...ux-foundation.org>
cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Al Viro <viro@....linux.org.uk>,
Ulrich Drepper <drepper@...hat.com>
Subject: Re: [PATCH] utime(s): Honour CAP_FOWNER when times==NULL
On Mon, 16 Jul 2007, Linus Torvalds wrote:
>
>
> On Tue, 17 Jul 2007, Satyam Sharma wrote:
> >
> > [PATCH] utime(s): Honour CAP_FOWNER when times==NULL
> >
> > do_utimes() does not honour CAP_FOWNER when times==NULL.
> > Trivial and obvious one-line fix.
>
> Ahh, ok. Is this old, or was it introduced recently (I'm looking at my
> recent change to that area, it doesn't seem to introduce this)?
Old, I'd think. Note that this issue was hidden behind the fact that
we would call vfs_permission()->generic_permission() anyway even if
that check failed.
Now generic_permission() returns 0 (success) if capable(CAP_DAC_OVERRIDE)
and -EACCES otherwise (that's for MAY_WRITE tests, which is what this
one is). Now I suspect most (all?) common userspace programs out there
just don't ever have a capable(CAP_DAC_OVERRIDE) && !capable(CAP_FOWNER)
kind of capability mix, so we never saw this before.
[ That does not mean this is not an issue, of course, though. ]
> IOW, how did you even notice this?
Just code inspection. In fact I got interested in following this
codepath precisely after the recent discussion on this list ...
> Also, while your one-liner looks correct, it does make me wonder: the
> whole
>
> if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
>
> test is a rather common test, and in fact, arguably, every time you see
> one part of it, you should probably see the other. Would it make sense to
> make a helper inline function to do this, and replace all users? Doing a
>
> git grep 'fsuid.*\<i_uid\>'
>
> seems to show quite a few cases of this pattern..
Yes, I thought of writing a helper function for this myself. The semantics
of CAP_FOWNER sort of justify that, but probably better to get Al's views
on this first.
Satyam
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists