Re: [PATCH v10 1/2] x86/tdx: Add TDX Guest attestation interface driver

From: Wander Lairson Costa
Date: Mon Aug 08 2022 - 08:05:54 EST


On Fri, Aug 5, 2022 at 6:35 PM Sathyanarayanan Kuppuswamy
<sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx> wrote:
>
>
>
> On 8/5/22 12:47 PM, Wander Lairson Costa wrote:
> > On Wed, Aug 03, 2022 at 05:33:22PM -0700, Kuppuswamy Sathyanarayanan wrote:
> >> +/**
> >> + * struct tdx_report_req: Get TDREPORT using REPORTDATA as input.
> >> + *
> >> + * @subtype : Subtype of TDREPORT (fixed as 0 by TDX Module
> >> + * specification, but added a parameter to handle
> >> + * future extension).
> >> + * @reportdata : User-defined REPORTDATA to be included into
> >> + * TDREPORT. Typically it can be some nonce
> >> + * provided by attestation service, so the
> >> + * generated TDREPORT can be uniquely verified.
> >> + * @rpd_len : Length of the REPORTDATA (fixed as 64 bytes by
> >> + * the TDX Module specification, but parameter is
> >> + * added to handle future extension).
> >> + * @tdreport : TDREPORT output from TDCALL[TDG.MR.REPORT].
> >> + * @tdr_len : Length of the TDREPORT (fixed as 1024 bytes by
> >> + * the TDX Module specification, but a parameter
> >> + * is added to accommodate future extension).
> >> + *
> >> + * Used in TDX_CMD_GET_REPORT IOCTL request.
> >> + */
> >> +struct tdx_report_req {
> >> + __u8 subtype;
> >> + __u64 reportdata;
> >> + __u32 rpd_len;
> >> + __u64 tdreport;
> >> + __u32 tdr_len;
> >> +};
> >
> > Any reason why reportdata and tdreport aren't "void *"?
>
> It is the recommended way to pass the pointers.
>
> https://docs.kernel.org/driver-api/ioctl.html
>

Ah, right. In this case, we should use the u64_to_user_ptr() function
for pointer conversion as recommended.