[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2] x86/traps: Correct overly-general assertion introduced in c/s d5c251c
The assertion about guest paging mode must only apply to guest pagefaults, as should the later call to paging_fault(). This ASSERT() accidentally also trips if Xen takes a pagefault when in HVM context, such as a copy_to_user() failure in the shadow pagetable code. Merge the ASSERT() into the later paging_fault() callsite, prediating everything on guest_mode() to start with. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> v2: * Avoid calling paging_fault() for hypervisor pagefaults. --- xen/arch/x86/traps.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 2d79ee0..7f28d0a 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -1797,10 +1797,6 @@ static int fixup_page_fault(unsigned long addr, struct cpu_user_regs *regs) if ( in_irq() || !(regs->eflags & X86_EFLAGS_IF) ) return 0; - /* Logdirty mode is the only expected paging mode for PV guests. */ - if ( paging_mode_enabled(d) ) - ASSERT(paging_mode_only_log_dirty(d)); - if ( !(regs->error_code & PFEC_page_present) && (pagefault_by_memadd(addr, regs)) ) return handle_memadd_fault(addr, regs); @@ -1831,10 +1827,17 @@ static int fixup_page_fault(unsigned long addr, struct cpu_user_regs *regs) return EXCRET_fault_fixed; } - /* Logdirty guests call back into the paging code to update shadows. */ - if ( paging_mode_log_dirty(d) ) + /* + * Logdirty guests call back into the paging code to update shadows. We + * don't expect any other paging modes with PV guests. + */ + if ( guest_mode(regs) && paging_mode_enabled(d) ) { - int ret = paging_fault(addr, regs); + int ret; + + ASSERT(paging_mode_only_log_dirty(d)); + + ret = paging_fault(addr, regs); if ( ret == EXCRET_fault_fixed ) trace_trap_two_addr(TRC_PV_PAGING_FIXUP, regs->eip, addr); return ret; -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |