* [Qemu-devel] [PATCH for-2.11] hw/nvram/spapr_nvram: Device can not be created by the users
@ 2017-08-24 7:41 Thomas Huth
2017-08-24 11:15 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2017-08-24 7:41 UTC (permalink / raw)
To: qemu-devel, David Gibson; +Cc: qemu-ppc
Trying to add a spapr-nvram device currently aborts QEMU like this:
$ ppc64-softmmu/qemu-system-ppc64 -device spapr-nvram
qemu-system-ppc64: hw/ppc/spapr_rtas.c:407: spapr_rtas_register:
Assertion `!rtas_table[token].name' failed.
Aborted (core dumped)
This NVRAM device registers RTAS calls during its realize function
and thus can only be used once - and that's internally from spapr.c.
So let's mark the device with user_creatable = false to avoid that
the users can crash their QEMU this way.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
hw/nvram/spapr_nvram.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c
index bc355a4..4a0aec8 100644
--- a/hw/nvram/spapr_nvram.c
+++ b/hw/nvram/spapr_nvram.c
@@ -264,6 +264,8 @@ static void spapr_nvram_class_init(ObjectClass *klass, void *data)
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
dc->props = spapr_nvram_properties;
dc->vmsd = &vmstate_spapr_nvram;
+ /* Reason: Internal device only, uses spapr_rtas_register() in realize() */
+ dc->user_creatable = false;
}
static const TypeInfo spapr_nvram_type_info = {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.11] hw/nvram/spapr_nvram: Device can not be created by the users
2017-08-24 7:41 [Qemu-devel] [PATCH for-2.11] hw/nvram/spapr_nvram: Device can not be created by the users Thomas Huth
@ 2017-08-24 11:15 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2017-08-24 11:15 UTC (permalink / raw)
To: Thomas Huth; +Cc: qemu-devel, qemu-ppc
[-- Attachment #1: Type: text/plain, Size: 1538 bytes --]
On Thu, Aug 24, 2017 at 09:41:33AM +0200, Thomas Huth wrote:
> Trying to add a spapr-nvram device currently aborts QEMU like this:
>
> $ ppc64-softmmu/qemu-system-ppc64 -device spapr-nvram
> qemu-system-ppc64: hw/ppc/spapr_rtas.c:407: spapr_rtas_register:
> Assertion `!rtas_table[token].name' failed.
> Aborted (core dumped)
>
> This NVRAM device registers RTAS calls during its realize function
> and thus can only be used once - and that's internally from spapr.c.
> So let's mark the device with user_creatable = false to avoid that
> the users can crash their QEMU this way.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
Applied to ppc-for-2.11, thanks.
> ---
> hw/nvram/spapr_nvram.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c
> index bc355a4..4a0aec8 100644
> --- a/hw/nvram/spapr_nvram.c
> +++ b/hw/nvram/spapr_nvram.c
> @@ -264,6 +264,8 @@ static void spapr_nvram_class_init(ObjectClass *klass, void *data)
> set_bit(DEVICE_CATEGORY_MISC, dc->categories);
> dc->props = spapr_nvram_properties;
> dc->vmsd = &vmstate_spapr_nvram;
> + /* Reason: Internal device only, uses spapr_rtas_register() in realize() */
> + dc->user_creatable = false;
> }
>
> static const TypeInfo spapr_nvram_type_info = {
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-24 12:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-24 7:41 [Qemu-devel] [PATCH for-2.11] hw/nvram/spapr_nvram: Device can not be created by the users Thomas Huth
2017-08-24 11:15 ` David Gibson
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).