From: Viacheslav Dubeyko <slava@dubeyko.com>
To: Zheng Zheng <fengaojigui88@gmail.com>
Cc: glaubitz@physik.fu-berlin.de, frank.li@vivo.com,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
syzkaller-bugs@googlegroups.com
Subject: Re: [BUG] WARNING: possible recursive locking in hfsplus_get_block (fs/hfsplus/extents.c:264, v7.4-rc3)
Date: Tue, 17 Nov 2026 12:50:16 -0800 [thread overview]
Message-ID: <da5996e93eb644e6226158639b6abc05d720b8a8.camel@dubeyko.com> (raw)
In-Reply-To: <CAO-4RZ1a46EoJY7x6euiS+7aTOb-T9X62E9nGyToRcyvKU+eHg@mail.gmail.com>
Hi Zheng,
Thanks for the report. Let me take a look into it.
Thanks,
Slava.
On Tue, 2026-11-17 at 11:01 +0800, Zheng Zheng wrote:
> Hi Viacheslav,
>
> We found a reproducible lockdep recursive-locking warning in hfsplus
> on
> v7.4-rc3 with syzkaller. The same signature is present on v7.4-rc2.
>
> The following is the key excerpt from the rc3 external verification
> log
> (`rc3/logs/external-verification/run1-singleproc-serial.log`, hit at
> 114.00 s):
>
> [ 114.001303][T10445] WARNING: possible recursive locking detected
> [ 114.003629][T10445] 7.4.0-rc3-kernsight-kasan #1 Tainted:
> G E
> [ 114.005869][T10445] --------------------------------------------
> [ 114.008132][T10445] syz-executor/10445 is trying to acquire
> lock:
> [ 114.010406][T10445] ff1100017d7545c0
> (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4},
> at: hfsplus_get_block+0x282/0xab0
> [ 114.021835][T10445] but task is already holding lock:
> [ 114.024125][T10445] ff1100017d753300
> (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4},
> at: hfsplus_file_truncate+0x20d/0xd70
> [ 114.044862][T10445] lock(&HFSPLUS_I(inode)->extents_lock);
> [ 114.058492][T10445] lock(&HFSPLUS_I(inode)->extents_lock);
> [ 114.058944][T10445] *** DEADLOCK ***
> [ 114.058944][T10445] May be due to missing lock nesting notation
> [ 114.060170][T10445] locks held by syz-executor/10445: 6, on
> CPU#3:
> [ 114.063858][T10445] #4: ff1100017d753300
> (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4},
> at: hfsplus_file_truncate+0x20d/0xd70
> [ 114.064748][T10445] #5: ff1100017d26e8f0 (&sbi-
> >alloc_mutex){+.+.}-{4:4},
> at: hfsplus_block_free+0xf3/0x690
> [ 114.068038][T10445] Call Trace:
> [ 114.068542][T10445] dump_stack_lvl+0x116/0x1b0
> [ 114.068921][T10445] print_deadlock_bug+0x293/0x3d0
> [ 114.069329][T10445] __lock_acquire+0x153c/0x2110
> [ 114.070151][T10445] lock_acquire+0x1bf/0x370
> [ 114.071749][T10445] __mutex_lock+0x178/0x1dd0
> [ 114.075318][T10445] hfsplus_get_block+0x282/0xab0
> [ 114.075713][T10445] block_read_full_folio+0x305/0x850
> [ 114.076997][T10445] filemap_read_folio+0xc4/0x2a0
> [ 114.077824][T10445] do_read_cache_folio+0x255/0x5a0
> [ 114.078746][T10445] read_cache_page+0x62/0x150
> [ 114.079124][T10445] hfsplus_block_free+0x156/0x690
> [ 114.079520][T10445] hfsplus_free_extents+0x345/0x4a0
> [ 114.079928][T10445] hfsplus_file_truncate+0x59b/0xd70
> [ 114.159730][T10445] hfsplus_delete_inode+0x196/0x230
> [ 114.160139][T10445] hfsplus_unlink+0x7b5/0x980
> [ 114.162948][T10445] vfs_unlink+0x30d/0xc90
> [ 114.169449][T10445] filename_unlinkat+0x3ee/0x680
> [ 114.171418][T10445] __x64_sys_unlink+0x4c/0xa0
> [ 114.171796][T10445] do_syscall_64+0x132/0x7c0
> [ 114.172170][T10445] entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> What seems to happen:
>
> 1. hfsplus_file_truncate() on the unlinked file holds that file
> inode's
> extents_lock (extents.c:579).
> 2. hfsplus_free_extents() -> hfsplus_block_free() reads the
> allocation
> bitmap through sbi->alloc_file->i_mapping while the file inode's
> extents_lock is still held (bitmap.c:183-185).
> 3. The bitmap read enters hfsplus_get_block() for the allocation-file
> inode
> and takes its own extents_lock (extents.c:264).
>
> The two mutexes are different instances (the external-log addresses
> differ:
> ff1100017d7545c0 vs ff1100017d753300) but share the same lockdep
> class,
> because extents_lock is initialized in a common inode-initialization
> path.
> lockdep therefore reports recursive locking.
>
> Is this a lockdep false positive caused by the shared class, or is
> there a
> real lock-ordering issue? If it is a false positive, should the
> allocation-file inode use a separate lockdep class (or a nested
> annotation)
> for extents_lock? Alternatively, should hfsplus_block_free() run
> outside the
> file inode's extents_lock?
>
> Reproduction:
>
> kernel: v7.4-rc3, CONFIG_KASAN=y, CONFIG_PROVE_LOCKING=y,
> CONFIG_HFSPLUS_FS=y, booted with oops=panic panic_on_warn=1
> guest: Debian trixie x86_64, 6 GiB RAM, 4 vCPU, KVM
> syzkaller: 853b104bb454141a5b0fc0e4218ec78e9f34ffb1
>
> in the guest, as root:
> syz-execprog -procs=1 -threaded -repeat=1 \
> -executor ./syz-executor repro.kernsight.prog
>
> The reproducer is a 56-entry state-reconstruction recipe. The main
> fuzzing
> pipeline verified it 2/2 on freshly replayed VMs; the crash was
> reproduced
> during crash-log replay at entry 55/55. An external fresh-VM run also
> reproduced it 2/2 with -procs=1 -repeat=1 (114.00 s and 110.75 s).
> Note that
> the recipe needs strict single-process ordering; 8 parallel workers
> did not
> reproduce it.
>
> How to reproduce reliably on mainline (v7.4-rc3)
> ------------------------------------------------
> We reproduced this on mainline v7.4-rc3 with the following recipe. No
> local HFS+ patches are applied; the source tree is vanilla v7.4-rc3.
>
> 1. Build the mainline v7.4-rc3 kernel with the configuration in
> rc3/kernel.config. The essential options are CONFIG_KASAN=y,
> CONFIG_PROVE_LOCKING=y, CONFIG_HFSPLUS_FS=y and
> CONFIG_DEBUG_INFO=y.
> The bzImage used here has sha256
> 0c16409f8aec508ac44a63e631c2bd352536401f3fd0856df1d839fb953a1882.
>
> 2. Boot a Debian trixie x86_64 guest (6 GiB RAM, 4 vCPU, KVM) with
> the QEMU
> command line in rc3/environment.txt. Keep the serial console; the
> lockdep
> report appears there (and in dmesg). panic_on_warn=1 is not
> required to
> observe this lockdep report.
>
> 3. Copy syz-execprog and syz-executor built from syzkaller commit
> 853b104bb454141a5b0fc0e4218ec78e9f34ffb1, plus
> rc3/reproducer/repro.kernsight.prog, into the guest.
>
> 4. In the guest, as root, run:
>
> syz-execprog -procs=1 -threaded -repeat=1 \
> -executor ./syz-executor repro.kernsight.prog
>
> 5. Expect "WARNING: possible recursive locking detected" after
> roughly
> 110-115 seconds, with:
>
> hfsplus_get_block+0x282/0xab0
> hfsplus_file_truncate+0x20d/0xd70
>
> We observed this 2/2 on fresh VMs at 114.00 s and 110.75 s.
>
> Important details for stable reproduction:
>
> - Use -procs=1. With -procs=8 (or -repeat=0) the 56-program state
> recipe is
> interleaved and did not reproduce in a 20-minute run.
> - Use the full repro.kernsight.prog recipe. The minimal repro.prog
> alone is
> state-dependent and does not reproduce by itself.
> - The report is a lockdep recursive-locking warning, so serial/dmesg
> is the
> reliable success signal; it is not a KASAN panic.
>
> A repository with the syzkaller programs, kernel configs and full
> logs is
> available at:
>
> https://github.com/Zheng-zheng-codes/hfsplus-extents-lock-deadlock
>
> The repository keeps the v7.4-rc2 and v7.4-rc3 results in separate
> `rc2/`
> and `rc3/` directories so the two kernels are not mixed.
>
> Repository layout:
>
> - `README.md` at the repository root
> Overview of the report and an explicit rc2/rc3 split.
>
> - `rc2/` -- original v7.4-rc2 results
> - `README.md`: v7.4-rc2 report and reproduction notes.
> - `environment.txt`: rc2 kernel image/hash, QEMU command line and
> syzkaller revision.
> - `kernel.config`: v7.4-rc2 kernel configuration.
> - `reproducer/repro.kernsight.prog`: rc2 pipeline-verified state
> recipe.
> - `reproducer/repro.priming.prog`: rc2 priming portion.
> - `reproducer/repro.prog`: rc2 triggering testcase.
> - `logs/log0..log3`, `logs/report0..report3`: original rc2
> syzkaller
> execution logs and crash reports.
> - `logs/machineInfo0..machineInfo3`, `logs/title-stat.json`: guest
> environment and title statistics.
> - `logs/crash-excerpt.txt`: rc2 crash excerpt.
>
> - `rc3/` -- new v7.4-rc3 results (the results in this report)
> - `README.md`: v7.4-rc3 report, locking analysis and reproduction
> notes.
> - `environment.txt`: rc3 kernel image/hash, guest image/hash, QEMU
> command
> line and syzkaller revision.
> - `kernel.config`: v7.4-rc3 kernel configuration.
> - `reproducer/repro.kernsight.prog`: rc3 56-entry state recipe.
> - `reproducer/repro.priming.prog`: rc3 priming portion.
> - `reproducer/repro.prog`: rc3 triggering testcase.
> - `reproducer/repro.report`, `repro.stats`, `repro.outcomes.jsonl`,
> `repro.context.json`: pipeline verification evidence, including
> the
> 2/2 fresh-VM result.
> - `logs/log-0.txt`, `logs/report-0.txt`: original rc3 syzkaller log
> and
> crash report.
> - `logs/machineInfo-0.txt`, `logs/title-stat.json`: rc3 guest
> environment
> and title statistics.
> - `logs/external-verification/run1-singleproc-serial.log` and
> `run2-singleproc-serial.log`: full serial consoles of the two
> independent rc3 fresh-VM reproductions (114.00 s and 110.75 s).
> - `logs/external-verification/*-run.log` and `*-execprog-out.log`:
> the
> corresponding run records and syz-execprog output.
> - `SHA256SUMS`: checksums for the rc3 inputs and logs.
>
> When reproducing, note the difference:
> - rc2 reproduces from its own recipe in `rc2/reproducer/` (see
> `rc2/README.md` for the exact command used in that testing round).
> - rc3 must be run with strict single-process ordering:
> syz-execprog -procs=1 -threaded -repeat=1 \
> -executor ./syz-executor repro.kernsight.prog
>
> Best regards,
> Zheng Zheng
prev parent reply other threads:[~2026-11-17 20:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 3:01 Zheng Zheng
2026-11-17 20:50 ` Viacheslav Dubeyko [this message]
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=da5996e93eb644e6226158639b6abc05d720b8a8.camel@dubeyko.com \
--to=slava@dubeyko.com \
--cc=fengaojigui88@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=syzkaller-bugs@googlegroups.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®