From: rtm@csail.mit.edu
To: Gao Xiang <xiang@kernel.org>, Chao Yu <chao@kernel.org>
Cc: linux-erofs@lists.ozlabs.org
Subject: z_erofs_extent.plen == 0x2000000 can lead to crash
Date: Wed, 01 Oct 2025 17:57:10 -0400 [thread overview]
Message-ID: <75022.1759355830@localhost> (raw)
Here's a corrupt erofs image that can cause a crash:
# wget http://www.rtmrtm.org/rtm/erofs4a.img
# mount -t erofs -o loop erofs4a.img /mnt
# cat < /mnt/d/y > /dev/null
kernel BUG at block/blk-mq.c:1152!
Oops: invalid opcode: 0000 [#1] SMP PTI
CPU: 11 UID: 0 PID: 1315 Comm: cat Not tainted 6.17.0-01737-g50c19e20ed2e #29 PREEMPT(voluntary)
Hardware name: FreeBSD BHYVE/BHYVE, BIOS 14.0 10/17/2021
RIP: 0010:blk_mq_end_request+0x28/0x30
The problem is that the inner "do" loop of z_erofs_submit_queue() runs
without bound submitting read requests, because bvec.bv_len is zero.
The reason for the zero is that the broken filesystem image contains
an z_erofs_extent.plen of 0x2000000. This looks non-zero to the
} else if (map->m_plen) {
in z_erofs_map_blocks_ext(), but then the code does
map->m_plen &= Z_EROFS_EXTENT_PLEN_MASK;
causing m_plen to be zero.
If CONFIG_EROFS_FS_DEBUG, the problem is caught by
z_erofs_submit_queue()'s
DBG_BUGON(bvec.bv_len < sb->s_blocksize);
Robert Morris
rtm@mit.edu
next reply other threads:[~2025-10-01 22:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-01 21:57 rtm [this message]
2025-10-02 0:21 ` z_erofs_extent.plen == 0x2000000 can lead to crash Gao Xiang
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=75022.1759355830@localhost \
--to=rtm@csail.mit.edu \
--cc=chao@kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=xiang@kernel.org \
/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.