Skip to content

Commit d63e9a9

Browse files
committed
Fix booing Linux 6.12 in domU
Linux 6.12 changed compression parameters and it hits memory limit hardcoded in libxenguest. Increase the limit.
1 parent df247dd commit d63e9a9

2 files changed

+64
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
From b3262b7069a51e460a9f044eec4fc5e2e5758db2 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
3+
4+
Date: Tue, 8 Oct 2024 23:24:31 +0200
5+
Subject: [PATCH] tools/xg: increase LZMA_BLOCK_SIZE for uncompressing the
6+
kernel
7+
MIME-Version: 1.0
8+
Content-Type: text/plain; charset=UTF-8
9+
Content-Transfer-Encoding: 8bit
10+
11+
Linux 6.12-rc2 fails to decompress with the current 128MiB, contrary to
12+
the code comment. It results in a failure like this:
13+
14+
domainbuilder: detail: xc_dom_kernel_file: filename="/var/lib/qubes/vm-kernels/6.12-rc2-1.1.fc37/vmlinuz"
15+
domainbuilder: detail: xc_dom_malloc_filemap : 12104 kB
16+
domainbuilder: detail: xc_dom_module_file: filename="/var/lib/qubes/vm-kernels/6.12-rc2-1.1.fc37/initramfs"
17+
domainbuilder: detail: xc_dom_malloc_filemap : 7711 kB
18+
domainbuilder: detail: xc_dom_boot_xen_init: ver 4.19, caps xen-3.0-x86_64 hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
19+
domainbuilder: detail: xc_dom_parse_image: called
20+
domainbuilder: detail: xc_dom_find_loader: trying multiboot-binary loader ...
21+
domainbuilder: detail: loader probe failed
22+
domainbuilder: detail: xc_dom_find_loader: trying HVM-generic loader ...
23+
domainbuilder: detail: loader probe failed
24+
domainbuilder: detail: xc_dom_find_loader: trying Linux bzImage loader ...
25+
domainbuilder: detail: _xc_try_lzma_decode: XZ decompression error: Memory usage limit reached
26+
xc: error: panic: xg_dom_bzimageloader.c:761: xc_dom_probe_bzimage_kernel unable to XZ decompress kernel: Invalid kernel
27+
domainbuilder: detail: loader probe failed
28+
domainbuilder: detail: xc_dom_find_loader: trying ELF-generic loader ...
29+
domainbuilder: detail: loader probe failed
30+
xc: error: panic: xg_dom_core.c:689: xc_dom_find_loader: no loader found: Invalid kernel
31+
libxl: error: libxl_dom.c:566:libxl__build_dom: xc_dom_parse_image failed
32+
33+
The important part: XZ decompression error: Memory usage limit reached
34+
35+
This looks to be related to the following change in Linux:
36+
8653c909922743bceb4800e5cc26087208c9e0e6 ("xz: use 128 MiB dictionary and force single-threaded mode")
37+
38+
Fix this by increasing the block size to 256MiB. And remove the
39+
misleading comment (from lack of better ideas).
40+
41+
Signed-off-by: Marek Marczykowski-Górecki <[email protected]>
42+
---
43+
tools/libs/guest/xg_dom_bzimageloader.c | 3 +--
44+
1 file changed, 1 insertion(+), 2 deletions(-)
45+
46+
diff --git a/tools/libs/guest/xg_dom_bzimageloader.c b/tools/libs/guest/xg_dom_bzimageloader.c
47+
index c6ee6d83e7c6..1fb4e5a1f728 100644
48+
--- a/tools/libs/guest/xg_dom_bzimageloader.c
49+
+++ b/tools/libs/guest/xg_dom_bzimageloader.c
50+
@@ -272,8 +272,7 @@ static int _xc_try_lzma_decode(
51+
return retval;
52+
}
53+
54+
-/* 128 Mb is the minimum size (half-way) documented to work for all inputs. */
55+
-#define LZMA_BLOCK_SIZE (128*1024*1024)
56+
+#define LZMA_BLOCK_SIZE (256*1024*1024)
57+
58+
static int xc_try_xz_decode(
59+
struct xc_dom_image *dom, void **blob, size_t *size)
60+
--
61+
2.46.0
62+

xen.spec.in

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ Patch0627: 0627-x86-msr-Allow-hardware-domain-to-read-package-C-stat.patch
141141
Patch0628: 0628-x86-mwait-idle-Use-ACPI-for-CPUs-without-hardcoded-C.patch
142142
Patch0629: 0629-libxl_pci-Pass-power_mgmt-via-QMP.patch
143143

144+
Patch0630: 0630-tools-xg-increase-LZMA_BLOCK_SIZE-for-uncompressing-.patch
145+
144146
# Qubes specific patches
145147
Patch1000: 1000-Do-not-access-network-during-the-build.patch
146148
Patch1001: 1001-hotplug-store-block-params-for-cleanup.patch

0 commit comments

Comments
 (0)