]> git.ipfire.org Git - thirdparty/qemu.git/commit
exec: Handle multipage ranges in invalidate_and_set_dirty()
authorPeter Maydell <peter.maydell@linaro.org>
Sun, 16 Nov 2014 19:44:21 +0000 (19:44 +0000)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 7 Jan 2015 20:47:42 +0000 (14:47 -0600)
commit844470158c61645f6448fe2fd3963080cead44db
tree95431b5306848d242eab1aeb8041707bcbc11c2f
parent05c5febf8cfe4e6f11a2c5147e13443ce3e9ba52
exec: Handle multipage ranges in invalidate_and_set_dirty()

The code in invalidate_and_set_dirty() needs to handle addr/length
combinations which cross guest physical page boundaries. This can happen,
for example, when disk I/O reads large blocks into guest RAM which previously
held code that we have cached translations for. Unfortunately we were only
checking the clean/dirty status of the first page in the range, and then
were calling a tb_invalidate function which only handles ranges that don't
cross page boundaries. Fix the function to deal with multipage ranges.

The symptoms of this bug were that guest code would misbehave (eg segfault),
in particular after a guest reboot but potentially any time the guest
reused a page of its physical RAM for new code.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1416167061-13203-1-git-send-email-peter.maydell@linaro.org
(cherry picked from commit f874bf905ff2f8dcc17acbfc61e49a92a6f4d04b)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
exec.c
include/exec/ram_addr.h