lkml.org 
[lkml]   [2006]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC/PATCH] revoke/frevoke system calls
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-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-07-20 23:11    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site