All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Christoph Hellwig <hch@infradead.org>,
	Michael Thayer <michael.thayer@oracle.com>,
	"Knut St . Osmundsen" <knut.osmundsen@oracle.com>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] virt: Add vboxguest driver for Virtual Box Guest integration
Date: Wed, 4 Oct 2017 16:34:25 +0200	[thread overview]
Message-ID: <20171004143425.GB10709@kroah.com> (raw)
In-Reply-To: <6ff67ff3-5282-5131-39d0-ad5edf40dccd@redhat.com>

On Wed, Oct 04, 2017 at 12:40:54PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 04-10-17 12:30, Greg Kroah-Hartman wrote:
> > On Wed, Oct 04, 2017 at 12:23:41PM +0200, Arnd Bergmann wrote:
> > > On Wed, Oct 4, 2017 at 12:11 PM, Greg Kroah-Hartman
> > > <gregkh@linuxfoundation.org> wrote:
> > > > On Wed, Oct 04, 2017 at 11:32:23AM +0200, Hans de Goede wrote:
> > > > > Hi,
> > > > > 
> > > > > On 03-10-17 13:41, Hans de Goede wrote:
> > > > > 
> > > > > <snip>
> > > > > 
> > > > > > > > +#define CHECK_IOCTL_IN(req)                             \
> > > > > > > > +do {                                         \
> > > > > > > > +    if ((req)->Hdr.cbIn != (sizeof((req)->Hdr) + sizeof((req)->u.In)) || \
> > > > > > > > +        (req)->Hdr.cbOut != sizeof((req)->Hdr))                 \
> > > > > > > > +        return -EINVAL;                             \
> > > > > > > > +} while (0)
> > > > > > > 
> > > > > > > Make these things functions instead of macros.
> > > > > > 
> > > > > > Turning these into functions is a good idea I will do so for v2.
> > > > > 
> > > > > Correction, I forgot that the passed in "req" macro
> > > > > argument has a different type with all the calls, so
> > > > > these cannot be changed into functions because they
> > > > > rely on sizeof on the specific type to do the size
> > > > > checks.
> > > > 
> > > > Don't we already have built-in checks for these types of things?  Surely
> > > > we don't require each ioctl user in the kernel to do this by
> > > > themselves...
> > > 
> > > No other driver uses this kind of header for the ioctl structures,
> > > usually we just rely on the ioctl command number to encode the
> > > size, or we copy a fixed length.
> > 
> > Then why can't we do the same thing here as well?
> 
> VirtualBox uses the same ioctl interface for the guest-additions userspace
> parts on all supported platforms and not all platforms support encoding
> the size in the ioctl number, so all the ioctl data structs have a header
> with the in and out sizes in there, these macros check that header.
> 
> As mentioned during the RFC discussions changing the ioctl interface
> is going to be troublesome to do because we want to be ABI compatible
> with the kernel module shipped with the guest additions.
> 
> Having 2 separate guest additions builds, one for running with the out
> of tree driver (which eventually should go away I hope, but certainly not
> soon) and another build for the mainline version of the vboxguest driver
> is not supportable.
> 
> I'm confident that if we find issues during the review process, which
> have security implications, or where behavior is not clearly specified,
> that we can get VirtualBox upstream to fix the API for that, but outright
> re-designing the API is not really an option I believe.
> 
> As for these specific macros to check the ioctl data struct header,
> if these are considered a problem I can simply write out the code in
> the few places where this macro is called.

Ok, that makes a bit more sense, let's see what your next round of
patches look like, we can take it from there :)

thanks,

greg k-h

      reply	other threads:[~2017-10-04 14:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-03  9:21 [PATCH 0/1] virt: Add vboxguest driver for Virtual Box Guest integration Hans de Goede
2017-10-03  9:21 ` [PATCH] " Hans de Goede
2017-10-03 10:04   ` Christoph Hellwig
2017-10-03 11:41     ` Hans de Goede
2017-10-03 12:40       ` Greg Kroah-Hartman
2017-10-04  9:32         ` Hans de Goede
2017-10-04  9:32       ` Hans de Goede
2017-10-04 10:11         ` Greg Kroah-Hartman
2017-10-04 10:23           ` Arnd Bergmann
2017-10-04 10:30             ` Greg Kroah-Hartman
2017-10-04 10:40               ` Hans de Goede
2017-10-04 14:34                 ` Greg Kroah-Hartman [this message]

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=20171004143425.GB10709@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Larry.Finger@lwfinger.net \
    --cc=arnd@arndb.de \
    --cc=hch@infradead.org \
    --cc=hdegoede@redhat.com \
    --cc=knut.osmundsen@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.thayer@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.