[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing
From: |
Anthony Liguori |
Subject: |
Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away |
Date: |
Mon, 22 Jun 2009 12:44:46 -0500 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090320) |
See attached.
--
Regards,
Anthony Liguori
commit a70787dc8200dad03f3d3a85fdb40497f336f12b
Author: Anthony Liguori <address@hidden>
Date: Mon Jun 22 12:39:00 2009 -0500
Make sure to zero out memory before calling madvise to increase robustness
Avi pointed out that it's not entirely safe to rely on madvise zeroing out
memory. So let's do it explicitly before calling madvise.
Signed-off-by: Anthony Liguori <address@hidden>
diff --git a/vl.c b/vl.c
index 60a00e1..1c077b4 100644
--- a/vl.c
+++ b/vl.c
@@ -3358,13 +3358,13 @@ static int ram_load(QEMUFile *f, void *opaque, int
version_id)
if (flags & RAM_SAVE_FLAG_COMPRESS) {
uint8_t ch = qemu_get_byte(f);
-#if defined(__linux__)
+ memset(qemu_get_ram_ptr(addr), ch, TARGET_PAGE_SIZE);
+#ifndef _WIN32
if (ch == 0 &&
(!kvm_enabled() || kvm_has_sync_mmu())) {
madvise(qemu_get_ram_ptr(addr), TARGET_PAGE_SIZE,
MADV_DONTNEED);
- } else
+ }
#endif
- memset(qemu_get_ram_ptr(addr), ch, TARGET_PAGE_SIZE);
} else if (flags & RAM_SAVE_FLAG_PAGE)
qemu_get_buffer(f, qemu_get_ram_ptr(addr), TARGET_PAGE_SIZE);
} while (!(flags & RAM_SAVE_FLAG_EOS));
- [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away, Avi Kivity, 2009/06/22
- Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away, Anthony Liguori, 2009/06/22
- Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away, Avi Kivity, 2009/06/22
- Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away, Anthony Liguori, 2009/06/22
- Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away, Avi Kivity, 2009/06/22
- Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away, Anthony Liguori, 2009/06/22
- Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away, Avi Kivity, 2009/06/22
- Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away,
Anthony Liguori <=
- Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away, Avi Kivity, 2009/06/22
- Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away, Paul Brook, 2009/06/22
- Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away, Anthony Liguori, 2009/06/22