pmu: fix pmu vmstate subsection list
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)
--- hw/misc/macio/pmu.c | 1 + 1 file changed, 1 insertion(+)
hw/misc/macio/pmu.c +1 -0
@@ -718,6 +718,7 @@ static const VMStateDescription vmstate_pmu = { }, .subsections = (const VMStateDescription * []) { &vmstate_pmu_adb, +NULL } };
Signature · 1 line
2.33.1
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")Signed-off-by Laurent Vivier <[email protected]>---
Quoted 8 lines
hw/misc/macio/pmu.c | 1 + 1 file changed, 1 insertion(+)hw/misc/macio/pmu.c +0
-0
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.
Quoted 7 lines
Quoted 7 lines
hw/misc/macio/pmu.c +0
-0@@ -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.
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")Signed-off-by Laurent Vivier <[email protected]>--- hw/misc/macio/pmu.c | 1 + 1 file changed, 1 insertion(+)hw/misc/macio/pmu.c +0
-0
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.
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")Signed-off-by Laurent Vivier <[email protected]>--- hw/misc/macio/pmu.c | 1 + 1 file changed, 1 insertion(+)hw/misc/macio/pmu.c +0
-0
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.
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")Signed-off-by Laurent Vivier <[email protected]>
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@@ -718,6 +718,7 @@ static const VMStateDescription vmstate_pmu = { }, .subsections = (const VMStateDescription * []) { &vmstate_pmu_adb, +NULL } };