diff mbox series

[RFC,kvmtool,v1,22/32] Change guest ram mapping from private to shared

Message ID 20221202174417.1310826-23-tabba@google.com (mailing list archive)
State New, archived
Headers show
Series Add support for restricted guest memory in kvmtool | expand

Commit Message

Fuad Tabba Dec. 2, 2022, 5:44 p.m. UTC
Private mappings don't work with restricted memory since it might
be COWed.

Signed-off-by: Fuad Tabba <tabba@google.com>
---
 util/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/util/util.c b/util/util.c
index 1424815..107f34d 100644
--- a/util/util.c
+++ b/util/util.c
@@ -173,7 +173,7 @@  void *mmap_anon_or_hugetlbfs_align(struct kvm *kvm, const char *hugetlbfs_path,
 
 	/* Map the allocated memory in the fd to the specified alignment. */
 	addr_align = (void *)ALIGN((u64)addr_map, align_sz);
-	if (mmap(addr_align, size, PROT_RW, MAP_PRIVATE | MAP_FIXED, fd, 0) ==
+	if (mmap(addr_align, size, PROT_RW, MAP_SHARED | MAP_FIXED, fd, 0) ==
 	    MAP_FAILED) {
 		close(fd);
 		return MAP_FAILED;