Debugger-driven invalid memory accesses are not guest errors, so should not cause these error logs.
Debuggers can access memory wildly, including access to addresses not specified by the user (e.g., gdb it might try to walk the stack or load target addresses to display disassembly). Failure is reported synchronously by the GDB protcol so the user can be notified via the debugger client. Reviewed-by: David Hildenbrand <da...@redhat.com> Signed-off-by: Nicholas Piggin <npig...@gmail.com> --- system/memory.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/system/memory.c b/system/memory.c index 4c829793a0a..4c64a56676d 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1412,7 +1412,9 @@ bool memory_region_access_valid(MemoryRegion *mr, { if (mr->ops->valid.accepts && !mr->ops->valid.accepts(mr->opaque, addr, size, is_write, attrs)) { - qemu_log_mask(LOG_INVALID_MEM, "Invalid %s at addr 0x%" HWADDR_PRIX + /* Don't log memory errors due to debugger accesses */ + int log_mask = attrs.debug ? 0 : LOG_INVALID_MEM; + qemu_log_mask(log_mask, "Invalid %s at addr 0x%" HWADDR_PRIX ", size %u, region '%s', reason: rejected\n", is_write ? "write" : "read", addr, size, memory_region_name(mr)); @@ -1420,7 +1422,8 @@ bool memory_region_access_valid(MemoryRegion *mr, } if (!mr->ops->valid.unaligned && (addr & (size - 1))) { - qemu_log_mask(LOG_INVALID_MEM, "Invalid %s at addr 0x%" HWADDR_PRIX + int log_mask = attrs.debug ? 0 : LOG_INVALID_MEM; + qemu_log_mask(log_mask, "Invalid %s at addr 0x%" HWADDR_PRIX ", size %u, region '%s', reason: unaligned\n", is_write ? "write" : "read", addr, size, memory_region_name(mr)); @@ -1434,7 +1437,8 @@ bool memory_region_access_valid(MemoryRegion *mr, if (size > mr->ops->valid.max_access_size || size < mr->ops->valid.min_access_size) { - qemu_log_mask(LOG_INVALID_MEM, "Invalid %s at addr 0x%" HWADDR_PRIX + int log_mask = attrs.debug ? 0 : LOG_INVALID_MEM; + qemu_log_mask(log_mask, "Invalid %s at addr 0x%" HWADDR_PRIX ", size %u, region '%s', reason: invalid size " "(min:%u max:%u)\n", is_write ? "write" : "read", -- 2.47.1