* [PATCH] vl.c/memdev: Error on bad memory backend
@ 2020-03-17 12:07 Dr. David Alan Gilbert (git)
2020-03-17 12:34 ` Igor Mammedov
0 siblings, 1 reply; 3+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2020-03-17 12:07 UTC (permalink / raw)
To: qemu-devel, imammedo, pbonzini
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
If memory-backend is a non-existent object, qemu crashes.
Check that the backend actually resolves.
e.g. ./qemu-system-x86_64 -machine pc,accel=kvm,memory-backend=foo
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
softmmu/vl.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index ff2685dff8..76507e99c4 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -4288,6 +4288,11 @@ void qemu_init(int argc, char **argv, char **envp)
backend = object_resolve_path_type(current_machine->ram_memdev_id,
TYPE_MEMORY_BACKEND, NULL);
+ if (!backend) {
+ error_report("Unknown memory backend object id '%s'",
+ current_machine->ram_memdev_id);
+ exit(EXIT_FAILURE);
+ }
backend_size = object_property_get_uint(backend, "size", &error_abort);
if (have_custom_ram_size && backend_size != ram_size) {
error_report("Size specified by -m option must match size of "
--
2.24.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] vl.c/memdev: Error on bad memory backend
2020-03-17 12:07 [PATCH] vl.c/memdev: Error on bad memory backend Dr. David Alan Gilbert (git)
@ 2020-03-17 12:34 ` Igor Mammedov
2020-03-17 12:55 ` Dr. David Alan Gilbert
0 siblings, 1 reply; 3+ messages in thread
From: Igor Mammedov @ 2020-03-17 12:34 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git); +Cc: pbonzini, qemu-devel, Marc-André Lureau
On Tue, 17 Mar 2020 12:07:59 +0000
"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> If memory-backend is a non-existent object, qemu crashes.
> Check that the backend actually resolves.
>
> e.g. ./qemu-system-x86_64 -machine pc,accel=kvm,memory-backend=foo
there is a patch to fix it already
[PATCH] softmmu: fix crash with invalid -M memory-backend=
by Marc-André
but looks like it fell through cracks ...
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> softmmu/vl.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index ff2685dff8..76507e99c4 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -4288,6 +4288,11 @@ void qemu_init(int argc, char **argv, char **envp)
>
> backend = object_resolve_path_type(current_machine->ram_memdev_id,
> TYPE_MEMORY_BACKEND, NULL);
> + if (!backend) {
> + error_report("Unknown memory backend object id '%s'",
> + current_machine->ram_memdev_id);
> + exit(EXIT_FAILURE);
> + }
> backend_size = object_property_get_uint(backend, "size", &error_abort);
> if (have_custom_ram_size && backend_size != ram_size) {
> error_report("Size specified by -m option must match size of "
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vl.c/memdev: Error on bad memory backend
2020-03-17 12:34 ` Igor Mammedov
@ 2020-03-17 12:55 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 3+ messages in thread
From: Dr. David Alan Gilbert @ 2020-03-17 12:55 UTC (permalink / raw)
To: Igor Mammedov; +Cc: pbonzini, qemu-devel, Marc-André Lureau
* Igor Mammedov (imammedo@redhat.com) wrote:
> On Tue, 17 Mar 2020 12:07:59 +0000
> "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
>
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > If memory-backend is a non-existent object, qemu crashes.
> > Check that the backend actually resolves.
> >
> > e.g. ./qemu-system-x86_64 -machine pc,accel=kvm,memory-backend=foo
>
> there is a patch to fix it already
> [PATCH] softmmu: fix crash with invalid -M memory-backend=
> by Marc-André
>
> but looks like it fell through cracks ...
Oops, didn't see that.
(I tripped over this because I hadn't originally realised that it was
an object ID rather than object type with options)
Dave
> >
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
> > softmmu/vl.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/softmmu/vl.c b/softmmu/vl.c
> > index ff2685dff8..76507e99c4 100644
> > --- a/softmmu/vl.c
> > +++ b/softmmu/vl.c
> > @@ -4288,6 +4288,11 @@ void qemu_init(int argc, char **argv, char **envp)
> >
> > backend = object_resolve_path_type(current_machine->ram_memdev_id,
> > TYPE_MEMORY_BACKEND, NULL);
> > + if (!backend) {
> > + error_report("Unknown memory backend object id '%s'",
> > + current_machine->ram_memdev_id);
> > + exit(EXIT_FAILURE);
> > + }
> > backend_size = object_property_get_uint(backend, "size", &error_abort);
> > if (have_custom_ram_size && backend_size != ram_size) {
> > error_report("Size specified by -m option must match size of "
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-17 12:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-17 12:07 [PATCH] vl.c/memdev: Error on bad memory backend Dr. David Alan Gilbert (git)
2020-03-17 12:34 ` Igor Mammedov
2020-03-17 12:55 ` Dr. David Alan Gilbert
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).