mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Satyam Sharma <ssatyam@cse.iitk.ac.in>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Al Viro <viro@ftp.linux.org.uk>,
	Satyam Sharma <ssatyam@cse.iitk.ac.in>,
	Ulrich Drepper <drepper@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH] utime(s): Honour CAP_FOWNER when times==NULL
Date: Tue, 17 Jul 2007 00:24:23 +0530	[thread overview]
Message-ID: <20070716185423.1607.78787.sendpatchset@cselinux1.cse.iitk.ac.in> (raw)

[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.

Signed-off-by: Satyam Sharma <ssatyam@cse.iitk.ac.in>

---

BTW this bug was hidden by the fact that we call vfs_permission() from the
code below (for) this condition. vfs_permission() inevitably degenerates to
generic_permission() which returns 0 (success) for CAP_DAC_OVERRIDE.

However, a privileged process that has released CAP_DAC_OVERRIDE (but carries
CAP_FOWNER) would still get bit by this issue. There is a sample userspace
program (with instructions on how to reproduce) available at:

http://www.cse.iitk.ac.in/users/ssatyam/test.c

 fs/utimes.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/utimes.c b/fs/utimes.c
index b3c8895..83a7e69 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -106,7 +106,7 @@ long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags
                 if (IS_IMMUTABLE(inode))
                         goto dput_and_out;
 
-		if (current->fsuid != inode->i_uid) {
+		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) {
 			if (f) {
 				if (!(f->f_mode & FMODE_WRITE))
 					goto dput_and_out;

             reply	other threads:[~2007-07-16 18:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070716185423.1607.78787.sendpatchset@cselinux1.cse.iitk.ac.i n>
2007-07-16 18:54 ` Satyam Sharma [this message]
2007-07-16 18:47   ` Linus Torvalds
2007-07-16 19:30     ` Satyam Sharma
2007-07-16 20:45       ` Al Viro
2007-07-16 21:46         ` Satyam Sharma
2007-07-16 21:54           ` Satyam Sharma
2007-07-16 23:18             ` Al Viro
2007-07-16 23:50               ` Satyam Sharma
2007-07-17  9:22           ` Satyam Sharma

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=20070716185423.1607.78787.sendpatchset@cselinux1.cse.iitk.ac.in \
    --to=ssatyam@cse.iitk.ac.in \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@ftp.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®