Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp637935img; Fri, 22 Mar 2019 05:40:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPAAO1S0pF+/M6caYPfOIWXpEZsh2+k2KaHp4XGBh47nfC7f3UICL++4UKUzkJcb+RD4xf X-Received: by 2002:a63:c242:: with SMTP id l2mr8755859pgg.138.1553258411598; Fri, 22 Mar 2019 05:40:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553258411; cv=none; d=google.com; s=arc-20160816; b=0et6mB/dUx5DJFAOhf6VwJR7Ft1NyhKN32drZ7fUS8Y4fkSgrHG6yRcLvhMnL7BHDK kqyXL2ok8fW/cP4EGJRtLiZbCldnaPfS5/9RLEAOtqcTlRsIsi529mzKFzhsHfTIHAw2 AVZMNQnhW1EL57dZKytqCwQ4yeLQBfKilgWjBtFbuVmnzTu3FLn0+oHIwC3mBzSyN9d6 ryCj2hh61p/gMeQgRnZEBZ+Lh1eQ9StHBUzcnNA1pTaNR2m7AuI260HRfgyg4cvx25xN VSeebLY5J4qb5u1afI6OW/+nHU1YmTegUyIyVQPvrBnL/1f3O4bxgHwby6oVX5KCjjc7 u7AQ== 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=j9NGbZRI8jIJgHOFIXXGVdOc+FD+9QTvTfxKZbp/J48=; b=BSZPa/TZs/gZI3zB32ap4nXTfiNE9wQzJXtY53ZVspQKm4hOMLVwH87cLSHtggAKGN Ai2iapjXtoT3YcRjFpo3e6UgEbYYcKiKA214IVt+CQbtCSu9g6GGBuues4TeZKHucVKX Fg+3jVtUc8QeZyYxNr38gH14Ih8d4U48SePX7ZdbRoXdfk8bbFl8p0mnxDpjInN3Oyrh WWLGPsE1wsITKFRuPDdCwnlRlQ5K5AnDGVmM0cmk/KjrGcSdsQZiulUzoAMBl7G4jr6Q L85oPI8ToBsZeAOJDmLoBB2sRYKd/LEsHfwJyMUOmrJikoNCDeHwCO60yoqvXP1/KoKj QqHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2HinUOlL; 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 b4si6874384pls.231.2019.03.22.05.39.56; Fri, 22 Mar 2019 05:40:11 -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=2HinUOlL; 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 S2388648AbfCVMjY (ORCPT + 99 others); Fri, 22 Mar 2019 08:39:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:46158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388661AbfCVMHp (ORCPT ); Fri, 22 Mar 2019 08:07:45 -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 B9D5B21929; Fri, 22 Mar 2019 12:07:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553256465; bh=aYZHFHgeVdl2GRbo3j+Fk6Ms5tBe1gFHYCnTkzknYzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2HinUOlL4XPPXteI0dWR8m0OfTe0l/dueRZ3HXa3/TDoTvlMaxtWkSKVhYNY9q92j TYJTvTnG6EBmt3VomvDHY32uuKYlC/kpQ4+8Nm8o14LZ4kEkFlKuInWlXyMRqz07ui DWbFzekGOp2Z2tHNSa+2WlFjHQy1XpJvJEJeP5EI= 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.19 220/280] security/selinux: fix SECURITY_LSM_NATIVE_LABELS on reused superblock Date: Fri, 22 Mar 2019 12:16:13 +0100 Message-Id: <20190322111334.762993193@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111306.356185024@linuxfoundation.org> References: <20190322111306.356185024@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.19-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 @@ -1034,8 +1034,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);