qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Laurent Vivier" <lvivier@redhat.com>,
	"Martin Schrodt" <martin@schrodt.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"Gianluca Gabruelli" <gianluca.gabrielli@suse.com>,
	"Volker Rümelin" <vr_qemu@t-online.de>,
	"Li Qiang" <liq3ea@gmail.com>,
	"Mauro Matteo Cascella" <mcascell@redhat.com>,
	"Qiuhao Li" <Qiuhao.Li@outlook.com>,
	"Jon Maloy" <jmaloy@redhat.com>,
	"Alexander Bulekov" <alxndr@bu.edu>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	crazybyte@protonmail.com, "Matt Parker" <mtparkr@gmail.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [RFC PATCH 2/3] hw/audio/intel-hda: Restrict DMA engine to memories (not MMIO devices)
Date: Sat, 18 Dec 2021 17:09:11 +0100	[thread overview]
Message-ID: <20211218160912.1591633-3-philmd@redhat.com> (raw)
In-Reply-To: <20211218160912.1591633-1-philmd@redhat.com>

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;
-- 
2.33.1



  parent reply	other threads:[~2021-12-18 16:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-18 16:09 [RFC PATCH 0/3] hw/audio/intel-hda: Restrict DMA engine to memories (non-MMIO devices) Philippe Mathieu-Daudé
2021-12-18 16:09 ` [RFC PATCH 1/3] hw/audio/intel-hda: Do not ignore DMA overrun errors Philippe Mathieu-Daudé
2021-12-18 16:09 ` Philippe Mathieu-Daudé [this message]
2022-03-18 19:13   ` [RFC PATCH 2/3] hw/audio/intel-hda: Restrict DMA engine to memories (not MMIO devices) [CVE-2021-3611] Thomas Huth
2021-12-18 16:09 ` [RFC PATCH 3/3] tests/qtest/intel-hda-test: Add reproducer for issue #542 Philippe Mathieu-Daudé
2022-03-18 19:15   ` Thomas Huth
2021-12-18 16:14 ` [RFC PATCH 0/3] hw/audio/intel-hda: Restrict DMA engine to memories (CVE-2021-3611) Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211218160912.1591633-3-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=Qiuhao.Li@outlook.com \
    --cc=alxndr@bu.edu \
    --cc=crazybyte@protonmail.com \
    --cc=gianluca.gabrielli@suse.com \
    --cc=jmaloy@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=liq3ea@gmail.com \
    --cc=lvivier@redhat.com \
    --cc=martin@schrodt.org \
    --cc=mcascell@redhat.com \
    --cc=mtparkr@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=vr_qemu@t-online.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).