Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp562864pxb; Wed, 8 Sep 2021 07:25:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuuaxVvOn//nhaCrYg1oosSrGutIDKwF5juElaKHKAewmbs2RCV+ysVC5+LVMX2Pww0XOs X-Received: by 2002:a05:6402:1e8e:: with SMTP id f14mr4102599edf.15.1631111135865; Wed, 08 Sep 2021 07:25:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631111135; cv=none; d=google.com; s=arc-20160816; b=c+l2tCE5F7y9kX+IAq7DPgEpG3FmxVABRo+O3v2M7WVNHbjHo9JByfqBsZQbc0rOBq KRYcG/gN5MdAItfOlOru8iRXq6AIK4IOImvJDqFFXqItaVwm2rket7OifM/a2nYelziv 9/lCqv9qau9l6sImF5X6p6Zn4GvYw7Dpjv7XZ1egL+23k0vAOYNO9h3Ig1x8Hc2JQSwP 3VCywG5SAIjMT/BC1bYVczavc0upbN7uLfq54YCk5/tG0RpDMDrfJ46uHmzQLBfrxeK+ t/IWfTy0KiDaZj74BQV0tGzTsoGTEgNkZyRQJYKzLQYeLNBhOUnRI25X9whQl5SbB3O4 eRgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:mime-version:user-agent:message-id :in-reply-to:date:references:cc:to:from; bh=wXkXBSBgEWSLKxKb20dnw6WiUEo40Sw5cOl9zyToWbM=; b=WQyW9oGVefstZQI98c/iTCh0kYEPN5ZsYEJOx80ZAuSgKHx5PH9nY0QohmpE4DlpAY Qx564Clo6THLcRuP258NfioEtgtBsLctR+psyLHMDdUEg5U+F58kXSFo2BHGotqoBtug j0WQiW7JNE6XpnmB0dTrjFq91rt2CsgSVFMNZxMQUsSOGB8oQZimHTs+O+VDp8Fw/ptP lz1/Lq7y74irlSgn9o0sEJvWQbOrhvkL69F5X4DPV+tvznaz+hiZQyhIhudQHvTEFw77 NhKGd/b8ru0sMiMg1+6G8kaWFqfVq6XNq0/E7ZucZNcx9XhrZmDoOzp9MY632U7RQhNV VUPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m25si2201030edv.420.2021.09.08.07.25.11; Wed, 08 Sep 2021 07:25:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348996AbhIHOWi (ORCPT + 99 others); Wed, 8 Sep 2021 10:22:38 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:42616 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbhIHOWh (ORCPT ); Wed, 8 Sep 2021 10:22:37 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]:37094) by out02.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1mNyS5-002ZZZ-SF; Wed, 08 Sep 2021 08:21:25 -0600 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95]:42036 helo=email.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1mNyS4-00BBdJ-GW; Wed, 08 Sep 2021 08:21:25 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Miklos Szeredi Cc: Vivek Goyal , "Dr. David Alan Gilbert" , Andreas Gruenbacher , Alexander Viro , linux-fsdevel , LKML , virtio-fs-list , Daniel J Walsh , Christian Brauner , Casey Schaufler , LSM , SElinux list , "Theodore Ts'o" , Giuseppe Scrivano , "Fields\, Bruce" , Stephen Smalley , Dave Chinner , "Serge E. Hallyn" References: <20210902152228.665959-1-vgoyal@redhat.com> Date: Wed, 08 Sep 2021 09:20:32 -0500 In-Reply-To: (Miklos Szeredi's message of "Wed, 8 Sep 2021 09:37:17 +0200") Message-ID: <87lf47tahb.fsf@disp2133> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1mNyS4-00BBdJ-GW;;;mid=<87lf47tahb.fsf@disp2133>;;;hst=in01.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+SrgV0tKVopvxRdxK+6dEdGv6cwF2N0VI= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on sa06.xmission.com X-Spam-Level: X-Spam-Status: No, score=-0.2 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01 autolearn=disabled version=3.4.2 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Miklos Szeredi X-Spam-Relay-Country: X-Spam-Timing: total 550 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 11 (2.0%), b_tie_ro: 9 (1.7%), parse: 1.02 (0.2%), extract_message_metadata: 13 (2.3%), get_uri_detail_list: 1.62 (0.3%), tests_pri_-1000: 11 (2.0%), tests_pri_-950: 1.31 (0.2%), tests_pri_-900: 1.14 (0.2%), tests_pri_-90: 154 (27.9%), check_bayes: 151 (27.5%), b_tokenize: 9 (1.6%), b_tok_get_all: 8 (1.5%), b_comp_prob: 2.9 (0.5%), b_tok_touch_all: 127 (23.1%), b_finish: 0.98 (0.2%), tests_pri_0: 346 (62.9%), check_dkim_signature: 0.63 (0.1%), check_dkim_adsp: 2.3 (0.4%), poll_dns_idle: 0.52 (0.1%), tests_pri_10: 2.4 (0.4%), tests_pri_500: 7 (1.2%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v3 0/1] Relax restrictions on user.* xattr X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Miklos Szeredi writes: > On Tue, 7 Sept 2021 at 23:40, Vivek Goyal wrote: >> >> On Mon, Sep 06, 2021 at 04:56:44PM +0200, Miklos Szeredi wrote: >> > On Mon, 6 Sept 2021 at 16:39, Dr. David Alan Gilbert >> > wrote: >> > >> > > IMHO the real problem here is that the user/trusted/system/security >> > > 'namespaces' are arbitrary hacks rather than a proper namespacing >> > > mechanism that allows you to create new (nested) namespaces and associate >> > > permissions with each one. >> > >> > Indeed. >> > >> > This is what Eric Biederman suggested at some point for supporting >> > trusted xattrs within a user namespace: >> > >> > | For trusted xattrs I think it makes sense in principle. The namespace >> > | would probably become something like "trusted.". >> > >> > Theory sounds simple enough. Anyone interested in looking at the details? >> >> So this namespaced trusted.* xattr domain will basically avoid the need >> to have CAP_SYS_ADMIN in init_user_ns, IIUC. I guess this is better >> than giving CAP_SYS_ADMIN in init_user_ns. > > That's the objective, yes. I think the trick is getting filesystems > to store yet another xattr type. Using the uid of the root user of a user namespace is probably the best idea we have so far for identifying a user namespace in persistent on-disk meta-data. We ran into a little trouble using that idea for file capabilities. The key problem was there are corner cases where some nested user namespaces have the same root user id as their parent namespaces. This has the potential to allow privilege escalation if the creator of the user namespace does not have sufficient capabilities. The solution we adopted can be seen in db2e718a4798 ("capabilities: require CAP_SETFCAP to map uid 0"). That solution is basically not allowing the creation of user namespaces that could have problems. I think use trusted xattrs this way the code would need to treat CAP_SYS_ADMIN the same way it currently treats CAP_SETFCAP. Eric