tools/xg: increase LZMA_BLOCK_SIZE for uncompressing the kernel
PATCH 1/1 tools/xg: increase LZMA_BLOCK_SIZE for uncompressing the kernel
Linux 6.12-rc2 fails to decompress with the current 128MiB, contrary to the code comment. It results in a failure like this:
domainbuilder: detail: xc_dom_kernel_file: filename="/var/lib/qubes/vm-kernels/6.12-rc2-1.1.fc37/vmlinuz"
domainbuilder: detail: xc_dom_malloc_filemap : 12104 kB
domainbuilder: detail: xc_dom_module_file: filename="/var/lib/qubes/vm-kernels/6.12-rc2-1.1.fc37/initramfs"
domainbuilder: detail: xc_dom_malloc_filemap : 7711 kB
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
domainbuilder: detail: xc_dom_parse_image: called
domainbuilder: detail: xc_dom_find_loader: trying multiboot-binary loader ...
domainbuilder: detail: loader probe failed
domainbuilder: detail: xc_dom_find_loader: trying HVM-generic loader ...
domainbuilder: detail: loader probe failed
domainbuilder: detail: xc_dom_find_loader: trying Linux bzImage loader ...
domainbuilder: detail: _xc_try_lzma_decode: XZ decompression error: Memory usage limit reached
xc: error: panic: xg_dom_bzimageloader.c:761: xc_dom_probe_bzimage_kernel unable to XZ decompress kernel: Invalid kernel
domainbuilder: detail: loader probe failed
domainbuilder: detail: xc_dom_find_loader: trying ELF-generic loader ...
domainbuilder: detail: loader probe failed
xc: error: panic: xg_dom_core.c:689: xc_dom_find_loader: no loader found: Invalid kernel
libxl: error: libxl_dom.c:566:libxl__build_dom: xc_dom_parse_image failed
The important part: XZ decompression error: Memory usage limit reached
This looks to be related to the following change in Linux:8653c909922743bceb4800e5cc26087208c9e0e6 ("xz: use 128 MiB dictionary and force single-threaded mode")
Fix this by increasing the block size to 256MiB. And remove the misleading comment (from lack of better ideas).
--- tools/libs/guest/xg_dom_bzimageloader.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/libs/guest/xg_dom_bzimageloader.c +1 -2
@@ -272,8 +272,7 @@ static int _xc_try_lzma_decode(return retval; } -/* 128 Mb is the minimum size (half-way) documented to work for all inputs. */ -#define LZMA_BLOCK_SIZE (128*1024*1024) +#define LZMA_BLOCK_SIZE (256*1024*1024)static int xc_try_xz_decode (struct xc_dom_image *dom,void **blob,size_t *size)
Signature · 1 line
2.46.0
tools/libs/guest/xg_dom_bzimageloader.c static int _xc_try_lzma_decode( · line 275
Quoted 9 lines · Marek Marczykowski-Górecki
tools/libs/guest/xg_dom_bzimageloader.c +1
-2@@ -272,8 +272,7 @@ static int _xc_try_lzma_decode(return retval; } -/* 128 Mb is the minimum size (half-way) documented to work for all inputs. */ -#define LZMA_BLOCK_SIZE (128*1024*1024) +#define LZMA_BLOCK_SIZE (256*1024*1024)
That's as arbitrary as before, now just not even with a comment at least hinting at it being arbitrary. Quoting from one of the LZMA API headers:
* Decoder already supports dictionaries up to 4 GiB - 1 B (i.e.
* UINT32_MAX), so increasing the maximum dictionary size of the
* encoder won't cause problems for old decoders.
IOW - what if the Linux folks decided to increase the dictionary size further? I therefore wonder whether we don't need to make this more dynamic, perhaps by peeking into the header to obtain the dictionary size used. The one thing I'm not sure about is whether there can't be multiple such headers throughout the file, and hence (in principle) differing dictionary sizes.
Jan
Quoted 18 lines · Jan Beulich
tools/libs/guest/xg_dom_bzimageloader.c static int _xc_try_lzma_decode( · line 275
Quoted 9 lines · Marek Marczykowski-Górecki
tools/libs/guest/xg_dom_bzimageloader.c +1
-2@@ -272,8 +272,7 @@ static int _xc_try_lzma_decode(return retval; } -/* 128 Mb is the minimum size (half-way) documented to work for all inputs. */ -#define LZMA_BLOCK_SIZE (128*1024*1024) +#define LZMA_BLOCK_SIZE (256*1024*1024)That's as arbitrary as before, now just not even with a comment at least hinting at it being arbitrary. Quoting from one of the LZMA API headers:
* Decoder already supports dictionaries up to 4 GiB - 1 B (i.e.
*UINT32_MAX), so increasing the maximum dictionary size of the
* encoder won't cause problems for old decoders.
Quoted 6 lines
IOW - what if the Linux folks decided to increase the dictionary size further? I therefore wonder whether we don't need to make this more dynamic, perhaps by peeking into the header to obtain the dictionary size used. The one thing I'm not sure about is whether there can't be multiple such headers throughout the file, and hence (in principle) differing dictionary sizes.
What is the purpose of this block size limit? From the error message, it seems to be avoiding excessive memory usage during decompression (which could be DoS via OOM). If that's the case, then taking the limit from the kernel binary itself will miss this point (especially in case of pygrub or similar, but there may be other cases of not-fully-trusted kernel binaries).
I realize replacing one arbitrary number with another is not really future-proof, but also the last one lasted for over 10 years, so maybe it isn't really a big issue.
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
Quoted 26 lines · Marek Marczykowski-Górecki
Quoted 18 lines · Jan Beulich
tools/libs/guest/xg_dom_bzimageloader.c static int _xc_try_lzma_decode( · line 275
Quoted 9 lines · Marek Marczykowski-Górecki
tools/libs/guest/xg_dom_bzimageloader.c +1
-2@@ -272,8 +272,7 @@ static int _xc_try_lzma_decode(return retval; } -/* 128 Mb is the minimum size (half-way) documented to work for all inputs. */ -#define LZMA_BLOCK_SIZE (128*1024*1024) +#define LZMA_BLOCK_SIZE (256*1024*1024)That's as arbitrary as before, now just not even with a comment at least hinting at it being arbitrary. Quoting from one of the LZMA API headers:
* Decoder already supports dictionaries up to 4 GiB - 1 B (i.e.
*UINT32_MAX), so increasing the maximum dictionary size of the
* encoder won't cause problems for old decoders.Quoted 6 lines
IOW - what if the Linux folks decided to increase the dictionary size further? I therefore wonder whether we don't need to make this more dynamic, perhaps by peeking into the header to obtain the dictionary size used. The one thing I'm not sure about is whether there can't be multiple such headers throughout the file, and hence (in principle) differing dictionary sizes.
Quoted 6 lines
What is the purpose of this block size limit? From the error message, it seems to be avoiding excessive memory usage during decompression (which could be DoS via OOM). If that's the case, then taking the limit from the kernel binary itself will miss this point (especially in case of pygrub or similar, but there may be other cases of not-fully-trusted kernel binaries).
Indeed. The question then simply is: Where do we want to draw the line between what we permit and what we reject?
Jan
Quoted 34 lines · Jan Beulich
Quoted 26 lines · Marek Marczykowski-Górecki
Quoted 18 lines · Jan Beulich
tools/libs/guest/xg_dom_bzimageloader.c static int _xc_try_lzma_decode( · line 275
Quoted 9 lines · Marek Marczykowski-Górecki
tools/libs/guest/xg_dom_bzimageloader.c +1
-2@@ -272,8 +272,7 @@ static int _xc_try_lzma_decode(return retval; } -/* 128 Mb is the minimum size (half-way) documented to work for all inputs. */ -#define LZMA_BLOCK_SIZE (128*1024*1024) +#define LZMA_BLOCK_SIZE (256*1024*1024)That's as arbitrary as before, now just not even with a comment at least hinting at it being arbitrary. Quoting from one of the LZMA API headers:
* Decoder already supports dictionaries up to 4 GiB - 1 B (i.e.
*UINT32_MAX), so increasing the maximum dictionary size of the
* encoder won't cause problems for old decoders.Quoted 6 lines
IOW - what if the Linux folks decided to increase the dictionary size further? I therefore wonder whether we don't need to make this more dynamic, perhaps by peeking into the header to obtain the dictionary size used. The one thing I'm not sure about is whether there can't be multiple such headers throughout the file, and hence (in principle) differing dictionary sizes.
Quoted 6 lines
What is the purpose of this block size limit? From the error message, it seems to be avoiding excessive memory usage during decompression (which could be DoS via OOM). If that's the case, then taking the limit from the kernel binary itself will miss this point (especially in case of pygrub or similar, but there may be other cases of not-fully-trusted kernel binaries).
Quoted 2 lines
Indeed. The question then simply is: Where do we want to draw the line between what we permit and what we reject?
IMHO the most natural solution would be to use guest memory for this purpose. OTOH this probably would require a significant rework of libxenguest.
Juergen
Quoted 38 lines · Juergen Gross
Quoted 37 lines · Jan Beulich
Quoted 35 lines · Marek Marczykowski-Górecki
Quoted 20 lines · Jan Beulich
tools/libs/guest/xg_dom_bzimageloader.c static int _xc_try_lzma_decode( · line 275
Quoted 9 lines · Marek Marczykowski-Górecki
tools/libs/guest/xg_dom_bzimageloader.c +0
-0@@ -272,8 +272,7 @@ static int _xc_try_lzma_decode( return retval; }-/* 128 Mb is the minimum size (half-way) documented to work for all inputs. */
tools/libs/guest/xg_dom_bzimageloader.c +1
-1-#define LZMA_BLOCK_SIZE (128*1024*1024) +#define LZMA_BLOCK_SIZE (256*1024*1024)That's as arbitrary as before, now just not even with a comment at least
hinting at it being arbitrary. Quoting from one of the LZMA API headers:* Decoder already supports dictionaries up to 4 GiB - 1 B (i.e.
*UINT32_MAX), so increasing the maximum dictionary size of the
* encoder won't cause problems for old decoders.Quoted 6 lines
IOW - what if the Linux folks decided to increase the dictionary size further? I therefore wonder whether we don't need to make this more dynamic, perhaps by peeking into the header to obtain the dictionary size used. The one thing I'm not sure about is whether there can't be multiple such headers throughout the file, and hence (in principle) differing dictionary sizes.
What is the purpose of this block size limit? From the error message, it
seems to be avoiding excessive memory usage during decompression (which could be DoS via OOM). If that's the case, then taking the limit from the kernel binary itself will miss this point (especially in case of pygrub or similar, but there may be other cases of not-fully-trusted kernel binaries).
Quoted 6 lines
Quoted 2 lines
Indeed. The question then simply is: Where do we want to draw the line between what we permit and what we reject?
IMHO the most natural solution would be to use guest memory for this purpose.
OTOH this probably would require a significant rework of libxenguest.
That was XSA-25. There are toolstack-provided limits on kernel&initrd sizes.
~Andrew
Quoted 42 lines · Andrew Cooper
Quoted 41 lines · Juergen Gross
Quoted 39 lines · Jan Beulich
Quoted 28 lines · Marek Marczykowski-Górecki
Quoted 20 lines · Jan Beulich
tools/libs/guest/xg_dom_bzimageloader.c static int _xc_try_lzma_decode( · line 275
Quoted 9 lines · Marek Marczykowski-Górecki
tools/libs/guest/xg_dom_bzimageloader.c +0
-0@@ -272,8 +272,7 @@ static int _xc_try_lzma_decode( return retval; }-/* 128 Mb is the minimum size (half-way) documented to work for all inputs. */
tools/libs/guest/xg_dom_bzimageloader.c +1
-1-#define LZMA_BLOCK_SIZE (128*1024*1024) +#define LZMA_BLOCK_SIZE (256*1024*1024)That's as arbitrary as before, now just not even with a comment at least
hinting at it being arbitrary. Quoting from one of the LZMA API headers:* Decoder already supports dictionaries up to 4 GiB - 1 B (i.e.
*UINT32_MAX), so increasing the maximum dictionary size of the
* encoder won't cause problems for old decoders.Quoted 6 lines
IOW - what if the Linux folks decided to increase the dictionary size further? I therefore wonder whether we don't need to make this more dynamic, perhaps by peeking into the header to obtain the dictionary size used. The one thing I'm not sure about is whether there can't be multiple such headers throughout the file, and hence (in principle) differing dictionary sizes.
Quoted 7 lines
What is the purpose of this block size limit? From the error message, it
seems to be avoiding excessive memory usage during decompression (which could be DoS via OOM). If that's the case, then taking the limit from the kernel binary itself will miss this point (especially in case of pygrub or similar, but there may be other cases of not-fully-trusted kernel binaries).Indeed. The question then simply is: Where do we want to draw the line between what we permit and what we reject?
Quoted 6 lines
Quoted 3 lines
IMHO the most natural solution would be to use guest memory for this purpose.
OTOH this probably would require a significant rework of libxenguest.That was XSA-25. There are toolstack-provided limits on kernel&initrd sizes.
Which probably can't be directly applied to dictionary size used during (de)compression.
Jan
Quoted 47 lines · Jan Beulich
Quoted 46 lines · Andrew Cooper
Quoted 44 lines · Juergen Gross
Quoted 37 lines · Jan Beulich
Quoted 28 lines · Marek Marczykowski-Górecki
Quoted 20 lines · Jan Beulich
tools/libs/guest/xg_dom_bzimageloader.c
Quoted 9 lines · Marek Marczykowski-Górecki
tools/libs/guest/xg_dom_bzimageloader.c +0
-0@@ -272,8 +272,7 @@ static int _xc_try_lzma_decode( return retval; } -/* 128 Mb is the minimum size (half-way) documented to work forall inputs. */
tools/libs/guest/xg_dom_bzimageloader.c +1
-1-#define LZMA_BLOCK_SIZE (128*1024*1024) +#define LZMA_BLOCK_SIZE (256*1024*1024)That's as arbitrary as before, now just not even with a comment at least
hinting at it being arbitrary. Quoting from one of the LZMA API headers:* Decoder already supports dictionaries up to 4 GiB - 1 B (i.e.
*UINT32_MAX), so increasing the maximum dictionary size of the
* encoder won't cause problems for old decoders.Quoted 6 lines
IOW - what if the Linux folks decided to increase the dictionary size further? I therefore wonder whether we don't need to make this more dynamic, perhaps by peeking into the header to obtain the dictionary size used. The one thing I'm not sure about is whether there can't be multiple such headers throughout the file, and hence (in principle) differing dictionary sizes.
Quoted 7 lines
What is the purpose of this block size limit? From the error message, it
seems to be avoiding excessive memory usage during decompression (which could be DoS via OOM). If that's the case, then taking the limit from the kernel binary itself will miss this point (especially in case of pygrub or similar, but there may be other cases of not-fully-trusted kernel binaries).Quoted 2 lines
Indeed. The question then simply is: Where do we want to draw the line between what we permit and what we reject?
IMHO the most natural solution would be to use guest memory for this purpose.
OTOH this probably would require a significant rework of libxenguest.
Quoted 5 lines
Quoted 2 lines
That was XSA-25. There are toolstack-provided limits on kernel&initrd sizes.
Which probably can't be directly applied to dictionary size used during (de)compression.
My point still stands: using GUEST memory for all the decompression work would avoid all these problems. If the guest memory isn't sufficient, a decompression by e.g. grub wouldn't work either.
Juergen
Quoted 51 lines · Jürgen Groß
Quoted 50 lines · Jan Beulich
Quoted 48 lines · Andrew Cooper
Quoted 38 lines · Juergen Gross
Quoted 37 lines · Jan Beulich
Quoted 35 lines · Marek Marczykowski-Górecki
Quoted 20 lines · Jan Beulich
tools/libs/guest/xg_dom_bzimageloader.c
Quoted 9 lines · Marek Marczykowski-Górecki
tools/libs/guest/xg_dom_bzimageloader.c +0
-0@@ -272,8 +272,7 @@ static int _xc_try_lzma_decode( return retval; } -/* 128 Mb is the minimum size (half-way) documented to work forall inputs. */
tools/libs/guest/xg_dom_bzimageloader.c +1
-1-#define LZMA_BLOCK_SIZE (128*1024*1024) +#define LZMA_BLOCK_SIZE (256*1024*1024)That's as arbitrary as before, now just not even with a comment at least
hinting at it being arbitrary. Quoting from one of the LZMA API headers:* Decoder already supports dictionaries up to 4 GiB - 1 B (i.e.
*UINT32_MAX), so increasing the maximum dictionary size of the
* encoder won't cause problems for old decoders.Quoted 6 lines
IOW - what if the Linux folks decided to increase the dictionary size further? I therefore wonder whether we don't need to make this more dynamic, perhaps by peeking into the header to obtain the dictionary size used. The one thing I'm not sure about is whether there can't be multiple such headers throughout the file, and hence (in principle) differing dictionary sizes.
What is the purpose of this block size limit? From the error message, it
seems to be avoiding excessive memory usage during decompression (which could be DoS via OOM). If that's the case, then taking the limit from the kernel binary itself will miss this point (especially in case of pygrub or similar, but there may be other cases of not-fully-trusted kernel binaries).Quoted 6 lines
Quoted 2 lines
Indeed. The question then simply is: Where do we want to draw the line between what we permit and what we reject?
IMHO the most natural solution would be to use guest memory for this purpose.
OTOH this probably would require a significant rework of libxenguest.That was XSA-25. There are toolstack-provided limits on kernel&initrd sizes.
Quoted 6 lines
Quoted 2 lines
Which probably can't be directly applied to dictionary size used during (de)compression.
My point still stands: using GUEST memory for all the decompression work would avoid all these problems. If the guest memory isn't sufficient, a decompression by e.g. grub wouldn't work either.
Doing that would probably require mapping guest memory to dom0 for this purpose. And probably quite severe changes to the decompressing code (liblzma?) to actually use that memory instead of standard heap. I don't think it's a feasible short term fix.
Theoretically this could be made configurable (if nothing else, then via an env variable or even build-time setting...), but honestly it feels like an overkill.
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
Adding Oleksii, as this IMO wants to be a blocker for 4.20.
Quoted 59 lines · Marek Marczykowski-Górecki
Quoted 51 lines · Jürgen Groß
Quoted 50 lines · Jan Beulich
Quoted 48 lines · Andrew Cooper
Quoted 38 lines · Juergen Gross
Quoted 37 lines · Jan Beulich
Quoted 35 lines · Marek Marczykowski-Górecki
Quoted 20 lines · Jan Beulich
tools/libs/guest/xg_dom_bzimageloader.c
Quoted 9 lines · Marek Marczykowski-Górecki
tools/libs/guest/xg_dom_bzimageloader.c +0
-0@@ -272,8 +272,7 @@ static int _xc_try_lzma_decode( return retval; } -/* 128 Mb is the minimum size (half-way) documented to work forall inputs. */
tools/libs/guest/xg_dom_bzimageloader.c +1
-1-#define LZMA_BLOCK_SIZE (128*1024*1024) +#define LZMA_BLOCK_SIZE (256*1024*1024)That's as arbitrary as before, now just not even with a comment at least
hinting at it being arbitrary. Quoting from one of the LZMA API headers:* Decoder already supports dictionaries up to 4 GiB - 1 B (i.e.
*UINT32_MAX), so increasing the maximum dictionary size of the
* encoder won't cause problems for old decoders.Quoted 6 lines
IOW - what if the Linux folks decided to increase the dictionary size further? I therefore wonder whether we don't need to make this more dynamic, perhaps by peeking into the header to obtain the dictionary size used. The one thing I'm not sure about is whether there can't be multiple such headers throughout the file, and hence (in principle) differing dictionary sizes.
What is the purpose of this block size limit? From the error message, it
seems to be avoiding excessive memory usage during decompression (which could be DoS via OOM). If that's the case, then taking the limit from the kernel binary itself will miss this point (especially in case of pygrub or similar, but there may be other cases of not-fully-trusted kernel binaries).Quoted 6 lines
Quoted 2 lines
Indeed. The question then simply is: Where do we want to draw the line between what we permit and what we reject?
IMHO the most natural solution would be to use guest memory for this purpose.
OTOH this probably would require a significant rework of libxenguest.That was XSA-25. There are toolstack-provided limits on kernel&initrd sizes.
Quoted 6 lines
Quoted 2 lines
Which probably can't be directly applied to dictionary size used during (de)compression.
My point still stands: using GUEST memory for all the decompression work would avoid all these problems. If the guest memory isn't sufficient, a decompression by e.g. grub wouldn't work either.
Quoted 7 lines
Doing that would probably require mapping guest memory to dom0 for this purpose. And probably quite severe changes to the decompressing code (liblzma?) to actually use that memory instead of standard heap. I don't think it's a feasible short term fix.
Theoretically this could be made configurable (if nothing else, then via an env variable or even build-time setting...), but honestly it feels like an overkill.
As a compromise that could likely be done in time for the release, would it be feasible to fetch the dictionary size from the header and cap it at certain boundary using max(<header val>, <boundary>)?
Thanks, Roger.
Quoted 70 lines · Roger Pau Monné
Adding Oleksii, as this IMO wants to be a blocker for 4.20.
Quoted 59 lines · Marek Marczykowski-Górecki
Quoted 51 lines · Jürgen Groß
Quoted 50 lines · Jan Beulich
Quoted 48 lines · Andrew Cooper
Quoted 38 lines · Juergen Gross
Quoted 37 lines · Jan Beulich
Quoted 35 lines · Marek Marczykowski-Górecki
Quoted 20 lines · Jan Beulich
tools/libs/guest/xg_dom_bzimageloader.c
Quoted 9 lines · Marek Marczykowski-Górecki
tools/libs/guest/xg_dom_bzimageloader.c +0
-0@@ -272,8 +272,7 @@ static int _xc_try_lzma_decode( return retval; } -/* 128 Mb is the minimum size (half-way) documented to work forall inputs. */
tools/libs/guest/xg_dom_bzimageloader.c +1
-1-#define LZMA_BLOCK_SIZE (128*1024*1024) +#define LZMA_BLOCK_SIZE (256*1024*1024)That's as arbitrary as before, now just not even with a comment at least
hinting at it being arbitrary. Quoting from one of the LZMA API headers:* Decoder already supports dictionaries up to 4 GiB - 1 B (i.e.
*UINT32_MAX), so increasing the maximum dictionary size of the
* encoder won't cause problems for old decoders.Quoted 6 lines
IOW - what if the Linux folks decided to increase the dictionary size further? I therefore wonder whether we don't need to make this more dynamic, perhaps by peeking into the header to obtain the dictionary size used. The one thing I'm not sure about is whether there can't be multiple such headers throughout the file, and hence (in principle) differing dictionary sizes.
What is the purpose of this block size limit? From the error message, it
seems to be avoiding excessive memory usage during decompression (which could be DoS via OOM). If that's the case, then taking the limit from the kernel binary itself will miss this point (especially in case of pygrub or similar, but there may be other cases of not-fully-trusted kernel binaries).Quoted 6 lines
Quoted 2 lines
Indeed. The question then simply is: Where do we want to draw the line between what we permit and what we reject?
IMHO the most natural solution would be to use guest memory for this purpose.
OTOH this probably would require a significant rework of libxenguest.That was XSA-25. There are toolstack-provided limits on kernel&initrd sizes.
Quoted 6 lines
Quoted 2 lines
Which probably can't be directly applied to dictionary size used during (de)compression.
My point still stands: using GUEST memory for all the decompression work would avoid all these problems. If the guest memory isn't sufficient, a decompression by e.g. grub wouldn't work either.
Quoted 7 lines
Doing that would probably require mapping guest memory to dom0 for this purpose. And probably quite severe changes to the decompressing code (liblzma?) to actually use that memory instead of standard heap. I don't think it's a feasible short term fix.
Theoretically this could be made configurable (if nothing else, then via an env variable or even build-time setting...), but honestly it feels like an overkill.
Quoted 3 lines
As a compromise that could likely be done in time for the release, would it be feasible to fetch the dictionary size from the header and cap it at certain boundary using
max(<header val>, <boundary>)?
Isn't the current constant more or less that already? It's named LZMA_BLOCK_SIZE, but the lzma_stream_decoder() argument it's used for is "memlimit", described as "Memory usage limit as bytes".
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
Quoted 24 lines · Marek Marczykowski-Górecki
Linux 6.12-rc2 fails to decompress with the current 128MiB, contrary to the code comment. It results in a failure like this:
domainbuilder: detail:
xc_dom_kernel_file: filename="/var/lib/qubes/vm-kernels/6.12-rc2-1.1.fc37/vmlinuz"
domainbuilder: detail:xc_dom_malloc_filemap: 12104 kB
domainbuilder: detail:xc_dom_module_file: filename="/var/lib/qubes/vm-kernels/6.12-rc2-1.1.fc37/initramfs"
domainbuilder: detail:xc_dom_malloc_filemap: 7711 kB
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
domainbuilder: detail:xc_dom_parse_image: called
domainbuilder: detail:xc_dom_find_loader: trying multiboot-binary loader ...
domainbuilder: detail: loader probe failed
domainbuilder: detail:xc_dom_find_loader: trying HVM-generic loader ...
domainbuilder: detail: loader probe failed
domainbuilder: detail:xc_dom_find_loader: trying Linux bzImage loader ...
domainbuilder: detail:_xc_try_lzma_decode: XZ decompression error: Memory usage limit reached
xc: error: panic: xg_dom_bzimageloader.c:761:xc_dom_probe_bzimage_kernelunable to XZ decompress kernel: Invalid kernel
domainbuilder: detail: loader probe failed
domainbuilder: detail:xc_dom_find_loader: trying ELF-generic loader ...
domainbuilder: detail: loader probe failed
xc: error: panic: xg_dom_core.c:689:xc_dom_find_loader: no loader found: Invalid kernel
libxl: error: libxl_dom.c:566:libxl__build_dom:xc_dom_parse_imagefailedThe important part: XZ decompression error: Memory usage limit reached
Quoted 7 lines
This looks to be related to the following change in Linux:
8653c909922743bceb4800e5cc26087208c9e0e6("xz: use 128 MiB dictionary and force single-threaded mode")Fix this by increasing the block size to 256MiB. And remove the misleading comment (from lack of better ideas).
Signed-off-by Marek Marczykowski-Górecki <[email protected]>
I assumed I already RB this, but it seems not.
Could we get an Ack from the tools or libs maintainer for this to go in? It's not the best solution, but we need to get this sorted in time for 4.20, and backport to stable branches.
Thanks, Roger.
Andrew Cooper
Acked-byQuoted 31 lines · Roger Pau Monné
Quoted 30 lines · Marek Marczykowski-Górecki
Linux 6.12-rc2 fails to decompress with the current 128MiB, contrary to the code comment. It results in a failure like this:
domainbuilder: detail:
xc_dom_kernel_file: filename="/var/lib/qubes/vm-kernels/6.12-rc2-1.1.fc37/vmlinuz"
domainbuilder: detail:xc_dom_malloc_filemap: 12104 kB
domainbuilder: detail:xc_dom_module_file: filename="/var/lib/qubes/vm-kernels/6.12-rc2-1.1.fc37/initramfs"
domainbuilder: detail:xc_dom_malloc_filemap: 7711 kB
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
domainbuilder: detail:xc_dom_parse_image: called
domainbuilder: detail:xc_dom_find_loader: trying multiboot-binary loader ...
domainbuilder: detail: loader probe failed
domainbuilder: detail:xc_dom_find_loader: trying HVM-generic loader ...
domainbuilder: detail: loader probe failed
domainbuilder: detail:xc_dom_find_loader: trying Linux bzImage loader ...
domainbuilder: detail:_xc_try_lzma_decode: XZ decompression error: Memory usage limit reached
xc: error: panic: xg_dom_bzimageloader.c:761:xc_dom_probe_bzimage_kernelunable to XZ decompress kernel: Invalid kernel
domainbuilder: detail: loader probe failed
domainbuilder: detail:xc_dom_find_loader: trying ELF-generic loader ...
domainbuilder: detail: loader probe failed
xc: error: panic: xg_dom_core.c:689:xc_dom_find_loader: no loader found: Invalid kernel
libxl: error: libxl_dom.c:566:libxl__build_dom:xc_dom_parse_imagefailedThe important part: XZ decompression error: Memory usage limit reached
This looks to be related to the following change in Linux:
8653c909922743bceb4800e5cc26087208c9e0e6("xz: use 128 MiB dictionary and force single-threaded mode")Fix this by increasing the block size to 256MiB. And remove the misleading comment (from lack of better ideas).
Quoted 8 lines
Quoted 1 line
Signed-off-by Marek Marczykowski-Górecki <[email protected]>Reviewed-by Roger Pau Monné <[email protected]>I assumed I already RB this, but it seems not.
Could we get an Ack from the tools or libs maintainer for this to go in? It's not the best solution, but we need to get this sorted in time for 4.20, and backport to stable branches.
I agree. This isn't great, but it's far better than doing nothing, and there's no other viable alternative proposed.
~Andrew
Anthony PERARD
Acked-byQuoted 33 lines · Roger Pau Monné
Quoted 24 lines · Marek Marczykowski-Górecki
Linux 6.12-rc2 fails to decompress with the current 128MiB, contrary to the code comment. It results in a failure like this:
domainbuilder: detail:
xc_dom_kernel_file: filename="/var/lib/qubes/vm-kernels/6.12-rc2-1.1.fc37/vmlinuz"
domainbuilder: detail:xc_dom_malloc_filemap: 12104 kB
domainbuilder: detail:xc_dom_module_file: filename="/var/lib/qubes/vm-kernels/6.12-rc2-1.1.fc37/initramfs"
domainbuilder: detail:xc_dom_malloc_filemap: 7711 kB
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
domainbuilder: detail:xc_dom_parse_image: called
domainbuilder: detail:xc_dom_find_loader: trying multiboot-binary loader ...
domainbuilder: detail: loader probe failed
domainbuilder: detail:xc_dom_find_loader: trying HVM-generic loader ...
domainbuilder: detail: loader probe failed
domainbuilder: detail:xc_dom_find_loader: trying Linux bzImage loader ...
domainbuilder: detail:_xc_try_lzma_decode: XZ decompression error: Memory usage limit reached
xc: error: panic: xg_dom_bzimageloader.c:761:xc_dom_probe_bzimage_kernelunable to XZ decompress kernel: Invalid kernel
domainbuilder: detail: loader probe failed
domainbuilder: detail:xc_dom_find_loader: trying ELF-generic loader ...
domainbuilder: detail: loader probe failed
xc: error: panic: xg_dom_core.c:689:xc_dom_find_loader: no loader found: Invalid kernel
libxl: error: libxl_dom.c:566:libxl__build_dom:xc_dom_parse_imagefailedThe important part: XZ decompression error: Memory usage limit reached
Quoted 7 lines
This looks to be related to the following change in Linux:
8653c909922743bceb4800e5cc26087208c9e0e6("xz: use 128 MiB dictionary and force single-threaded mode")Fix this by increasing the block size to 256MiB. And remove the misleading comment (from lack of better ideas).
Signed-off-by Marek Marczykowski-Górecki <[email protected]>
Quoted 7 lines
Reviewed-by Roger Pau Monné <[email protected]>I assumed I already RB this, but it seems not.
Could we get an Ack from the tools or libs maintainer for this to go in? It's not the best solution, but we need to get this sorted in time for 4.20, and backport to stable branches.
Thanks,
--
| Vates
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech