From: Nguyen Ngoc Thang <ngocthang2710.1999@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,
syzbot+f8ce6c197125ab9d72ce@syzkaller.appspotmail.com
Subject: [PATCH v4 0/2] hfsplus: fix the extents overflow file recursive tree_lock and its root cause
Date: Sat, 12 Sep 2026 20:24:05 +0700 [thread overview]
Message-ID: <20260912132407.16856-1-ngocthang2710.1999@gmail.com> (raw)
In-Reply-To: <c6b841becc5b1709a9f54a1c0efd0a14f02ad97b.camel@dubeyko.com>
syzbot: WARNING: possible recursive locking in hfsplus_find_init
https://syzkaller.appspot.com/bug?extid=f8ce6c197125ab9d72ce
This is the whole solution Slava asked for, in one series:
Patch 1 fixes the recursive tree_lock itself: hfsplus_ext_read_extent()
now refuses to look up an overflow extent for the extents overflow
file's own inode (it can never have one), and hfsplus_file_extend()
tests whether the fork actually has room before allocating blocks for
it, instead of allocating and undoing the allocation on failure.
Patch 2 addresses "how would we check the fork itself" and "how could
we check the forks of other b-trees", asked across the last few
rounds: hfsplus_check_fork() validates the eight fork extents of the
extents, catalog and attributes trees at hfs_btree_open() time,
following the severity split discussed -- first extent unusable ->
mount fails; a later extent corrupt (the syzbot image's case) -> open
read-only.
v3 -> v4:
- hfsplus_file_extend() tests fork capacity before allocating instead
of allocating and freeing on -ENOSPC (Slava)
- added hfsplus_check_fork(), called from hfs_btree_open() for all
three trees, with the mount-fail/read-only severity split (Slava)
- hfsplus_reconfigure() and hfsplus_fill_super() check the resulting
per-tree corrupt flag instead of re-deriving it on every remount
Nguyen Ngoc Thang (2):
hfsplus: fix recursive tree_lock in hfsplus_file_extend()
hfsplus: validate b-tree fork extents at mount time
fs/hfsplus/btree.c | 12 ++++++
fs/hfsplus/extents.c | 96 +++++++++++++++++++++++++++++++++++++++--
fs/hfsplus/hfsplus_fs.h | 4 ++
fs/hfsplus/super.c | 9 ++++
4 files changed, 117 insertions(+), 4 deletions(-)
--
2.43.0
next prev parent reply other threads:[~2026-09-12 13:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-06 15:49 [PATCH] hfsplus: fix recursive tree_lock in hfsplus_file_extend() ThangNN99
2026-09-07 17:05 ` Viacheslav Dubeyko
2026-09-07 17:15 ` ThangNN99
2026-09-07 17:26 ` Viacheslav Dubeyko
2026-09-08 11:54 ` ThangNN99
2026-09-08 17:39 ` Viacheslav Dubeyko
2026-09-09 16:20 ` Nguyen Ngoc Thang
2026-09-09 18:36 ` Viacheslav Dubeyko
2026-09-10 16:01 ` Nguyen Ngoc Thang
2026-09-10 19:20 ` Viacheslav Dubeyko
2026-09-11 11:46 ` Nguyen Ngoc Thang
2026-09-11 18:26 ` Viacheslav Dubeyko
2026-09-12 13:24 ` Nguyen Ngoc Thang [this message]
2026-09-12 13:24 ` [PATCH v4 1/2] " Nguyen Ngoc Thang
2026-09-12 13:24 ` [PATCH v4 2/2] hfsplus: validate b-tree fork extents at mount time Nguyen Ngoc Thang
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=20260912132407.16856-1-ngocthang2710.1999@gmail.com \
--to=ngocthang2710.1999@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 \
--cc=syzbot+f8ce6c197125ab9d72ce@syzkaller.appspotmail.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