Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp890522iol; Thu, 9 Jun 2022 16:50:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCo1yP6iLpqUGtHCnNTz/VZgcUdJH/v71qRAwkO0TBU8GAu+wIPnIiHuZRh4X/RsRdOERX X-Received: by 2002:a17:906:482:b0:6fe:86fa:a5c5 with SMTP id f2-20020a170906048200b006fe86faa5c5mr38157687eja.28.1654818636954; Thu, 09 Jun 2022 16:50:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654818636; cv=none; d=google.com; s=arc-20160816; b=TEf8QLJKQoYVGJT6b0QsfwQABYK3kIr23k0kdSKI0xSL2eh/4RiFdcEzCdD0vEEVk1 Jj5kOWEeVzVlKlTuzLnuIA7p2SVd7x5M+zDOAtBuZ3vhZ2rUYIGdBnleGnpslXm3QCVT ydVqI+ECVKC7QABuYumHQ/HGA9ZKSIh9kGUf+Cj9nck36qqhD1QcFDKGo5fRqm57kaYW thv6ZldDjhHY+DWnw2gx1t7OqDD0VK6C4ysT8GgIFDjU/1vU9yMRsvARjIdq6TjrGKeV pet61RhF+4yAVmb1v0TNdSF/3PwlOO+ODDQ4wwq3Md9V6LW5CRim3TGUR2qFE69zCUxe G20g== 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=eDmXp3ZuBjTXOBmPYv4mZcQYx/eWv5XhoC0gtLTeZ6I=; b=re09gi9GspOClJgvB7IJX/y3DiDyVROcazeXZQnPOETBynZ74q9nfCrJ6elqE8oYw9 Vy9Unophalu+xCYDmEaSxBTcOad0hU+YYv6uwEQshEKzRul4lsST7Jw57M6Bcfl/DM5S DaXBc25a783uuYrNXPUYznBu5UCgbPylVjjKJ1hii3c4fzDuedqDhftl1fbZaLY4RJnc Rgtojx+O4/wz/5/Cb/DGvFNB+0m6EWUqFBymPmRrunT6mOQuQasxrIuOHXgpJUDGBUjT fgxZzIzAl6PDFNVn0eZJS2mtcBllR/acXXzwnaJKwq4hy5hVEDAox8t94jrc0hisR/DG Pqqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b="U176/tiD"; 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 be19-20020a0564021a3300b0042aa0dfeccasi22496521edb.354.2022.06.09.16.50.11; Thu, 09 Jun 2022 16:50:36 -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="U176/tiD"; 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 S1345987AbiFIXPL (ORCPT + 99 others); Thu, 9 Jun 2022 19:15:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231691AbiFIXPB (ORCPT ); Thu, 9 Jun 2022 19:15:01 -0400 Received: from sonic301-38.consmr.mail.ne1.yahoo.com (sonic301-38.consmr.mail.ne1.yahoo.com [66.163.184.207]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDEE1114AA8 for ; Thu, 9 Jun 2022 16:14:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1654816499; bh=eDmXp3ZuBjTXOBmPYv4mZcQYx/eWv5XhoC0gtLTeZ6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=U176/tiD1hgLfzbcS0eCNK/Ezuc3L7ufu4dnU5uNWon/zcrOUuArzMcYMhVQAy5qw5TzCUef1OhyO12SZh6MuBQO7tqNEpnno7KUzIG7rd6hpRKsKb407Vn3msNOyYrLOAXokExPtrgSFkwg87MKqYwwqL2miRNClFm48hftvj7uRUMqbqxmRT/DGPSga6StWE4m5ZQr18MIfm9K/19AHc3rzbwXiyGuKvyBIhZRIRHzK4oSrua7sEfHTtzPu4wKb1PbAn39rOdCDqOD4fXxjgTdGHust4vtMJotY1D2cI/cejwJgU2zIMsxpTjNr9KWXur77C+i+nfIoezW0apEzg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1654816499; bh=xKe8wJlmbyQ1F9bDZPMHs0gTq3Ktfu2OM+++FszJqRT=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=hx1jd3UF6HohxVktu6kQAAiwMdX65sFHyjZ86NATd36VG0RBHAfm9nGebYCUzqlW7iG6ClR7hiD1dXxZOthA+VsUYWK4b2L6y2YIQ1dZDMkwiW0jEaxRi/jx59NWX9wtt8zRRUHrFyPETa+Of1JVXv5FkJaEVTQKKudem/aPSP4BBq8N36+izrnhFdS9lfhOQfgCjlhsr5QWOgXWPBPDn/5fTjPuZSUjjF242y3E7r9eFvn6eZ2dYHgy2hU00362suwIToQnL/kXqlndkzus5WZwO6RgAVLJ2Js2iA8pSmhkftbXvIjQ4jEl5/DHbMgz1c3+tA91H0CpIz+uUkFTug== X-YMail-OSG: s7GCQBoVM1md9MO2CIbHFQP2m32Ea0bH39Fi5KwKNVQBDfbIJDQGoE0Cjaw_z1Y cm2wao2Eq3wbXfHFDQbnwPUi6Nm8W2Fiw31Xch2CNCgNG2RHNAkOuDB3eC.1x.g7p1u1l7ojJray bGoywYU.kTF5.ffmfcGYtYkjbeB5.WVqqTyyur1IRN.ZsFTeJ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W9haGDD9Pmscn_g avFCQIMnGY.d7eDRWc5Z.klsnoYNQdfS39N.j0ATJoGUGyzEHIpFLg.LQJA-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.ne1.yahoo.com with HTTP; Thu, 9 Jun 2022 23:14:59 +0000 Received: by hermes--canary-production-gq1-54945cc758-dgl4g (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 8f2f82ea5c9f338d52d2410bae995cf8; Thu, 09 Jun 2022 23:14:53 +0000 (UTC) From: Casey Schaufler To: casey.schaufler@intel.com, jmorris@namei.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Cc: casey@schaufler-ca.com, linux-audit@redhat.com, keescook@chromium.org, john.johansen@canonical.com, penguin-kernel@i-love.sakura.ne.jp, paul@paul-moore.com, stephen.smalley.work@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH v36 25/33] LSM: Add a function to report multiple LSMs Date: Thu, 9 Jun 2022 16:01:38 -0700 Message-Id: <20220609230146.319210-26-casey@schaufler-ca.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220609230146.319210-1-casey@schaufler-ca.com> References: <20220609230146.319210-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, T_SCC_BODY_TEXT_LINE autolearn=ham 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 1efd34a8f75f..4cf551133e99 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -234,6 +234,15 @@ static inline bool lsmblob_equal(const struct lsmblob *bloba, extern int lsm_name_to_slot(char *name); extern const char *lsm_slot_to_name(int slot); +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.35.1