From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AC61ECAAA1 for ; Fri, 9 Sep 2022 05:26:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229791AbiIIF0X (ORCPT ); Fri, 9 Sep 2022 01:26:23 -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: Precedence: bulk List-ID: X-Mailing-List: linux-doc@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 :(