[PATCH] lzma: Relax memory limit for lzma decompressor

WANG Rui wangrui at loongson.cn
Fri Nov 24 23:26:43 PST 2023


The kexec cannot load LZMA compressed vmlinuz.efi on LoongArch.

  Try LZMA decompression.
  lzma_decompress_file: read on /tmp/Image4yyfhM of 65536 bytes failed
  pez_prepare: decompressed size 8563960
  pez_prepare: done
  Cannot load vmlinuz.efi

The root cause is that lzma decompressor requires more memory usage,
which exceeds the current 64M limit.

Reported-by: Huacai Chen <chenhuacai at kernel.org>
Signed-off-by: WANG Rui <wangrui at loongson.cn>
---
 kexec/lzma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kexec/lzma.c b/kexec/lzma.c
index 2fc07e6..56778d1 100644
--- a/kexec/lzma.c
+++ b/kexec/lzma.c
@@ -73,7 +73,7 @@ static LZFILE *lzopen_internal(const char *path, const char *mode, int fd)
 		ret = lzma_alone_encoder(&lzfile->strm, &opt_lzma);
 	} else {
 		ret = lzma_auto_decoder(&lzfile->strm,
-					UINT64_C(64) * 1024 * 1024, 0);
+					UINT64_C(128) * 1024 * 1024, 0);
 	}
 	if (ret != LZMA_OK) {
 		fclose(fp);
-- 
2.42.0




More information about the kexec mailing list