A shot at fixing dma-reentrancy issues.

Patch 1 adds a flag to track device IO activity to DeviceState.
Patch 2 Checks/sets the flag prior to invoking MemoryRegion handlers to
prevent the mmio->dma->mmio case
Patch 3 Sets the flag in dma-related calls to prevent the bh->dma->mmio
case

The related issues are tracked here: 
https://gitlab.com/qemu-project/qemu/-/issues/556
There is also a related whitepaper: https://qiuhao.org/Matryoshka_Trap.pdf

Cc: Philippe Mathieu-Daudé <phi...@redhat.com>
Cc: Mauro Matteo Cascella <mcasc...@redhat.com>
Cc: Qiuhao Li <qiuhao...@outlook.com>
Cc: Peter Xu <pet...@redhat.com>
Cc: Jason Wang <jasow...@redhat.com>
Cc: David Hildenbrand <da...@redhat.com>
Cc: Gerd Hoffmann <kra...@redhat.com>
Cc: Peter Maydell <peter.mayd...@linaro.org>
Cc: Li Qiang <liq...@gmail.com>
Cc: Thomas Huth <th...@redhat.com>
Cc: Laurent Vivier <lviv...@redhat.com>
Cc: Bandan Das <b...@redhat.com>
Cc: Edgar E. Iglesias <edgar.igles...@gmail.com>
Cc: Darren Kenny <darren.ke...@oracle.com>
Cc: Bin Meng <bin.m...@windriver.com>
Cc: Paolo Bonzini <pbonz...@redhat.com>
Cc: Stefan Hajnoczi <stefa...@redhat.com>

Alexander Bulekov (3):
  memory: Track whether a Device is engaged in IO
  memory: fix PIO/MMIO-initiated dma-reentracy issues
  memory: fix bh-initiated dma-reentracy issues

 include/hw/pci/pci.h   | 13 +++++++++++--
 include/hw/qdev-core.h |  3 +++
 softmmu/dma-helpers.c  | 12 ++++++++++++
 softmmu/memory.c       | 15 +++++++++++++++
 softmmu/trace-events   |  1 +
 5 files changed, 42 insertions(+), 2 deletions(-)

-- 
2.33.0


Reply via email to