From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751177AbdGOH6c (ORCPT ); Sat, 15 Jul 2017 03:58:32 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:44995 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751132AbdGOH6b (ORCPT ); Sat, 15 Jul 2017 03:58:31 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: "Levin\, Alexander \(Sasha Levin\)" Cc: "linux-kernel\@vger.kernel.org" , "stable\@vger.kernel.org" References: <20170715012538.10101-1-alexander.levin@verizon.com> <20170715012538.10101-72-alexander.levin@verizon.com> Date: Sat, 15 Jul 2017 02:50:30 -0500 In-Reply-To: <20170715012538.10101-72-alexander.levin@verizon.com> (Alexander Levin's message of "Sat, 15 Jul 2017 01:26:22 +0000") Message-ID: <871spinnp5.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1dWHy4-00069r-0h;;;mid=<871spinnp5.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=67.3.213.87;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19IpY3AEbX6uswPUapTlnrBLpvAelaRq14= X-SA-Exim-Connect-IP: 67.3.213.87 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4999] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] * 0.1 XMSolicitRefs_0 Weightloss drug * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;"Levin\, Alexander \(Sasha Levin\)" X-Spam-Relay-Country: X-Spam-Timing: total 5764 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 3.3 (0.1%), b_tie_ro: 2.3 (0.0%), parse: 1.04 (0.0%), extract_message_metadata: 22 (0.4%), get_uri_detail_list: 1.79 (0.0%), tests_pri_-1000: 11 (0.2%), tests_pri_-950: 1.18 (0.0%), tests_pri_-900: 0.96 (0.0%), tests_pri_-400: 20 (0.4%), check_bayes: 19 (0.3%), b_tokenize: 6 (0.1%), b_tok_get_all: 6 (0.1%), b_comp_prob: 2.0 (0.0%), b_tok_touch_all: 3.1 (0.1%), b_finish: 0.64 (0.0%), tests_pri_0: 241 (4.2%), check_dkim_signature: 0.45 (0.0%), check_dkim_adsp: 2.7 (0.0%), tests_pri_500: 5460 (94.7%), poll_dns_idle: 5455 (94.6%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH for v4.9 LTS 72/87] libfs: Modify mount_pseudo_xattr to be clear it is not a userspace mount 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org *Scratches my head* Is there code in v4.9 where this matters? At the time I merged this to my knowledge there were no in kernel users that cared. Which is why I did not cc stable in the first place. Eric "Levin, Alexander (Sasha Levin)" writes: > From: "Eric W. Biederman" > > [ Upstream commit 75422726b0f717d67db3283c2eb5bc14fa2619c5 ] > > Add MS_KERNMOUNT to the flags that are passed. > Use sget_userns and force &init_user_ns instead of calling sget so that > even if called from a weird context the internal filesystem will be > considered to be in the intial user namespace. > > Luis Ressel reported that the the failure to pass MS_KERNMOUNT into > mount_pseudo broke his in development graphics driver that uses the > generic drm infrastructure. I am not certain the deriver was bug > free in it's usage of that infrastructure but since > mount_pseudo_xattr can never be triggered by userspace it is clearer > and less error prone, and less problematic for the code to be explicit. > > Reported-by: Luis Ressel > Tested-by: Luis Ressel > Acked-by: Al Viro > Signed-off-by: "Eric W. Biederman" > Signed-off-by: Sasha Levin > --- > fs/libfs.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fs/libfs.c b/fs/libfs.c > index 48826d4da189..9588780ad43e 100644 > --- a/fs/libfs.c > +++ b/fs/libfs.c > @@ -245,7 +245,8 @@ struct dentry *mount_pseudo_xattr(struct file_system_type *fs_type, char *name, > struct inode *root; > struct qstr d_name = QSTR_INIT(name, strlen(name)); > > - s = sget(fs_type, NULL, set_anon_super, MS_NOUSER, NULL); > + s = sget_userns(fs_type, NULL, set_anon_super, MS_KERNMOUNT|MS_NOUSER, > + &init_user_ns, NULL); > if (IS_ERR(s)) > return ERR_CAST(s);