Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752023AbcDRJOT (ORCPT ); Mon, 18 Apr 2016 05:14:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59258 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751737AbcDRJOR (ORCPT ); Mon, 18 Apr 2016 05:14:17 -0400 Date: Mon, 18 Apr 2016 10:14:12 +0100 From: "Richard W.M. Jones" To: Josh Triplett Cc: "H. Peter Anvin" , Colin Walters , linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, akpm@linux-foundation.org, luto@kernel.org, viro@zeniv.linux.org.uk, mathieu.desnoyers@efficios.com, zab@redhat.com, emunson@akamai.com, paulmck@linux.vnet.ibm.com, aarcange@redhat.com, xemul@parallels.com, sfr@canb.auug.org.au, milosz@adfin.com, rostedt@goodmis.org, arnd@arndb.de, ebiederm@xmission.com, gorcunov@openvz.org, iulia.manda21@gmail.com, dave.hansen@linux.intel.com, mguzik@redhat.com, adobriyan@gmail.com, dave@stgolabs.net, linux-api@vger.kernel.org, gorcunov@gmail.com, fw@deneb.enyo.de Subject: Re: [PATCH v2 0/2] vfs: Define new syscall getumask. Message-ID: <20160418091412.GD11600@redhat.com> References: <1460552272-15985-1-git-send-email-rjones@redhat.com> <1460562105.353100.577697153.013DF466@webmail.messagingengine.com> <57143B74.3070302@zytor.com> <20160418015736.GA16600@x> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160418015736.GA16600@x> User-Agent: Mutt/1.5.20 (2009-12-10) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1309 Lines: 29 On Sun, Apr 17, 2016 at 06:57:36PM -0700, Josh Triplett wrote: > O_NOUMASK seems potentially useful to support implementation of umask > entirely in userspace, which also addresses thread-safety. A program > could read its process umask out at startup, handle umask entirely in > userspace (including for threads), and only interact with the system > umask after fork and before exec. I had a look at O_NOUMASK and there are a few problems: It's relatively easy to implement for open(2). A few filesystems implement their own open so I had to go into those filesystems and modify how they handle current_umask too. And FUSE support is tricky so I passed on that. The real problem is that mkdir/mkdirat/mknod/mknodat are affected by umask, but there is no convenient flags parameter to pass the O_NOUMASK flag. So I think the patch only half-solves the problem. I have a patch which needs a bit more testing, which I can post if you think that's helpful, but I don't think it would be acceptable in its current state. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org