Skip to content

Commit

Permalink
Log message when guest performs invalid read/write (modification to c…
Browse files Browse the repository at this point in the history
…ore memory routines)
  • Loading branch information
Andre Beckus committed Aug 10, 2013
1 parent 8f3cef8 commit 8dddd50
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "exec/address-spaces.h"
#include "exec/ioport.h"
#include "qemu/bitops.h"
#include "qemu/log.h"
#include "sysemu/kvm.h"
#include <assert.h>

Expand Down Expand Up @@ -851,6 +852,13 @@ static uint64_t memory_region_dispatch_read1(MemoryRegion *mr,
uint64_t data = 0;

if (!memory_region_access_valid(mr, addr, size, false)) {
qemu_log_mask(LOG_GUEST_ERROR,
"Invalid memory read: offset=0x%llx size=%d"
" (memory region=%s 0x%llx)\n",
(unsigned long long)addr,
size,
mr->name,
(unsigned long long)mr->addr);
return -1U; /* FIXME: better signalling */
}

Expand Down Expand Up @@ -902,6 +910,13 @@ static void memory_region_dispatch_write(MemoryRegion *mr,
unsigned size)
{
if (!memory_region_access_valid(mr, addr, size, true)) {
qemu_log_mask(LOG_GUEST_ERROR,
"Invalid memory write: offset=0x%llx size=%d"
" (memory region=%s 0x%llx)\n",
(unsigned long long)addr,
size,
mr->name,
(unsigned long long)mr->addr);
return; /* FIXME: better signalling */
}

Expand Down

0 comments on commit 8dddd50

Please sign in to comment.