From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964901AbVI0LNo (ORCPT ); Tue, 27 Sep 2005 07:13:44 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S964902AbVI0LNo (ORCPT ); Tue, 27 Sep 2005 07:13:44 -0400 Received: from leon.mat.uni.torun.pl ([158.75.2.17]:49340 "EHLO Leon.mat.uni.torun.pl") by vger.kernel.org with ESMTP id S964901AbVI0LNo (ORCPT ); Tue, 27 Sep 2005 07:13:44 -0400 Date: Tue, 27 Sep 2005 13:13:01 +0200 (CEST) From: Krzysztof Benedyczak X-X-Sender: golbi@Juliusz To: Linus Torvalds cc: linux-kernel@vger.kernel.org, Michael Kerrisk , Michal Wronski Subject: Re: [PATCH] umask in POSIX message queues In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org 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