All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] hw/sd/sdhci: Fix DMA re-entrancy issue
@ 2021-12-15 20:56 Philippe Mathieu-Daudé
  2021-12-15 20:56 ` [RFC PATCH 1/3] hw/sd/sdhci: Honor failed DMA transactions Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-12-15 20:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Peter Maydell, Thomas Huth, qemu-block,
	David Hildenbrand, Jason Wang, Bin Meng, Li Qiang,
	Philippe Mathieu-Daudé,
	Peter Xu, Qiuhao Li, Darren Kenny, Bandan Das, Gerd Hoffmann,
	Stefan Hajnoczi, Edgar E . Iglesias, Alexander Bulekov,
	Paolo Bonzini, Mauro Matteo Cascella, Philippe Mathieu-Daudé

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




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

end of thread, other threads:[~2022-03-18 18:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-15 20:56 [RFC PATCH 0/3] hw/sd/sdhci: Fix DMA re-entrancy issue Philippe Mathieu-Daudé
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.