linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Kari Hurtta <hurtta+gmane@siilo.fmi.fi>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [RFC/PATCH] revoke/frevoke system calls
Date: Thu, 20 Jul 2006 23:09:01 +0200	[thread overview]
Message-ID: <20060720210901.GA29485@atjola.homenet> (raw)
In-Reply-To: <5dd5c0nixe.fsf@attruh.keh.iki.fi>

On 2006.07.20 23:02:53 +0300, Kari Hurtta wrote:
> Pekka J Enberg <penberg@cs.Helsinki.FI> writes in
> gmane.linux.file-systems,gmane.linux.kernel:
> 
> > From: Pekka Enberg <penberg@cs.helsinki.fi>
> > 
> > This patch implements the revoke(2) and frevoke(2) system calls for all
> > types of files. We revoke files in two passes: first we scan all open 
> > files that refer to the inode and substitute the struct file pointer in fd 
> > table with NULL causing all subsequent operations on that fd to fail. 
> > After we have done that to all file descriptors, we close the files and 
> > take down mmaps.
> > 
> > Note that now we need to unconditionally do fput/fget in sys_write and
> > sys_read because they race with do_revoke.
> > 
> > Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
> 
> What permissions is needed revoke access of other users open
> files ?
> 
> > +asmlinkage int sys_revoke(const char __user *filename)
> > +{
> > +	int err;
> > +	struct nameidata nd;
> > +
> > +	err = __user_walk(filename, 0, &nd);
> > +	if (!err) {
> > +		err = do_revoke(nd.dentry->d_inode, NULL);
> > +		path_release(&nd);
> > +	}
> > +	return err;
> > +}
> > +
> > +asmlinkage int sys_frevoke(unsigned int fd)
> > +{
> > +	struct file *file = fget(fd);
> > +	int err = -EBADF;
> > +
> > +	if (file) {
> > +		err = do_revoke(file->f_dentry->d_inode, file);
> > +		fput(file);
> > +	}
> > +	return err;
> > +}
> 
> Is that requiring only that user is able to refer file ?
> 
> 
> BSD manual page for revoke(2) seems say:
> 
>     Access to a file may be revoked only by its owner or the super user.

In do_revoke() there is:

+	if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER)) {
+		ret = -EPERM;
+		goto out;

That pretty much matches what the BSD manpage says.

Björn
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2006-07-20 21:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-20 12:07 [RFC/PATCH] revoke/frevoke system calls Pekka J Enberg
2006-07-20 20:02 ` Kari Hurtta
2006-07-20 21:09   ` Björn Steinbrink [this message]
2006-07-21 22:16     ` Edgar Toernig
2006-07-22  0:19 ` Andrew Morton
2006-07-22  6:22   ` Pekka J Enberg
2006-07-22  6:59     ` Andrew Morton
2006-07-22  7:41       ` Pekka Enberg
     [not found] <6AFvY-7ZK-15@gated-at.bofh.it>
2006-07-20 21:26 ` Bodo Eggert
2006-07-20 23:01   ` roucaries bastien
  -- strict thread matches above, loose matches on Subject: below --
2006-07-22  8:05 Albert Cahalan
2006-08-07 10:45 ` Pekka Enberg
2006-08-07 15:19   ` Albert Cahalan

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=20060720210901.GA29485@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=hurtta+gmane@siilo.fmi.fi \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 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).