Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp979148pxb; Fri, 22 Apr 2022 15:49:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyokw9oYU1AamRlsb8rMZ2ZjdnIaU3AZKOyN5D2lVU+AzweOxu21MmbdPxRVS0cLMSbhEyQ X-Received: by 2002:a17:902:f688:b0:15b:45ea:b682 with SMTP id l8-20020a170902f68800b0015b45eab682mr6581831plg.134.1650667778158; Fri, 22 Apr 2022 15:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650667778; cv=none; d=google.com; s=arc-20160816; b=zrkkMwBaw7LH3xqObLh7DzqOH5H+W2k1++MCnpcuaidtjfC10fr7P7tUnY75x9wPNm TOo1zaIJLEyO3VDH0GaL9UxQVnJZNE1KlcXnqRCKEipIi08hwGjJTI/pflYWdC6uNVv5 Ke9Ll1qShH2kbwpGjNZfBtH2d2BVWaz+RJZUlYMIBBN0tZ4okRrGWrejg/arytnRSZm5 PLeIH72x6lF3oBNTS0tjMZZnccjJXLD082Tc8t70G1W5MnHKyO/UsslS4TmVywA+xbvo X2VZXb8/ooUuLbwXlaWSZ5PHmSN3dsczqmq9WBZhLdQI2OxXouQ25K2opPdg7di/fAwy Dy9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ckZb8HQa6B+H6t9pofeOOWMFEAGtcGaN614SCDhVQYA=; b=D1B88/DcHvhBxDVr+fN3OOssWaKUvkf22cCp64BOY/FSOOSpiVXKCjVwGkUeNb2VMp Dxkqswa9Beh/9sU81ESP3SMWjHQigXRBT7GDJU5IiaaTAqGZSELzbCoVl0XR4l7Z9t0v UgLrDSAOA+35me+7SIZZ7lSAeOE/32U+rVfzhWAspIeTXYJCXFsLkWWp55XlBcjY4tCT pHU33Kg1MUPGbVLcE9bp9mK24rN4gJ16eyYpCoIXj+WX5QtlV5JeSImxvg0dNY2TgMPd uXUcRw8IE1uDPsTWgLOrvlVUe+FXRw6qdfKOzwFAQGyao7la1iZDtxYy4QRTQnMwwthv R0jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SHDfVa3F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t71-20020a63814a000000b003aa9b5fc288si4883204pgd.695.2022.04.22.15.49.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 15:49:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SHDfVa3F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0FE41405F46; Fri, 22 Apr 2022 13:41:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385544AbiDUHHp (ORCPT + 99 others); Thu, 21 Apr 2022 03:07:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385571AbiDUHHg (ORCPT ); Thu, 21 Apr 2022 03:07:36 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BE4D15704; Thu, 21 Apr 2022 00:04:48 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id j8-20020a17090a060800b001cd4fb60dccso4336968pjj.2; Thu, 21 Apr 2022 00:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ckZb8HQa6B+H6t9pofeOOWMFEAGtcGaN614SCDhVQYA=; b=SHDfVa3FMmxgIMWcn+Q/V5BXKCMqc6gupBa491JtUf1YiJXt+jMBITI1+IndLPAiIv qD3FcIJbcu4Z7orWyaJDi7S/qhIErBQTYGkWKwxUlUJ2vMf+DsGzkb0kk9s3xYo/3k0Q q/9kDDn1jaPKUZneasma7uFV0PCTz3gm6cl0XD7cUOAbhJilfDoai2do+GjxN34nx897 W2ff5yPbIFfPf8l1ovxQlBqjo0jBNRi8Lu65nc+tYdDHkL6ab8PVF4pkwqLl8bIoBbkB 6l5CxHzI/LentyJLL/pPGx8po3avHC9IScIBKDV/A1u12xhU8rFhiCHPGCJf/meaz7yd 7d9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ckZb8HQa6B+H6t9pofeOOWMFEAGtcGaN614SCDhVQYA=; b=kF99Lb+uWG+J7oEnYZsZypTaFKqDUvQxFnd0OAKW6DIzpMvzYLIK4srMVyh2Z58BbL mCG76lBDu5RqQ13HRLTnSeL4xfkibx0MmYHXD5nahIhBmFIlp5+hZEXW8vI/PSzRKowt s8ysI+Z8bhIqY/IqR23bNsvxyKUSNTieirl0dDjD0EU09CfZH8rFKQYmZfyGGHRoY8jO VggFSlQd7ke1xvhZ7xTOvG8l/4bp6XewY2l/n6xUPs9RhaWMwYWrmnwIcElj4AsXfRDe fuwjbUokzzWbkoF6dDKw0myd3fOpogZZpZO+2M0NeXpCBSEfl42lPxauPNYYpVUlAeFF QGBA== X-Gm-Message-State: AOAM531XkUBWZQOjVRGTLsthYme3InjsrnPIQHJZ7B9VHaIDDXSUQCon VBE5VrpghFpTAvq6A6LgWX8= X-Received: by 2002:a17:902:8f81:b0:154:be2d:1948 with SMTP id z1-20020a1709028f8100b00154be2d1948mr24109757plo.110.1650524687783; Thu, 21 Apr 2022 00:04:47 -0700 (PDT) Received: from localhost (c-107-3-154-88.hsd1.ca.comcast.net. [107.3.154.88]) by smtp.gmail.com with ESMTPSA id a38-20020a056a001d2600b004f72acd4dadsm22961885pfx.81.2022.04.21.00.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 00:04:47 -0700 (PDT) Date: Thu, 21 Apr 2022 00:04:44 -0700 From: Isaku Yamahata To: Sathyanarayanan Kuppuswamy Cc: Isaku Yamahata , 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 Subject: Re: [PATCH v3 4/4] platform/x86: intel_tdx_attest: Add TDX Guest attestation interface driver Message-ID: <20220421070444.GB1423762@private.email.ne.jp> References: <20220415220109.282834-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20220415220109.282834-5-sathyanarayanan.kuppuswamy@linux.intel.com> <20220420012032.GA2224031@ls.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no 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 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. 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. -- Isaku Yamahata