Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp647213img; Fri, 22 Mar 2019 05:52:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDjfVX6OOxw0LNustOGEEo+O+4DXKLevmt9cAmX8nYi+AemgDduWrccjCAevST3vp3xmjD X-Received: by 2002:a17:902:32b:: with SMTP id 40mr9030971pld.122.1553259162353; Fri, 22 Mar 2019 05:52:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553259162; cv=none; d=google.com; s=arc-20160816; b=CLHK0fpm5YDPlzV6U5326TJRYhKcJ12BsI3MyI1f5i3RZ7p5fBE/tMT7NiLdj8WSwg 0mDW0z1FNB4dRGzpKzK/54B7f0xTW3he72xpYA2/3c3Sm0PuTfYcwIVTKR0KB1BKvjSz BRQfQF/yYriRjqTYATt5/Zfm4uCwpLla6BgPO66dUxMutk5wOqKNDhfGDjIuicyBB2Yf YvvTKFykRxJEJWbJO2EoYFF4111wmZyVGLSexEcz6nzwWdb7/EOAFwD+bEHstWoenYA7 IQmpntg82dtUcwtNXOi0AjNlDkm948pl4DBxm4nuK7hJp9kOERksOd237qPcS8zMPiDp 8TGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VJGcBzgoZZ4t8oqhRPAki7+ui1GRfqnW15pWCFM6/Bw=; b=E1X8SJlpuEK1RCmCy1r1E54TfVeHGPgKgs2hOnKEZkmimLguDooNREKxVXCOfyClhr zvm0LZYVXp+XEvMAjiUs3+X2BbxcotXvYhmJUMzaPZjn8E6GsRX1dMCcWLpRX7+y6joJ eE8BfZgeMN8qsB9mXGV2aMJTAiE/Jrk/rOu6p9Yc9otVPdjHgrIlzvvPWGwuChX1OsBc gpy1f9DSPyIXMdamRJYzsmAXhlDKkFoGIqL9Tnm7jHi/SFuspN8MtzcXo8CWIcIjm9iV bkxFPYqfIeSkX5uIXPtv9sXsg7rirfzYYA2HIANdGuLIqa2PhNOJBfaWzlQogVsle3rU V5eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=X51iUNh6; 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 f2si6735416pgv.10.2019.03.22.05.52.27; Fri, 22 Mar 2019 05:52:42 -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; dkim=pass header.i=@kernel.org header.s=default header.b=X51iUNh6; 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 S1733207AbfCVMvu (ORCPT + 99 others); Fri, 22 Mar 2019 08:51:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:58498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732779AbfCVLyI (ORCPT ); Fri, 22 Mar 2019 07:54:08 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3FB372192C; Fri, 22 Mar 2019 11:54:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553255647; bh=4V6VNYuJw8MAPLpKtwwTLmBGr3vw6nL5a3WY3y3yi3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X51iUNh6+6sGS3gXuIuIyoR/fqqIOtACZqa7mTTQU/F4mLctaB37Mb2flA/VE9f2I d3tWsa/tlWsWZmNW/SCNESzubzgmeCxj+ef2o4dzohxSNgnUng3sREcHcr2nXlLT+Z sWilccs4BbPoO4BXQ03OMHSm+4Uvn0xYXVVJ2FBI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Scott Mayhew , "J. Bruce Fields" , Stephen Smalley , Paul Moore Subject: [PATCH 4.14 137/183] security/selinux: fix SECURITY_LSM_NATIVE_LABELS on reused superblock Date: Fri, 22 Mar 2019 12:16:05 +0100 Message-Id: <20190322111251.684562973@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111241.819468003@linuxfoundation.org> References: <20190322111241.819468003@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: J. Bruce Fields commit 3815a245b50124f0865415dcb606a034e97494d4 upstream. In the case when we're reusing a superblock, selinux_sb_clone_mnt_opts() fails to set set_kern_flags, with the result that nfs_clone_sb_security() incorrectly clears NFS_CAP_SECURITY_LABEL. The result is that if you mount the same NFS filesystem twice, NFS security labels are turned off, even if they would work fine if you mounted the filesystem only once. ("fixes" may be not exactly the right tag, it may be more like "fixed-other-cases-but-missed-this-one".) Cc: Scott Mayhew Cc: stable@vger.kernel.org Fixes: 0b4d3452b8b4 "security/selinux: allow security_sb_clone_mnt_opts..." Signed-off-by: J. Bruce Fields Acked-by: Stephen Smalley Signed-off-by: Paul Moore Signed-off-by: Greg Kroah-Hartman --- security/selinux/hooks.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -1000,8 +1000,11 @@ static int selinux_sb_clone_mnt_opts(con BUG_ON(!(oldsbsec->flags & SE_SBINITIALIZED)); /* if fs is reusing a sb, make sure that the contexts match */ - if (newsbsec->flags & SE_SBINITIALIZED) + if (newsbsec->flags & SE_SBINITIALIZED) { + if ((kern_flags & SECURITY_LSM_NATIVE_LABELS) && !set_context) + *set_kern_flags |= SECURITY_LSM_NATIVE_LABELS; return selinux_cmp_sb_context(oldsb, newsb); + } mutex_lock(&newsbsec->lock);