Received: by 10.223.185.116 with SMTP id b49csp782450wrg; Wed, 14 Feb 2018 06:58:15 -0800 (PST) X-Google-Smtp-Source: AH8x2253xMoGdgq86liO5gha6Im2FIJ+JQIJhBh0O8qpYOIsu6oy8hsubhUhiy9C79WuCvtsVdaz X-Received: by 10.101.90.203 with SMTP id d11mr4091276pgt.366.1518620295373; Wed, 14 Feb 2018 06:58:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518620295; cv=none; d=google.com; s=arc-20160816; b=1CvOe7jaLxVRfEsJ2RerIOdcG3DQhMYsau+aab0c3o4VxmgXWe1XYyJKg89uf33Pl3 +ESqTLMbMqlPgo+jYKR02f5JdxCRGTtalYIHt/n4e4991CrLTjSMoQcpXKz+0VAcoF/0 SpKBL0KjGoUhi0wTSQZyt1S3Xv7I7+nfGh+d2v3H1OMOXara6f7t+C/b+P4w440u6Tlp J1gA3gVvquwrzSenoyxCqtVel+sj1BxLh7QWExPvl2vnIjctGS4wWjuDemxmEL8ZzfZ/ P438xtkWmFPxA8UgwN34nv72gHKcv8pKdq7Vfo+Z574R5Jdzt8ajU6nTuu373UVJyXp3 z3Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=ZWVjQVgvMjd48bf8M4h97IXjuqw+dWgPRwlPa0IoFgg=; b=LEFxuh6rnEkDIMLLbwG1gSOnnJ6I3zz1ydPDKcfxgfrv1cw2saTtuzCVMejPwiG77m bsSdL9pPtnVYUZyWA+AooANDZSDCp/LEsPl9RlV9DWIYuCbEkeNBIKZjfAjpaxcL35s4 R3eE+yQR5wU6axV1zM+aiwN4F9K3CRfS1sF45x8Yj8C3t/NrKD7NI33mSYI5GfmI6Ubj ioEcQfD2wWvIXMQCsC9vmvhY9OmXu+CFM6f1nyxx5dkt2YRZ0WL6NmgAhiZLehc1KmcD Hv39a1nYUn8z2KxC3SJ4ugPIkmXHi1JVWmoxtXY8fEMEQX7FCrcJEtQiip8tIzIgUOhd OSpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d15si5124928pgv.822.2018.02.14.06.58.00; Wed, 14 Feb 2018 06:58:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030785AbeBNO4w (ORCPT + 99 others); Wed, 14 Feb 2018 09:56:52 -0500 Received: from h2.hallyn.com ([78.46.35.8]:58830 "EHLO mail.hallyn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030382AbeBNO4v (ORCPT ); Wed, 14 Feb 2018 09:56:51 -0500 Received: by mail.hallyn.com (Postfix, from userid 1001) id 9E82B1204BB; Wed, 14 Feb 2018 08:56:50 -0600 (CST) Date: Wed, 14 Feb 2018 08:56:50 -0600 From: "Serge E. Hallyn" To: "Enrico Weigelt, metux IT consult" Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] p9caps: add Plan9 capability devices Message-ID: <20180214145650.GA2102@mail.hallyn.com> References: <40d4c871-a16a-7b8f-2d4a-422a5a490693@infradead.org> <20180211215028.16210-1-metux@gmx.de> <20180211215028.16210-2-metux@gmx.de> <20180213071655.GA11240@mail.hallyn.com> <3a99edaf-0365-ec7e-4d2f-1e21dea007ac@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3a99edaf-0365-ec7e-4d2f-1e21dea007ac@gmx.de> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Enrico Weigelt, metux IT consult (metux@gmx.de): > On 13.02.2018 07:16, Serge E. Hallyn wrote: > >>+ /* make sure only one instance per namespace can be opened */ > > ... at a time > yeah, right. > > >might be better to keep this state in the user_ns itself, would > >avoid kzalloc below. > > thought about, but hesitated to touch user_ns. might not be the best > idea when having p9caps as module (OTOH, doesn't need to be a module) If it's an out of tree module you'd have to do it this way, but if it's in-tree, even as a module, adding a bit to the userns struct would imo be ok. > the whole thing might become a bit more complex when introducing > plan9-like unprivileged mount operations. haven't sorted out how to > do that yet. I hope you'll have a discussion here about that first. > >Would it be worth doing any privilege checking here? > > Which ones should I check ? Well, granting privileges to another task is extra-special, so in the 2010 submission we created a new POSIX capability for it (CAP_GRANT_ID). Now speaking practically, I love the caphash idea, but it does have issues with a modern login system. There are privileged things which login needs to do besides changing uid, including but not limited to: 1. setting limits 2. setting loginuid, 3. mounting things (polyinstantiated /tmp, decrypted homedir, etc) 4. setting selinux context These are probably all solvable, and don't need to be solved before we solve this part, that would be silly, but they're worth thinking about. The ones which must be done on the current task are the hardest to solve. (and of course gplv3 as Al pointed out is a blocker) -serge