Skip to content

Commit 485e27e

Browse files
committed
KVM: sefltests: Verify value of dirty_log_test last page isn't bogus
Add a sanity check that a completely garbage value wasn't written to the last dirty page in the ring, e.g. that it doesn't contain the *next* iteration's value. Reviewed-by: Maxim Levitsky <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent d0bd72c commit 485e27e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/testing/selftests/kvm/dirty_log_test.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,9 @@ static void vm_dirty_log_verify(enum vm_guest_mode mode, unsigned long **bmap)
514514
* last page's iteration), as the value to be
515515
* written may be cached in a CPU register.
516516
*/
517-
if (page == dirty_ring_last_page ||
518-
page == dirty_ring_prev_iteration_last_page)
517+
if ((page == dirty_ring_last_page ||
518+
page == dirty_ring_prev_iteration_last_page) &&
519+
val < iteration)
519520
continue;
520521
} else if (!val && iteration == 1 && bmap0_dirty) {
521522
/*

0 commit comments

Comments
 (0)