query-stats-schemas crash fix for QEMU 7.1
The following changes since commit c7208a6e0d049f9e8af15df908168a79b1f99685:
Update version for v7.1.0-rc3 release (2022-08-16 20:45:19 -0500)
are available in the Git repository at:
https://gitlab.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to a9197ad2101cfc885cc316af299f49ba89039e54:
kvm: fix segfault with query-stats-schemas and -M none (2022-08-18 14:08:24 +0200)
----------------------------------------------------------------
Fix SIGSEGV with query-stats-schema.
This allows management tools to query the statistics schemas without worrying that some versions of QEMU will crash.
----------------------------------------------------------------
Paolo Bonzini (1):
kvm: fix segfault with query-stats-schemas and -M none
accel/kvm/kvm-all.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
2.37.1
[PULL 1/1] kvm: fix segfault with query-stats-schemas and -M none
-M none creates a guest without a vCPU, causing the following error:
$ ./qemu-system-x86_64 -qmp stdio -M none -accel kvm
{execute:qmp_capabilities}
{"return": {}}
{execute: query-stats-schemas}
Segmentation fault (core dumped)Fix it by not querying the vCPU stats if first_cpu is NULL.
--- accel/kvm/kvm-all.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
accel/kvm/kvm-all.c +5 -3
@@ -4131,7 +4131,9 @@ void query_stats_schemas_cb(StatsSchemaList **result, Error **errp)query_stats_schema (result,STATS_TARGET_VM , stats_fd, errp);close (stats_fd); - stats_args.result.schema = result; - stats_args.errp = errp; -run_on_cpu (first_cpu, query_stats_schema_vcpu,RUN_ON_CPU_HOST_PTR (&stats_args)); +if (first_cpu) { + stats_args.result.schema = result; + stats_args.errp = errp; +run_on_cpu (first_cpu, query_stats_schema_vcpu,RUN_ON_CPU_HOST_PTR (&stats_args)); + } }
Signature · 1 line
2.37.1
Richard Henderson
AppliedQuoted 10 lines · Paolo Bonzini
The following changes since commit
c7208a6e0d049f9e8af15df908168a79b1f99685:Update version for v7.1.0-rc3 release (2022-08-16 20:45:19 -0500)are available in the Git repository at:
https://gitlab.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to
a9197ad2101cfc885cc316af299f49ba89039e54:
Quoted 7 lines
kvm: fix segfault with query-stats-schemas and -M none (2022-08-18 14:08:24 +0200)----------------------------------------------------------------
Fix SIGSEGV with query-stats-schema.This allows management tools to query the statistics schemas without worrying that some versions of QEMU will crash.
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/7.1 as appropriate.
r~
Quoted 7 lines
----------------------------------------------------------------
Paolo Bonzini (1):
kvm: fix segfault with query-stats-schemas and -M noneaccel/kvm/kvm-all.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)