From: Matthias Goergens <matthias.goergens@gmail.com>
To: Viacheslav Dubeyko <slava@dubeyko.com>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
Yangtao Li <frank.li@vivo.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/2] hfs, hfsplus: bound the partition-table and wrapper hops
Date: Sat, 26 Sep 2026 16:40:08 +0800 [thread overview]
Message-ID: <20260926084010.569552-1-matthias.goergens@gmail.com> (raw)
hfs_mdb_get() and hfsplus_read_wrapper() follow a partition table, and
hfsplus also an HFS wrapper, back to the volume header with no bound on
how often. A partition entry or wrapper descriptor with a zero offset
sends the loop back to the header it has just read, and a crafted image
hangs the mount.
These patches allow each kind of hop at most once: one partition-table
hop, before any wrapper hop, and one wrapper hop. TN1150 requires a
wrapper's embedded volume to be HFS Plus, so a second wrapper is never
valid. Apple documents no nested partition maps, and neither macOS nor
the boot ROM reads one. With both limits, plain, wrapped, partitioned
and partitioned-then-wrapped volumes still mount under QEMU.
If you would rather not rely on that, the alternative is to reject only
a hop that does not advance part_start. Both hops add unsigned offsets,
so the loop then always ends, but a crafted chain of one-sector hops
can cost a synchronous read per sector of the device before it does,
which on slow media such as a CD adds up. I can send that instead.
Matthias Goergens (2):
hfs: bound the partition-table hop in hfs_mdb_get()
hfsplus: bound the wrapper and partition-table hops in
hfsplus_read_wrapper()
fs/hfs/mdb.c | 10 +++++++++-
fs/hfsplus/wrapper.c | 15 +++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
--
2.55.0
next reply other threads:[~2026-09-26 8:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-26 8:40 Matthias Goergens [this message]
2026-09-26 8:40 ` [PATCH 1/2] hfs: bound the partition-table hop in hfs_mdb_get() Matthias Goergens
2026-09-26 8:40 ` [PATCH 2/2] hfsplus: bound the wrapper and partition-table hops in hfsplus_read_wrapper() Matthias Goergens
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=20260926084010.569552-1-matthias.goergens@gmail.com \
--to=matthias.goergens@gmail.com \
--cc=frank.li@vivo.com \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=slava@dubeyko.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
all inboxes | Powered by JetHome®