]> git.proxmox.com Git - mirror_qemu.git/commit - system/physmem.c
memory: destroy phys_sections one by one
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 25 Jun 2013 07:30:48 +0000 (09:30 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 4 Jul 2013 15:42:44 +0000 (17:42 +0200)
commit058bc4b57f9d6b39d9a6748b4049e1be3fde3dac
tree54fbb9dd492ac08fccd66b274dbf5545071cfc9a
parent2c9b15cab12c21e32dffb67c5e18f3dc407ca224
memory: destroy phys_sections one by one

phys_sections_clear is invoked after the dispatch tree has been
destroyed.  This leaves a window where phys_sections_nb > 0 but the
subpages are not valid anymore, which is a recipe for use-after-free
bugs.

Move the destruction of subpages in phys_sections_clear.  We will
still destroy the subpages when an address space is cleaned up,
because address_space_destroy will clear as->root and commit the
change before it calls address_space_destroy_dispatch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
exec.c