From patchwork Wed May 26 00:59:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tushar Sugandhi X-Patchwork-Id: 12280453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FFC8C47087 for ; Wed, 26 May 2021 01:09:56 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D6471613F1 for ; Wed, 26 May 2021 01:09:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D6471613F1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-170-r9GaBI3PN2KbZ9oYRrzUmw-1; Tue, 25 May 2021 21:09:53 -0400 X-MC-Unique: r9GaBI3PN2KbZ9oYRrzUmw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7E8AE80B72A; Wed, 26 May 2021 01:09:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AAAFD687DF; Wed, 26 May 2021 01:09:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A849F1800BB8; Wed, 26 May 2021 01:09:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14Q19iPf020087 for ; Tue, 25 May 2021 21:09:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 168D520287CB; Wed, 26 May 2021 01:09:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 11F802021458 for ; Wed, 26 May 2021 01:09:42 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 18DC2185A79C for ; Wed, 26 May 2021 01:09:42 +0000 (UTC) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by relay.mimecast.com with ESMTP id us-mta-262-tBGNbL45NNeJtu0Dg6DfQQ-1; Tue, 25 May 2021 21:09:39 -0400 X-MC-Unique: tBGNbL45NNeJtu0Dg6DfQQ-1 Received: from tusharsu-Ubuntu.lan (c-71-197-163-6.hsd1.wa.comcast.net [71.197.163.6]) by linux.microsoft.com (Postfix) with ESMTPSA id BA1C820B7178; Tue, 25 May 2021 18:00:03 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com BA1C820B7178 From: Tushar Sugandhi To: dm-devel@redhat.com Date: Tue, 25 May 2021 17:59:47 -0700 Message-Id: <20210526005954.31564-1-tusharsu@linux.microsoft.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 14Q19iPf020087 X-loop: dm-devel@redhat.com Cc: tusharsu@linux.microsoft.com, nramas@linux.microsoft.com, zohar@linux.ibm.com, snitzer@redhat.com, agk@redhat.com Subject: [dm-devel] [RFC 0/7] device mapper target measurements using IMA X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Hello all, I have been working on measuring various device mapper target attributes using IMA kernel subsystem. (more context in the patch series cover-letter below) I still have to work on: - filling the gaps in the documentation, - testing some corner cases etc. But I would like to get an early feedback from the device-mapper community on the code and therefore sharing the series as an RFC for the time being. Thanks, Tushar ---------------- --Cover Letter-- ---------------- For a given system, various external services/infrastructure tools (including the attestation service) interact with it - both during the setup and during rest of the system run-time. They share sensitive data and/or execute critical workload on that system. The external services may want to verify the current run-time state of the relevant kernel subsystems before fully trusting the system with business-critical data/workload. Device mapper is one such kernel subsystem that plays a critical role on a given system by providing various important functionalities to the block devices using various target types like crypt, verity, integrity etc. Each of these target types’ functionalities can be configured with various attributes. The attributes chosen to configure these target types can significantly impact the security profile of the block device, and in-turn, of the system itself. For instance, the type of encryption algorithm and the key size determines the strength of encryption for a given block device. Therefore, verifying the current state of various block devices as well as their various target attributes is crucial for external services before fully trusting the system with business-critical data/workload. IMA provides the necessary functionality for device mapper to measure the state and configuration of various block devices - - BY device mapper itself, from within the kernel, - in a tamper resistant way, - and re-measured - triggered on state/configuration change. This patch series uses this IMA functionality, by calling the function ima_measure_critical_data(), when a block device state is changed (e.g. on device create, resume, rename, remove etc.) It measures the device state and configuration and stores it in IMA logs, so that it can be used by external services for managing the system. Tushar Sugandhi (7): dm: measure data on table load dm: measure data on device resume dm: measure data on device remove dm: measure data on table clear dm: measure data on device rename dm: update target specific status functions to measure data dm: add documentation for IMA measurement support .../admin-guide/device-mapper/dm-ima.rst | 271 +++++++++++ .../admin-guide/device-mapper/index.rst | 1 + drivers/md/Makefile | 2 + drivers/md/dm-cache-target.c | 30 ++ drivers/md/dm-clone-target.c | 7 + drivers/md/dm-core.h | 5 + drivers/md/dm-crypt.c | 50 ++ drivers/md/dm-delay.c | 4 + drivers/md/dm-dust.c | 4 + drivers/md/dm-ebs-target.c | 3 + drivers/md/dm-era-target.c | 4 + drivers/md/dm-flakey.c | 4 + drivers/md/dm-ima.c | 442 ++++++++++++++++++ drivers/md/dm-ima.h | 41 ++ drivers/md/dm-integrity.c | 38 ++ drivers/md/dm-ioctl.c | 23 +- drivers/md/dm-linear.c | 8 + drivers/md/dm-log-userspace-base.c | 3 + drivers/md/dm-log-writes.c | 4 + drivers/md/dm-log.c | 10 + drivers/md/dm-mpath.c | 29 ++ drivers/md/dm-ps-historical-service-time.c | 3 + drivers/md/dm-ps-io-affinity.c | 3 + drivers/md/dm-ps-queue-length.c | 3 + drivers/md/dm-ps-round-robin.c | 4 + drivers/md/dm-ps-service-time.c | 3 + drivers/md/dm-raid.c | 42 ++ drivers/md/dm-raid1.c | 18 + drivers/md/dm-snap-persistent.c | 4 + drivers/md/dm-snap-transient.c | 4 + drivers/md/dm-snap.c | 16 + drivers/md/dm-stripe.c | 15 + drivers/md/dm-switch.c | 4 + drivers/md/dm-thin.c | 8 + drivers/md/dm-unstripe.c | 4 + drivers/md/dm-verity-target.c | 46 ++ drivers/md/dm-writecache.c | 3 + drivers/md/dm-zoned-target.c | 3 + include/linux/device-mapper.h | 6 +- include/uapi/linux/dm-ioctl.h | 6 + 40 files changed, 1175 insertions(+), 3 deletions(-) create mode 100644 Documentation/admin-guide/device-mapper/dm-ima.rst create mode 100644 drivers/md/dm-ima.c create mode 100644 drivers/md/dm-ima.h