Re: [PATCH v14 1/3] x86/tdx: Make __tdx_module_call() usable in driver module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 12, 2022 at 08:44:04AM -0700, Sathyanarayanan Kuppuswamy wrote:
> 
> 
> On 10/12/22 7:27 AM, Borislav Petkov wrote:
> > On Wed, Oct 12, 2022 at 06:35:56AM -0700, Sathyanarayanan Kuppuswamy wrote:
> >> So we should create a new wrapper for this use case or use
> > 
> > Yes, you got it - a new wrapper pls.
> 
> Ok. I will add a new wrapper to get the TDREPORT. 
> 
> +/*
> 
> + * Add a wrapper for TDG.MR.REPORT TDCALL. It is used in TDX guest
> 
> + * driver module to get the TDREPORT.
> 
> + */
> 
> +long tdx_mcall_get_report(void *reportdata, void *tdreport, u8 subtype)

Why "long"?

Why void *?  Don't you have real types for these?



> 
> +{
> 
> +       if (subtype || !reportdata || !tdreport)
> 
> +               return -EINVAL;

How could that happen if you control all callers?



> 
> +
> 
> +       /*
> 
> +        * Generate TDREPORT using "TDG.MR.REPORT" TDCALL.
> 
> +        *
> 
> +        * Get the TDREPORT using REPORTDATA as input. Refer to
> 
> +        * section 22.3.3 TDG.MR.REPORT leaf in the TDX Module 1.0
> 
> +        * specification for detailed information.
> 
> +        */
> 
> +       return __tdx_module_call(TDX_GET_REPORT, virt_to_phys(tdreport),
> 
> +                       virt_to_phys(reportdata), subtype, 0, NULL);

If you check for NULL, why are you not validating that these are valid
pointers as well?  You can't have it both ways.

thanks,

greg k-h



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux