[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] libxc/x86: fix mapping of the start_info area
commit d00385d80f151ee17eba35064a85769338ad6a74 Author: Roger Pau Monne <roger.pau@xxxxxxxxxx> AuthorDate: Wed Mar 28 12:55:15 2018 +0100 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Wed Mar 28 13:54:46 2018 +0100 libxc/x86: fix mapping of the start_info area The start_info size calculated in bootlate_hvm is wrong. It should use HVMLOADER_MODULE_MAX_COUNT instead of dom->num_modules and it doesn't take into account the size of the modules command line. This is not a problem so far because the actually used amount of memory doesn't cross a page boundary, and so no page-fault is triggered. Instead of fixing the size calculation done in bootlate_hvm just map the amount of memory allocated in alloc_magic_pages_hvm. Suggested-by: Wei Liu <wei.liu2@xxxxxxxxxx> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxc/xc_dom_x86.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c index 0b65dab4bc..f4bacb9e28 100644 --- a/tools/libxc/xc_dom_x86.c +++ b/tools/libxc/xc_dom_x86.c @@ -1666,21 +1666,11 @@ static int bootlate_hvm(struct xc_dom_image *dom) uint32_t domid = dom->guest_domid; xc_interface *xch = dom->xch; struct hvm_start_info *start_info; - size_t start_info_size; struct hvm_modlist_entry *modlist; unsigned int i; - start_info_size = sizeof(*start_info) + dom->cmdline_size; - start_info_size += sizeof(struct hvm_modlist_entry) * dom->num_modules; - - if ( start_info_size > - dom->start_info_seg.pages << XC_DOM_PAGE_SHIFT(dom) ) - { - DOMPRINTF("Trying to map beyond start_info_seg"); - return -1; - } - - start_info = xc_map_foreign_range(xch, domid, start_info_size, + start_info = xc_map_foreign_range(xch, domid, dom->start_info_seg.pages << + XC_DOM_PAGE_SHIFT(dom), PROT_READ | PROT_WRITE, dom->start_info_seg.pfn); if ( start_info == NULL ) @@ -1733,7 +1723,7 @@ static int bootlate_hvm(struct xc_dom_image *dom) start_info->magic = XEN_HVM_START_MAGIC_VALUE; - munmap(start_info, start_info_size); + munmap(start_info, dom->start_info_seg.pages << XC_DOM_PAGE_SHIFT(dom)); if ( dom->device_model ) { -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |