Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5855475imu; Wed, 30 Jan 2019 04:52:11 -0800 (PST) X-Google-Smtp-Source: ALg8bN4w02D93WWxJi8pgvJJVJlqYoaSlSbB0cttDeNfKQgbwaHseW3D1acByWUegkojQGymeTa6 X-Received: by 2002:a62:43c1:: with SMTP id l62mr30955650pfi.22.1548852731266; Wed, 30 Jan 2019 04:52:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548852731; cv=none; d=google.com; s=arc-20160816; b=Qadj8HisnSpz9lEQlRJ+WEfIN4oEH/Jaqq1D9Fbbc0+2wdBBusNk7CaeC/ywK9tnxB O7E0v+0rtnZo7B3FMUK6tSy4XNWt0DDj+Yv8x3c0aHfaSnDP3klKBu4jn6SyXdzjAxqJ y/d56IWVldoINWpqKQ12gEoYif3heierI/nsT1vGe0xKuxa9U0yn6NqDS7GL/9ND0vn6 i9k4uddTlp2G/Wz5WjsNTleaZ/7WvvmATMFvr7A9U8QeYod/vQxULyPYLqkN1Nyry1RX h/YEFpVTnHQykE6OYAqYI/aQ1Q7hHQ/ppPSc6LBBsdD6mPDJHw51ia9fTCcUISpXO2Yi MTYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from; bh=hnKmorc+neNZJy/wZjCnDgJ+ne5inD+qHj/w1zJpYX4=; b=Ke6b1hFCcBInj/R09pkPa+uYAt9O+QPjotKQ/DujD3MjSMKgMq9jCUwQKbL1ghjVAt nZDiKwhzG9P2/mDPP3acCmj+gKyeG4ccJ7FXntyXLecDuasUKNXIjNOvH9ftCmf1QV/K 6jM6g/9F7NvUcDll0WCwzQnf6PFhuR97dWkaoTvPqWN6XzaIINnE5CaMh36pnOsTrT2L AxiP4UCRUfjAcm1cDVkgGX40ke5NaWImzO5JHP10X91nnRzmYUoz9+XmWSLfKmy7FRga Ge1GSUrwRdXhTdStV3IhPB6L+IG9PsWO/Jz4GJvIGsmZzqUBcQhfFZADeGrok4xY2awZ cT3w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l59si949158plb.154.2019.01.30.04.51.56; Wed, 30 Jan 2019 04:52:11 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731085AbfA3Mtp (ORCPT + 99 others); Wed, 30 Jan 2019 07:49:45 -0500 Received: from out01.mta.xmission.com ([166.70.13.231]:54233 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730967AbfA3MrW (ORCPT ); Wed, 30 Jan 2019 07:47:22 -0500 Received: from in02.mta.xmission.com ([166.70.13.52]) by out01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1gopGy-0006AC-21; Wed, 30 Jan 2019 05:47:20 -0700 Received: from ip68-227-174-240.om.om.cox.net ([68.227.174.240] helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1gopGx-0001gZ-7c; Wed, 30 Jan 2019 05:47:19 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Casey Schaufler Cc: linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Al Viro , David Howells , Miklos Szeredi , Linus Torvalds , Karel Zak , util-linux@vger.kernel.org, Andy Lutomirski , LSM References: <87va2716mh.fsf@xmission.com> <03e0993b-21db-1cc4-7a33-0236de7be20d@schaufler-ca.com> <87r2cvx7wz.fsf@xmission.com> <87ef8vx7jz.fsf@xmission.com> Date: Wed, 30 Jan 2019 06:47:09 -0600 In-Reply-To: <87ef8vx7jz.fsf@xmission.com> (Eric W. Biederman's message of "Tue, 29 Jan 2019 19:23:12 -0600") Message-ID: <8736pawbw2.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=1gopGx-0001gZ-7c;;;mid=<8736pawbw2.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=68.227.174.240;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18a+etU5hIAZJSftdtZ1VtryMrnkJhAie4= X-SA-Exim-Connect-IP: 68.227.174.240 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 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] X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Casey Schaufler X-Spam-Relay-Country: X-Spam-Timing: total 439 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 3.2 (0.7%), b_tie_ro: 2.2 (0.5%), parse: 1.05 (0.2%), extract_message_metadata: 15 (3.4%), get_uri_detail_list: 2.0 (0.5%), tests_pri_-1000: 18 (4.1%), tests_pri_-950: 1.30 (0.3%), tests_pri_-900: 1.06 (0.2%), tests_pri_-90: 25 (5.6%), check_bayes: 23 (5.2%), b_tokenize: 7 (1.7%), b_tok_get_all: 8 (1.7%), b_comp_prob: 2.5 (0.6%), b_tok_touch_all: 3.1 (0.7%), b_finish: 0.67 (0.2%), tests_pri_0: 363 (82.7%), check_dkim_signature: 0.55 (0.1%), check_dkim_adsp: 2.3 (0.5%), poll_dns_idle: 0.50 (0.1%), tests_pri_10: 2.3 (0.5%), tests_pri_500: 7 (1.6%), rewrite_mail: 0.00 (0.0%) Subject: Re: [RFD] A mount api that notices previous mounts 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 ebiederm@xmission.com (Eric W. Biederman) writes: > ebiederm@xmission.com (Eric W. Biederman) writes: > >> Casey Schaufler writes: >>> Are you taking the LSM specific mount options into account? >> >> In the design yes, and I allow setting them. It appears in the code >> to retrieve the mount options I forgot to call security_sb_show_options. >> >> For finding the super block that you are going to mount the LSM mount >> options are not relevant. Even nfs will not want to set those early as >> they do not help determine the nfs super block. So the only place where >> there is anything interesting in my api is in reading back the security >> options so they can be compared to the options the mounter is setting. >> >> I will add the missing call to security_sb_show_options which is enough >> to fix selinux. Unfortunately smack does not currently implement >> .sb_show_options. Not implementing smack_sb_show_options means >> /proc/mounts fails to match /etc/mtab which is a bug and it is likely >> a real workd bug for the people who use smack and don't want to depend >> on /etc/mtab, or are transitioning away from it. >> >> Casey do you want to implement smack_sb_show_options or should I put it >> on my todo list? > > Oh. I should add that I am always parsing the LSM mount options out so > that there is not a chance of the individual filesystems implementing > comflicting options even when there are no LSMs active. Without that I > am afraid we run the risk of having LSM mount otions in conflict with > ordinary filesystems options at some point and by the time we discover > it it would start introducing filesystem regressions. > > That does help with stack though as there is no fundamental reason only > one LSM could process mount options. Sigh. I just realized that there is a smack variant of the bug I am working to fix. smack on remount does not fail if you change the smack mount options. It just silently ignores the smack mount options. Which is exactly the same poor interaction with userspace that has surprised user space and caused CVEs. How much do you think the smack users will care if you start verifying that if smack options are present in remount that they are unchanged from mount? I suspect the smack userbase is small enough, and the corner case is crazy enough we can fix this poor communication by smack. Otherwise it looks like there needs to be a new security hook so old and new remounts can be distinguished by the LSMs, and smack can be fixed in the new version. Eric