linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Sathyanarayanan Kuppuswamy  <sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, Shuah Khan <shuah@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	"H . Peter Anvin" <hpa@zytor.com>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	Tony Luck <tony.luck@intel.com>, Kai Huang <kai.huang@intel.com>,
	Wander Lairson Costa <wander@redhat.com>,
	Isaku Yamahata <isaku.yamahata@gmail.com>,
	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 v14 1/3] x86/tdx: Make __tdx_module_call() usable in driver module
Date: Wed, 12 Oct 2022 18:23:31 +0200	[thread overview]
Message-ID: <Y0bqA8+Xi1kLchxh@kroah.com> (raw)
In-Reply-To: <6759025f-fc08-74f0-efd7-2331110dec0c@linux.intel.com>

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

  reply	other threads:[~2022-10-12 16:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 21:55 [PATCH v14 0/3] Add TDX Guest Attestation support Kuppuswamy Sathyanarayanan
2022-09-28 21:55 ` [PATCH v14 1/3] x86/tdx: Make __tdx_module_call() usable in driver module Kuppuswamy Sathyanarayanan
2022-10-12 10:18   ` Borislav Petkov
2022-10-12 13:35     ` Sathyanarayanan Kuppuswamy
2022-10-12 14:27       ` Borislav Petkov
2022-10-12 15:44         ` Sathyanarayanan Kuppuswamy
2022-10-12 16:23           ` Greg Kroah-Hartman [this message]
2022-10-12 17:13             ` Sathyanarayanan Kuppuswamy
2022-10-12 17:26               ` Greg Kroah-Hartman
2022-10-12 18:11                 ` Sathyanarayanan Kuppuswamy
2022-09-28 21:55 ` [PATCH v14 2/3] virt: Add TDX guest driver Kuppuswamy Sathyanarayanan
2022-09-29 18:02   ` Wander Lairson Costa
2022-09-29 18:11     ` Sathyanarayanan Kuppuswamy
2022-09-30 12:22       ` Greg Kroah-Hartman
2022-09-30 15:27         ` Sathyanarayanan Kuppuswamy
2022-10-12 15:47   ` Borislav Petkov
2022-10-12 23:01     ` Sathyanarayanan Kuppuswamy
2022-10-13 13:21       ` Borislav Petkov
2022-09-28 21:55 ` [PATCH v14 3/3] selftests: tdx: Test TDX attestation GetReport support Kuppuswamy Sathyanarayanan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y0bqA8+Xi1kLchxh@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=isaku.yamahata@gmail.com \
    --cc=kai.huang@intel.com \
    --cc=khalid.elmously@canonical.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=marcelo.cerri@canonical.com \
    --cc=mingo@redhat.com \
    --cc=philip.cox@canonical.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tim.gardner@canonical.com \
    --cc=tony.luck@intel.com \
    --cc=wander@redhat.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).