Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1513656rwb; Tue, 27 Sep 2022 14:24:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5RtJx7EYk1nn2xrFNov8XIo7FhhAyLB/rq/F66cWqMflWC3rKZUfMJMBGSsiIprFy2z2vy X-Received: by 2002:a17:902:d58d:b0:176:da94:e6f7 with SMTP id k13-20020a170902d58d00b00176da94e6f7mr29262092plh.11.1664313886250; Tue, 27 Sep 2022 14:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664313886; cv=none; d=google.com; s=arc-20160816; b=ZVIaAiURTd2Omw5Bv1P6iJ4zUJwMWvnZeYFklVKz2Zz1AMxwgJ+MWKQzP12Ywyxz/e cqFQND6ZJZBdnq3LPidLXIsscRu0yhH+m2IeLseO+MhYW5BSxkNX1FaocOlFTmfhgnu/ A9InPm6492307Po4uIIUK7rSrN3q9TnqnkStbZmoNYY0jMmpQepwMSwAhbtqF59WlYw/ gUL842cm7jDazvS8nE/4dlw2/8Q4mIu7IwzoS1U9mDtZYKINvbvHAMvGFjiP2fR81lHH 9xFLtCoHtwi73ks1GMtT9DMk5rtTPdjVjDe1aAIWqB+yHidmw1KuNhFVjK2V1aHXCrKt iEGw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rYxxCr1vY4SS1ZjcTEiLgKsS7D/yNtgX53qXB2wQNf4=; b=x7xoJvJe0DCOcSIddqiJCdezF5mUC013C9BcGhAVjmA93r8QtVJq5mhmMaoX5C0t0W fTWmXGgAkpqvQBmLq6KCvG/rgapTCSAw+1i0pbmOtRgDytgXtbrdDPZlG20/YPUsCAB7 UwYVzhHHiHCKTfM3wuXnNSf31FyZUOnvP56DOjNPtJPcg4TxF4l95cNwel3mOmeQneyY ImbjUs/dx7hrIq7FdbZn9gFsljd4Uu5vZazSL6K96ne0MlnFV4fYQYYqsDjXJ7iQGEbJ yJnFKQsHIzxCv+gX9efAEEYEemtwW8fNxjcleAtQgZhTNvQ+KJwI8ZQMg96Tir8fIAmF LwDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=r6NEBmSe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a9-20020a056a000c8900b0052ab37ed70asi658670pfv.57.2022.09.27.14.24.34; Tue, 27 Sep 2022 14:24:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=r6NEBmSe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233009AbiI0UL5 (ORCPT + 99 others); Tue, 27 Sep 2022 16:11:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232590AbiI0ULf (ORCPT ); Tue, 27 Sep 2022 16:11:35 -0400 Received: from sonic308-15.consmr.mail.ne1.yahoo.com (sonic308-15.consmr.mail.ne1.yahoo.com [66.163.187.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E62E33AB30 for ; Tue, 27 Sep 2022 13:10:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1664309450; bh=rYxxCr1vY4SS1ZjcTEiLgKsS7D/yNtgX53qXB2wQNf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=r6NEBmSelYdXqWHpNna0y3jPLZUR474cRsEx92IGBZ99KcwkeEymTRq6r2RVzxdENRSWEfm95VZ2HozTA0NYPBnZe6upWD9xJPjjVofE+aC+D0zenzs03XqM2XrAFUTK0wdAjrS+BvpuRwBPJwP9GIS4a2bPcHjZmz6iIBPQ1N9Tam5yJfsM4pmY2MqDJieoSSbQcj+fHDbgAap/tVTDfqtNDuK3GHk3/goWnHfXU1b5hVTQbN3dTOlEL/g500TqJZv1dNSxG83pae84LwSSXglDJ9fQgFi6rTWglHszvN8BeI+VcQEiFndT7yMmU/BS/9KdhfPzMFeu6KY+Rfbygg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1664309450; bh=Pm78uT9GOCBV/z8p/R0bTSuyKxTpmx6NZc1YqKL+qrm=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=FlX25q0yk+u5QLzXqlpB5jE9/pFfL/8XM/+rCZzsz2GBdD2KfYUwm0g2crqv4F8my2dqI4AHasU6+WUClxyFw894Jpevqn5JZx+L/6kP9Vuq4tIXIFTp99UJ+HNvF+YeYeXRWxTUKD403K2K5UCz0WUCHmqzb5awJ3cpP1q04V9CIHN2usuRK6XWbdjA7uL8i+QElZXPHaWq9EwGjgf4MjQWbqlDY9/y/cgsuszuyne2pqX0okb7EXRWmes/kUY1BfvDk2DH19XKSyc+XqYO6fPZNRHzqKjnQMgtO+BMGZycE/exnEvPnimSIYvMO+J2R0A1rkJTJrtzjy4iu2SqFQ== X-YMail-OSG: H8mhBNUVM1lTvWe4r3SvyNsoU1BebnK8RaDhI96IPcxJQuWqz37MOitw0oxocmP e6hbrbAC_jZna61CsFeOavOPI5.Nd1pV.v9zKyUW6QKZhfOF6HHxxO0Ckq7CE7MYyHKmkjC0Hsw2 YQZtJhvsaVtfysq7rNJKuVHqmwfgC.RiLvpu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Evm5T.uc5wwCk57LRhmrsqSXU9m2mdFbPOZ.M- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.ne1.yahoo.com with HTTP; Tue, 27 Sep 2022 20:10:50 +0000 Received: by hermes--production-gq1-7dfd88c84d-nvfk6 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 55a7229bea084bb6b28fa3beefd2f4cd; Tue, 27 Sep 2022 20:10:47 +0000 (UTC) From: Casey Schaufler To: casey.schaufler@intel.com, paul@paul-moore.com, linux-security-module@vger.kernel.org Cc: casey@schaufler-ca.com, linux-audit@redhat.com, jmorris@namei.org, selinux@vger.kernel.org, keescook@chromium.org, john.johansen@canonical.com, penguin-kernel@i-love.sakura.ne.jp, stephen.smalley.work@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH v38 31/39] LSM: Add a function to report multiple LSMs Date: Tue, 27 Sep 2022 12:54:13 -0700 Message-Id: <20220927195421.14713-32-casey@schaufler-ca.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220927195421.14713-1-casey@schaufler-ca.com> References: <20220927195421.14713-1-casey@schaufler-ca.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Add a new boolean function lsm_multiple_contexts() to identify when multiple security modules provide security context strings. Signed-off-by: Casey Schaufler Acked-by: Paul Moore Reviewed-by: John Johansen --- include/linux/security.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/security.h b/include/linux/security.h index 170b303e9122..c190b9189287 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -262,6 +262,15 @@ static inline const char *lsm_slot_to_name(int slot) } #endif +static inline bool lsm_multiple_contexts(void) +{ +#ifdef CONFIG_SECURITY + return lsm_slot_to_name(1) != NULL; +#else + return false; +#endif +} + /** * lsmblob_value - find the first non-zero value in an lsmblob structure. * @blob: Pointer to the data -- 2.37.3