From: <Mario.Limonciello@dell.com>
To: <dvhart@infradead.org>, <greg@kroah.com>
Cc: <andy.shevchenko@gmail.com>, <linux-kernel@vger.kernel.org>,
<platform-driver-x86@vger.kernel.org>, <luto@kernel.org>,
<quasisec@google.com>, <pali.rohar@gmail.com>
Subject: RE: [PATCH v3 5/8] platform/x86: dell-wmi-smbios: introduce character device for userspace
Date: Tue, 3 Oct 2017 15:49:04 +0000 [thread overview]
Message-ID: <5cbdbc85d3e14880a187dfb8f76b1745@ausx13mpc120.AMER.DELL.COM> (raw)
In-Reply-To: <20171003152010.GB14523@fury>
> -----Original Message-----
> From: Darren Hart [mailto:dvhart@infradead.org]
> Sent: Tuesday, October 3, 2017 10:20 AM
> To: Greg KH <greg@kroah.com>
> Cc: Limonciello, Mario <Mario_Limonciello@Dell.com>; Andy Shevchenko
> <andy.shevchenko@gmail.com>; LKML <linux-kernel@vger.kernel.org>;
> platform-driver-x86@vger.kernel.org; Andy Lutomirski <luto@kernel.org>;
> quasisec@google.com; pali.rohar@gmail.com
> Subject: Re: [PATCH v3 5/8] platform/x86: dell-wmi-smbios: introduce character
> device for userspace
>
> On Tue, Oct 03, 2017 at 11:26:11AM +0200, Greg KH wrote:
> > On Wed, Sep 27, 2017 at 11:02:17PM -0500, Mario Limonciello wrote:
> > > +static int dell_wmi_smbios_open(struct inode *inode, struct file *file)
> > > +{
> > > + return nonseekable_open(inode, file);
> > > +}
> > > +
> > > +static int dell_wmi_smbios_release(struct inode *inode, struct file *file)
> > > +{
> > > + return 0;
> > > +}
> >
> > Why even declare an open/release if you don't do anything with them?
> > Just leave them empty.
> >
> > > +static long dell_wmi_smbios_ioctl(struct file *filp, unsigned int cmd,
> > > + unsigned long arg)
> > > +{
> > > + void __user *p = (void __user *) arg;
> > > + size_t size;
> > > + int ret = 0;
> > > +
> > > + if (_IOC_TYPE(cmd) != DELL_WMI_SMBIOS_IOC)
> > > + return -ENOTTY;
> > > +
> > > + switch (cmd) {
> > > + case DELL_WMI_SMBIOS_CALL_CMD:
> > > + size = sizeof(struct wmi_calling_interface_buffer);
> > > + mutex_lock(&buffer_mutex);
> > > + if (copy_from_user(devfs_buffer, p, size)) {
> > > + ret = -EFAULT;
> > > + goto fail_smbios_cmd;
> > > + }
> > > + ret = run_wmi_smbios_call(devfs_buffer);
> >
> > You _are_ checking that your structures are valid here, right? I didn't
> > see you really were, so I'll let you go audit your code paths for the
> > next set of patches.
> >
> > But really, ugh, this seems horrible. It's a huge vague data blob going
> > both ways, this feels ripe for abuse and other bad things. Do you have
> > a working userspace implementation for all of this to publish at the
> > same time?
> >
>
> This is the general challenge with WMI support, as it was designed to
> provide userspace with a way to talk to the firmware.
>
> For the more general case going forward the intent is to perform the MOF
> parsing in the kernel, which will make it possible to do some automated
> buffer validation.
>
> This particular driver is an intermediate step improving on the
> mechanism used for existing devices (libsmbios -> dcdbas -> SMM) to use
> the safer WMI entry point (using an op region instead of passing a
> physical memory pointer to SMM).
>
> But, that said... Mario, in lieu of the MOF description of the buffer,
> we should be able to do some driver specific validation of this buffer
> here.
>
As the WMI interface exists today even the MOF doesn't describe the
Content of the buffer either. It's a buffer passed from userspace to BIOS and
back. I described it as the struct, but I'm not really sure how that can
be further validated by the Linux kernel without a checksum.
This is no different than how dell-smbios and dcdbas operates.
New interfaces will have description that is parsable by MOF.
next prev parent reply other threads:[~2017-10-03 15:49 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-28 4:02 [PATCH v3 0/8] Introduce support for Dell SMBIOS over WMI Mario Limonciello
2017-09-28 4:02 ` [PATCH v3 1/8] platform/x86: wmi: Add new method wmidev_evaluate_method Mario Limonciello
2017-09-28 4:02 ` [PATCH v3 2/8] platform/x86: dell-smbios: Introduce a WMI-ACPI interface Mario Limonciello
2017-09-28 6:53 ` Pali Rohár
2017-09-28 22:43 ` Mario.Limonciello
2017-09-29 7:35 ` Pali Rohár
2017-09-30 20:01 ` Mario.Limonciello
2017-09-30 21:06 ` Pali Rohár
2017-09-30 0:51 ` Darren Hart
2017-09-30 7:15 ` Pali Rohár
2017-09-30 19:56 ` Mario.Limonciello
2017-09-28 4:02 ` [PATCH v3 3/8] platform/x86: dell-wmi-smbios: Use Dell WMI descriptor check Mario Limonciello
2017-09-30 1:29 ` Darren Hart
2017-09-30 19:48 ` Mario.Limonciello
2017-09-30 20:01 ` Pali Rohár
2017-10-02 14:15 ` Mario.Limonciello
2017-10-02 14:37 ` Pali Rohár
2017-10-01 8:43 ` Andy Shevchenko
2017-09-28 4:02 ` [PATCH v3 4/8] platform/x86: wmi: create character devices when requested by drivers Mario Limonciello
2017-09-30 1:52 ` Darren Hart
2017-09-30 8:12 ` Greg Kroah-Hartman
2017-09-30 19:26 ` Mario.Limonciello
2017-10-01 13:23 ` Greg KH
2017-10-01 14:25 ` Mario.Limonciello
2017-10-01 18:03 ` Greg KH
2017-10-02 0:57 ` Darren Hart
2017-10-02 9:24 ` Greg Kroah-Hartman
2017-10-02 14:33 ` Darren Hart
2017-10-03 9:23 ` Greg KH
2017-10-03 15:09 ` Mario.Limonciello
2017-10-03 15:10 ` Darren Hart
2017-10-03 16:48 ` Andy Lutomirski
2017-10-03 17:46 ` Greg KH
2017-10-03 18:38 ` Mario.Limonciello
2017-10-03 19:31 ` Andy Lutomirski
2017-10-03 9:23 ` Greg KH
2017-10-03 15:13 ` Mario.Limonciello
2017-09-28 4:02 ` [PATCH v3 5/8] platform/x86: dell-wmi-smbios: introduce character device for userspace Mario Limonciello
2017-09-30 2:06 ` Darren Hart
2017-09-30 19:45 ` Mario.Limonciello
2017-10-03 9:26 ` Greg KH
2017-10-03 15:09 ` Mario.Limonciello
2017-10-03 15:20 ` Darren Hart
2017-10-03 15:49 ` Mario.Limonciello [this message]
2017-10-05 0:02 ` Darren Hart
2017-10-05 15:10 ` Mario.Limonciello
2017-09-28 4:02 ` [PATCH v3 6/8] platform/x86: dell-wmi-smbios: Add a sysfs interface for SMBIOS tokens Mario Limonciello
2017-09-30 2:10 ` Darren Hart
2017-10-01 8:51 ` Andy Shevchenko
2017-09-28 4:02 ` [PATCH v3 7/8] platform/x86: Kconfig: Change the default settings for dell-wmi-smbios Mario Limonciello
2017-09-28 4:02 ` [PATCH v3 8/8] platform/x86: dell-wmi-smbios: clean up wmi descriptor check Mario Limonciello
2017-10-02 13:15 ` Andy Shevchenko
2017-10-02 13:26 ` Mario.Limonciello
2017-09-30 2:16 ` [PATCH v3 0/8] Introduce support for Dell SMBIOS over WMI Darren Hart
2017-09-30 19:56 ` Mario.Limonciello
2017-10-05 2:44 ` Darren Hart
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=5cbdbc85d3e14880a187dfb8f76b1745@ausx13mpc120.AMER.DELL.COM \
--to=mario.limonciello@dell.com \
--cc=andy.shevchenko@gmail.com \
--cc=dvhart@infradead.org \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=pali.rohar@gmail.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=quasisec@google.com \
/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
all inboxes | Powered by JetHome®