diff options
Diffstat (limited to '0046-tools-dombuilder-Correct-the-length-calculation-in-x.patch')
-rw-r--r-- | 0046-tools-dombuilder-Correct-the-length-calculation-in-x.patch | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/0046-tools-dombuilder-Correct-the-length-calculation-in-x.patch b/0046-tools-dombuilder-Correct-the-length-calculation-in-x.patch new file mode 100644 index 0000000..b25f15d --- /dev/null +++ b/0046-tools-dombuilder-Correct-the-length-calculation-in-x.patch @@ -0,0 +1,44 @@ +From 8e51c8f1d45fad242a315fa17ba3582c02e66840 Mon Sep 17 00:00:00 2001 +From: Andrew Cooper <andrew.cooper3@citrix.com> +Date: Thu, 4 Jul 2024 14:12:31 +0200 +Subject: [PATCH 46/56] tools/dombuilder: Correct the length calculation in + xc_dom_alloc_segment() + +xc_dom_alloc_segment() is passed a size in bytes, calculates a size in pages +from it, then fills in the new segment information with a bytes value +re-calculated from the number of pages. + +This causes the module information given to the guest (MB, or PVH) to have +incorrect sizes; specifically, sizes rounded up to the next page. + +This in turn is problematic for Xen. When Xen finds a gzipped module, it +peeks at the end metadata to judge the decompressed size, which is a -4 +backreference from the reported end of the module. + +Fill in seg->vend using the correct number of bytes. + +Fixes: ea7c8a3d0e82 ("libxc: reorganize domain builder guest memory allocator") +Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> +Acked-by: Anthony PERARD <anthony.perard@vates.tech> +master commit: 4c3a618b0adaa0cd59e0fa0898bb60978b8b3a5f +master date: 2024-07-02 10:50:18 +0100 +--- + tools/libs/guest/xg_dom_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/libs/guest/xg_dom_core.c b/tools/libs/guest/xg_dom_core.c +index c4f4e7f3e2..f5521d528b 100644 +--- a/tools/libs/guest/xg_dom_core.c ++++ b/tools/libs/guest/xg_dom_core.c +@@ -601,7 +601,7 @@ int xc_dom_alloc_segment(struct xc_dom_image *dom, + memset(ptr, 0, pages * page_size); + + seg->vstart = start; +- seg->vend = dom->virt_alloc_end; ++ seg->vend = start + size; + + DOMPRINTF("%-20s: %-12s : 0x%" PRIx64 " -> 0x%" PRIx64 + " (pfn 0x%" PRIpfn " + 0x%" PRIpfn " pages)", +-- +2.45.2 + |