From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,vega@nebusec.ai,kyungsik.lee@lge.com,zhilinz@nebusec.ai,akpm@linux-foundation.org
Subject: + lib-validate-in-memory-lz4-chunk-length.patch added to mm-nonmm-unstable branch
Date: Mon, 14 Sep 2026 21:46:08 -0700 [thread overview]
Message-ID: <20260915044609.2B9081F000FF@smtp.kernel.org> (raw)
The patch titled
Subject: lib: validate in-memory LZ4 chunk length
has been added to the -mm mm-nonmm-unstable branch. Its filename is
lib-validate-in-memory-lz4-chunk-length.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/lib-validate-in-memory-lz4-chunk-length.patch
This patch will later appear in the mm-nonmm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Zhiling Zou <zhilinz@nebusec.ai>
Subject: lib: validate in-memory LZ4 chunk length
Date: Sat, 12 Sep 2026 21:32:17 +0800
We found and validated an issue in lib/decompress_unlz4.c. The bug is
reachable by a root user through kexec_file_load() with a crafted external
initrd.
unlz4() reads the compressed chunk length from an in-memory initrd and
passes it to LZ4_decompress_safe(). It only checks the chunk length
against the allocation size when the input is filled by a callback.
Reject an in-memory chunk that extends past the remaining input before
calling the LZ4 decoder. This prevents malformed initrds from making
the decoder read past the mapped archive.
Link: https://lore.kernel.org/59c6555c27aa7ba18ee227f9f02c78d15a37605f.1789219453.git.zhilinz@nebusec.ai
Fixes: e76e1fdfa8f8 ("lib: add support for LZ4-compressed kernel")
Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Kyungsik Lee <kyungsik.lee@lge.com>
Reported-by: VEGA <vega@nebusec.ai>
Assisted-by: LLM
---
lib/decompress_unlz4.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/lib/decompress_unlz4.c~lib-validate-in-memory-lz4-chunk-length
+++ a/lib/decompress_unlz4.c
@@ -139,6 +139,10 @@ STATIC inline int INIT unlz4(u8 *input,
if (!fill) {
inp += 4;
size -= 4;
+ if (chunksize > size) {
+ error("data corrupted");
+ goto exit_2;
+ }
} else {
if (chunksize > LZ4_compressBound(uncomp_chunksize)) {
error("chunk length is longer than allocated");
_
Patches currently in -mm which might be from zhilinz@nebusec.ai are
lib-validate-in-memory-lz4-chunk-length.patch
reply other threads:[~2026-09-15 4:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260915044609.2B9081F000FF@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=kyungsik.lee@lge.com \
--cc=mm-commits@vger.kernel.org \
--cc=vega@nebusec.ai \
--cc=zhilinz@nebusec.ai \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.