qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] audio/hda: fix guest triggerable assert
@ 2018-11-22 13:32 Gerd Hoffmann
  2018-11-22 15:52 ` Dr. David Alan Gilbert
  2018-11-22 22:46 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2018-11-22 13:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Guest writes to a readonly register trigger the assert in
intel_hda_reg_write().  Add a check and just ignore them.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1628433
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/audio/intel-hda.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
index 23a2cf6484..066532713c 100644
--- a/hw/audio/intel-hda.c
+++ b/hw/audio/intel-hda.c
@@ -929,6 +929,10 @@ static void intel_hda_reg_write(IntelHDAState *d, const IntelHDAReg *reg, uint32
     if (!reg) {
         return;
     }
+    if (!reg->wmask) {
+        /* read-only register */
+        return;
+    }
 
     if (d->debug) {
         time_t now = time(NULL);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] audio/hda: fix guest triggerable assert
  2018-11-22 13:32 [Qemu-devel] [PATCH] audio/hda: fix guest triggerable assert Gerd Hoffmann
@ 2018-11-22 15:52 ` Dr. David Alan Gilbert
  2018-11-23  6:31   ` Gerd Hoffmann
  2018-11-22 22:46 ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 4+ messages in thread
From: Dr. David Alan Gilbert @ 2018-11-22 15:52 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel

* Gerd Hoffmann (kraxel@redhat.com) wrote:
> Guest writes to a readonly register trigger the assert in
> intel_hda_reg_write().  Add a check and just ignore them.
> 
> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1628433
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Does make you wonder:
  a) Why the guest was writing to a read-only register
  b) Wth it only did it in the weird combination of
     devices tested.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  hw/audio/intel-hda.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
> index 23a2cf6484..066532713c 100644
> --- a/hw/audio/intel-hda.c
> +++ b/hw/audio/intel-hda.c
> @@ -929,6 +929,10 @@ static void intel_hda_reg_write(IntelHDAState *d, const IntelHDAReg *reg, uint32
>      if (!reg) {
>          return;
>      }
> +    if (!reg->wmask) {
> +        /* read-only register */
> +        return;
> +    }
>  
>      if (d->debug) {
>          time_t now = time(NULL);
> -- 
> 2.9.3
> 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] audio/hda: fix guest triggerable assert
  2018-11-22 13:32 [Qemu-devel] [PATCH] audio/hda: fix guest triggerable assert Gerd Hoffmann
  2018-11-22 15:52 ` Dr. David Alan Gilbert
@ 2018-11-22 22:46 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-22 22:46 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel

Hi Gerd,

On 22/11/18 14:32, Gerd Hoffmann wrote:
> Guest writes to a readonly register trigger the assert in
> intel_hda_reg_write().  Add a check and just ignore them.

Is this 3.1 material? It seems to apply.

> 
> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1628433
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/audio/intel-hda.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
> index 23a2cf6484..066532713c 100644
> --- a/hw/audio/intel-hda.c
> +++ b/hw/audio/intel-hda.c
> @@ -929,6 +929,10 @@ static void intel_hda_reg_write(IntelHDAState *d, const IntelHDAReg *reg, uint32
>      if (!reg) {
>          return;
>      }
> +    if (!reg->wmask) {
> +        /* read-only register */

Can you add:

           qemu_log_mask(LOG_GUEST_ERROR,
                         "intel-hda: Register %s is read-only\n",
                         reg->name);

Regardless:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> +        return;
> +    }
>  
>      if (d->debug) {
>          time_t now = time(NULL);
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] audio/hda: fix guest triggerable assert
  2018-11-22 15:52 ` Dr. David Alan Gilbert
@ 2018-11-23  6:31   ` Gerd Hoffmann
  0 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2018-11-23  6:31 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: qemu-devel

On Thu, Nov 22, 2018 at 03:52:12PM +0000, Dr. David Alan Gilbert wrote:
> * Gerd Hoffmann (kraxel@redhat.com) wrote:
> > Guest writes to a readonly register trigger the assert in
> > intel_hda_reg_write().  Add a check and just ignore them.
> > 
> > Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1628433
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> 
> Does make you wonder:
>   a) Why the guest was writing to a read-only register
>   b) Wth it only did it in the weird combination of
>      devices tested.

Note that we also have pci hotplug involved.  Probably a bug in the
guest, maybe due to a register access landing at the wrong device while
reshuffling the bars or something like that.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-23  6:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-22 13:32 [Qemu-devel] [PATCH] audio/hda: fix guest triggerable assert Gerd Hoffmann
2018-11-22 15:52 ` Dr. David Alan Gilbert
2018-11-23  6:31   ` Gerd Hoffmann
2018-11-22 22:46 ` Philippe Mathieu-Daudé

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