* [PATCH] umask in POSIX message queues
@ 2005-09-26 10:44 Krzysztof Benedyczak
2005-09-27 1:29 ` Linus Torvalds
0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Benedyczak @ 2005-09-26 10:44 UTC (permalink / raw)
To: linux-kernel; +Cc: torvalds, Michael Kerrisk, Michal Wronski
Hi
All kernels (form 2.6.6) ignore umask when creating new queues via
mq_open (when creating with open() on mqueue fs it is ok of course).
According to specification this a bug. The following trivial patch fixes
this. It should apply cleanly to any current kernel. Please apply.
Signed-off-by: Krzysztof Benedyczak <golbi@mat.uni.torun.pl>
--- linux-2.6.14-rc2/ipc/mqueue.c.orig 2005-09-25 18:52:29.000000000 +0200
+++ linux-2.6.14-rc2/ipc/mqueue.c 2005-09-26 11:44:41.000000000 +0200
@@ -278,6 +278,8 @@ static int mqueue_create(struct inode *d
queues_count++;
spin_unlock(&mq_lock);
+ mode &= ~current->fs->umask;
+
inode = mqueue_get_inode(dir->i_sb, mode, attr);
if (!inode) {
error = -ENOMEM;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] umask in POSIX message queues
2005-09-26 10:44 [PATCH] umask in POSIX message queues Krzysztof Benedyczak
@ 2005-09-27 1:29 ` Linus Torvalds
2005-09-27 11:13 ` Krzysztof Benedyczak
0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2005-09-27 1:29 UTC (permalink / raw)
To: Krzysztof Benedyczak; +Cc: linux-kernel, Michael Kerrisk, Michal Wronski
On Mon, 26 Sep 2005, Krzysztof Benedyczak wrote:
>
> All kernels (form 2.6.6) ignore umask when creating new queues via
> mq_open (when creating with open() on mqueue fs it is ok of course).
> According to specification this a bug. The following trivial patch fixes
> this. It should apply cleanly to any current kernel. Please apply.
As far as I can tell, the VFS layer should have done this for us already,
with code like
...
if (!IS_POSIXACL(dir->d_inode))
mode &= ~current->fs->umask;
error = vfs_create(dir->d_inode, path.dentry, mode, nd);
...
in fs/namei.c (open_namei()).
Which path did you come through that didn't do this? That would be the
real bug, I suspect..
Linus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] umask in POSIX message queues
2005-09-27 1:29 ` Linus Torvalds
@ 2005-09-27 11:13 ` Krzysztof Benedyczak
2005-09-27 14:55 ` Linus Torvalds
0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Benedyczak @ 2005-09-27 11:13 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, Michael Kerrisk, Michal Wronski
On Mon, 26 Sep 2005, Linus Torvalds wrote:
> As far as I can tell, the VFS layer should have done this for us already,
> with code like
>
> ...
> if (!IS_POSIXACL(dir->d_inode))
> mode &= ~current->fs->umask;
> error = vfs_create(dir->d_inode, path.dentry, mode, nd);
> ...
>
> in fs/namei.c (open_namei()).
>
> Which path did you come through that didn't do this? That would be the
> real bug, I suspect..
As I noted when creating mqueues with sys_open() the umask is set
correctly just by the code you pointed out. But sys_mq_open() doesn't use
open_namei() nor filp_open(); the reason is extra data - mq_attr - that
must be passed to real mqueue creating code. So the invocation path is:
sys_mq_open() -> do_create() -> vfs_create() -> (vfs create handler)
mqueue_create().
After rereading it I think that the better place for the line setting
umask is do_create() function as it will be on the same level as
open_namei(). I hope this change will clarify things.
If this make sense I'll send a patch.
Best regards
Krzysiek
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] umask in POSIX message queues
2005-09-27 11:13 ` Krzysztof Benedyczak
@ 2005-09-27 14:55 ` Linus Torvalds
2005-09-27 20:21 ` Krzysztof Benedyczak
0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2005-09-27 14:55 UTC (permalink / raw)
To: Krzysztof Benedyczak; +Cc: linux-kernel, Michael Kerrisk, Michal Wronski
On Tue, 27 Sep 2005, Krzysztof Benedyczak wrote:
>
> After rereading it I think that the better place for the line setting
> umask is do_create() function as it will be on the same level as
> open_namei(). I hope this change will clarify things.
>
> If this make sense I'll send a patch.
Yes, that makes more sense.
Please do send a tested patch,
Linus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] umask in POSIX message queues
2005-09-27 14:55 ` Linus Torvalds
@ 2005-09-27 20:21 ` Krzysztof Benedyczak
0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Benedyczak @ 2005-09-27 20:21 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, Michael Kerrisk, Michal Wronski
On Tue, 27 Sep 2005, Linus Torvalds wrote:
> On Tue, 27 Sep 2005, Krzysztof Benedyczak wrote:
> >
> > After rereading it I think that the better place for the line setting
> > umask is do_create() function as it will be on the same level as
> > open_namei(). I hope this change will clarify things.
> >
> > If this make sense I'll send a patch.
>
> Yes, that makes more sense.
>
> Please do send a tested patch,
Setting umask moved to do_create and tested once again.
Krzysiek
Signed-off-by: Krzysztof Benedyczak <golbi@mat.uni.torun.pl>
--- linux-2.6.14-rc2/ipc/mqueue.c.orig 2005-09-25 18:52:29.000000000 +0200
+++ linux-2.6.14-rc2/ipc/mqueue.c 2005-09-27 22:12:41.692903624 +0200
@@ -611,6 +611,7 @@ static struct file *do_create(struct den
dentry->d_fsdata = &attr;
}
+ mode &= ~current->fs->umask;
ret = vfs_create(dir->d_inode, dentry, mode, NULL);
dentry->d_fsdata = NULL;
if (ret)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-09-27 20:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-26 10:44 [PATCH] umask in POSIX message queues Krzysztof Benedyczak
2005-09-27 1:29 ` Linus Torvalds
2005-09-27 11:13 ` Krzysztof Benedyczak
2005-09-27 14:55 ` Linus Torvalds
2005-09-27 20:21 ` Krzysztof Benedyczak
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®