From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Utkal Singh <singhutkal015@gmail.com>
Cc: linux-erofs@lists.ozlabs.org
Subject: Re: [PATCH] erofs-utils: lib: validate algorithm format before use in z_erofs_map_blocks_ext
Date: Sun, 15 Mar 2026 18:39:34 +0800 [thread overview]
Message-ID: <99d8f308-35f3-42bc-8950-daa22b654e63@linux.alibaba.com> (raw)
In-Reply-To: <20260315072806.17504-1-singhutkal015@gmail.com>
On 2026/3/15 15:28, Utkal Singh wrote:
> The fmt field read from the on-disk extent is used directly as an index
> without bounds checking. A crafted image could set fmt to a value
> exceeding Z_EROFS_COMPRESSION_MAX, causing out-of-bounds access.
>
> Add a bounds check before using fmt-1 as algorithm format index,
> returning -EOPNOTSUPP for unknown algorithm formats.
>
> Signed-off-by: Utkal Singh <singhutkal015@gmail.com>
The following commit should be backported instead:
commit 131897c65e2b
Author: Gao Xiang <xiang@kernel.org>
Date: Sun Aug 24 23:11:57 2025 +0800
erofs: fix invalid algorithm for encoded extents
The current algorithm sanity checks do not properly apply to new
encoded extents.
Unify the algorithm check with Z_EROFS_COMPRESSION(_RUNTIME)_MAX
and ensure consistency with sbi->available_compr_algs.
Reported-and-tested-by: syzbot+5a398eb460ddaa6f242f@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/r/68a8bd20.050a0220.37038e.005a.GAE@google.com
Fixes: 1d191b4ca51d ("erofs: implement encoded extent metadata")
Thanks-to: Edward Adam Davis <eadavis@qq.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
next prev parent reply other threads:[~2026-03-15 10:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-15 7:28 [PATCH] erofs-utils: lib: validate algorithm format before use in z_erofs_map_blocks_ext Utkal Singh
2026-03-15 10:39 ` Gao Xiang [this message]
2026-03-15 14:20 ` [PATCH v2] erofs-utils: release 1.9.1 Utkal Singh
2026-03-15 14:22 ` [PATCH v2] erofs-utils: lib: validate algorithm for encoded extents Utkal Singh
2026-03-16 3:11 ` Yifan Zhao
2026-03-16 5:33 ` Utkal Singh
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=99d8f308-35f3-42bc-8950-daa22b654e63@linux.alibaba.com \
--to=hsiangkao@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=singhutkal015@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox