Mark guest mapping as MADV_DONTFORK
commit3a30014cfae7d4354503831e01b9ac1ef2b79b00
authorMarcelo Tosatti <mtosatti@redhat.com>
Fri, 22 Aug 2008 23:03:35 +0000 (22 20:03 -0300)
committerAvi Kivity <avi@qumranet.com>
Mon, 25 Aug 2008 10:20:36 +0000 (25 13:20 +0300)
treef26053e0364947ce0844f61e3c1d4cfa31553622
parentbb473282dca53b93f54e77fd10923e9d43dd6293
Mark guest mapping as MADV_DONTFORK

When qemu fork's (ssh migration, qemu-nbd, slirp), the guest memory
mapping becomes shared and write-protected by parent and child, until
execve switches to a new mm.

get_user_pages with force=1 parameter will break COW during this window,
leaving stale shadow mappings that point to the previously shared page.

Fix this by madvising the range as MADV_DONTFORK, if mmu notifiers are
disabled.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
qemu-kvm.c
qemu-kvm.h
vl.c