diff options
author | David Hildenbrand <david@redhat.com> | 2021-04-06 10:01:26 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-06-15 20:27:37 +0200 |
commit | dbb92eea3857ffeb770d006ad0306e408d33dd62 (patch) | |
tree | 5aa3c8d0091acba2116dea7a426416a0eead5120 | |
parent | cdfa56c551bb48f286cfe1f2daa1083d333ee45d (diff) |
softmmu/physmem: Fix qemu_ram_remap() to handle shared anonymous memory
RAM_SHARED now also properly indicates shared anonymous memory. Let's check
that flag for anonymous memory as well, to restore the proper mapping.
Fixes: 06329ccecfa0 ("mem: add share parameter to memory-backend-ram")
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20210406080126.24010-4-david@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | softmmu/physmem.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/softmmu/physmem.c b/softmmu/physmem.c index c0a3c47167..b75d205e8a 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -2243,13 +2243,13 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length) abort(); } else { flags = MAP_FIXED; + flags |= block->flags & RAM_SHARED ? + MAP_SHARED : MAP_PRIVATE; if (block->fd >= 0) { - flags |= (block->flags & RAM_SHARED ? - MAP_SHARED : MAP_PRIVATE); area = mmap(vaddr, length, PROT_READ | PROT_WRITE, flags, block->fd, offset); } else { - flags |= MAP_PRIVATE | MAP_ANONYMOUS; + flags |= MAP_ANONYMOUS; area = mmap(vaddr, length, PROT_READ | PROT_WRITE, flags, -1, 0); } |