Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1510650rwn; Thu, 8 Sep 2022 22:28:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR7ni0uGqTpSdShgtSr9P76243e2KK71xoNu2c4eBmJEkzaRq5YQtEcTLjW9ZQwUotTRLEW2 X-Received: by 2002:a17:90b:4c47:b0:1fa:dd14:aabd with SMTP id np7-20020a17090b4c4700b001fadd14aabdmr8002657pjb.76.1662701291073; Thu, 08 Sep 2022 22:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662701291; cv=none; d=google.com; s=arc-20160816; b=l1rNowbExcVaENQcftrMyZZG05PFNx2OhraiYMLWwHUuaRz5Xr7uES/HgPkf/pCsFk oUrGTeDzmwNas9x/uj27bRz+0+ZD6HT5xUQHebsoPAHBv0j+qnfOMHwzt8hj0AU7GraG cd1wGbJWdfPCLL2RaXSk98zU1SnPvaS1gN3S2thftDwu7NzVVInIUdHerFgPNOyBdVVO 84PXy5vJZdJlb/ik2c+cFj9k+l8z9V1Q0d57/ZbyMpmQ1XH6THTKvQVtqKPYae24OvN2 S4hnR9bnT9M9qwKS0D0Ekwpyw+prrwbyifGEKXVAFw/XEXdThQ4rakPVdgNjxgTc/PO3 MsIA== 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=XUC1fFHm/B6bvRWWVupf5TESXCk8pX2Iha4I6EbeqXY=; b=i4eErTEAKwKbC8VrNUWNjBocbp//y88vyvRcubuM1BUpTExmX/FU/pZKgXl06WreGA qaGWUe0a7UFDujA6889bOPR2AgAMAmG0VzI2FyfAX3DVqxnV75zbH8J5SlK37/pioi1B KKdEuv4ffIj3s8Jgr6MJcj3/sg7juIdtxdaZqB85dJQPT54YpYi3nQ8Aqm5I2E+I0MJ2 J7xOMBgzu1Z04vpK18Em18UnnpP0lGp57sRh49hksBFgk1yH5HJHLm8LtuyHuB9qbNz9 1siF5Qy1gTJhT7/PQLD1CH7HMCov7JokXB0Cy+xfXrLmOvD7g1H41Vmt+XtTcGSs3wCz hp2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FNeBCKbk; 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 u71-20020a63854a000000b0042aeddae776si739743pgd.290.2022.09.08.22.27.59; Thu, 08 Sep 2022 22:28: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=FNeBCKbk; 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 S230231AbiIIF0Y (ORCPT + 99 others); Fri, 9 Sep 2022 01:26:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229984AbiIIF0W (ORCPT ); Fri, 9 Sep 2022 01:26:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C78F125B12; Thu, 8 Sep 2022 22:26:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 229A7B81AD8; Fri, 9 Sep 2022 05:26:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CB1EC433D6; Fri, 9 Sep 2022 05:26:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662701178; bh=Xym8nFLz1doYxhLivSjmjBENQn3h/0+1UGRP2640huo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FNeBCKbkMaomtUhQZrSHqUijbnZ4bdUQ8JbJpI71pv04FLfRVOledJg1Eu2ph9zkO jxVwGxIkiYn2Oy0bhQVHmSZF6uXOWky7R4ztux5+XhyicxCbYSkOKqgTTlV/eJUyLA WEghLPcljutHXFUM5WW8nTb32hxhPHYCfGwI+9XM= Date: Fri, 9 Sep 2022 07:26:16 +0200 From: Greg Kroah-Hartman To: Dave Hansen Cc: Sathyanarayanan Kuppuswamy , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Shuah Khan , "H . Peter Anvin" , "Kirill A . Shutemov" , Tony Luck , Andi Kleen , Kai Huang , Wander Lairson Costa , Isaku Yamahata , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org Subject: Re: [PATCH v12 1/3] x86/tdx: Add TDX Guest attestation interface driver Message-ID: References: <20220908002723.923241-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20220908002723.923241-2-sathyanarayanan.kuppuswamy@linux.intel.com> <6cf407ed-95c7-0db4-d581-b85efad13239@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Thu, Sep 08, 2022 at 01:36:00PM -0700, Dave Hansen wrote: > On 9/8/22 12:07, Sathyanarayanan Kuppuswamy wrote: > > On 9/7/22 10:31 PM, Greg Kroah-Hartman wrote: > >> On Wed, Sep 07, 2022 at 05:27:20PM -0700, Kuppuswamy Sathyanarayanan wrote: > >>> + /* > >>> + * Per TDX Module 1.0 specification, section titled > >>> + * "TDG.MR.REPORT", REPORTDATA length is fixed as > >>> + * TDX_REPORTDATA_LEN, TDREPORT length is fixed as > >>> + * TDX_REPORT_LEN, and TDREPORT subtype is fixed as > >>> + * 0. Also check for valid user pointers. > >>> + */ > >>> + if (!req.reportdata || !req.tdreport || req.subtype || > >>> + req.rpd_len != TDX_REPORTDATA_LEN || > >>> + req.tdr_len != TDX_REPORT_LEN) > >>> + return -EINVAL; > >> You never verify that your reserved[7] fields are actually set to 0, > >> which means you can never use them in the future :( > > Currently, we don't use those fields in our code. Why do we have to > > make sure they are set to zero? > > Yes. > > > Can't we add checks when we really use them in future? > > No. > > This has been a hard learned lesson both by people writing software and > designing hardware interfaces: if you _let_ folks pass garbage you have > to _keep_ letting them pass garbage forever. It becomes part of the ABI. > > I'm sorry you missed the memo on this one. But, this is one million > percent a best practice across the industry. Please do it. And it's documented in the Documentation/ directory as a requirement to do as well, the memo shouldn't have been missed :(