diff mbox series

[RFC,2/3] hw/audio/intel-hda: Restrict DMA engine to memories (not MMIO devices)

Message ID 20211218160912.1591633-3-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series hw/audio/intel-hda: Restrict DMA engine to memories (non-MMIO devices) | expand

Commit Message

Philippe Mathieu-Daudé Dec. 18, 2021, 4:09 p.m. UTC
Issue #542 reports a reentrancy problem when the DMA engine accesses
the HDA controller I/O registers. Fix by restricting the DMA engine
to memories regions (forbidding MMIO devices such the HDA controller).

Reported-by: OSS-Fuzz (Issue 28435)
Reported-by: Alexander Bulekov <alxndr@bu.edu>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/542
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Likely intel_hda_xfer() and intel_hda_corb_run() should be restricted
too.
---
 hw/audio/intel-hda.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Huth March 18, 2022, 7:13 p.m. UTC | #1
On 18/12/2021 17.09, Philippe Mathieu-Daudé wrote:
> Issue #542 reports a reentrancy problem when the DMA engine accesses
> the HDA controller I/O registers. Fix by restricting the DMA engine
> to memories regions (forbidding MMIO devices such the HDA controller).
> 
> Reported-by: OSS-Fuzz (Issue 28435)
> Reported-by: Alexander Bulekov <alxndr@bu.edu>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/542
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Likely intel_hda_xfer() and intel_hda_corb_run() should be restricted
> too.
> ---
>   hw/audio/intel-hda.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
> index 0c1017edbbf..3aa57d274e6 100644
> --- a/hw/audio/intel-hda.c
> +++ b/hw/audio/intel-hda.c
> @@ -345,7 +345,7 @@ static void intel_hda_corb_run(IntelHDAState *d)
>   
>   static void intel_hda_response(HDACodecDevice *dev, bool solicited, uint32_t response)
>   {
> -    const MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED;
> +    const MemTxAttrs attrs = { .memory = true };
>       HDACodecBus *bus = HDA_BUS(dev->qdev.parent_bus);
>       IntelHDAState *d = container_of(bus, IntelHDAState, codecs);
>       hwaddr addr;

That's maybe the best we can do right now to fix CVE-2021-3611 !

Reviewed-by: Thomas Huth <thuth@redhat.com>
diff mbox series

Patch

diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
index 0c1017edbbf..3aa57d274e6 100644
--- a/hw/audio/intel-hda.c
+++ b/hw/audio/intel-hda.c
@@ -345,7 +345,7 @@  static void intel_hda_corb_run(IntelHDAState *d)
 
 static void intel_hda_response(HDACodecDevice *dev, bool solicited, uint32_t response)
 {
-    const MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED;
+    const MemTxAttrs attrs = { .memory = true };
     HDACodecBus *bus = HDA_BUS(dev->qdev.parent_bus);
     IntelHDAState *d = container_of(bus, IntelHDAState, codecs);
     hwaddr addr;