vhost: make msg padding explicit
diff mbox

Message ID 1524844881-178524-1-git-send-email-mst@redhat.com
State New
Headers show

Commit Message

Michael S. Tsirkin April 27, 2018, 4:02 p.m. UTC
There's a 32 bit hole just after type. It's best to
give it a name, this way compiler is forced to initialize
it with rest of the structure.

Reported-by: Kevin Easton <kevin@guarana.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/uapi/linux/vhost.h | 1 +
 1 file changed, 1 insertion(+)

Comments

David Miller April 30, 2018, 1:34 a.m. UTC | #1
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Fri, 27 Apr 2018 19:02:05 +0300

> There's a 32 bit hole just after type. It's best to
> give it a name, this way compiler is forced to initialize
> it with rest of the structure.
> 
> Reported-by: Kevin Easton <kevin@guarana.org>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Who applied this, me? :-)
David Miller May 1, 2018, 3:28 p.m. UTC | #2
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Fri, 27 Apr 2018 19:02:05 +0300

> There's a 32 bit hole just after type. It's best to
> give it a name, this way compiler is forced to initialize
> it with rest of the structure.
> 
> Reported-by: Kevin Easton <kevin@guarana.org>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Michael, will you be sending this directly to Linus or would you like
me to apply it to net or net-next?

Thanks.
Michael S. Tsirkin May 1, 2018, 5:19 p.m. UTC | #3
On Tue, May 01, 2018 at 11:28:22AM -0400, David Miller wrote:
> From: "Michael S. Tsirkin" <mst@redhat.com>
> Date: Fri, 27 Apr 2018 19:02:05 +0300
> 
> > There's a 32 bit hole just after type. It's best to
> > give it a name, this way compiler is forced to initialize
> > it with rest of the structure.
> > 
> > Reported-by: Kevin Easton <kevin@guarana.org>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> Michael, will you be sending this directly to Linus or would you like
> me to apply it to net or net-next?
> 
> Thanks.

I'd prefer you to apply it for net and cc stable if possible.
Thanks!
David Miller May 1, 2018, 6:05 p.m. UTC | #4
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Tue, 1 May 2018 20:19:19 +0300

> On Tue, May 01, 2018 at 11:28:22AM -0400, David Miller wrote:
>> From: "Michael S. Tsirkin" <mst@redhat.com>
>> Date: Fri, 27 Apr 2018 19:02:05 +0300
>> 
>> > There's a 32 bit hole just after type. It's best to
>> > give it a name, this way compiler is forced to initialize
>> > it with rest of the structure.
>> > 
>> > Reported-by: Kevin Easton <kevin@guarana.org>
>> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>> 
>> Michael, will you be sending this directly to Linus or would you like
>> me to apply it to net or net-next?
>> 
>> Thanks.
> 
> I'd prefer you to apply it for net and cc stable if possible.

Ok, applied, and added to my -stable submission queue.
Kevin Easton May 2, 2018, 6:28 a.m. UTC | #5
On Tue, May 01, 2018 at 02:05:51PM -0400, David Miller wrote:
> From: "Michael S. Tsirkin" <mst@redhat.com>
> Date: Tue, 1 May 2018 20:19:19 +0300
> 
> > On Tue, May 01, 2018 at 11:28:22AM -0400, David Miller wrote:
> >> From: "Michael S. Tsirkin" <mst@redhat.com>
> >> Date: Fri, 27 Apr 2018 19:02:05 +0300
> >> 
> >> > There's a 32 bit hole just after type. It's best to
> >> > give it a name, this way compiler is forced to initialize
> >> > it with rest of the structure.
> >> > 
> >> > Reported-by: Kevin Easton <kevin@guarana.org>
> >> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> >> 
> >> Michael, will you be sending this directly to Linus or would you like
> >> me to apply it to net or net-next?
> >> 
> >> Thanks.
> > 
> > I'd prefer you to apply it for net and cc stable if possible.
> 
> Ok, applied, and added to my -stable submission queue.

Hold on, this patch changes the layout for i386 (where there is
no padding at all).  And it's part of UAPI.

    - Kevin

>
Michael S. Tsirkin May 2, 2018, 1:36 p.m. UTC | #6
On Wed, May 02, 2018 at 02:28:09AM -0400, Kevin Easton wrote:
> On Tue, May 01, 2018 at 02:05:51PM -0400, David Miller wrote:
> > From: "Michael S. Tsirkin" <mst@redhat.com>
> > Date: Tue, 1 May 2018 20:19:19 +0300
> > 
> > > On Tue, May 01, 2018 at 11:28:22AM -0400, David Miller wrote:
> > >> From: "Michael S. Tsirkin" <mst@redhat.com>
> > >> Date: Fri, 27 Apr 2018 19:02:05 +0300
> > >> 
> > >> > There's a 32 bit hole just after type. It's best to
> > >> > give it a name, this way compiler is forced to initialize
> > >> > it with rest of the structure.
> > >> > 
> > >> > Reported-by: Kevin Easton <kevin@guarana.org>
> > >> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > >> 
> > >> Michael, will you be sending this directly to Linus or would you like
> > >> me to apply it to net or net-next?
> > >> 
> > >> Thanks.
> > > 
> > > I'd prefer you to apply it for net and cc stable if possible.
> > 
> > Ok, applied, and added to my -stable submission queue.
> 
> Hold on, this patch changes the layout for i386 (where there is
> no padding at all).  And it's part of UAPI.
> 
>     - Kevin
> 
> > 

Ouch.  True - and in particular the 32 bit ABI on 64 bit kernels doesn't
work at all. Hmm. It's relatively new and maybe there aren't any 32 bit
users yet. Thoughts?
David Miller May 2, 2018, 2:04 p.m. UTC | #7
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Wed, 2 May 2018 16:36:37 +0300

> Ouch.  True - and in particular the 32 bit ABI on 64 bit kernels doesn't
> work at all. Hmm. It's relatively new and maybe there aren't any 32 bit
> users yet. Thoughts?

If it's been in a released kernel version, we really aren't at liberty
to play "maybe nobody uses this" UAPI changing games.

Please send me a revert.
Michael S. Tsirkin May 2, 2018, 2:19 p.m. UTC | #8
On Wed, May 02, 2018 at 10:04:46AM -0400, David Miller wrote:
> From: "Michael S. Tsirkin" <mst@redhat.com>
> Date: Wed, 2 May 2018 16:36:37 +0300
> 
> > Ouch.  True - and in particular the 32 bit ABI on 64 bit kernels doesn't
> > work at all. Hmm. It's relatively new and maybe there aren't any 32 bit
> > users yet. Thoughts?
> 
> If it's been in a released kernel version, we really aren't at liberty
> to play "maybe nobody uses this" UAPI changing games.
> 
> Please send me a revert.

Sent. Looking at compat mess now.
Kevin Easton May 2, 2018, 2:40 p.m. UTC | #9
On Wed, May 02, 2018 at 05:19:27PM +0300, Michael S. Tsirkin wrote:
> On Wed, May 02, 2018 at 10:04:46AM -0400, David Miller wrote:
> > From: "Michael S. Tsirkin" <mst@redhat.com>
> > Date: Wed, 2 May 2018 16:36:37 +0300
> > 
> > > Ouch.  True - and in particular the 32 bit ABI on 64 bit kernels doesn't
> > > work at all. Hmm. It's relatively new and maybe there aren't any 32 bit
> > > users yet. Thoughts?
> > 
> > If it's been in a released kernel version, we really aren't at liberty
> > to play "maybe nobody uses this" UAPI changing games.
> > 
> > Please send me a revert.
> 
> Sent. Looking at compat mess now.

Just naming the padding field isn't sufficient anyway, there also needs to
be code in vhost_new_msg() to initialise it using the name.

    - Kevin

Patch
diff mbox

diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h
index c51f8e5..5a8ad06 100644
--- a/include/uapi/linux/vhost.h
+++ b/include/uapi/linux/vhost.h
@@ -68,6 +68,7 @@  struct vhost_iotlb_msg {
 
 struct vhost_msg {
 	int type;
+	int padding0;
 	union {
 		struct vhost_iotlb_msg iotlb;
 		__u8 padding[64];