Re: Q. Switch open_exec() and sys_uselib() to do_open_filp()

From: Al Viro
Date: Mon May 11 2009 - 00:00:33 EST


On Mon, May 11, 2009 at 11:46:15AM +0900, hooanon05@xxxxxxxxxxx wrote:
> My poor English may make me misunderstood.
> Please let me make sure.
> Do you mean FMODE_EXEC was passed to struct file before this commit?
>
> Previous open_exec() used to call
> file = nameidata_to_filp(&nd, O_RDONLY|O_LARGEFILE)
> and it calls
> filp = __dentry_open(nd->path.dentry, nd->path.mnt, flags, filp,
> NULL);
> __dentry_open()
> {
> f->f_flags = flags;
> f->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK |
> FMODE_PREAD | FMODE_PWRITE;
> ;;;
> }
>
> So FMODE_EXEC was not set to f_flags/f_mode, O_RDONLY|O_LARGEFILE only.

Nope. It ended up in nd->intent.open.flags due to path_lookup_open().
Then lookup_instantiate_filp() from a filesystem that might care about
intents did
nd->intent.open.file = __dentry_open(dget(dentry), mntget(nd->mnt),
nd->intent.open.flags - 1,
nd->intent.open.file,
open);
and nameidata_to_filp() ended up picking nd->intent.open.file.

So f_flags is exactly where that thing used to end up, if it ended up
anywhere at all.
--
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/