Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1438038imm; Wed, 23 May 2018 16:27:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqjo92DASdnQ9wQW8ie0KRQXsRRXiEc9SYJT2+FlEpdMvkP/UQj4LR8VEtDYbWxud0D2hU/ X-Received: by 2002:a17:902:6b45:: with SMTP id g5-v6mr4904289plt.67.1527118045805; Wed, 23 May 2018 16:27:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527118045; cv=none; d=google.com; s=arc-20160816; b=TQfuNbszmmJPCFGAJ7+T7ZNAXKs1WyRwWP0n13Z+YFRy0pRh+yy4Z88oHJgmakFstF TSv1utv9z8BseX+BZjuQs1dmjGPV5DCRyoSbbnsUrJTu/DG1EIWGMtNeDIyZYsfvrQdX 99qWbRGEgKkfF3ZoLm7KaN7QNxph7UM3ed5MMWDNHYRDXQ6jdj6HAjnCiBxdMUd8iWlP vfpgv0ed25P0BU7px1Jp2kQyV2z3qaZL1uxSu/lUkFOvihSKoqVzrAHPrXKUrgfPwyzZ dKouT2h+QEZG+h71a9VcAo7vrb7vMwfT9aspRHmyHkcKsTqEdqSumK67jPVm1HyzgbS1 lbkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=mEDjR0Aof0Zn3RewOmHm4+9bBF/voPLm2n/iu5WeJsM=; b=pLgCCks9qgStyPJViEGa9gWFIHzvFdvD+TStJoQ+Ud/DyC20eIhcqlFnCB/yjMzAlT SyzMgOTPEEtvXupASx1xN25W5MCZjJYe9ecsVuXOnY0rCyE41vAzajS3YkeYmhLMXmkW 1yPRW+IzSka/A/4eoaEHPj8UdY1ecOIs1hW+z/Kob6bz6b7kp/to78PCsDn4z2lS/+CK XnmTOJ/fP8Ci5UpbhKLhn5ewNGA39FS6+m7/MuzWyoML4oWHPj7Z3H/FyLwjYvUAQNWa UamGO0mGxXhB5H6qutpMzIvKCGC5h5BwXcSwNVh1w9DNSPXNbYUVKXM6m77pISotnZ+9 O6sw== 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 h1-v6si18116135pld.343.2018.05.23.16.27.10; Wed, 23 May 2018 16:27:25 -0700 (PDT) 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 S935139AbeEWX0n (ORCPT + 99 others); Wed, 23 May 2018 19:26:43 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:56739 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934671AbeEWX0l (ORCPT ); Wed, 23 May 2018 19:26:41 -0400 Received: from in02.mta.xmission.com ([166.70.13.52]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fLd9V-0002Pz-2P; Wed, 23 May 2018 17:26:41 -0600 Received: from [97.119.174.25] (helo=x220.int.ebiederm.org) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fLd9F-0004ID-Kh; Wed, 23 May 2018 17:26:40 -0600 From: "Eric W. Biederman" To: Linux Containers Cc: linux-fsdevel@vger.kernel.org, Seth Forshee , "Serge E. Hallyn" , Christian Brauner , linux-kernel@vger.kernel.org, "Eric W. Biederman" Date: Wed, 23 May 2018 18:25:34 -0500 Message-Id: <20180523232538.4880-2-ebiederm@xmission.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <87o9h6554f.fsf@xmission.com> References: <87o9h6554f.fsf@xmission.com> X-XM-SPF: eid=1fLd9F-0004ID-Kh;;;mid=<20180523232538.4880-2-ebiederm@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=97.119.174.25;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+fAn2sq8mnivDR6zl//L8yQoi6KgBI1lU= X-SA-Exim-Connect-IP: 97.119.174.25 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa07.xmission.com X-Spam-Level: *** X-Spam-Status: No, score=3.5 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TR_Symld_Words,T_TooManySym_01,XMNoVowels,XMSubLong autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 TR_Symld_Words too many words that have symbols inside * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;Linux Containers X-Spam-Relay-Country: X-Spam-Timing: total 15022 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 2.7 (0.0%), b_tie_ro: 1.91 (0.0%), parse: 0.74 (0.0%), extract_message_metadata: 9 (0.1%), get_uri_detail_list: 0.69 (0.0%), tests_pri_-1000: 2.8 (0.0%), tests_pri_-950: 1.15 (0.0%), tests_pri_-900: 0.97 (0.0%), tests_pri_-400: 17 (0.1%), check_bayes: 16 (0.1%), b_tokenize: 6 (0.0%), b_tok_get_all: 4.8 (0.0%), b_comp_prob: 1.43 (0.0%), b_tok_touch_all: 2.3 (0.0%), b_finish: 0.58 (0.0%), tests_pri_0: 106 (0.7%), check_dkim_signature: 0.42 (0.0%), check_dkim_adsp: 3.3 (0.0%), tests_pri_500: 14880 (99.1%), poll_dns_idle: 14869 (99.0%), rewrite_mail: 0.00 (0.0%) Subject: [REVIEW][PATCH 2/6] vfs: Allow userns root to call mknod on owned filesystems. X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These filesystems already always set SB_I_NODEV so mknod will not be useful for gaining control of any devices no matter their permissions. This will allow overlayfs and applications to fakeroot to use device nodes to represent things on disk. Signed-off-by: "Eric W. Biederman" --- fs/namei.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/namei.c b/fs/namei.c index 942c1f096f6b..20335896dcce 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3679,7 +3679,8 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) if (error) return error; - if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD)) + if ((S_ISCHR(mode) || S_ISBLK(mode)) && + !ns_capable(dentry->d_sb->s_user_ns, CAP_MKNOD)) return -EPERM; if (!dir->i_op->mknod) -- 2.14.1