Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp948958pxb; Fri, 22 Apr 2022 15:06:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPJemShm464tcNE8aZDg4ScU8nn1CFIvTXh9fdvLXf5XeD+2+10YqJfKnnBYeh62e6rBqH X-Received: by 2002:aa7:91c8:0:b0:50c:d1d5:3525 with SMTP id z8-20020aa791c8000000b0050cd1d53525mr7141798pfa.50.1650665210327; Fri, 22 Apr 2022 15:06:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650665210; cv=none; d=google.com; s=arc-20160816; b=fQNkqTD/E2D2cf+d0MK2kFuFP1oPxASxoMoT0inPjrkq3jf//g25MaRzK4eWIHHtCR sm/n1HNU4Z+kaxbnnyR+eVFy0caNzpoIIqsZiHIfRtCZu0/kbp6kUaSXQukTmheGfbEz HoDbfIXzO5LdhkJlnH1xZ7JTiiIjdEUfpHW3+rZgHMdR8bLBf9BozsMXk38aSRyhBd69 FgiNlwl8z3pMnr197r6b7sAvkmbeZga09cZCSnjSwGZkDVkux9YrlGj7M4hAaM8oAr5h fR5JSO8FB3BIxp2tTGSnGUPbE0yV72DG+CkFcyRlCKyDPkIX85Tu5NNcctETgVyRg8eN eOiA== 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=FFKRnJCNJr9IulnUGVK47uTJ7EAY3wGLZfAj71S5bYc=; b=ZX4rLoZzVT3nCik4IcfPA9I3p4/yaHPBW6MU0G0iNc9BXKVPSatnFcexHwDNz/+Nwt T1amBFXzWBed2IjTXjWHs1kXtO1KzA7dG0pso/MKCbFmS/PKsXBA92/w0YfXDUpHVgh2 TNuA+G8L382krHJvGKpD10jWRGsnMd7ohEj4JXw6LxvVZfvE2PdZykS0Qbp2xinHjB8H lCLYs65wcoPfE0G22Gc+t0Gulj3nMgZhYuSEybOuvt+vug2MqgSJkMSrEFW/nDsIV3fn FS5OBWGqJqL022oX8mfYvbOPHP1z8vdUSzWWOdI5DB7L3GNa6atbweUxXR2ousBqZto5 RV6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EhghRW3d; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q9-20020a17090311c900b00159071f2c80si10775341plh.593.2022.04.22.15.06.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 15:06:50 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EhghRW3d; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 57EAE272FB1; Fri, 22 Apr 2022 13:13:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389590AbiDUOrR (ORCPT + 99 others); Thu, 21 Apr 2022 10:47:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389582AbiDUOrO (ORCPT ); Thu, 21 Apr 2022 10:47:14 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1C8742488; Thu, 21 Apr 2022 07:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650552263; x=1682088263; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=8nROONmBaEtt0RwaLOJXl6s8nLCzEBixvAjQNvvsvHE=; b=EhghRW3dbujf4YwyJxcd+vYecJ+iRh/2lYh8rOhnWI2yTiYzPks8CLMN ApzHq1gU1N1qw1zMBFgQCDlyigtzQff33e4S7HWcyX2lO8BUM3h0cHV5Z 88Ct1XLEtShImi7aqpArkcJ4AEuEWBedickrOfW0EeafkNZscxqO6YeZz AX3dhhiw+clEkZMSK8XSDkNGItCNZXFCHSScr5KfMHTWNv3xBa7OaDzgQ XuYjciPrxvWZtx1gBido3j3E96VtPQ1Q0rcqk17cWJR/AETLwur544QTk 1FP+l4awRPY9ksTsgfymhMxBWf9aoXmlMHbuvW0Wg7keeztNWWJnmY10o g==; X-IronPort-AV: E=McAfee;i="6400,9594,10324"; a="263216560" X-IronPort-AV: E=Sophos;i="5.90,278,1643702400"; d="scan'208";a="263216560" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2022 07:44:20 -0700 X-IronPort-AV: E=Sophos;i="5.90,278,1643702400"; d="scan'208";a="511093185" Received: from testes-mobl1.amr.corp.intel.com (HELO [10.212.210.35]) ([10.212.210.35]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2022 07:44:19 -0700 Message-ID: <70436892-0b4f-30c5-051b-2c86f7387101@linux.intel.com> Date: Thu, 21 Apr 2022 07:44:19 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.7.0 Subject: Re: [PATCH v3 4/4] platform/x86: intel_tdx_attest: Add TDX Guest attestation interface driver Content-Language: en-US To: Isaku Yamahata Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Hans de Goede , Mark Gross , "H . Peter Anvin" , "Kirill A . Shutemov" , Tony Luck , Andi Kleen , linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org References: <20220415220109.282834-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20220415220109.282834-5-sathyanarayanan.kuppuswamy@linux.intel.com> <20220420012032.GA2224031@ls.amr.corp.intel.com> <20220421070444.GB1423762@private.email.ne.jp> From: Sathyanarayanan Kuppuswamy In-Reply-To: <20220421070444.GB1423762@private.email.ne.jp> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 4/21/22 12:04 AM, Isaku Yamahata wrote: > On Tue, Apr 19, 2022 at 06:26:43PM -0700, > Sathyanarayanan Kuppuswamy wrote: > >> On 4/19/22 6:20 PM, Isaku Yamahata wrote: >>> If timeout occurs, the state of adev->tdquote_buf is unknown. It's not safe >>> to continue to using adev->tdquote_buf. VMM would continue to processing >>> getquote request with this buffer. What if TDX_CMD_GEN_QUOTE is issued again, >>> and tdquote_buf is re-used? >> >> This part is not clearly discussed in the specification. May be spec >> should define some reasonable timeout and teardown details. >> >> Regarding not using this buffer again, what happens if we de-allocate >> it on timeout and the host still updates it? > > Until GET_QUOTE_IN_FLIGHT is cleared, the shared page is owned by VMM, TD > attestation driver shouldn't reuse/free the pages. > > In the case of this driver, I think of two options > - don't timeout. wait for interrupt to arrive and check the shared GPA state. > - allow timeout. When the next request comes, check the shared GPA state. > If it's still GET_QUOTE_IN_FLIGHT, return EBUSY. Out of the above two options, I think option 1 is better. It is simpler to serialize them using mutex compared to checking the shared buffer of previous request. > > It's possible for VMM to keep the shared GPA forever maliciously(DoS) or > unintentionally due to bug. TD can't do much about it. I will add a note about it in commit log. -- Sathyanarayanan Kuppuswamy Linux Kernel Developer