Skip to contentSkip to conversation

pmu: fix pmu vmstate subsection list

PATCH In review Laurent Vivier 5 participants 6 messages Nov 16, 2021 – Nov 17, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pmu: fix pmu vmstate subsection list

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")
---
 hw/misc/macio/pmu.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/macio/pmu.c +1 -0
index 4ad4f50e08c3..eb39c64694aa 100644
@@ -718,6 +718,7 @@ static const VMStateDescription vmstate_pmu = {
     },
     .subsections = (const VMStateDescription * []) {
         &vmstate_pmu_adb,
+        NULL
     }
 };
 
Signature · 1 line
2.33.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · On Tue, 16 Nov 2021 16:08:37 +0100 Laurent Vivier <[email protected]> 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:

Quoted 7 lines
  $ ./qemu-system-ppc64  -dump-vmstate vmstate.json
  Segmentation fault (core dumped)
Fixes d811d61fbc6c ("mac_newworld: add PMU device")

---

Quoted 8 lines
 hw/misc/macio/pmu.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/macio/pmu.c +0 -0
index 4ad4f50e08c3..eb39c64694aa 100644

hw/misc/macio/pmu.c static const VMStateDescription vmstate_pmu = { · line 724

Quoted 7 lines
hw/misc/macio/pmu.c +1 -0
@@ -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.

#2 lore raw
Quoted 7 lines
Quoted 7 lines
hw/misc/macio/pmu.c +0 -0
index 4ad4f50e08c3..eb39c64694aa 100644
@@ -718,6 +718,7 @@ static const VMStateDescription vmstate_pmu = {
      },
      .subsections = (const VMStateDescription * []) {
Quoted 8 lines

hw/misc/macio/pmu.c static const VMStateDescription vmstate_pmu = { · line 724

Quoted 5 lines
hw/misc/macio/pmu.c +1 -0
          &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.

Reviewed-by on v1 1/1
#3 lore raw
In reply to Laurent Vivier
Quoted 20 lines · Laurent Vivier

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")
---
 hw/misc/macio/pmu.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/macio/pmu.c +0 -0
index 4ad4f50e08c3..eb39c64694aa 100644

hw/misc/macio/pmu.c static const VMStateDescription vmstate_pmu = { · line 723

Quoted 6 lines
hw/misc/macio/pmu.c +1 -0
@@ -718,6 +718,7 @@ static const VMStateDescription vmstate_pmu = {
     },
     .subsections = (const VMStateDescription * []) {
         &vmstate_pmu_adb,
+        NULL
     }
 };

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

Reviewed-by on v1 1/1
#4 lore raw
In reply to Laurent Vivier
Quoted 20 lines · Laurent Vivier

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")
---
  hw/misc/macio/pmu.c | 1 +
  1 file changed, 1 insertion(+)
hw/misc/macio/pmu.c +0 -0
index 4ad4f50e08c3..eb39c64694aa 100644

hw/misc/macio/pmu.c static const VMStateDescription vmstate_pmu = { · line 723

Quoted 6 lines
hw/misc/macio/pmu.c +1 -0
@@ -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:

ATB,

Mark.

#5 lore raw
In reply to Laurent Vivier
Quoted 11 lines · Laurent Vivier

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")

Queued for 6.2

Thanks,

C.

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