lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 21 Oct 2022 06:39:54 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Sathyanarayanan Kuppuswamy 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
        Shuah Khan <shuah@...nel.org>,
        Jonathan Corbet <corbet@....net>,
        "H . Peter Anvin" <hpa@...or.com>,
        "Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
        Tony Luck <tony.luck@...el.com>,
        Kai Huang <kai.huang@...el.com>,
        Wander Lairson Costa <wander@...hat.com>,
        Isaku Yamahata <isaku.yamahata@...il.com>,
        marcelo.cerri@...onical.com, tim.gardner@...onical.com,
        khalid.elmously@...onical.com, philip.cox@...onical.com,
        linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
        linux-doc@...r.kernel.org
Subject: Re: [PATCH v15 2/3] virt: Add TDX guest driver

On Thu, Oct 20, 2022 at 05:00:27PM -0700, Sathyanarayanan Kuppuswamy wrote:
> Hi,
> 
> On 10/19/22 10:38 PM, Greg Kroah-Hartman wrote:
> > On Wed, Oct 19, 2022 at 09:58:27PM -0700, Kuppuswamy Sathyanarayanan wrote:
> >> +static long tdx_get_report(void __user *argp)
> >> +{
> >> +	u8 *reportdata, *tdreport;
> >> +	struct tdx_report_req req;
> >> +	long ret;
> >> +
> >> +	if (copy_from_user(&req, argp, sizeof(req)))
> >> +		return -EFAULT;
> >> +
> >> +	/*
> >> +	 * Per TDX Module 1.0 specification, section titled
> >> +	 * "TDG.MR.REPORT", REPORTDATA length is fixed as
> >> +	 * TDX_REPORTDATA_LEN, TDREPORT length is fixed as
> >> +	 * TDX_REPORT_LEN, and TDREPORT subtype is fixed as 0.
> >> +	 */
> >> +	if (req.subtype || req.rpd_len != TDX_REPORTDATA_LEN ||
> >> +	    req.tdr_len != TDX_REPORT_LEN) {
> >> +		pr_err("TDX_CMD_GET_REPORT: invalid req: subtype:%u rpd_len:%u tdr_len:%u\n",
> >> +		       req.subtype, req.rpd_len, req.tdr_len);
> > 
> > You are allowing userspace to spam the kernel logs, please do not do
> > that.
> 
> Added it to help userspace understand the reason for the failure (only for
> the cases like request param issues and TDCALL failure). Boris recommended
> adding it in the previous review.

Again, you just created a vector for userspace to spam the kernel log.
No kernel driver should ever do that.

> >> +#ifdef MODULE
> >> +static const struct x86_cpu_id tdx_guest_ids[] = {
> >> +	X86_MATCH_FEATURE(X86_FEATURE_TDX_GUEST, NULL),
> >> +	{}
> >> +};
> >> +MODULE_DEVICE_TABLE(x86cpu, tdx_guest_ids);
> >> +#endif
> > 
> > Why the #ifdef?  Should not be needed, right?
> 
> I have added it to fix the following warning reported by 0-day.
> 
> https://lore.kernel.org/lkml/202209211607.tCtTWKbV-lkp@intel.com/
> 
> It is related to nullifying the MODULE_DEVICE_TABLE in #ifndef MODULE
> case in linux/module.h.

Then fix it properly, by correctly using that structure no matter what.
You don't do that here...

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ