Re: [RFC] O_NOACC: open without any access

From: Linus Torvalds
Date: Wed Jun 24 2009 - 12:41:49 EST




On Wed, 24 Jun 2009, Al Viro wrote:
>
> i_filesystem_fop is certainly bogus, but why do we want to bother with
> file_operations at all?
>
> Unless you really insist on unlimited use of ioctl(2) on such beasts (and
> any users will be non-portable for obvious reasons anyway), there's no need
> to go anywhere near ->open() *or* ->f_op in general.

A lot of filesystems (especially network filesystems) want to do something
special when you open a node on them.

NFS, for example, does that whole alloc_nfs_open_context() thing to keep
track of RPC credentials etc. It's where things like "filp->f_private"
get set etc.

So if you don't call open(), you'll not initialize the filp sufficiently
to do lots of operations.

But yes:

> Just add new methods to ->i_op (and we already have that coming from
> fs code) and teach do_filp_open() to
> * call permission() with new flag (MAY_TALK_TO_FS_NODE) for such
> open()
> * do not die with -ELOOP on symlinks if we have O_NOFOLLOW + your flag
> * do not call ->f_op->open() at all for such open()
> and we are all set. Hell, we can even teach sys_ioctl() that given set
> of ioctls maps to calls of our new methods. Taken from ->i_op...

Sure. That will work, but I do think that it's going to be more hacky than
just trying to make the file descriptor look as real as possible, and just
calling "open" on it.

But I don't really have any strong opinions.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/