evtchn/fifo: map correct pages when guest is HVM
PATCH 1/1 evtchn/fifo: map correct pages when guest is HVM
From: David Vrabel <[email protected]>
If a HVM guest attempts to use the FIFO-based ABI it will not receive any events and destroying the guest may crash Xen or trigger an assert when attempting to unmap a control block page. This occurs because Xen maps the wrong page for both the control blocks and the event arrays.
In map_guest_page(), use the MFN of the guest's page and not the GFN when calling map_domain_page_global().
--- xen/common/event_fifo.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
xen/common/event_fifo.c +1 -1
@@ -357,7 +357,7 @@ static int map_guest_page(struct domain *d, uint64_t gfn, void **virt)return -EINVAL ; } - *virt =map_domain_page_global (gfn); + *virt =map_domain_page_global (page_to_mfn (p));if ( !*virt ) {put_page_and_type (p);
Signature · 1 line
1.7.2.5
xen/common/event_fifo.c static int map_guest_page(struct domain *d, uint64_t gfn, void **virt) · line 360
Quoted 9 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/common/event_fifo.c +1
-1@@ -357,7 +357,7 @@ static int map_guest_page(struct domain *d, uint64_t gfn, void **virt)return -EINVAL ; } - *virt =map_domain_page_global (gfn); + *virt =map_domain_page_global (page_to_mfn (p));
That's what we have
#define __map_domain_page_global(pg) map_domain_page_global(__page_to_mfn(pg))
for. No need to re-submit, I could adjust this while committing unless you mind.
Jan
Quoted 12 lines · Jan Beulich
xen/common/event_fifo.c static int map_guest_page(struct domain *d, uint64_t gfn, void **virt) · line 360
Quoted 9 lines
Quoted 1 line
Quoted 1 line · David Vrabel
xen/common/event_fifo.c +1
-1@@ -357,7 +357,7 @@ static int map_guest_page(struct domain *d, uint64_t gfn, void **virt)return -EINVAL ; } - *virt =map_domain_page_global (gfn); + *virt =map_domain_page_global (page_to_mfn (p));That's what we have
Quoted 4 lines
#define
__map_domain_page_global(pg)map_domain_page_global(__page_to_mfn(pg))for. No need to re-submit, I could adjust this while committing unless you mind.
Please do, thanks.
David
Quoted 11 lines · David Vrabel
From: David Vrabel <[email protected]>
If a HVM guest attempts to use the FIFO-based ABI it will not receive any events and destroying the guest may crash Xen or trigger an assert when attempting to unmap a control block page. This occurs because Xen maps the wrong page for both the control blocks and the event arrays.
In
map_guest_page(), use the MFN of the guest's page and not the GFN when callingmap_domain_page_global().
Should you have the Reported-by: Boris Ostrovsky <[email protected]> flag?
Quoted 26 lines
Signed-off-by David Vrabel <[email protected]>--- xen/common/event_fifo.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)xen/common/event_fifo.c +1
-1@@ -357,7 +357,7 @@ static int map_guest_page(struct domain *d, uint64_t gfn, void **virt)return -EINVAL ; } - *virt =map_domain_page_global (gfn); + *virt =map_domain_page_global (page_to_mfn (p));if ( !*virt ) {put_page_and_type (p);Signature · 7 lines
1.7.2.5 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 9 lines · Konrad Rzeszutek Wilk
Quoted 8 lines · David Vrabel
From: David Vrabel <[email protected]>
If a HVM guest attempts to use the FIFO-based ABI it will not receive any events and destroying the guest may crash Xen or trigger an assert when attempting to unmap a control block page. This occurs because Xen maps the wrong page for both the control blocks and the event arrays.
Quoted 6 lines
Quoted 3 lines
In
map_guest_page(), use the MFN of the guest's page and not the GFN when callingmap_domain_page_global().Should you have the Reported-by: Boris Ostrovsky <[email protected]> flag?
Yes. I'm really bad at remembering these.
David