Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6220700rwi; Tue, 18 Oct 2022 09:30:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/ihlOoT9LU+r4kkc9JmmtAgWqhVXD5df76CwBi26Cm4ZBiiRcxiceFjIcWiRdy6xPKJl6 X-Received: by 2002:a17:907:70b:b0:740:ef93:2ffb with SMTP id xb11-20020a170907070b00b00740ef932ffbmr3114616ejb.93.1666110659300; Tue, 18 Oct 2022 09:30:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666110659; cv=none; d=google.com; s=arc-20160816; b=b782NJOKjAQjCz4X3Yu8xlcuEpIL1VZSlEOab8AhLJvwpSbiw1O6QygTL7WA+Mpckb w7BRb5PruhMYZ6rqo5sRbfRSI0jlnp1CodT2uh711mzMPS5CqpPgntjtYDBvKC4CcVGK CAmvQgo9SdAwZ5iSXHtRE2/V2I30zTUUo8YDXFZKCWT7bzDxGQVf+GQk1Jjjbx6i1o8y MbVqWX4FhrdvwaPHHUXpnLTolqy2oF+pHyBHfBJJNyy9S/zJNgFh5UL5gtZycExoFV7c OCFzE9T7q0ZWodb5nTTWxn+oabt1nmkl0E6ue5RHYyPufN9MQWMaS0o1Rw8L5LqpfAf8 5XcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ceuJAwNdywqeGq5mgXWKkZzXbpQvQEXjRi5CoKJf7qQ=; b=sQQl6REC2d9ZyRdH7/rigTM68iHykaLBrvvpoxmKbmTNwM2VgIzm/Eh733VbzlVvot b6oHFSf/TWgEM3ka+f/9d7SIF7cejkjnt1L4aqhVZRaDvaTRS+mMZi+ZtOK4r7or0hsJ cfLA1m31r3XJqoBpNfgzEZ9542WFYQNIW6Y5b590xfwHWZk+LlD7O/Qe01uy+G62oQy8 RU2BPxANXWNdm/H2yfl+4Cz50n0tFYnK+HGSpKOM4yoGhLeCwQ1+MIuncmywzo4Y5K3a yEdZt7Xaw0LAdSFy+wt6wrhbE+BG2e4bYVE+EyjUpTlU2mfwM+6w+yF1wAj7QagNofXN 9XiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b="d//1P7UD"; 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 js8-20020a17090797c800b0078de8494d17si13241545ejc.472.2022.10.18.09.30.33; Tue, 18 Oct 2022 09:30:59 -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=@digikod.net header.s=20191114 header.b="d//1P7UD"; 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 S230151AbiJRPcL (ORCPT + 99 others); Tue, 18 Oct 2022 11:32:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230323AbiJRPcI (ORCPT ); Tue, 18 Oct 2022 11:32:08 -0400 Received: from smtp-42ab.mail.infomaniak.ch (smtp-42ab.mail.infomaniak.ch [IPv6:2001:1600:3:17::42ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38F3D4F38F for ; Tue, 18 Oct 2022 08:32:04 -0700 (PDT) Received: from smtp-2-0000.mail.infomaniak.ch (unknown [10.5.36.107]) by smtp-2-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4MsHsZ163mzMqN0w; Tue, 18 Oct 2022 17:32:02 +0200 (CEST) Received: from ns3096276.ip-94-23-54.eu (unknown [23.97.221.149]) by smtp-2-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4MsHsX4RHJzMppDd; Tue, 18 Oct 2022 17:32:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1666107122; bh=nHmKfmaafXkFdZ1cKaSMwMPaalSNB93vBG08IP5ymEI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=d//1P7UDlfmXbLfumG+7GpwG1gBkOSiMcd7vK+r3gwZgQAcSVhG6f6IwKYD1ZZ14d jqolszIvuEQVXfMRDyH0EwIRyfEYgrtiqXAxlJDrhSuFRhyTkFDamwfwwcejzkTA09 0osNI20uMpVmFVF26H9VTbG+/aGTP8ScmL90w/3A= Message-ID: <0a8f21a6-02de-36f0-7613-06ed3daf934b@digikod.net> Date: Tue, 18 Oct 2022 17:31:59 +0200 MIME-Version: 1.0 User-Agent: Subject: Re: [PATCH 0/9] integrity: Move hooks into LSM Content-Language: en-US To: Kees Cook , Mimi Zohar Cc: Paul Moore , KP Singh , Casey Schaufler , John Johansen , James Morris , linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-integrity@vger.kernel.org, linux-hardening@vger.kernel.org, Roberto Sassu References: <20221013222702.never.990-kees@kernel.org> From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= In-Reply-To: <20221013222702.never.990-kees@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 There is a complementary patch series that didn't received review: https://lore.kernel.org/all/20210427113732.471066-1-roberto.sassu@huawei.com/ On 14/10/2022 00:36, Kees Cook wrote: > Hi, > > It's been over 4 years since LSM stack was introduced. The integrity > subsystem is long overdue for moving to this infrastructure. Here's my > first pass at converting integrity and ima (and some of evm) into LSM > hooks. This should be enough of an example to finish evm, and introduce > the missing hooks for both. For example, after this, it looks like ima > only has a couple places it's still doing things outside of the LSM. At > least these stood out: > > fs/namei.c: ima_post_create_tmpfile(mnt_userns, inode); > fs/namei.c: ima_post_path_mknod(mnt_userns, dentry); > > Mimi, can you please take this series and finish the conversion for > what's missing in ima and evm? > > I would also call attention to "175 insertions(+), 240 deletions(-)" -- > as expected, this is a net reduction in code. > > Thanks! > > -Kees > > Kees Cook (9): > integrity: Prepare for having "ima" and "evm" available in "integrity" > LSM > security: Move trivial IMA hooks into LSM > ima: Move xattr hooks into LSM > ima: Move ima_file_free() into LSM > LSM: Introduce inode_post_setattr hook > fs: Introduce file_to_perms() helper > ima: Move ima_file_check() into LSM > integrity: Move trivial hooks into LSM > integrity: Move integrity_inode_get() out of global header > > fs/attr.c | 3 +- > fs/file_table.c | 1 - > fs/namei.c | 2 - > fs/nfsd/vfs.c | 6 -- > include/linux/evm.h | 6 -- > include/linux/fs.h | 22 +++++++ > include/linux/ima.h | 87 --------------------------- > include/linux/integrity.h | 30 +-------- > include/linux/lsm_hook_defs.h | 3 + > security/Kconfig | 10 +-- > security/apparmor/include/file.h | 18 ++---- > security/integrity/evm/evm_main.c | 14 ++++- > security/integrity/iint.c | 28 +++++++-- > security/integrity/ima/ima.h | 12 ++++ > security/integrity/ima/ima_appraise.c | 21 +++++-- > security/integrity/ima/ima_main.c | 66 ++++++++++++++------ > security/integrity/integrity.h | 8 +++ > security/security.c | 78 ++++++------------------ > 18 files changed, 175 insertions(+), 240 deletions(-) >