This is useful for using unit-tests/fuzzing to detect bugs introduced by the re-entrancy guard mechanism into devices that are intentionally re-entrant.
Signed-off-by: Alexander Bulekov <alx...@bu.edu> Reviewed-by: Thomas Huth <th...@redhat.com> --- softmmu/memory.c | 3 +++ util/async.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/softmmu/memory.c b/softmmu/memory.c index af9365bb81..d038633a6c 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -547,6 +547,9 @@ static MemTxResult access_with_adjusted_size(hwaddr addr, !mr->ram_device && !mr->ram && !mr->rom_device && !mr->readonly) { if (mr->dev->mem_reentrancy_guard.engaged_in_io) { trace_memory_region_reentrant_io(get_cpu_index(), mr, addr, size); +#ifdef DEBUG + abort(); +#endif return MEMTX_ACCESS_ERROR; } mr->dev->mem_reentrancy_guard.engaged_in_io = true; diff --git a/util/async.c b/util/async.c index a9b528c370..2dc9389e0d 100644 --- a/util/async.c +++ b/util/async.c @@ -160,6 +160,9 @@ void aio_bh_call(QEMUBH *bh) last_engaged_in_io = bh->reentrancy_guard->engaged_in_io; if (bh->reentrancy_guard->engaged_in_io) { trace_reentrant_aio(bh->ctx, bh->name); +#ifdef DEBUG + abort(); +#endif } bh->reentrancy_guard->engaged_in_io = true; } -- 2.39.0