viridian: fix assertion failure
PATCH v2 1/1 viridian: fix assertion failure
Whilst attempting to crash an apparently wedged Windows domain using 'xen-hvmcrash' I managed to trigger the following ASSERT:
(XEN) Assertion '!vp->ptr' failed at viridian.c:607
with stack:
(XEN) [<ffff82d08032c55d>] viridian_map_guest_page+0x1b4/0x1b6 (XEN) [<ffff82d08032b1db>] viridian_synic_load_vcpu_ctxt+0x39/0x3b (XEN) [<ffff82d08032b90d>] viridian.c#viridian_load_vcpu_ctxt+0x93/0xcc (XEN) [<ffff82d0803096d6>] hvm_load+0x10e/0x19e (XEN) [<ffff82d080274c6d>] arch_do_domctl+0xb74/0x25b4 (XEN) [<ffff82d0802068ab>] do_domctl+0x16f7/0x19d8
This happened because viridian_map_guest_page() was not written to cope with being called multiple times, but this is unfortunately exactly what happens when xen-hvmcrash re-loads the domain context (having clobbered the values of RIP).
This patch simply makes viridian_map_guest_page() return immediately if it finds the page already mapped (i.e. vp->ptr != NULL).
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: "Roger Pau Monné" <[email protected]>
v2:
- Stop leaking page references
--- xen/arch/x86/hvm/viridian/viridian.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
xen/arch/x86/hvm/viridian/viridian.c +4 -2
@@ -602,10 +602,12 @@ void viridian_map_guest_page(struct vcpu *v, struct viridian_page *vp) {struct domain *d = v->domain;unsigned long gmfn = vp->msr.fields.pfn; -struct page_info *page =get_page_from_gfn (d, gmfn,NULL ,P2M_ALLOC ); +struct page_info *page; -ASSERT (!vp->ptr); +if ( vp->ptr ) +return ; + page =get_page_from_gfn (d, gmfn,NULL ,P2M_ALLOC );if ( !page ) goto fail;
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 19 lines · Paul Durrant
Whilst attempting to crash an apparently wedged Windows domain using 'xen-hvmcrash' I managed to trigger the following ASSERT:
(XEN) Assertion '!vp->ptr' failed at viridian.c:607
with stack:
(XEN) [<ffff82d08032c55d>] viridian_map_guest_page+0x1b4/0x1b6 (XEN) [<ffff82d08032b1db>] viridian_synic_load_vcpu_ctxt+0x39/0x3b (XEN) [<ffff82d08032b90d>] viridian.c#viridian_load_vcpu_ctxt+0x93/0xcc (XEN) [<ffff82d0803096d6>] hvm_load+0x10e/0x19e (XEN) [<ffff82d080274c6d>] arch_do_domctl+0xb74/0x25b4 (XEN) [<ffff82d0802068ab>] do_domctl+0x16f7/0x19d8This happened because
viridian_map_guest_page()was not written to cope with being called multiple times, but this is unfortunately exactly what happens when xen-hvmcrash re-loads the domain context (having clobbered the values of RIP).
Quoted 4 lines
This patch simply makes
viridian_map_guest_page()return immediately if it finds the page already mapped (i.e.vp->ptr!= NULL).Signed-off-by Paul Durrant <[email protected]>
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel