Re: [PATCH v2 3/3] selftests/tdx: Test GetQuote TDX attestation feature

From: Dave Hansen
Date: Thu Apr 27 2023 - 15:54:04 EST


On 4/26/23 08:47, Dionna Amalie Glaze wrote:
>> +/* Helper function to get TDREPORT */
>> +long get_tdreport0(int devfd, struct tdx_report_req *req)
>> +{
>> + int i;
>> +
>> + /* Generate sample report data */
>> + for (i = 0; i < TDX_REPORTDATA_LEN; i++)
>> + req->reportdata[i] = i;
>> +
> Shouldn't req be zeroed before populating reportdata? We wouldn't want
> uninitialized memory to leave the guest. I know this is just a test,
> but it's best to model good practices for anyone that might
> copy/paste.

It's leaving the guest and going to the TDX module. What's the problem
there?