Protection key exceptions also block setting the A bit on the PTE. Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> --- x86/access.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/x86/access.c b/x86/access.c index aceec26..b2c77e2 100644 --- a/x86/access.c +++ b/x86/access.c @@ -351,11 +351,8 @@ pt_element_t ac_test_permissions(ac_test_t *at, unsigned flags, bool writable, if (F(AC_ACCESS_FETCH) && !executable) at->expected_fault = 1; - if (!at->expected_fault) - expected |= PT_ACCESSED_MASK; - if (!leaf) - return expected; + goto done; if (F(AC_ACCESS_FETCH) && user && F(AC_CPU_CR4_SMEP)) at->expected_fault = 1; @@ -375,6 +372,10 @@ pt_element_t ac_test_permissions(ac_test_t *at, unsigned flags, bool writable, if (F(AC_ACCESS_WRITE) && !at->expected_fault) expected |= PT_DIRTY_MASK; +done: + if (!at->expected_fault) + expected |= PT_ACCESSED_MASK; + return expected; } -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html