From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Laurent Vivier" <lvivier@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Thomas Huth" <thuth@redhat.com>,
qemu-block@nongnu.org, "David Hildenbrand" <david@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Bin Meng" <bin.meng@windriver.com>,
"Li Qiang" <liq3ea@gmail.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Peter Xu" <peterx@redhat.com>,
"Qiuhao Li" <Qiuhao.Li@outlook.com>,
"Darren Kenny" <darren.kenny@oracle.com>,
"Bandan Das" <bsd@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Edgar E . Iglesias" <edgar.iglesias@gmail.com>,
"Alexander Bulekov" <alxndr@bu.edu>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Mauro Matteo Cascella" <mcascell@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [RFC PATCH 0/3] hw/sd/sdhci: Fix DMA re-entrancy issue
Date: Wed, 15 Dec 2021 21:56:53 +0100 [thread overview]
Message-ID: <20211215205656.488940-1-philmd@redhat.com> (raw)
Hi,
This series is an attempt to fix the DMA re-entrancy problem
on the SDHCI device. OSS-Fuzz found it and Alexander generated
a helpful reproducer.
By setting the MemTxAttrs::memory bit before doing DMA transactions,
the flatview API will return MEMTX_BUS_ERROR if the transaction
targets a non-memory (a device), which is usually how DMA-reentrancy
bugs are exploited.
On real hardware, the checks are on the interconnect bus, not in
the SDHCI block. However QEMU blocks aren't modelled that way.
Using the flatview API seems (to me) the simplest and closer
to hardware, it is a generic API and we can use it to trace
bus transactions on all blocks.
Note this series is simply one example to fix the generic
issues. The important changes are in the previous series:
https://lore.kernel.org/qemu-devel/20211215182421.418374-1-philmd@redhat.com/
Based-on: <20211215182421.418374-1-philmd@redhat.com>
"physmem: Have flatview API check bus permission from MemTxAttrs"
Cc: Mauro Matteo Cascella <mcascell@redhat.com>
Cc: Qiuhao Li <Qiuhao.Li@outlook.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Li Qiang <liq3ea@gmail.com>
Cc: Thomas Huth <thuth@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Bandan Das <bsd@redhat.com>
Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Cc: Darren Kenny <darren.kenny@oracle.com>
Cc: Bin Meng <bin.meng@windriver.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Alexander Bulekov <alxndr@bu.edu>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Philippe Mathieu-Daudé (3):
hw/sd/sdhci: Honor failed DMA transactions
hw/sd/sdhci: Prohibit DMA accesses to devices
tests/qtest/fuzz-sdcard-test: Add reproducer for OSS-Fuzz (Issue
29225)
hw/sd/sdhci.c | 35 ++++++++++++----
tests/qtest/fuzz-sdcard-test.c | 76 ++++++++++++++++++++++++++++++++++
2 files changed, 102 insertions(+), 9 deletions(-)
--
2.33.1
next reply other threads:[~2021-12-15 20:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-15 20:56 Philippe Mathieu-Daudé [this message]
2021-12-15 20:56 ` [RFC PATCH 1/3] hw/sd/sdhci: Honor failed DMA transactions Philippe Mathieu-Daudé
2022-03-18 18:35 ` Thomas Huth
2021-12-15 20:56 ` [RFC PATCH 2/3] hw/sd/sdhci: Prohibit DMA accesses to devices Philippe Mathieu-Daudé
2021-12-16 3:14 ` Jason Wang
2022-03-18 18:38 ` Thomas Huth
2021-12-15 20:56 ` [RFC PATCH 3/3] tests/qtest/fuzz-sdcard-test: Add reproducer for OSS-Fuzz (Issue 29225) Philippe Mathieu-Daudé
2022-01-18 12:41 ` Thomas Huth
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=20211215205656.488940-1-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=Qiuhao.Li@outlook.com \
--cc=alxndr@bu.edu \
--cc=bin.meng@windriver.com \
--cc=bsd@redhat.com \
--cc=darren.kenny@oracle.com \
--cc=david@redhat.com \
--cc=edgar.iglesias@gmail.com \
--cc=f4bug@amsat.org \
--cc=jasowang@redhat.com \
--cc=kraxel@redhat.com \
--cc=liq3ea@gmail.com \
--cc=lvivier@redhat.com \
--cc=mcascell@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
/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).