Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp710491rdb; Thu, 22 Feb 2024 18:14:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUgrAI0QfDQoqGKjRu5PTvbTmO7KnZA1eGUjCez7cMnxKx/5v7+L9pspCIFavrzEW2gQRk6PW2cqGBLGkH/mCCDDQmZOVN77JJXO896Gg== X-Google-Smtp-Source: AGHT+IF2IPlKG7bT4P1Sodte/p59TsCVcRRdJbXzCxTaf+H9M2J7/MuanlWuRdKoMadQftE/XPLy X-Received: by 2002:a17:90a:3de1:b0:299:75aa:8940 with SMTP id i88-20020a17090a3de100b0029975aa8940mr560695pjc.26.1708654488507; Thu, 22 Feb 2024 18:14:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708654488; cv=pass; d=google.com; s=arc-20160816; b=w8MKkAQhWUocHQhdP+dS0Oth21dk2kRlNkKC5eUNMvFuFz5Y19dL5E2z30Ow12KV3j U0wyt3rNvWwH44AQE9qoXBjURpzOJm0vYrAcJ/rGUR804YN+UVICEIACUbfttyEUOL9u 1I0h0rNhnxLzmR2i5q92iVkcuy+SpcZzxFgnmQTV9hsfIU9p+eNJ19/Hqx4JMFZtTsER gQM57Fhi0Ai7RNX2EXXTbvvK35hSIdKXhHXcbU9PhhBHgCoNT96+K+rMS8Ram5i20ZJr tFw1WFkj1COdU0cU8nCBrhpTL8QJHVYHvIdlDRn6y/so8+vokzP8+Z2ufITHotZOydUf VA1A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=OXjz/vsMb5fpv8Bc5UR7V9XbSyeFpyJyM9rkfYDSOW8=; fh=fHyqRWIV6DRZtyE6+pV3T+XZVT4is8eNsNQ8QFYiMIE=; b=ijBr4NISR+Hpiz+MT3ps8QrREIACawbgegErN0zftukvCLBUz7oAVbnNW7/SzU37DI naENh2BbS8FjibakxQySfv95z5bf/jaM20jbdpbBsptuB9Ly5UzwZ0XGGWe33uEr8/kd GQonhttXGaT55QEuLRQYRyceMhXVpGSEgGEiplX/wA/sVLMWd03ffVddlKKKbfxtaruQ pl/ZMvAGWBHCLIY5k9AC/+jodJuxUR2KqZA9b87HYBaqQ+jYZelKQR4ChMmOHGdsljwt yHSZ3u/lLGXLDBgY5j2k76RNOhALvNG7pYBeFvSv1AShz4ewIo4zMqKIGXj2GZkqR6lc jxtA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WCaHFbZw; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-77489-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77489-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id ma15-20020a170903094f00b001dc6b36b818si378621plb.35.2024.02.22.18.14.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 18:14:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77489-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WCaHFbZw; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-77489-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77489-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E9C8BB23582 for ; Thu, 22 Feb 2024 23:10:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B19F31B7E8; Thu, 22 Feb 2024 23:09:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WCaHFbZw" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F5F417BCA for ; Thu, 22 Feb 2024 23:09:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708643342; cv=none; b=U7lQHQD0OzPIfKzNU3o3qyK/Xx7ezCmVWRToATU/Mw9iUH/KWH545QS/UiffVzxyW+q9Jg2HwE7R1D1o6fUbtox528YB1u55Px7euJS/yQ6C+rp29iZQ3s1sJm399W2fiieH9pSWoyxe1QkrZXj8vFCB99W2HlAO2d7mgtetsPk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708643342; c=relaxed/simple; bh=CUEbmC3xxg97bqbF8nhMBRdSGGgUTSxwxVsPeikIJGo=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=kNBzRua7tNb7DjLyoT5mFecVX4shGWWYozMgDqYgRsNoCIplrnNGyfqKsn/XdgwQbu5xr+4ZI+D9rmPPHuAjYFnHvlZVq6L98ymoUNt3P8YXVonEPqbsoYqKoP+cVM09H+33bPdMbbD2HsU5C9dlPlPLObtfROC9uzecP3+SdN4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WCaHFbZw; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708643341; x=1740179341; h=message-id:date:mime-version:subject:from:to:cc: references:in-reply-to:content-transfer-encoding; bh=CUEbmC3xxg97bqbF8nhMBRdSGGgUTSxwxVsPeikIJGo=; b=WCaHFbZwyiEKDrBeuJWZNqt7vtiL341LVfYjouLZzJO0zzuSghYiX+/e 0cPRErL2POOY+ueGSxy2xSC5sj5Cm534n1K67v43b2im26VCwkj7KcuzP wtzF9qjc1/8lzLUDQ6ejKOMztrWVk9nlYSP4woe3YCzTNtD0zrlf3FIpn jN1QssvPfmK30KPVPD0aYVR8m/C/g1Ce1t62cBT1xdpwG56tmVn9bl94U dA4MFseVTBVHTYwKu09JkIha2VriGnyJPLETmQ2YW/0wvzHXcDDcnsGjH Q5mmGsAAOfCBR/NRInfOaNU2tMS0dQEFzFfXadJR5QYm+rA/rHbENvlif A==; X-IronPort-AV: E=McAfee;i="6600,9927,10992"; a="6689157" X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="6689157" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2024 15:09:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10992"; a="936918708" X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="936918708" Received: from rdegger-desk1.amr.corp.intel.com (HELO [10.209.74.18]) ([10.209.74.18]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2024 15:08:52 -0800 Message-ID: <3e237f17-7992-4852-8888-7a6e5a6de31c@linux.intel.com> Date: Thu, 22 Feb 2024 15:08:52 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] virt: tdx-guest: Handle GetQuote request error code Content-Language: en-US From: Kuppuswamy Sathyanarayanan To: "Kirill A . Shutemov" , x86@kernel.org Cc: Dave Hansen , Dan Williams , Xiaoyao Li , linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev References: <20240111033245.2632484-1-sathyanarayanan.kuppuswamy@linux.intel.com> In-Reply-To: <20240111033245.2632484-1-sathyanarayanan.kuppuswamy@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi x86 Maintainers, On 1/10/24 7:32 PM, Kuppuswamy Sathyanarayanan wrote: > During the TDX guest attestation process, TSM ConfigFS ABI is used by > the user attestation agent to get the signed VM measurement data (a.k.a > Quote), which can be used by a remote verifier to validate the > trustworthiness of the guest. When a user requests for the Quote data > via the ConfigFS ABI, the TDX Quote generation handler > (tdx_report_new()) forwards the request to VMM (or QE) via a hypercall, > and then shares the output with the user. > > Currently, when handling the Quote generation request, tdx_report_new() > handler only checks whether the VMM successfully processed the request > and if it is true it returns success and shares the output to the user > without actually validating the output data. Since the VMM can return > error even after processing the Quote request, always returning success > for the processed requests is incorrect and will create confusion to > the user. Although for the failed request, output buffer length will > be zero and can also be used by the user to identify the failure case, > it will be more clear to return error for all failed cases. > > Validate the Quote data output status and return error code for all > failed cases. > > Fixes: f4738f56d1dc ("virt: tdx-guest: Add Quote generation support using TSM_REPORTS") > Reported-by: Xiaoyao Li > Closes: https://lore.kernel.org/linux-coco/6bdf569c-684a-4459-af7c-4430691804eb@linux.intel.com/T/#u > Signed-off-by: Kuppuswamy Sathyanarayanan > --- Can you consider merging this fix? It already got acks from Kirill, Kai and Li. Do you want me rebase it and resend it with updated tags? > > Changes since v1: > * Updated the commit log (Kirill) > > drivers/virt/coco/tdx-guest/tdx-guest.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/virt/coco/tdx-guest/tdx-guest.c b/drivers/virt/coco/tdx-guest/tdx-guest.c > index 1253bf76b570..61368318fa39 100644 > --- a/drivers/virt/coco/tdx-guest/tdx-guest.c > +++ b/drivers/virt/coco/tdx-guest/tdx-guest.c > @@ -228,6 +228,12 @@ static int tdx_report_new(struct tsm_report *report, void *data) > goto done; > } > > + if (quote_buf->status != GET_QUOTE_SUCCESS) { > + pr_err("GetQuote request failed, ret %llx\n", quote_buf->status); > + ret = -EIO; > + goto done; > + } > + > buf = kvmemdup(quote_buf->data, quote_buf->out_len, GFP_KERNEL); > if (!buf) { > ret = -ENOMEM; -- Sathyanarayanan Kuppuswamy Linux Kernel Developer