Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp18920239rwd; Wed, 28 Jun 2023 02:30:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ59BqwmWYHWWSoW7jRPF+sr6e9klv7hcvElwyRSMFE9vndfmhbGbswgRGlcEPG/uzYBlQpM X-Received: by 2002:a05:6402:782:b0:51a:2d2c:75ee with SMTP id d2-20020a056402078200b0051a2d2c75eemr21485995edy.25.1687944611137; Wed, 28 Jun 2023 02:30:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687944611; cv=none; d=google.com; s=arc-20160816; b=LcvkywYwcC8BM4BGvJrMlenugUX/EULTcor1SH2f8fJqDs7hCeMnOkoLMCK/KfW1Qe NS/uWvNOCt/tWMRRn/sL8JV95H1PxcCh6pdOYBzanATcZxITGBAY0e0ySNgpEPLozCLd FWzvA7Yom+ofkFozhGy3i/E2MqnkR6v0Vf2YLGB+sG/iFE5r+NhyVK+9ypJUqE9tM8VN yH2GL8Dj+xU9kwrbtvnRKhuWHskx1XXtkim/vCOOozy/LVxVlAu+TNvvkr4H7QbMub80 b+xDjwL27iWiX+0cybHSWrLRbeJwfyZO7ZngDWitOHFOk5YykKbkJMm43t+bizzCqqva mY2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MjBWWdJao9Dxs8hsyuj2BxikWPncIml3TmXJJ8y1Kss=; fh=tpc21sRxU81FvL9AU0rRD/OgaQtwPmw4HRiWGnnwddc=; b=d74msmxGEjLdsEmylDvmMyRgit/1ng0GowojqNPEdQpbGh0mmEGahZOhCjjIclavhv V2nwEyaHw+mf2+yVlKRxkoK/2K4vxlgi4sKRdvwbhJYBvkLhc2lytSDJ33ehl7NF63AH C7rIM20zNldNaGh3tHRQvtwaovy1+fvww5c7XoLoeYAe9eCVZrlfIL69iZ0PuuouAjjJ 8/hupGsYWFc7bQUUwvqIWa1NKtMzGA/WOnP4cwhVdKyzlC82Z7QfGEC/1ZMGzyoUAp68 VMLr7MPI9sJ3GW96xy/3OpO0z2wKZzzOA/QtKsm8vYHiWoxfY3GNgEIXrGJB4kKZrm4B KvbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e4Ni7XDN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be12-20020a0564021a2c00b0051bed4e3849si5264898edb.158.2023.06.28.02.29.46; Wed, 28 Jun 2023 02:30:11 -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=@linuxfoundation.org header.s=korg header.b=e4Ni7XDN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237199AbjF1JIw (ORCPT + 99 others); Wed, 28 Jun 2023 05:08:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233916AbjF1JEY (ORCPT ); Wed, 28 Jun 2023 05:04:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18AEF3595; Wed, 28 Jun 2023 02:02:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 89FE561276; Wed, 28 Jun 2023 09:02:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DDCAC433C0; Wed, 28 Jun 2023 09:02:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687942953; bh=dZ8ewtgN7+nQ8HFCPwMwFbD5X/40NMNmnlkYkea6Iqo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=e4Ni7XDNzGqsmBfx9rCiTuMO4Rbz5g8lx7ujGD3cwkr3aUIVy8zh8n5HiwhgYrUEO 8Fn09MGTbBZWGIAO0UJiAwEfgWLT9oJoP1qajsNFxwm9mz/fdQ8E21qW3FOvXQ+v+w upAwUY0M0SsU7obLCi96V8Utj+Xqp0CqbpNxW3Mw= Date: Wed, 28 Jun 2023 11:02:30 +0200 From: "gregkh@linuxfoundation.org" To: "Huang, Kai" Cc: "corbet@lwn.net" , "linux-coco@lists.linux.dev" , "shuah@kernel.org" , "Yu, Guorui" , "Luck, Tony" , "dave.hansen@linux.intel.com" , "joey.gouly@arm.com" , "dionnaglaze@google.com" , "qinkun@apache.org" , "kirill.shutemov@linux.intel.com" , "mingo@redhat.com" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "Du, Fan" , "tglx@linutronix.de" , "linux-doc@vger.kernel.org" , "wander@redhat.com" , "atishp@rivosinc.com" , "Aktas, Erdem" , "hpa@zytor.com" , "chongc@google.com" , "bp@alien8.de" , "linux-kselftest@vger.kernel.org" , "sathyanarayanan.kuppuswamy@linux.intel.com" , "brijesh.singh@amd.com" , "Williams, Dan J" , "dhowells@redhat.com" Subject: Re: [PATCH v3 3/3] selftests/tdx: Test GetQuote TDX attestation feature Message-ID: <2023062825-rebel-happily-09fd@gregkh> References: <972e1d5c5ec53e2757fb17a586558c5385e987dd.1684048511.git.sathyanarayanan.kuppuswamy@linux.intel.com> <64876bf6c30e2_1433ac29415@dwillia2-xfh.jf.intel.com.notmuch> <64961c3baf8ce_142af829436@dwillia2-xfh.jf.intel.com.notmuch> <9437b176-e15a-3cec-e5cb-68ff57dbc25c@linux.intel.com> <649b7a9b69cb6_11e68529473@dwillia2-xfh.jf.intel.com.notmuch> <2023062805-drove-privatize-ae2c@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Wed, Jun 28, 2023 at 08:56:30AM +0000, Huang, Kai wrote: > On Wed, 2023-06-28 at 08:46 +0200, gregkh@linuxfoundation.org wrote: > > On Wed, Jun 28, 2023 at 02:16:45AM +0000, Huang, Kai wrote: > > > > You really shouldn't be putting attestation validation logic in the > > > > kernel. > > > > > > Agreed. The data blob for remote verification should be just some data blob to > > > the kernel. I think the kernel shouldn't even try to understand the data blob > > > is for which architecture. From the kernel's perspective, it should be just > > > some data blob that the kernel gets from hardware/firmware or whatever embedded > > > in the root-of-trust in the hardware after taking some input from usrspace for > > > the unique identity of the blob that can be used to, e.g., mitigate replay- > > > attack, etc. > > > > Great, then use the common "data blob" api that we have in the kernel > > for a very long time now, the "firwmare download" api, or the sysfs > > binary file api. Both of them just use the kernel as a pass-through and > > do not touch the data at all. No need for crazy custom ioctls and all > > that mess :) > > > > I guess I was talking about from "kernel shouldn't try to parse attestation data > blob" perspective. Looking at AMD's attestation flow (I have no deep > understanding of AMD's attestation flow), the assumption of "one remote > verifiable data blob" isn't even true -- AMD can return "attestation report" > (remote verifiable) and the "certificate" to verify it separately: > > https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snp-attestation.html > > On the other hand, AFAICT Intel SGX-based attestation doesn't have a mechanism > "for the kernel" to return certificate(s), but choose to embed the > certificate(s) to the Quote itself. I believe we can add such mechanism (e.g., > another TDVMCALL) for the kernel to get certificate(s) separately, but AFAICT it > doesn't exist yet. > > Btw, getting "remote verifiable blob" is only one step of the attestation flow. > For instance, before the blob can be generated, there must be a step to > establish the attestation key between the machine and the attestation service. > And the flow to do this could be very different between vendors too. > > That being said, while I believe all those differences can be unified in some > way, I think the question is whether it is worth to put such effort to try to > unify attestation flow for all vendors. As Erdem Aktas mentioned earlier, "the > number of CPU vendors for confidential computing seems manageable". So you think that there should be a custom user/kernel api for every single different CPU vendor? That's not how kernel development works, sorry. Let's try to unify them to make both the kernel, and userspace, sane. And Dan is right, if this is handling keys, then the key subsystem needs to be used here instead of custom ioctls. thanks, greg k-h