qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pmu: fix pmu vmstate subsection list
@ 2021-11-16 15:08 Laurent Vivier
  2021-11-16 15:20 ` Greg Kurz
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Laurent Vivier @ 2021-11-16 15:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, Mark Cave-Ayland

The subsection is not closed by a NULL marker so this can trigger
a segfault when the pmu vmstate is saved.

This can be easily shown with:

  $ ./qemu-system-ppc64  -dump-vmstate vmstate.json
  Segmentation fault (core dumped)

Fixes: d811d61fbc6c ("mac_newworld: add PMU device")
Cc: mark.cave-ayland@ilande.co.uk
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 hw/misc/macio/pmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/misc/macio/pmu.c b/hw/misc/macio/pmu.c
index 4ad4f50e08c3..eb39c64694aa 100644
--- a/hw/misc/macio/pmu.c
+++ b/hw/misc/macio/pmu.c
@@ -718,6 +718,7 @@ static const VMStateDescription vmstate_pmu = {
     },
     .subsections = (const VMStateDescription * []) {
         &vmstate_pmu_adb,
+        NULL
     }
 };
 
-- 
2.33.1



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

* Re: [PATCH] pmu: fix pmu vmstate subsection list
  2021-11-16 15:08 [PATCH] pmu: fix pmu vmstate subsection list Laurent Vivier
@ 2021-11-16 15:20 ` Greg Kurz
  2021-11-17 11:03   ` Cédric Le Goater
  2021-11-16 15:44 ` Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Greg Kurz @ 2021-11-16 15:20 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: qemu-ppc, qemu-devel

On Tue, 16 Nov 2021 16:08:37 +0100
Laurent Vivier <lvivier@redhat.com> wrote:

> The subsection is not closed by a NULL marker so this can trigger
> a segfault when the pmu vmstate is saved.
> 
> This can be easily shown with:
> 
>   $ ./qemu-system-ppc64  -dump-vmstate vmstate.json
>   Segmentation fault (core dumped)
> 
> Fixes: d811d61fbc6c ("mac_newworld: add PMU device")
> Cc: mark.cave-ayland@ilande.co.uk
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  hw/misc/macio/pmu.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/misc/macio/pmu.c b/hw/misc/macio/pmu.c
> index 4ad4f50e08c3..eb39c64694aa 100644
> --- a/hw/misc/macio/pmu.c
> +++ b/hw/misc/macio/pmu.c
> @@ -718,6 +718,7 @@ static const VMStateDescription vmstate_pmu = {
>      },
>      .subsections = (const VMStateDescription * []) {
>          &vmstate_pmu_adb,
> +        NULL
>      }
>  };
>  

This fix is so obvious that I guess you could carry it through the
trivial tree IMHO.



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

* Re: [PATCH] pmu: fix pmu vmstate subsection list
  2021-11-16 15:08 [PATCH] pmu: fix pmu vmstate subsection list Laurent Vivier
  2021-11-16 15:20 ` Greg Kurz
@ 2021-11-16 15:44 ` Philippe Mathieu-Daudé
  2021-11-16 19:50 ` Mark Cave-Ayland
  2021-11-17 18:13 ` Cédric Le Goater
  3 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-11-16 15:44 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel; +Cc: Mark Cave-Ayland, qemu-ppc

On 11/16/21 16:08, Laurent Vivier wrote:
> The subsection is not closed by a NULL marker so this can trigger
> a segfault when the pmu vmstate is saved.
> 
> This can be easily shown with:
> 
>   $ ./qemu-system-ppc64  -dump-vmstate vmstate.json
>   Segmentation fault (core dumped)
> 
> Fixes: d811d61fbc6c ("mac_newworld: add PMU device")
> Cc: mark.cave-ayland@ilande.co.uk
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  hw/misc/macio/pmu.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/misc/macio/pmu.c b/hw/misc/macio/pmu.c
> index 4ad4f50e08c3..eb39c64694aa 100644
> --- a/hw/misc/macio/pmu.c
> +++ b/hw/misc/macio/pmu.c
> @@ -718,6 +718,7 @@ static const VMStateDescription vmstate_pmu = {
>      },
>      .subsections = (const VMStateDescription * []) {
>          &vmstate_pmu_adb,
> +        NULL
>      }
>  };

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

BTW I ran 'git grep -W -F .subsections' and couldn't find other
occurrence.



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

* Re: [PATCH] pmu: fix pmu vmstate subsection list
  2021-11-16 15:08 [PATCH] pmu: fix pmu vmstate subsection list Laurent Vivier
  2021-11-16 15:20 ` Greg Kurz
  2021-11-16 15:44 ` Philippe Mathieu-Daudé
@ 2021-11-16 19:50 ` Mark Cave-Ayland
  2021-11-17 18:13 ` Cédric Le Goater
  3 siblings, 0 replies; 6+ messages in thread
From: Mark Cave-Ayland @ 2021-11-16 19:50 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel; +Cc: qemu-ppc

On 16/11/2021 15:08, Laurent Vivier wrote:

> The subsection is not closed by a NULL marker so this can trigger
> a segfault when the pmu vmstate is saved.
> 
> This can be easily shown with:
> 
>    $ ./qemu-system-ppc64  -dump-vmstate vmstate.json
>    Segmentation fault (core dumped)
> 
> Fixes: d811d61fbc6c ("mac_newworld: add PMU device")
> Cc: mark.cave-ayland@ilande.co.uk
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>   hw/misc/macio/pmu.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/hw/misc/macio/pmu.c b/hw/misc/macio/pmu.c
> index 4ad4f50e08c3..eb39c64694aa 100644
> --- a/hw/misc/macio/pmu.c
> +++ b/hw/misc/macio/pmu.c
> @@ -718,6 +718,7 @@ static const VMStateDescription vmstate_pmu = {
>       },
>       .subsections = (const VMStateDescription * []) {
>           &vmstate_pmu_adb,
> +        NULL
>       }
>   };

Eeek. Good spot, looks like this bug has been around for some time:

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.


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

* Re: [PATCH] pmu: fix pmu vmstate subsection list
  2021-11-16 15:20 ` Greg Kurz
@ 2021-11-17 11:03   ` Cédric Le Goater
  0 siblings, 0 replies; 6+ messages in thread
From: Cédric Le Goater @ 2021-11-17 11:03 UTC (permalink / raw)
  To: Greg Kurz, Laurent Vivier; +Cc: qemu-ppc, qemu-devel

>> diff --git a/hw/misc/macio/pmu.c b/hw/misc/macio/pmu.c
>> index 4ad4f50e08c3..eb39c64694aa 100644
>> --- a/hw/misc/macio/pmu.c
>> +++ b/hw/misc/macio/pmu.c
>> @@ -718,6 +718,7 @@ static const VMStateDescription vmstate_pmu = {
>>       },
>>       .subsections = (const VMStateDescription * []) {
>>           &vmstate_pmu_adb,
>> +        NULL
>>       }
>>   };
>>   
> 
> This fix is so obvious that I guess you could carry it through the
> trivial tree IMHO.

I don't have anything queued for ppc yet but anyhow I can send a PR
at the end of the week if trivial doesn't.

Thanks,

C.


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

* Re: [PATCH] pmu: fix pmu vmstate subsection list
  2021-11-16 15:08 [PATCH] pmu: fix pmu vmstate subsection list Laurent Vivier
                   ` (2 preceding siblings ...)
  2021-11-16 19:50 ` Mark Cave-Ayland
@ 2021-11-17 18:13 ` Cédric Le Goater
  3 siblings, 0 replies; 6+ messages in thread
From: Cédric Le Goater @ 2021-11-17 18:13 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel; +Cc: Mark Cave-Ayland, qemu-ppc

On 11/16/21 16:08, Laurent Vivier wrote:
> The subsection is not closed by a NULL marker so this can trigger
> a segfault when the pmu vmstate is saved.
> 
> This can be easily shown with:
> 
>    $ ./qemu-system-ppc64  -dump-vmstate vmstate.json
>    Segmentation fault (core dumped)
> 
> Fixes: d811d61fbc6c ("mac_newworld: add PMU device")
> Cc: mark.cave-ayland@ilande.co.uk
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Queued for 6.2

Thanks,

C.


> ---
>   hw/misc/macio/pmu.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/hw/misc/macio/pmu.c b/hw/misc/macio/pmu.c
> index 4ad4f50e08c3..eb39c64694aa 100644
> --- a/hw/misc/macio/pmu.c
> +++ b/hw/misc/macio/pmu.c
> @@ -718,6 +718,7 @@ static const VMStateDescription vmstate_pmu = {
>       },
>       .subsections = (const VMStateDescription * []) {
>           &vmstate_pmu_adb,
> +        NULL
>       }
>   };
>   
> 



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

end of thread, other threads:[~2021-11-17 18:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 15:08 [PATCH] pmu: fix pmu vmstate subsection list Laurent Vivier
2021-11-16 15:20 ` Greg Kurz
2021-11-17 11:03   ` Cédric Le Goater
2021-11-16 15:44 ` Philippe Mathieu-Daudé
2021-11-16 19:50 ` Mark Cave-Ayland
2021-11-17 18:13 ` Cédric Le Goater

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).