Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp877489pxb; Tue, 1 Feb 2022 12:16:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwc95OEdjvUiAp6luDs2TBr0194nWqPvoC1k4lIqJciF7cJeJSMlStjXaiaRUwDDZqjJotM X-Received: by 2002:a17:903:1c4:: with SMTP id e4mr27300964plh.75.1643746567100; Tue, 01 Feb 2022 12:16:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643746567; cv=none; d=google.com; s=arc-20160816; b=sTNhbYeBD8RZaOf/jSA99iHHbZCUGFxAmWgsAapm1zGxPQQd3WL7VvpFu4Ox8kg+02 wgw3IyoXYmEXf29FKG7kxkgJEZWI8qgH92VHfbHB8dPMq0XtITAzMSICRhaIlqAfmjZ4 YyJAVdmNNmg7LlEk5JLu5PkFa8TfSlet+Pf6svi6nUQLhYNFFhC0OCalVEmJdWbIWvWm vouqlWI0R4EMKwji3F3dW0iea3Z/sKmKJc62skmgPA+fGqadPByBEvu1bFFeMt5ydxWN pkB32ZNlojTFexiAZ8k/1mkyLbuJoF8QX87S5NpcZZZtU70HXpAY5GL54q5M02JEOuSX Zlkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=xbb7oKj7pGqcFFQvVLEG96fF5LM89XRk6kAiNWwlPYQ=; b=rafEwwFS4Uq34p7Ttl2Ai5CCZvl4slcHNdJumlqjskzV5HdOTvKDZtgkeH4zhA8YHH x0+SEH5zOiQap659LLTcwkve4CAncBQK+ZNTOAXAnGtsu8mrQR51TW0T6jtuMaE2LF0s xXmxql3ZLMxQAkVFJMuRfpnKMVZpz24Dae51vymWMVWD5ZpKiDgiHIxv1h7PK7+5sOnT DlAWMCLyvdrXbcvNTmBFEfFI89Z0T7bomg/1DvM/1viHb3e2w2cDKl5usUapONGkvsuh e2SvZ7uAURYrFqeVMTBKfChHImWFySgPh2Y+bCCzhw8IWMwsV+/Rmpf/l1h16du/IyMH 5LAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=M0Ar9MCO; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q76si16704107pgq.694.2022.02.01.12.15.45; Tue, 01 Feb 2022 12:16:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=M0Ar9MCO; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378080AbiAaMqw (ORCPT + 99 others); Mon, 31 Jan 2022 07:46:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:38167 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378085AbiAaMqw (ORCPT ); Mon, 31 Jan 2022 07:46:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643633211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xbb7oKj7pGqcFFQvVLEG96fF5LM89XRk6kAiNWwlPYQ=; b=M0Ar9MCOE2xJFnUP6eN2Hp8grewCNTM0SrC2DaNhW1UN03H1NibZnGy1zlAST681H7X58y H8JhYBvuHOAgEbsY/zX1bmGN3PLpfiRBwJaa6OTw7dXwXx2NHHZvYkmY0+C30O/sqc4z+Z eDu+SOpFgw0W9YloCeFsJ0m2a5CSzXc= Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-517-Fko0tQaWNpaB8obDNdFXow-1; Mon, 31 Jan 2022 07:46:50 -0500 X-MC-Unique: Fko0tQaWNpaB8obDNdFXow-1 Received: by mail-yb1-f198.google.com with SMTP id i203-20020a253bd4000000b006195f020a0cso14627784yba.14 for ; Mon, 31 Jan 2022 04:46:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xbb7oKj7pGqcFFQvVLEG96fF5LM89XRk6kAiNWwlPYQ=; b=Q03xrkY8Qt9L+ax+cUpAwEk8Y6/ieIugCVwmcxyqhMf5iWffdo66GyQYyU9IzAZPvn PIQSjqw3N9BYnJqGV++cTQlO6R00P/VDMXicLp+cm7/UAJNEYmA35XnLDfDhmL3TSVAu 7vN+oqFo+L8WFhOwaYx1/aKWbi7G5eSIMbbHkeVRN9OYv3hQs6wIKQy3LJMAahBdzjZM pGgeiBth2FSSqgpnJKVnt+aeNAaESK5eK7Xx3dG+uy0gPEsMsKES6/6VUbcJJ6167bZq 6JqE8eWSgbjhH7NKTP36eufR+N2hhX5uifV2krIzTn65HYWWd8mV5nzuFxEdVyyAgUfn GOyg== X-Gm-Message-State: AOAM532awNOItO3DbBpzAs+OZ7++IWsNH/wTJHkyC7BQ7Ft+9RWiodEF dDZXYSxKjuXLN9So2z6ZqMtQ9QHBB2z1nTGqK0eK6KN7tJQpli8CY2+qnQjabQX8Oas3kvcGdm9 JQyItXAs/0eqr1LJMvALbYZcpkSPXXyAv5/UM X-Received: by 2002:a25:b003:: with SMTP id q3mr26931227ybf.767.1643633209483; Mon, 31 Jan 2022 04:46:49 -0800 (PST) X-Received: by 2002:a25:b003:: with SMTP id q3mr26931208ybf.767.1643633209321; Mon, 31 Jan 2022 04:46:49 -0800 (PST) MIME-Version: 1.0 References: <20220120214948.3637895-1-smayhew@redhat.com> <20220120214948.3637895-2-smayhew@redhat.com> In-Reply-To: From: Ondrej Mosnacek Date: Mon, 31 Jan 2022 13:46:32 +0100 Message-ID: Subject: Re: [PATCH RFC v2 1/2] selinux: Fix selinux_sb_mnt_opts_compat() To: Paul Moore Cc: Scott Mayhew , SElinux list , linux-nfs , Linux kernel mailing list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Fri, Jan 28, 2022 at 3:28 AM Paul Moore wrote: > On Thu, Jan 27, 2022 at 4:54 AM Ondrej Mosnacek wrote: > > I wonder if we could make this all much simpler by *always* doing the > > label parsing in selinux_add_opt() and just returning an error when > > !selinux_initialized(&selinux_state). Before the new mount API, mount > > options were always passed directly to the mount(2) syscall, so it > > wasn't possible to pass any SELinux mount options before the SELinux > > policy was loaded. I don't see why we need to jump through hoops here > > just to support this pseudo-feature of stashing an unparsed label into > > an fs_context before policy is loaded... Userspace should never need > > to do that. > > I could agree with that, although part of my mind is a little nervous > about the "userspace should *never* ..." because that always seems to > bite us. Although I'm struggling to think of a case where userspace > would need to set explicit SELinux mount options without having a > policy loaded. I get that, but IMO this is enough of an odd "use case" that I wouldn't worry too much. To be affected by this, someone would need to: 1. Use the new mount API, which: a) doesn't even have man pages yet, b) isn't even used by the mount(8) utility yet. 2. Call fsconfig(2) with a SELinux mount option before policy is loaded. 3. Call fsmount(2) with the same fd after policy is loaded. And racing with the policy load doesn't count - that could fail randomly with or without the change. I honestly can't imagine any realistic scenario where someone would do this... -- Ondrej Mosnacek Software Engineer, Linux Security - SELinux kernel Red Hat, Inc.