From patchwork Mon Mar 6 09:20:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Righi X-Patchwork-Id: 1752267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=AwczUymD; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PVY3m4CPvz246k for ; Mon, 6 Mar 2023 20:21:23 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pZ71q-0007gp-D7; Mon, 06 Mar 2023 09:21:10 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pZ71o-0007fJ-Mt for kernel-team@lists.ubuntu.com; Mon, 06 Mar 2023 09:21:08 +0000 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 9087F3F125 for ; Mon, 6 Mar 2023 09:21:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1678094467; bh=dMWU3+RSXdKzjqSUUKPkWH9evrWVjjpC9eYYD9zj0OQ=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=AwczUymDlhHeJaDkgGMsi9NB+D5rQEWuw5RZFuNIUzPNbwLdzUsFh8aGEBILgHm1p AZ31W2IlMsNGa8UmgyJLfgCJApPDuoESRjN4CyMSu1JW1yW0DycBXL7p6BUk7h128H 89RQbkZcyRK3pvM1fQWCzt79nlI6Zp2zzQsWe9/gshlskqm9lt9S9Zf+dVdo8s9OG5 o/0WN7mSaXQtu16TO+MSwbhX8yJpPDltRsYzovPqyI+9H8uEKEgw/wNw3UE8hUSkxz Yak508aiZnMyJK/xVWkZ2l6/E1NPgHrq+/dyRcQj2aHqqtreRCw9D4jLe9oQDV/CgF lUKpNXWtfdJDA== Received: by mail-ed1-f69.google.com with SMTP id d35-20020a056402402300b004e37aed9832so3513927eda.18 for ; Mon, 06 Mar 2023 01:21:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dMWU3+RSXdKzjqSUUKPkWH9evrWVjjpC9eYYD9zj0OQ=; b=Fxr05vdKi8APj/xfhidP1yE4oLlFSiGBGpD82lDSxWtdnbZzrMQwdVhVXt5qe5IZkQ HUO/BaPzf68kii2qREgXebTyxpoxvt8zn6CSdG4K0IPkg1W8mwB/cEWZqxmv4vSLtERg E+EM5nQDZ6hdY0opOmLUdo6VZMXDRZ7gdBdHPTFepg1PSR+9+xs1142xpgT27fST2GD+ wpeoNzHn2kVg4QMu4ez05WHAD/kzr/BPtF0hSImM/bUI2Dv6DzhT9Vo+3VAZIzrfkBUu lNsvHSR9N4vrEYHMIKr/b6nwrM0og5JWdDVAPZ8CW78uZOPq+VwrVmIARjF7Nl6vgAX8 RUKA== X-Gm-Message-State: AO0yUKUTPal/OzA33OHEFaX699K6oB8a+0gKmNdy3HCDI0fE1bEAtfSa PprpBi3LWqJkAGvF0JiszLqaYPMnajUuJ61D0k3z20s1k8Go446ULVuZztHVfCcKO8mcG4xA8E7 r/lXprewbpUBOG6iQ7qrKD/AjF/NzPzI2dR4ZJgIIXSzPkHpqJQ== X-Received: by 2002:a05:6402:1512:b0:4c2:6b68:c126 with SMTP id f18-20020a056402151200b004c26b68c126mr8848787edw.8.1678094467256; Mon, 06 Mar 2023 01:21:07 -0800 (PST) X-Google-Smtp-Source: AK7set8s1IaZl9SA//4kr8nreCKStVpZM7kvHURPjhsimk4ThyWdaOT/641QSgh9Sbrd1SOqv6UBMg== X-Received: by 2002:a05:6402:1512:b0:4c2:6b68:c126 with SMTP id f18-20020a056402151200b004c26b68c126mr8848771edw.8.1678094466941; Mon, 06 Mar 2023 01:21:06 -0800 (PST) Received: from localhost.localdomain (host-79-53-23-214.retail.telecomitalia.it. [79.53.23.214]) by smtp.gmail.com with ESMTPSA id n18-20020a50c212000000b004af515d2dd8sm4864293edf.74.2023.03.06.01.21.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Mar 2023 01:21:06 -0800 (PST) From: Andrea Righi To: kernel-team@lists.ubuntu.com Subject: [SRU][K][PATCH 0/1] new TDX attestation driver from Intel Date: Mon, 6 Mar 2023 10:20:52 +0100 Message-Id: <20230306092058.26718-1-andrea.righi@canonical.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/2009437 [Impact] TDX guest attestation has been merged as SAUCE patches in the kinetic kernel with the following commits: https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/kinetic/commit/?h=master-next&id=285d6d8136ebadcee7fd6452b9e4223996a2a0af https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/kinetic/commit/?h=master-next&id=0b78a71c7d7630ab7c3c8a03cbe4f78f1361fb45 However, Intel released a new TDX attestation driver that will be submitted upstream. We should align with the new version that will likely end upstream. See also LP: #1971027 [Test case] Testing this feature requires a special hardware in the host, special firmware and special configuration of a guest. Right now it can only be tested by Intel. [Fix] Apply the new driver provided by Intel in LP: #1971027. [Regression potential] The new driver can potentially break user-space applications that are relying on the TDX attestation feature. This is because of this struct (used in the user-space/kernel communication, via ioctl): + * Used in TDX_CMD_GET_REPORT IOCTL request. + */ +struct tdx_report_req { + __u8 subtype; + __u64 reportdata; + __u32 rpd_len; + __u64 tdreport; + __u32 tdr_len; +}; The new patch changed the struct as following: +struct tdx_report_req { + __u8 reportdata[TDX_REPORTDATA_LEN]; + __u8 tdreport[TDX_REPORT_LEN]; +}; In general we should never apply changes that are breaking user-space like this (especially for non-devel kernels), but realistically we can probably say that nobody is using this feature yet, so nobody has any user-space program that is relying on the old struct (and if they do, they're probably in touch with Intel, so they're aware of this change). In conclusion, this change should be considered pretty safe, despite the potential user-space brekage. ---------------------------------------------------------------- Andrea Righi (3): Revert "UBUNTU: SAUCE: selftests: tdx: Test GetReport TDX attestation feature" Revert "UBUNTU: SAUCE: x86/tdx: Add TDX Guest attestation interface driver" UBUNTU: [Config] enable TDX attestation driver as module by default Kuppuswamy Sathyanarayanan (3): UBUNTU: SAUCE: x86/tdx: Add a wrapper to get TDREPORT0 from the TDX Module UBUNTU: SAUCE: virt: Add TDX guest driver UBUNTU: SAUCE: selftests/tdx: Test TDX attestation GetReport support Documentation/virt/coco/tdx-guest.rst | 52 ++++++++ Documentation/virt/index.rst | 1 + Documentation/x86/tdx.rst | 43 +++++++ arch/x86/coco/tdx/tdx.c | 151 ++++++------------------ arch/x86/include/asm/tdx.h | 2 + arch/x86/include/uapi/asm/tdx.h | 51 -------- debian.master/config/annotations | 3 + debian.master/config/config.common.ubuntu | 1 + drivers/virt/Kconfig | 2 + drivers/virt/Makefile | 1 + drivers/virt/coco/tdx-guest/Kconfig | 10 ++ drivers/virt/coco/tdx-guest/Makefile | 2 + drivers/virt/coco/tdx-guest/tdx-guest.c | 102 ++++++++++++++++ include/uapi/linux/tdx-guest.h | 42 +++++++ tools/arch/x86/include/uapi/asm/tdx.h | 51 -------- tools/testing/selftests/tdx/Makefile | 8 +- tools/testing/selftests/tdx/config | 2 +- tools/testing/selftests/tdx/tdx_attest_test.c | 156 ------------------------ tools/testing/selftests/tdx/tdx_guest_test.c | 163 ++++++++++++++++++++++++++ 19 files changed, 464 insertions(+), 379 deletions(-) create mode 100644 Documentation/virt/coco/tdx-guest.rst delete mode 100644 arch/x86/include/uapi/asm/tdx.h create mode 100644 drivers/virt/coco/tdx-guest/Kconfig create mode 100644 drivers/virt/coco/tdx-guest/Makefile create mode 100644 drivers/virt/coco/tdx-guest/tdx-guest.c create mode 100644 include/uapi/linux/tdx-guest.h delete mode 100644 tools/arch/x86/include/uapi/asm/tdx.h delete mode 100644 tools/testing/selftests/tdx/tdx_attest_test.c create mode 100644 tools/testing/selftests/tdx/tdx_guest_test.c