Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5959312pxb; Mon, 14 Feb 2022 11:43:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcq+/sHFjTYCavaeqx4HdpR7y1rBwi7zNyREENwZJLh79qNc1y2GGQL3b+92pMJtbQxwC+ X-Received: by 2002:a17:90b:3e85:: with SMTP id rj5mr203130pjb.65.1644867794136; Mon, 14 Feb 2022 11:43:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644867794; cv=none; d=google.com; s=arc-20160816; b=EC9AnAo9K86QtJq67UtlXYNx8mGI/w9IYuWzuWUJb6HTQGM6z50D1P32xSLRvsvO9D 7uJcKrVXypboJdwSjFw2l1dMIXumouzDAnCw5eijB8yx3dZo9oP4oyPpmNeKu4Xb08jI eg/SqlIVWoWmCR3z+f4mfQDYsYSyeRuUd5SbYvwKITTxR06kLocVai0IQa58CrG/4lcW ZfjR+a0PKqc9d2zn4FRsSt0Czw26TXIuVwkBbQVS3D4DukcMGj9D4DIscXdKBsojivQS EThqn5b4SxUzIIcowoJ1Ct2JdcjbP78L4Knt+2qHRHLncQ5DOkSHWSkdMEwE2iP2rGuz TUdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DoGk55/Bsm2Tq8tnmxTPkJC2eteP6g/NAH0jYuUbpZ4=; b=xc+4UizRy5eGOTWNqH47+fzWsCt5JSL5eYZOM5QkGyl3AdJjIdrhJoFBSV0aece0wS Xu94KQTCLuJnX4f/X8vckIhKyQLcBBrmbQ+WHCJve2hzVtUOPzSJUgWmMJ81oKvRXzwW yrXXd6Qb/Y+5rwCBYTVPxU6FwKfSrRaOLvzxmEEo+scggs/YG3lcqgLshPWk/8XCCf6k IZ45yemOEDdGCKLo+NmseGybJwGdzB3XSNIwwi5ZibBubnmunydt7HWiAs7YZXcjpzKd 108WZcMNVGRVtrKxEagpemH8AtWNyq6nyCfmnd6Fp33W0p0Fp3uOt5scJAkMH4SFwknw 5bmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TyHoLvy9; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y22si13142434pll.259.2022.02.14.11.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 11:43:14 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TyHoLvy9; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4127EDCE31; Mon, 14 Feb 2022 11:28:21 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245290AbiBNJtk (ORCPT + 99 others); Mon, 14 Feb 2022 04:49:40 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343994AbiBNJqf (ORCPT ); Mon, 14 Feb 2022 04:46:35 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 365C86AA6D; Mon, 14 Feb 2022 01:40:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A2C9611DF; Mon, 14 Feb 2022 09:40:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76699C340EF; Mon, 14 Feb 2022 09:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644831604; bh=n1qsIm72eVmDCyK2h8ZoQhDWe6tCmwaW4bloGcFk00g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TyHoLvy9V7BLZkEnTEn3OKb32zXUWyGBlrJMWfP7LUWMX5hyzBS6TMr/4MAMq8nao cUSaH0SCXOS28yzz2/GLvgIGbLt+5FSJaEVOQnaMKXYkpI0+Vlz1YcInBasAaLjOSt duPmVkesE1TpbmevbwIoN0Z57vjVDx0E5zJcRjBc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Berger , Christian Brauner , Mimi Zohar Subject: [PATCH 5.10 004/116] ima: Do not print policy rule with inactive LSM labels Date: Mon, 14 Feb 2022 10:25:03 +0100 Message-Id: <20220214092458.828412636@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092458.668376521@linuxfoundation.org> References: <20220214092458.668376521@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefan Berger commit 89677197ae709eb1ab3646952c44f6a171c9e74c upstream. Before printing a policy rule scan for inactive LSM labels in the policy rule. Inactive LSM labels are identified by args_p != NULL and rule == NULL. Fixes: 483ec26eed42 ("ima: ima/lsm policy rule loading logic bug fixes") Signed-off-by: Stefan Berger Cc: # v5.6+ Acked-by: Christian Brauner [zohar@linux.ibm.com: Updated "Fixes" tag] Signed-off-by: Mimi Zohar Signed-off-by: Greg Kroah-Hartman --- security/integrity/ima/ima_policy.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -1636,6 +1636,14 @@ int ima_policy_show(struct seq_file *m, rcu_read_lock(); + /* Do not print rules with inactive LSM labels */ + for (i = 0; i < MAX_LSM_RULES; i++) { + if (entry->lsm[i].args_p && !entry->lsm[i].rule) { + rcu_read_unlock(); + return 0; + } + } + if (entry->action & MEASURE) seq_puts(m, pt(Opt_measure)); if (entry->action & DONT_MEASURE)