Commit:     fc3dffe12148b9612870eb21b24f2aecefa9ea24
Parent:     038e51de2e7ae2c8e9d8a0b15231f8509875dc33
Author:     Avi Kivity <[EMAIL PROTECTED]>
AuthorDate: Mon Jan 22 20:40:40 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Jan 23 07:52:06 2007 -0800

    [PATCH] KVM: fix bogus pagefault on writable pages
    If a page is marked as dirty in the guest pte, set_pte_common() can set the
    writable bit on newly-instantiated shadow pte.  This optimization avoids
    a write fault after the initial read fault.
    However, if a write fault instantiates the pte, fix_write_pf() incorrectly
    reports the fault as a guest page fault, and the guest oopses on what 
    to be a correctly-mapped page.
    Fix is to detect the condition and only report a guest page fault on a user
    access to a kernel page.
    With the fix, a kvm guest can survive a whole night of running the kernel
    hacker's screensaver (make -j9 in a loop).
    Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>
    Cc: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 drivers/kvm/paging_tmpl.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h
index 2dbf430..6bc4195 100644
--- a/drivers/kvm/paging_tmpl.h
+++ b/drivers/kvm/paging_tmpl.h
@@ -274,7 +274,7 @@ static int FNAME(fix_write_pf)(struct kvm_vcpu *vcpu,
        struct kvm_mmu_page *page;
        if (is_writeble_pte(*shadow_ent))
-               return 0;
+               return !user || (*shadow_ent & PT_USER_MASK);
        writable_shadow = *shadow_ent & PT_SHADOW_WRITABLE_MASK;
        if (user) {
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to