All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.1 for-stable] vmstate_xhci_event: fix unterminated field list
@ 2014-07-22 15:26 Laszlo Ersek
  2014-07-22 15:35 ` Amit Shah
  2014-07-22 15:42 ` Paolo Bonzini
  0 siblings, 2 replies; 5+ messages in thread
From: Laszlo Ersek @ 2014-07-22 15:26 UTC (permalink / raw)
  To: lersek, amit.shah, dgilbert, kraxel, qemu-devel, qemu-stable

"vmstate_xhci_event" was introduced in commit 37352df3 ("xhci: add live
migration support"), and first released in v1.6.0. The field list in this
VMSD is not terminated with the VMSTATE_END_OF_LIST() macro.

During normal use (ie. migration), the issue is practically invisible,
because the "vmstate_xhci_event" object (with the unterminated field list)
is only ever referenced -- via "vmstate_xhci_intr" -- if xhci_er_full()
returns true, for the "ev_buffer" test. Since that field_exists() check
(apparently) almost always returns false, we almost never traverse
"vmstate_xhci_event" during migration, which hides the bug.

However, Amit's vmstate checker forces recursion into this VMSD as well,
and the lack of VMSTATE_END_OF_LIST() breaks the field list terminator
check (field->name != NULL) in dump_vmstate_vmsd(). The result is
undefined behavior, which in my case translates to infinite recursion
(because the loop happens to overflow into "vmstate_xhci_intr", which then
links back to "vmstate_xhci_event").

Add the missing terminator.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 hw/usb/hcd-xhci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 7f2af89..58c4b11 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -3737,6 +3737,7 @@ static const VMStateDescription vmstate_xhci_event = {
         VMSTATE_UINT32(flags,  XHCIEvent),
         VMSTATE_UINT8(slotid,  XHCIEvent),
         VMSTATE_UINT8(epid,    XHCIEvent),
+        VMSTATE_END_OF_LIST()
     }
 };
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.1 for-stable] vmstate_xhci_event: fix unterminated field list
  2014-07-22 15:26 [Qemu-devel] [PATCH for-2.1 for-stable] vmstate_xhci_event: fix unterminated field list Laszlo Ersek
@ 2014-07-22 15:35 ` Amit Shah
  2014-07-22 15:42 ` Paolo Bonzini
  1 sibling, 0 replies; 5+ messages in thread
From: Amit Shah @ 2014-07-22 15:35 UTC (permalink / raw)
  To: Laszlo Ersek; +Cc: qemu-devel, qemu-stable, Juan Quintela, dgilbert, kraxel

On (Tue) 22 Jul 2014 [17:26:41], Laszlo Ersek wrote:
> "vmstate_xhci_event" was introduced in commit 37352df3 ("xhci: add live
> migration support"), and first released in v1.6.0. The field list in this
> VMSD is not terminated with the VMSTATE_END_OF_LIST() macro.
> 
> During normal use (ie. migration), the issue is practically invisible,
> because the "vmstate_xhci_event" object (with the unterminated field list)
> is only ever referenced -- via "vmstate_xhci_intr" -- if xhci_er_full()
> returns true, for the "ev_buffer" test. Since that field_exists() check
> (apparently) almost always returns false, we almost never traverse
> "vmstate_xhci_event" during migration, which hides the bug.
> 
> However, Amit's vmstate checker forces recursion into this VMSD as well,
> and the lack of VMSTATE_END_OF_LIST() breaks the field list terminator
> check (field->name != NULL) in dump_vmstate_vmsd(). The result is
> undefined behavior, which in my case translates to infinite recursion
> (because the loop happens to overflow into "vmstate_xhci_intr", which then
> links back to "vmstate_xhci_event").
> 
> Add the missing terminator.
> 
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

Thanks for spotting this!

Reviewed-by: Amit Shah <amit.shah@redhat.com>


		Amit

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.1 for-stable] vmstate_xhci_event: fix unterminated field list
  2014-07-22 15:26 [Qemu-devel] [PATCH for-2.1 for-stable] vmstate_xhci_event: fix unterminated field list Laszlo Ersek
  2014-07-22 15:35 ` Amit Shah
@ 2014-07-22 15:42 ` Paolo Bonzini
  2014-07-22 15:48   ` Laszlo Ersek
  1 sibling, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2014-07-22 15:42 UTC (permalink / raw)
  To: Laszlo Ersek, amit.shah, dgilbert, kraxel, qemu-devel, qemu-stable

Il 22/07/2014 17:26, Laszlo Ersek ha scritto:
> "vmstate_xhci_event" was introduced in commit 37352df3 ("xhci: add live
> migration support"), and first released in v1.6.0. The field list in this
> VMSD is not terminated with the VMSTATE_END_OF_LIST() macro.
> 
> During normal use (ie. migration), the issue is practically invisible,
> because the "vmstate_xhci_event" object (with the unterminated field list)
> is only ever referenced -- via "vmstate_xhci_intr" -- if xhci_er_full()
> returns true, for the "ev_buffer" test. Since that field_exists() check
> (apparently) almost always returns false, we almost never traverse
> "vmstate_xhci_event" during migration, which hides the bug.
> 
> However, Amit's vmstate checker forces recursion into this VMSD as well,
> and the lack of VMSTATE_END_OF_LIST() breaks the field list terminator
> check (field->name != NULL) in dump_vmstate_vmsd(). The result is
> undefined behavior, which in my case translates to infinite recursion
> (because the loop happens to overflow into "vmstate_xhci_intr", which then
> links back to "vmstate_xhci_event").
> 
> Add the missing terminator.
> 
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  hw/usb/hcd-xhci.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
> index 7f2af89..58c4b11 100644
> --- a/hw/usb/hcd-xhci.c
> +++ b/hw/usb/hcd-xhci.c
> @@ -3737,6 +3737,7 @@ static const VMStateDescription vmstate_xhci_event = {
>          VMSTATE_UINT32(flags,  XHCIEvent),
>          VMSTATE_UINT8(slotid,  XHCIEvent),
>          VMSTATE_UINT8(epid,    XHCIEvent),
> +        VMSTATE_END_OF_LIST()
>      }
>  };
>  
> 

Cc: qemu-stable@nongnu.org
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.1 for-stable] vmstate_xhci_event: fix unterminated field list
  2014-07-22 15:42 ` Paolo Bonzini
@ 2014-07-22 15:48   ` Laszlo Ersek
  2014-07-22 16:14     ` Peter Maydell
  0 siblings, 1 reply; 5+ messages in thread
From: Laszlo Ersek @ 2014-07-22 15:48 UTC (permalink / raw)
  To: Paolo Bonzini, amit.shah, dgilbert, kraxel, qemu-devel, qemu-stable

On 07/22/14 17:42, Paolo Bonzini wrote:
> Il 22/07/2014 17:26, Laszlo Ersek ha scritto:
>> "vmstate_xhci_event" was introduced in commit 37352df3 ("xhci: add live
>> migration support"), and first released in v1.6.0. The field list in this
>> VMSD is not terminated with the VMSTATE_END_OF_LIST() macro.
>>
>> During normal use (ie. migration), the issue is practically invisible,
>> because the "vmstate_xhci_event" object (with the unterminated field list)
>> is only ever referenced -- via "vmstate_xhci_intr" -- if xhci_er_full()
>> returns true, for the "ev_buffer" test. Since that field_exists() check
>> (apparently) almost always returns false, we almost never traverse
>> "vmstate_xhci_event" during migration, which hides the bug.
>>
>> However, Amit's vmstate checker forces recursion into this VMSD as well,
>> and the lack of VMSTATE_END_OF_LIST() breaks the field list terminator
>> check (field->name != NULL) in dump_vmstate_vmsd(). The result is
>> undefined behavior, which in my case translates to infinite recursion
>> (because the loop happens to overflow into "vmstate_xhci_intr", which then
>> links back to "vmstate_xhci_event").
>>
>> Add the missing terminator.
>>
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
>> ---
>>  hw/usb/hcd-xhci.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
>> index 7f2af89..58c4b11 100644
>> --- a/hw/usb/hcd-xhci.c
>> +++ b/hw/usb/hcd-xhci.c
>> @@ -3737,6 +3737,7 @@ static const VMStateDescription vmstate_xhci_event = {
>>          VMSTATE_UINT32(flags,  XHCIEvent),
>>          VMSTATE_UINT8(slotid,  XHCIEvent),
>>          VMSTATE_UINT8(epid,    XHCIEvent),
>> +        VMSTATE_END_OF_LIST()
>>      }
>>  };
>>  
>>
> 
> Cc: qemu-stable@nongnu.org

As far as I can see, this address was present in my original To: list.
:) (Admittedly, not with CC.)

> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Thank you!

Laszlo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.1 for-stable] vmstate_xhci_event: fix unterminated field list
  2014-07-22 15:48   ` Laszlo Ersek
@ 2014-07-22 16:14     ` Peter Maydell
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2014-07-22 16:14 UTC (permalink / raw)
  To: Laszlo Ersek
  Cc: QEMU Developers, qemu-stable, Gerd Hoffmann, Amit Shah,
	Paolo Bonzini, Dr. David Alan Gilbert

On 22 July 2014 16:48, Laszlo Ersek <lersek@redhat.com> wrote:
> On 07/22/14 17:42, Paolo Bonzini wrote:
>> Cc: qemu-stable@nongnu.org
>
> As far as I can see, this address was present in my original To: list.
> :) (Admittedly, not with CC.)

Including the line in the commit message means it can get
pulled back out of the git log automatically for application
to the stable branch.

I'll commit this to master shortly.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-07-22 16:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-22 15:26 [Qemu-devel] [PATCH for-2.1 for-stable] vmstate_xhci_event: fix unterminated field list Laszlo Ersek
2014-07-22 15:35 ` Amit Shah
2014-07-22 15:42 ` Paolo Bonzini
2014-07-22 15:48   ` Laszlo Ersek
2014-07-22 16:14     ` Peter Maydell

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.