From patchwork Fri Mar 10 08:53:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roberto Sassu X-Patchwork-Id: 13168879 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5F4DC6FD1C for ; Fri, 10 Mar 2023 09:01:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231447AbjCJJBT (ORCPT ); Fri, 10 Mar 2023 04:01:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231309AbjCJJAw (ORCPT ); Fri, 10 Mar 2023 04:00:52 -0500 Received: from frasgout11.his.huawei.com (frasgout11.his.huawei.com [14.137.139.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44891F601E; Fri, 10 Mar 2023 00:54:37 -0800 (PST) Received: from mail02.huawei.com (unknown [172.18.147.228]) by frasgout11.his.huawei.com (SkyGuard) with ESMTP id 4PY04p6NqLz9v7H9; Fri, 10 Mar 2023 16:45:46 +0800 (CST) Received: from huaweicloud.com (unknown [10.204.63.22]) by APP2 (Coremail) with SMTP id GxC2BwDnbmUy8ApkK+yFAQ--.17497S2; Fri, 10 Mar 2023 09:54:18 +0100 (CET) From: Roberto Sassu To: zohar@linux.ibm.com, dmitry.kasatkin@gmail.com, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, mic@digikod.net Cc: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, keescook@chromium.org, Roberto Sassu Subject: [PATCH v4 0/3] security: Always enable integrity LSM Date: Fri, 10 Mar 2023 09:53:58 +0100 Message-Id: <20230310085401.1964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E 87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUrR6zUUUUU X-CM-SenderInfo: purev21wro2thvvxqx5xdzvxpfor3voofrz/1tbiAgAMBF1jj4ZrTwABsY X-CFilter-Loop: Reflected Precedence: bulk List-ID: From: Roberto Sassu Since the integrity (including IMA and EVM) functions are currently always called by the LSM infrastructure, and always after all LSMs, formalize these requirements by introducing a new LSM ordering called LSM_ORDER_LAST, and set it for the 'integrity' LSM (patch 1). Consequently, revert commit 92063f3ca73a ("integrity: double check iint_cache was initialized"), as the double check becomes always verified (patch 2), and remove 'integrity' from the list of LSMs in security/Kconfig (patch 3). Changelog v3: - Remove Signed-off-by tag by Mimi (suggested by Paul) - Clarify that an LSM with order LSM_ORDER_FIRST or LSM_ORDER_LAST is always enabled if it is selected in the kernel configuration (suggested by Paul) v2: - Fix commit message in patch 1 (suggested by Mimi) - Bump version of patch 2 (v1 -> v3) to make one patch set - Add patch 3 (suggested by Mimi) v1: - Add comment for LSM_ORDER_LAST definition (suggested by Mimi) - Add Fixes tag (suggested by Mimi) - Do minor corrections in the commit messages (suggested by Mimi and Stefan) Roberto Sassu (3): security: Introduce LSM_ORDER_LAST and set it for the integrity LSM Revert "integrity: double check iint_cache was initialized" security: Remove integrity from the LSM list in Kconfig include/linux/lsm_hooks.h | 1 + security/Kconfig | 16 +++++++++------- security/integrity/iint.c | 9 +-------- security/security.c | 12 +++++++++--- 4 files changed, 20 insertions(+), 18 deletions(-)