| 0/0 |
2026/07/14 00:01 |
flow |
assessment-security |
54m
Results: map[DenialOfService:true Explanation:Based on the provided crash report and source code analysis, here is the
assessment of the bug:
**Root Cause Analysis:**
The bug report shows a deadlock involving two different filesystems: BTRFS and
JFS. The sequence of events is as follows:
1. **Task 5981 (`jfs_mkdir`)**: Executes a directory creation on a JFS
filesystem. It acquires the directory's `inode_lock` exclusively and then calls
`txBegin()`, which blocks indefinitely. This is a known issue with JFS where
corrupted filesystem images can cause the transaction manager to deadlock or
wait forever for a log sync that never happens.
2. **Task 6004 (`btrfs_control_ioctl`)**: Executes `BTRFS_IOC_SCAN_DEV` with a
path that resides inside the deadlocked JFS filesystem. It acquires the global
BTRFS `uuid_mutex` and then attempts a path lookup (`bdev_file_open_by_path` ->
`kern_path`). The path lookup blocks on the JFS directory's `inode_lock_shared`
held by Task 5981.
3. **Task 5977 (`btrfs_close_devices`)**: Attempts to unmount a completely
unrelated BTRFS filesystem. It tries to acquire the `uuid_mutex` and blocks
forever because Task 6004 is holding it.
The root cause is the JFS transaction deadlock triggered by a corrupted
filesystem image. The BTRFS subsystem becomes a victim because it holds a global
subsystem mutex (`uuid_mutex`) while performing a VFS path lookup, which is a
known anti-pattern as path lookups can block indefinitely on broken or malicious
filesystems (e.g., FUSE, deadlocked JFS, hung NFS).
**Security Impact:**
* **Exploitable:** No. This is a pure deadlock resulting in a hung task. There
is no memory corruption, use-after-free, or information leak involved.
* **Denial of Service:** Yes. The bug causes a local DoS by hanging the JFS
filesystem. Furthermore, it causes a system-wide DoS for BTRFS, as all
subsequent BTRFS mounts, unmounts, and device scans will hang waiting for the
`uuid_mutex`.
* **Accessible From Unprivileged Processes:** No. The BTRFS ioctl
(`BTRFS_IOC_SCAN_DEV`) explicitly checks for global `CAP_SYS_ADMIN`.
Additionally, mounting JFS or BTRFS requires global `CAP_SYS_ADMIN`.
* **Accessible From User Namespaces:** No. Neither BTRFS nor JFS support
`FS_USERNS_MOUNT`, meaning they cannot be mounted inside an unprivileged user
namespace.
* **Malicious Filesystem Trigger:** Yes. The underlying JFS `txBegin` deadlock
is triggered by mounting and interacting with a maliciously crafted JFS image
(which syzkaller generates). Normal JFS images do not deadlock under standard
concurrent operations. Exploitable:false FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/07/14 00:01 |
action |
syz-repro-to-c-repro |
0m
Results:
|
| 2/1 |
2026/07/14 00:01 |
action |
kernel-checkouter |
1m
Results: map[KernelSrc:/app/workdir/cache/src/c3b10855f1d50c561644ae90962390cd82c2c010]
|
| 3/1 |
2026/07/14 00:03 |
action |
kernel-builder |
29m
Results: map[KernelObj:/app/workdir/cache/build/603670cb9e3c4ec69799f06d97f80017fad8bbca]
|
| 4/1 |
2026/07/14 00:32 |
action |
codesearch-prepare |
19m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/07/14 00:51 |
agent |
expert |
4m
Model:
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
Instruction: You are an experienced Linux kernel security engineer. Your task is to analyze given kernel bug report
and determine its security impact based on the following dimensions.
Use the provided tools to examine the source code, check for capability checks (e.g., capable(), ns_capable()),
and understand the nature of the bug. Analyze the given kernel build and configuration.
You can check the kernel config by grepping ".config" file; you can check kernel cmdline by grepping
".config" file for "CONFIG_CMDLINE=". Assume sysctl parameters have default values.
But analyze for the corresponding production build w/o debugging tools enabled (like KASAN, KMSAN, UBSAN).
Try different strategies when analyzing the bug:
- think of ways in which the vulnerable code is unreachable
- or the other way around: try to come up with different ideas of how an unprivileged user can reach the bug
If still unsure err on the side of the bug being non-exploitable/not-accessible.
In the final reply, provide a reasoning for your assessment.
Analysis dimensions:
* Exploitable:
Determine if the bug can result in memory corruption, elevated privileges, or an information leak.
Memory safety issues are almost always exploitable (KASAN or UBSAN reports for use-after-free, out-of-bounds;
refcounting issues, corrupted lists, etc). When kernel is crashing on a completely wild pointer access
(e.g. user-space address, or non-canonical address, but not on NULL or address corresponding to KASAN shadow
for NULL address), including both data accesses and control transfers, that also usually implies possibility
of exploitation. Such reports usually say "unable to handle kernel paging request".
Uses of uninitialized values detected by KMSAN may be exploitable b/c attacker frequently can affect uninit
values with spraying techniques. However, for these exploitability depends on how exactly the uninit value
is used in the code, and what it affects.
Information leaks are exploitable on their own and should be classified as such. A bug that copies kernel
memory contents to userspace (e.g. an out-of-bounds read whose result is returned to the caller, or
uninitialized stack/heap bytes written to a user buffer) is exploitable: it can reveal kernel pointer
values and defeat KASLR, expose sensitive data such as cryptographic keys or other processes' memory, and
serves as a necessary building block in most modern kernel privilege-escalation exploit chains. Do not classify
an information leak as non-exploitable solely because it does not directly cause a memory write or control-flow
hijack; the leak itself is the exploit primitive.
Think of what happens after the bug is triggered. Some bugs cause kernel panic and halt execution,
they are harder to exploit. For example, BUG reports halts the kernel. However, WARNING reports don't halt
execution in production builds. Debug bug detection tools (like KASAN, KMSAN, KCSAN, UBSAN) are also not enabled
in production builds, so attacker can freely exploit these bugs w/o being detected by these tools.
If you see an integer overflow, think how the overflowed value used later (if it's used as allocation size,
or an array index). If you see an out-of-bounds read, think if it's followed by an out-of-bounds write as well.
Some KCSAN data-races may be exploitable by skilled attackers as well. Think what data structures got corrupted
as the result of data races and how. However, note that kernel has lots of "benign" data races that don't lead
to any runtime misbehavior at all.
* Denial Of Service:
Determine if the bug can result in denial-of-service. Most bugs can, since they cause system crash,
hangs, deadlocks, or resource leaks. This is mostly applicable to WARNING bugs that won't cause system crash
in production. For these think what will be consequences of the violation of the kernel assumptions flagged
by the WARNING. In some cases the unexpected condition is also properly handled by the normal control flow
(e.g. with "if (WARN_ON(...))"), these won't cause denial-of-service. If the condition is not handled,
then it may or may not cause denial-of-service.
* Accessible From Unprivileged Processes:
Determine if the bug can be reached from a typical (non-root) user process that does NOT have any special capabilities
(like CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON) or access to device nodes restricted to root.
Assume that unprivileged_bpf_disabled=1, that is eBPF loading is not accessible. However, cBPF (classical BPF)
is still accessible to non-root processes.
Assume that user namespaces are not accessible, that is, the process cannot get the mentioned capabilities even
within a new user namespace (checked by ns_capable() function in the kernel sources).
* Accessible From User Namespaces:
Determine if the bug can be reached within a user-namespace where the process has all capabilities
(including CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON). Such capabilities are checked with ns_capable()
function in the kernel sources.
* VM Guest Trigger:
Determine if the bug can be triggered from the context of a typical KVM guest (e.g., set up by a QEMU VMM).
Consider accesses to standard Linux host paravirtualized features (virtio-blk, virtio-net, etc.),
and handling of VM exits in the KVM code.
* VM Host Trigger in The Confidential Computing Context:
Determine if the bug can be triggered in a confidential computing guest kernel from the context of a KVM host.
Consider access to standard Linux guest paravirtualized features (virtio-blk, virtio-net, etc.).
* Ethernet Network Trigger:
Determine if the bug can be triggered by processing ingress network Ethernet traffic, either directly (network stack)
or via drivers exposed to network data.
* Other Remote Trigger:
Determine if the bug can be triggered by processing remote traffic other than Ethernet (Wifi, Bluetooth, NFC, etc).
* Peripheral Trigger:
Determine if the bug can be triggered via an untrusted peripheral device that can be physically plugged
into a system, such as a USB device or a niche hardware driver handling external hardware inputs.
This is particularly important for mobile and desktop environments where users can plug in unknown devices.
* Malicious Filesystem Trigger:
Determine if the bug can be triggered by the kernel mounting and parsing a malicious filesystem image.
This is highly critical for Desktop and Mobile environments where external media or downloaded images
might be auto-mounted.
Don't make assumptions about the kernel source code (it may be different from what you assume it is).
Extensively use the provided code access tools (codesearch-*, git-*, grepper, etc)
to examine the actual source code, and confirm any assumptions.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt:
The kernel bug report is:
INFO: task syz.2.43:5977 blocked for more than 143 seconds.
Not tainted syzkaller #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz.2.43 state:D stack:24712 pid:5977 tgid:5976 ppid:5604 task_flags:0x400140 flags:0x00080003
Call Trace:
context_switch kernel/sched/core.c:5510 [inline]
__schedule+0x16dc/0x5500 kernel/sched/core.c:7234
__schedule_loop kernel/sched/core.c:7311 [inline]
rt_mutex_schedule+0x76/0xf0 kernel/sched/core.c:7607
rt_mutex_slowlock_block+0x55c/0x680 kernel/locking/rtmutex.c:1670
__rt_mutex_slowlock kernel/locking/rtmutex.c:1747 [inline]
__rt_mutex_slowlock_locked kernel/locking/rtmutex.c:1787 [inline]
rt_mutex_slowlock+0x2d4/0x780 kernel/locking/rtmutex.c:1827
__rt_mutex_lock kernel/locking/rtmutex.c:1842 [inline]
__mutex_lock_common kernel/locking/rtmutex_api.c:560 [inline]
mutex_lock_nested+0x168/0x1d0 kernel/locking/rtmutex_api.c:578
btrfs_close_devices+0xc5/0x570 fs/btrfs/volumes.c:1215
btrfs_free_fs_info+0x4f/0x360 fs/btrfs/disk-io.c:1229
deactivate_locked_super+0xbc/0x130 fs/super.c:477
btrfs_get_tree_super fs/btrfs/super.c:-1 [inline]
btrfs_get_tree_subvol fs/btrfs/super.c:2114 [inline]
btrfs_get_tree+0xcd0/0x1980 fs/btrfs/super.c:2148
vfs_get_tree+0x92/0x2a0 fs/super.c:1694
fc_mount fs/namespace.c:1198 [inline]
do_new_mount_fc fs/namespace.c:3765 [inline]
do_new_mount+0x319/0xdc0 fs/namespace.c:3841
do_mount fs/namespace.c:4174 [inline]
__do_sys_mount fs/namespace.c:4390 [inline]
__se_sys_mount+0x31d/0x420 fs/namespace.c:4367
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f915fe0f0ca
RSP: 002b:00007f915e065e58 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f915e065ee0 RCX: 00007f915fe0f0ca
RDX: 00002000000000c0 RSI: 00002000000015c0 RDI: 00007f915e065ea0
RBP: 00002000000000c0 R08: 00007f915e065ee0 R09: 0000000002000000
R10: 0000000002000000 R11: 0000000000000246 R12: 00002000000015c0
R13: 00007f915e065ea0 R14: 000000000000559e R15: 0000200000001400
</TASK>
INFO: task syz.4.44:5981 blocked in I/O wait for more than 143 seconds.
Not tainted syzkaller #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz.4.44 state:D stack:25640 pid:5981 tgid:5979 ppid:5603 task_flags:0x400140 flags:0x00080002
Call Trace:
<TASK>
context_switch kernel/sched/core.c:5510 [inline]
__schedule+0x16dc/0x5500 kernel/sched/core.c:7234
__schedule_loop kernel/sched/core.c:7311 [inline]
schedule+0x164/0x2b0 kernel/sched/core.c:7326
io_schedule+0x80/0xe0 kernel/sched/core.c:8154
TXN_SLEEP_DROP_LOCK fs/jfs/jfs_txnmgr.c:125 [inline]
txBegin+0x281/0xbe0 fs/jfs/jfs_txnmgr.c:376
jfs_mkdir+0x226/0xb00 fs/jfs/namei.c:232
vfs_mkdir+0x402/0x620 fs/namei.c:5276
filename_mkdirat+0x289/0x520 fs/namei.c:5309
__do_sys_mkdirat fs/namei.c:5330 [inline]
__se_sys_mkdirat+0x35/0x150 fs/namei.c:5327
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc0cb9cde59
RSP: 002b:00007fc0c9c26028 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 00007fc0cbc55fa0 RCX: 00007fc0cb9cde59
RDX: 00000000000001c0 RSI: 0000200000000080 RDI: ffffffffffffff9c
RBP: 00007fc0cba63e6f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fc0cbc56038 R14: 00007fc0cbc55fa0 R15: 00007fff58024af8
</TASK>
INFO: task syz.4.44:6004 blocked for more than 143 seconds.
Not tainted syzkaller #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz.4.44 state:D stack:28424 pid:6004 tgid:5979 ppid:5603 task_flags:0x400140 flags:0x00080002
Call Trace:
<TASK>
context_switch kernel/sched/core.c:5510 [inline]
__schedule+0x16dc/0x5500 kernel/sched/core.c:7234
__schedule_loop kernel/sched/core.c:7311 [inline]
rt_mutex_schedule+0x76/0xf0 kernel/sched/core.c:7607
rt_mutex_slowlock_block kernel/locking/rtmutex.c:1670 [inline]
__rt_mutex_slowlock kernel/locking/rtmutex.c:1747 [inline]
__rt_mutex_slowlock_locked+0x1f84/0x25b0 kernel/locking/rtmutex.c:1787
__rwbase_read_lock+0xc3/0x180 kernel/locking/rwbase_rt.c:114
rwbase_read_lock kernel/locking/rwbase_rt.c:147 [inline]
__down_read kernel/locking/rwsem.c:1502 [inline]
down_read+0x132/0x200 kernel/locking/rwsem.c:1576
inode_lock_shared include/linux/fs.h:1039 [inline]
lookup_slow+0x46/0x70 fs/namei.c:1935
walk_component fs/namei.c:2282 [inline]
lookup_last fs/namei.c:2789 [inline]
path_lookupat+0x3f5/0x8c0 fs/namei.c:2813
filename_lookup+0x265/0x5d0 fs/namei.c:2842
kern_path+0x3d/0x150 fs/namei.c:3036
lookup_bdev block/bdev.c:1208 [inline]
bdev_file_open_by_path+0xd5/0x480 block/bdev.c:1081
btrfs_scan_one_device+0xa8/0x680 fs/btrfs/volumes.c:1483
btrfs_control_ioctl+0x22a/0x370 fs/btrfs/super.c:2279
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:597 [inline]
__se_sys_ioctl+0xff/0x170 fs/ioctl.c:583
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc0cb9cde59
RSP: 002b:00007fc0c9c05028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fc0cbc56090 RCX: 00007fc0cb9cde59
RDX: 00002000000004c0 RSI: 0000000050009404 RDI: 0000000000000005
RBP: 00007fc0cba63e6f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fc0cbc56128 R14: 00007fc0cbc56090 R15: 00007fff58024af8
</TASK>
INFO: task syz.4.44:6009 blocked for more than 143 seconds.
Not tainted syzkaller #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz.4.44 state:D stack:24744 pid:6009 tgid:5979 ppid:5603 task_flags:0x400040 flags:0x00080002
Call Trace:
<TASK>
context_switch kernel/sched/core.c:5510 [inline]
__schedule+0x16dc/0x5500 kernel/sched/core.c:7234
__schedule_loop kernel/sched/core.c:7311 [inline]
rt_mutex_schedule+0x76/0xf0 kernel/sched/core.c:7607
rt_mutex_slowlock_block kernel/locking/rtmutex.c:1670 [inline]
__rt_mutex_slowlock kernel/locking/rtmutex.c:1747 [inline]
__rt_mutex_slowlock_locked+0x1f84/0x25b0 kernel/locking/rtmutex.c:1787
__rwbase_read_lock+0xc3/0x180 kernel/locking/rwbase_rt.c:114
rwbase_read_lock kernel/locking/rwbase_rt.c:147 [inline]
__down_read kernel/locking/rwsem.c:1502 [inline]
down_read+0x132/0x200 kernel/locking/rwsem.c:1576
inode_lock_shared include/linux/fs.h:1039 [inline]
lookup_slow+0x46/0x70 fs/namei.c:1935
walk_component fs/namei.c:2282 [inline]
lookup_last fs/namei.c:2789 [inline]
path_lookupat+0x3f5/0x8c0 fs/namei.c:2813
filename_lookup+0x265/0x5d0 fs/namei.c:2842
vfs_statx+0xfc/0x200 fs/stat.c:353
vfs_fstatat fs/stat.c:373 [inline]
vfs_lstat include/linux/fs.h:3221 [inline]
__do_sys_newlstat fs/stat.c:524 [inline]
__se_sys_newlstat fs/stat.c:518 [inline]
__x64_sys_newlstat+0x125/0x1e0 fs/stat.c:518
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc0cb9cde59
RSP: 002b:00007fc0c9be4028 EFLAGS: 00000246 ORIG_RAX: 0000000000000006
RAX: ffffffffffffffda RBX: 00007fc0cbc56180 RCX: 00007fc0cb9cde59
RDX: 0000000000000000 RSI: 00002000000000c0 RDI: 00002000000001c0
RBP: 00007fc0cba63e6f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fc0cbc56218 R14: 00007fc0cbc56180 R15: 00007fff58024af8
</TASK>
INFO: task syz.4.44:6011 blocked for more than 143 seconds.
Not tainted syzkaller #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz.4.44 state:D stack:25672 pid:6011 tgid:5979 ppid:5603 task_flags:0x400140 flags:0x00080002
Call Trace:
<TASK>
context_switch kernel/sched/core.c:5510 [inline]
__schedule+0x16dc/0x5500 kernel/sched/core.c:7234
__schedule_loop kernel/sched/core.c:7311 [inline]
rt_mutex_schedule+0x76/0xf0 kernel/sched/core.c:7607
rt_mutex_slowlock_block kernel/locking/rtmutex.c:1670 [inline]
__rt_mutex_slowlock kernel/locking/rtmutex.c:1747 [inline]
__rt_mutex_slowlock_locked+0x1f84/0x25b0 kernel/locking/rtmutex.c:1787
rt_mutex_slowlock+0xbd/0x170 kernel/locking/rtmutex.c:1827
__rt_mutex_lock kernel/locking/rtmutex.c:1842 [inline]
rwbase_write_lock+0x14c/0x720 kernel/locking/rwbase_rt.c:251
inode_lock include/linux/fs.h:1024 [inline]
open_last_lookups fs/namei.c:4605 [inline]
path_openat+0xae9/0x3850 fs/namei.c:4860
do_file_open+0x23e/0x4a0 fs/namei.c:4892
do_sys_openat2+0x115/0x200 fs/open.c:1368
do_sys_open fs/open.c:1374 [inline]
__do_sys_openat fs/open.c:1390 [inline]
__se_sys_openat fs/open.c:1385 [inline]
__x64_sys_openat+0x138/0x170 fs/open.c:1385
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc0cb9cde59
RSP: 002b:00007fc0c97c1028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007fc0cbc56270 RCX: 00007fc0cb9cde59
RDX: 000000000000275a RSI: 0000200000000100 RDI: ffffffffffffff9c
RBP: 00007fc0cba63e6f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fc0cbc56308 R14: 00007fc0cbc56270 R15: 00007fff58024af8
</TASK>
Showing all locks held in the system:
4 locks held by pr/legacy/17:
1 lock held by khungtaskd/38:
#0: ffffffff8e1c3000 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#0: ffffffff8e1c3000 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#0: ffffffff8e1c3000 (rcu_read_lock){....}-{1:3}, at: debug_show_all_locks+0x2e/0x180 kernel/locking/lockdep.c:6775
2 locks held by kworker/u8:4/66:
4 locks held by kworker/u8:7/781:
#0: ffff88801aea0938 ((wq_completion)netns){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3297 [inline]
#0: ffff88801aea0938 ((wq_completion)netns){+.+.}-{0:0}, at: process_scheduled_works+0xa20/0x14e0 kernel/workqueue.c:3405
#1: ffffc9000513fc40 (net_cleanup_work){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3297 [inline]
#1: ffffc9000513fc40 (net_cleanup_work){+.+.}-{0:0}, at: process_scheduled_works+0xa20/0x14e0 kernel/workqueue.c:3405
#2: ffffffff8f5a1fe0 (pernet_ops_rwsem){++++}-{4:4}, at: cleanup_net+0xf5/0x810 net/core/net_namespace.c:673
#3: ffffffff8f5b0b78 (rtnl_mutex){+.+.}-{4:4}, at: wg_destruct+0x25/0x310 drivers/net/wireguard/device.c:246
7 locks held by kworker/u8:9/1301:
5 locks held by klogd/4955:
2 locks held by dhcpcd/5261:
#0: ffff888040540928 (nlk_cb_mutex-ROUTE){+.+.}-{4:4}, at: netlink_dump+0xe7/0xee0 net/netlink/af_netlink.c:2273
#1: ffffffff8f5b0b78 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_lock net/core/rtnetlink.c:80 [inline]
#1: ffffffff8f5b0b78 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_dump_ifinfo+0xa74/0x14b0 net/core/rtnetlink.c:2562
2 locks held by getty/5354:
#0: ffff88803740b0a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x25/0x70 drivers/tty/tty_ldisc.c:243
#1: ffffc90003cc62e0 (&ldata->atomic_read_lock){+.+.}-{4:4}, at: n_tty_read+0x460/0x1360 drivers/tty/n_tty.c:2211
1 lock held by udevd/5595:
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_control_ioctl+0x117/0x370 fs/btrfs/super.c:2292
1 lock held by udevd/5615:
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_control_ioctl+0x117/0x370 fs/btrfs/super.c:2292
1 lock held by udevd/5623:
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_control_ioctl+0x117/0x370 fs/btrfs/super.c:2292
1 lock held by udevd/5625:
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_control_ioctl+0x117/0x370 fs/btrfs/super.c:2292
1 lock held by syz.2.43/5977:
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_close_devices+0xc5/0x570 fs/btrfs/volumes.c:1215
2 locks held by syz.4.44/5981:
#0: ffff8880417ac500 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:494
#1: ffff888062cde648 (&type->i_mutex_dir_key#10/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:1069 [inline]
#1: ffff888062cde648 (&type->i_mutex_dir_key#10/1){+.+.}-{4:4}, at: __start_dirop fs/namei.c:2918 [inline]
#1: ffff888062cde648 (&type->i_mutex_dir_key#10/1){+.+.}-{4:4}, at: start_dirop fs/namei.c:2942 [inline]
#1: ffff888062cde648 (&type->i_mutex_dir_key#10/1){+.+.}-{4:4}, at: filename_create+0x200/0x370 fs/namei.c:4955
2 locks held by syz.4.44/6004:
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_control_ioctl+0x21c/0x370 fs/btrfs/super.c:2274
#1: ffff888062cde648 (&type->i_mutex_dir_key#10){++++}-{4:4}, at: inode_lock_shared include/linux/fs.h:1039 [inline]
#1: ffff888062cde648 (&type->i_mutex_dir_key#10){++++}-{4:4}, at: lookup_slow+0x46/0x70 fs/namei.c:1935
1 lock held by syz.4.44/6009:
#0: ffff888062cde648 (&type->i_mutex_dir_key#10){++++}-{4:4}, at: inode_lock_shared include/linux/fs.h:1039 [inline]
#0: ffff888062cde648 (&type->i_mutex_dir_key#10){++++}-{4:4}, at: lookup_slow+0x46/0x70 fs/namei.c:1935
2 locks held by syz.4.44/6011:
#0: ffff8880417ac500 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:494
#1: ffff888062cde648 (&type->i_mutex_dir_key#10){++++}-{4:4}, at: inode_lock include/linux/fs.h:1024 [inline]
#1: ffff888062cde648 (&type->i_mutex_dir_key#10){++++}-{4:4}, at: open_last_lookups fs/namei.c:4605 [inline]
#1: ffff888062cde648 (&type->i_mutex_dir_key#10){++++}-{4:4}, at: path_openat+0xae9/0x3850 fs/namei.c:4860
1 lock held by syz.1.54/6045:
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_super fs/btrfs/super.c:1878 [inline]
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_subvol fs/btrfs/super.c:2114 [inline]
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree+0x485/0x1980 fs/btrfs/super.c:2148
1 lock held by syz.3.67/6117:
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_super fs/btrfs/super.c:1878 [inline]
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_subvol fs/btrfs/super.c:2114 [inline]
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree+0x485/0x1980 fs/btrfs/super.c:2148
1 lock held by syz.5.77/6277:
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_control_ioctl+0x21c/0x370 fs/btrfs/super.c:2274
1 lock held by syz.0.95/6414:
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_control_ioctl+0x21c/0x370 fs/btrfs/super.c:2274
1 lock held by syz.7.98/6438:
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_control_ioctl+0x21c/0x370 fs/btrfs/super.c:2274
1 lock held by syz.6.99/6433:
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_super fs/btrfs/super.c:1878 [inline]
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_subvol fs/btrfs/super.c:2114 [inline]
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree+0x485/0x1980 fs/btrfs/super.c:2148
1 lock held by syz.8.116/6554:
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_control_ioctl+0x21c/0x370 fs/btrfs/super.c:2274
1 lock held by syz.9.150/6776:
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_super fs/btrfs/super.c:1878 [inline]
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree_subvol fs/btrfs/super.c:2114 [inline]
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_get_tree+0x485/0x1980 fs/btrfs/super.c:2148
7 locks held by syz-executor/6782:
#0: ffff88803676a500 (sb_writers#7){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#0: ffff88803676a500 (sb_writers#7){.+.+}-{0:0}, at: vfs_write+0x231/0xbb0 fs/read_write.c:683
#1: ffff88808f278478 (&of->mutex){+.+.}-{4:4}, at: kernfs_fop_write_iter+0x1d9/0x540 fs/kernfs/file.c:336
#2: ffff888029a022d8 (kn->active#52){.+.+}-{0:0}, at: kernfs_get_active_of fs/kernfs/file.c:73 [inline]
#2: ffff888029a022d8 (kn->active#52){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x22c/0x540 fs/kernfs/file.c:337
#3: ffffffff8ee264b8 (nsim_bus_dev_list_lock){+.+.}-{4:4}, at: del_device_store+0xd6/0x370 drivers/net/netdevsim/bus.c:234
#4: ffff888060d89160 (&dev->mutex){....}-{4:4}, at: device_lock include/linux/device.h:1102 [inline]
#4: ffff888060d89160 (&dev->mutex){....}-{4:4}, at: __device_driver_lock drivers/base/dd.c:1171 [inline]
#4: ffff888060d89160 (&dev->mutex){....}-{4:4}, at: device_release_driver_internal+0xb9/0x880 drivers/base/dd.c:1369
#5: ffff888065ee2310 (&devlink->lock_key#6){+.+.}-{4:4}, at: nsim_drv_remove+0x50/0x160 drivers/net/netdevsim/dev.c:1799
#6: ffffffff8f5b0b78 (rtnl_mutex){+.+.}-{4:4}, at: nsim_destroy+0x173/0x800 drivers/net/netdevsim/netdev.c:1191
1 lock held by syz.3.169/6851:
#0: ffffffff8e833d98 (uuid_mutex){+.+.}-{4:4}, at: btrfs_control_ioctl+0x21c/0x370 fs/btrfs/super.c:2274
2 locks held by syz-executor/6858:
#0: ffffffff8f5a1fe0 (pernet_ops_rwsem){++++}-{4:4}, at: copy_net_ns+0x4e2/0x720 net/core/net_namespace.c:575
#1: ffffffff8f5b0b78 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_net_lock_killable include/linux/rtnetlink.h:145 [inline]
#1: ffffffff8f5b0b78 (rtnl_mutex){+.+.}-{4:4}, at: register_netdev+0x18/0x60 net/core/dev.c:11553
4 locks held by syz.1.185/6922:
=============================================
NMI backtrace for cpu 0
CPU: 0 UID: 0 PID: 38 Comm: khungtaskd Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/09/2026
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
nmi_cpu_backtrace+0x274/0x2d0 lib/nmi_backtrace.c:122
nmi_trigger_cpumask_backtrace+0x17a/0x380 lib/nmi_backtrace.c:65
trigger_all_cpu_backtrace include/linux/nmi.h:162 [inline]
__sys_info lib/sys_info.c:157 [inline]
sys_info+0x135/0x170 lib/sys_info.c:165
check_hung_uninterruptible_tasks kernel/hung_task.c:353 [inline]
watchdog+0xfd7/0x1030 kernel/hung_task.c:561
kthread+0x388/0x470 kernel/kthread.c:436
ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
Sending NMI from CPU 0 to CPUs 1:
NMI backtrace for cpu 1
CPU: 1 UID: 0 PID: 17 Comm: pr/legacy Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/09/2026
RIP: 0010:io_serial_in+0x77/0xc0 drivers/tty/serial/8250/8250_port.c:401
Code: e8 2e 1a 70 fc 44 89 f9 d3 e3 49 83 ee 80 4c 89 f0 48 c1 e8 03 42 80 3c 20 00 74 08 4c 89 f7 e8 2f 85 d9 fc 41 03 1e 89 da ec <0f> b6 c0 5b 41 5c 41 5e 41 5f c3 cc cc cc cc cc 44 89 f9 80 e1 07
RSP: 0000:ffffc90000167a28 EFLAGS: 00000202
RAX: 1ffffffff33c8500 RBX: 00000000000003fd RCX: 0000000000000000
RDX: 00000000000003fd RSI: 0000000000000000 RDI: 0000000000000000
RBP: dffffc0000000000 R08: 0000000000000000 R09: 0000000000000000
R10: dffffc0000000000 R11: ffffffff85551df0 R12: dffffc0000000000
R13: 0000000000000000 R14: ffffffff99e42d40 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff888125d49000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f517278c000 CR3: 000000008f17a000 CR4: 00000000003526f0
Call Trace:
<TASK>
serial_in drivers/tty/serial/8250/8250.h:128 [inline]
serial_lsr_in drivers/tty/serial/8250/8250.h:150 [inline]
wait_for_lsr+0x190/0x300 drivers/tty/serial/8250/8250_port.c:1982
serial8250_fifo_wait_for_lsr_thre drivers/tty/serial/8250/8250_port.c:3229 [inline]
serial8250_console_fifo_write drivers/tty/serial/8250/8250_port.c:3294 [inline]
serial8250_console_write+0x113a/0x1b40 drivers/tty/serial/8250/8250_port.c:3379
console_emit_next_record kernel/printk/printk.c:3163 [inline]
console_flush_one_record+0x642/0xb50 kernel/printk/printk.c:3269
legacy_kthread_func+0x1b6/0x250 kernel/printk/printk.c:3712
kthread+0x388/0x470 kernel/kthread.c:436
ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
Reply: Based on the provided crash report and source code analysis, here is the assessment of the bug:
**Root Cause Analysis:**
The bug report shows a deadlock involving two different filesystems: BTRFS and JFS. The sequence of events is as follows:
1. **Task 5981 (`jfs_mkdir`)**: Executes a directory creation on a JFS filesystem. It acquires the directory's `inode_lock` exclusively and then calls `txBegin()`, which blocks indefinitely. This is a known issue with JFS where corrupted filesystem images can cause the transaction manager to deadlock or wait forever for a log sync that never happens.
2. **Task 6004 (`btrfs_control_ioctl`)**: Executes `BTRFS_IOC_SCAN_DEV` with a path that resides inside the deadlocked JFS filesystem. It acquires the global BTRFS `uuid_mutex` and then attempts a path lookup (`bdev_file_open_by_path` -> `kern_path`). The path lookup blocks on the JFS directory's `inode_lock_shared` held by Task 5981.
3. **Task 5977 (`btrfs_close_devices`)**: Attempts to unmount a completely unrelated BTRFS filesystem. It tries to acquire the `uuid_mutex` and blocks forever because Task 6004 is holding it.
The root cause is the JFS transaction deadlock triggered by a corrupted filesystem image. The BTRFS subsystem becomes a victim because it holds a global subsystem mutex (`uuid_mutex`) while performing a VFS path lookup, which is a known anti-pattern as path lookups can block indefinitely on broken or malicious filesystems (e.g., FUSE, deadlocked JFS, hung NFS).
**Security Impact:**
* **Exploitable:** No. This is a pure deadlock resulting in a hung task. There is no memory corruption, use-after-free, or information leak involved.
* **Denial of Service:** Yes. The bug causes a local DoS by hanging the JFS filesystem. Furthermore, it causes a system-wide DoS for BTRFS, as all subsequent BTRFS mounts, unmounts, and device scans will hang waiting for the `uuid_mutex`.
* **Accessible From Unprivileged Processes:** No. The BTRFS ioctl (`BTRFS_IOC_SCAN_DEV`) explicitly checks for global `CAP_SYS_ADMIN`. Additionally, mounting JFS or BTRFS requires global `CAP_SYS_ADMIN`.
* **Accessible From User Namespaces:** No. Neither BTRFS nor JFS support `FS_USERNS_MOUNT`, meaning they cannot be mounted inside an unprivileged user namespace.
* **Malicious Filesystem Trigger:** Yes. The underlying JFS `txBegin` deadlock is triggered by mounting and interacting with a maliciously crafted JFS image (which syzkaller generates). Normal JFS images do not deadlock under standard concurrent operations.
|
| 6/2 |
2026/07/14 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 17196
output: 40
thoughts: 1257
Thoughts: **Analyzing a Btrfs Hang with `uuid_mutex`**
Okay, I'm looking at a hung task report here. Several tasks are blocked, all related to Btrfs, and the call traces point towards `btrfs_close_devices`, `btrfs_scan_one_device`, and other filesystem operations. The common denominator seems to be this `uuid_mutex`. My immediate thought is, are we seeing contention on this mutex?
Let me check the lock status. Ah, interesting. It looks like multiple `udevd` processes *and* some syzkaller tasks are supposedly "holding" `uuid_mutex`. That's highly unusual. Mutexes are designed to be exclusive; only one task should hold it at any given time. This lockdep output seems to suggest a deadlock, but it's not a clear-cut case.
Wait a second, "1 lock held by udevd/5595:" doesn't necessarily mean it *holds* the mutex, it could mean it's *blocked* trying to acquire it. I need to be precise here. Lockdep could be misleading, and I need to figure out which state the task is in.
Given the call traces, `btrfs_control_ioctl` is called from the `udevd` processes. And `btrfs_close_devices` is what's blocking, and that makes sense, as a mutex could be held during close operations. Let me go look at the source code for `btrfs_control_ioctl` and `btrfs_close_devices` in `fs/btrfs/super.c` and `fs/btrfs/volumes.c` respectively. I need to understand the locking around `uuid_mutex` in those functions. It seems very likely that this is the cause of the hang, where one task is blocking, while the others are also blocking.
|
| 7/2 |
2026/07/14 00:51 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/btrfs/super.c Name:btrfs_control_ioctl]
Results: map[SourceCode:2251: /*
2252: * Used by /dev/btrfs-control for devices ioctls.
2253: */
2254: static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
2255: unsigned long arg)
2256: {
2257: struct btrfs_ioctl_vol_args *vol;
2258: struct btrfs_device *device = NULL;
2259: dev_t devt = 0;
2260: int ret = -ENOTTY;
2261:
2262: if (!capable(CAP_SYS_ADMIN))
2263: return -EPERM;
2264:
2265: vol = memdup_user((void __user *)arg, sizeof(*vol));
2266: if (IS_ERR(vol))
2267: return PTR_ERR(vol);
2268: ret = btrfs_check_ioctl_vol_args_path(vol);
2269: if (ret < 0)
2270: goto out;
2271:
2272: switch (cmd) {
2273: case BTRFS_IOC_SCAN_DEV:
2274: mutex_lock(&uuid_mutex);
2275: /*
2276: * Scanning outside of mount can return NULL which would turn
2277: * into 0 error code.
2278: */
2279: device = btrfs_scan_one_device(vol->name, false);
2280: ret = PTR_ERR_OR_ZERO(device);
2281: mutex_unlock(&uuid_mutex);
2282: break;
2283: case BTRFS_IOC_FORGET_DEV:
2284: if (vol->name[0] != 0) {
2285: ret = lookup_bdev(vol->name, &devt);
2286: if (ret)
2287: break;
2288: }
2289: ret = btrfs_forget_devices(devt);
2290: break;
2291: case BTRFS_IOC_DEVICES_READY:
2292: mutex_lock(&uuid_mutex);
2293: /*
2294: * Scanning outside of mount can return NULL which would turn
2295: * into 0 error code.
2296: */
2297: device = btrfs_scan_one_device(vol->name, false);
2298: if (IS_ERR_OR_NULL(device)) {
2299: mutex_unlock(&uuid_mutex);
2300: ret = PTR_ERR_OR_ZERO(device);
2301: break;
2302: }
2303: ret = !(device->fs_devices->num_devices ==
2304: device->fs_devices->total_devices);
2305: mutex_unlock(&uuid_mutex);
2306: break;
2307: case BTRFS_IOC_GET_SUPPORTED_FEATURES:
2308: ret = btrfs_ioctl_get_supported_features((void __user*)arg);
2309: break;
2310: }
2311:
2312: out:
2313: kfree(vol);
2314: return ret;
2315: }
SourceFile:fs/btrfs/super.c]
|
| 8/2 |
2026/07/14 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 19867
output: 40
thoughts: 104
Thoughts: **Analyzing BTRFS Security Restrictions**
Okay, hold on a minute. This `btrfs_control_ioctl` functionβ¦ itβs checking for `CAP_SYS_ADMIN`! That immediately raises a flag.
```c
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
```
So, this means, as I see it, that the operation is **not** accessible to a regular, unprivileged user. It's a fundamental security measure, thankfully. The system is preventing arbitrary access. Let me re-confirm my understanding, I think, it's `capable`, not `ns_capable` meaning it requires *global* root, not just some namespace-specific privilege. I'm glad it's not a relaxed namespace check. I wonder if there are other functions with similar restriction. Let me check `btrfs_close_devices` to see what it does.
|
| 9/2 |
2026/07/14 00:51 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/btrfs/volumes.c Name:btrfs_close_devices]
Results: map[SourceCode:1210: void btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
1211: {
1212: LIST_HEAD(list);
1213: struct btrfs_fs_devices *tmp;
1214:
1215: mutex_lock(&uuid_mutex);
1216: close_fs_devices(fs_devices);
1217: if (!fs_devices->opened && !fs_devices->holding) {
1218: list_splice_init(&fs_devices->seed_list, &list);
1219:
1220: /*
1221: * If the struct btrfs_fs_devices is not assembled with any
1222: * other device, it can be re-initialized during the next mount
1223: * without the needing device-scan step. Therefore, it can be
1224: * fully freed.
1225: */
1226: if (fs_devices->num_devices == 1) {
1227: list_del(&fs_devices->fs_list);
1228: free_fs_devices(fs_devices);
1229: }
1230: }
1231:
1232:
1233: list_for_each_entry_safe(fs_devices, tmp, &list, seed_list) {
1234: close_fs_devices(fs_devices);
1235: list_del(&fs_devices->seed_list);
1236: free_fs_devices(fs_devices);
1237: }
1238: mutex_unlock(&uuid_mutex);
1239: }
SourceFile:fs/btrfs/volumes.c]
|
| 10/2 |
2026/07/14 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 20696
output: 40
thoughts: 95
Thoughts: **My Line of Reasoning During Btrfs Mount Investigation**
Okay, so I'm digging into how Btrfs handles its mounting process, specifically the deactivation and device closure. It appears that `btrfs_close_devices` gets triggered from within `btrfs_free_fs_info`. That, in turn, is called by `deactivate_locked_super`, which is ultimately called by `btrfs_get_tree` during the mount operation. This looks like the standard teardown sequence.
Now, the interesting bit. I recall that mounting a Btrfs filesystem requires `CAP_SYS_ADMIN` in the *initial* user namespace. That's because, unlike some other filesystems, Btrfs doesn't support `FS_USERNS_MOUNT`, as far as I know. So, let's just make sure that's still the case, and verify the conditions I expect to be true. I want to make certain this behaviour continues, before I move on.
|
| 11/2 |
2026/07/14 00:51 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/btrfs/super.c Name:btrfs_fs_type]
Results: map[SourceCode:2228: static struct file_system_type btrfs_fs_type = {
2229: .owner = THIS_MODULE,
2230: .name = "btrfs",
2231: .init_fs_context = btrfs_init_fs_context,
2232: .parameters = btrfs_fs_parameters,
2233: .kill_sb = btrfs_kill_super,
2234: .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA |
2235: FS_ALLOW_IDMAP | FS_MGTIME,
2236: };
SourceFile:fs/btrfs/super.c]
|
| 12/2 |
2026/07/14 00:51 |
llm |
expert |
0m
Model:
Tokens:
input: 21252
output: 39
thoughts: 2273
Thoughts: **Deadlock Analysis in Btrfs and JFS interaction**
Okay, so it looks like `btrfs_fs_type` doesn't support `FS_USERNS_MOUNT`, so a global `CAP_SYS_ADMIN` is needed to mount a Btrfs filesystem. But then I noticed `btrfs_scan_one_device`, called from `btrfs_control_ioctl`, *also* needs that global root. This means the bug is only exploitable by a global root user.
Now, let's get into the specifics of the bug - it's a deadlock or hung task. The trace is pointing to it. I see a `btrfs_close_devices` call that's blocked, which is interesting. It's happening during a mount syscall. Then I'm seeing a JFS `mkdir` call also blocked, which is expected.
Looking at the other tasks, I see one task holding `uuid_mutex` (from `btrfs_control_ioctl`) and blocked on `inode_lock_shared` within `lookup_slow`. Another is just blocked on `inode_lock_shared`, also in `lookup_slow`. Another's blocked on `inode_lock` in `open_last_lookups`.
The pieces are starting to fit... Task 6004 holds `uuid_mutex` and is waiting for an `inode_lock_shared` (a directory lock). Task 5977 is blocked on `uuid_mutex` within `btrfs_close_devices`. Task 6011 is blocked on an `inode_lock` (write lock) in `open_last_lookups`. Task 5981 is blocked inside `txBegin` in JFS.
Now, who holds the `inode_lock` that task 6004 is waiting on? It looks like task 5981 is the culprit. Task 5981 holds a lock `&type->i_mutex_dir_key#10/1` and is indeed the JFS task. It's blocked in `txBegin` while doing a `jfs_mkdir`. So it looks like the `txBegin` call is blocked within the JFS context. So I must now determine why that call is blocked.
|
| 13/2 |
2026/07/14 00:52 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/jfs/jfs_txnmgr.c Name:txBegin]
Results: map[SourceCode: 337: /*
338: * NAME: txBegin()
339: *
340: * FUNCTION: start a transaction.
341: *
342: * PARAMETER: sb - superblock
343: * flag - force for nested tx;
344: *
345: * RETURN: tid - transaction id
346: *
347: * note: flag force allows to start tx for nested tx
348: * to prevent deadlock on logsync barrier;
349: */
350: tid_t txBegin(struct super_block *sb, int flag)
351: {
352: tid_t t;
353: struct tblock *tblk;
354: struct jfs_log *log;
355:
356: jfs_info("txBegin: flag = 0x%x", flag);
357: log = JFS_SBI(sb)->log;
358:
359: if (!log) {
360: jfs_error(sb, "read-only filesystem\n");
361: return 0;
362: }
363:
364: TXN_LOCK();
365:
366: INCREMENT(TxStat.txBegin);
367:
368: retry:
369: if (!(flag & COMMIT_FORCE)) {
370: /*
371: * synchronize with logsync barrier
372: */
373: if (test_bit(log_SYNCBARRIER, &log->flag) ||
374: test_bit(log_QUIESCE, &log->flag)) {
375: INCREMENT(TxStat.txBegin_barrier);
376: TXN_SLEEP(&log->syncwait);
377: goto retry;
378: }
379: }
380: if (flag == 0) {
381: /*
382: * Don't begin transaction if we're getting starved for tlocks
383: * unless COMMIT_FORCE or COMMIT_INODE (which may ultimately
384: * free tlocks)
385: */
386: if (TxAnchor.tlocksInUse > TxLockVHWM) {
387: INCREMENT(TxStat.txBegin_lockslow);
388: TXN_SLEEP(&TxAnchor.lowlockwait);
389: goto retry;
390: }
391: }
392:
393: /*
394: * allocate transaction id/block
395: */
396: if ((t = TxAnchor.freetid) == 0) {
397: jfs_info("txBegin: waiting for free tid");
398: INCREMENT(TxStat.txBegin_freetid);
399: TXN_SLEEP(&TxAnchor.freewait);
400: goto retry;
401: }
402:
403: tblk = tid_to_tblock(t);
404:
405: if ((tblk->next == 0) && !(flag & COMMIT_FORCE)) {
406: /* Don't let a non-forced transaction take the last tblk */
407: jfs_info("txBegin: waiting for free tid");
408: INCREMENT(TxStat.txBegin_freetid);
409: TXN_SLEEP(&TxAnchor.freewait);
410: goto retry;
411: }
412:
413: TxAnchor.freetid = tblk->next;
414:
415: /*
416: * initialize transaction
417: */
418:
419: /*
420: * We can't zero the whole thing or we screw up another thread being
421: * awakened after sleeping on tblk->waitor
422: *
423: * memset(tblk, 0, sizeof(struct tblock));
424: */
425: tblk->next = tblk->last = tblk->xflag = tblk->flag = tblk->lsn = 0;
426:
427: tblk->sb = sb;
428: ++log->logtid;
429: tblk->logtid = log->logtid;
430:
431: ++log->active;
432:
433: HIGHWATERMARK(stattx.maxtid, t); /* statistics */
434: INCREMENT(stattx.ntid); /* statistics */
435:
436: TXN_UNLOCK();
437:
438: jfs_info("txBegin: returning tid = %d", t);
439:
440: return t;
441: }
SourceFile:fs/jfs/jfs_txnmgr.c]
|
| 14/2 |
2026/07/14 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 25503
output: 42
thoughts: 53
Thoughts: Here's my thought process, as it stands:
**Debugging a Synchronization Issue**
Okay, so I'm digging into this synchronization issue, and line 376 is calling `TXN_SLEEP(&log->syncwait)`. I know that means it's waiting, but now I'm remembering that I saw `TXN_SLEEP_DROP_LOCK` on line 125, which *might* be relevant to the current problem. My intuition is that there's a difference.
I need to quickly understand what `TXN_SLEEP` does in the context of this transaction logic to understand if there is some potential interaction or error in synchronization or perhaps deadlock. I'm going to look at the macro definition immediately to make sure it's the correct kind of sleep.
|
| 15/2 |
2026/07/14 00:52 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:fs/jfs/jfs_txnmgr.c Name:TXN_SLEEP]
Results: map[SourceCode: SourceFile:]
|
| 16/2 |
2026/07/14 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 25790
output: 23
thoughts: 31
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience:
**Diving into Transactional Lock Drops in JFS**
Alright, time to dig into a potential issue. Let's start by looking at `TXN_SLEEP_DROP_LOCK` in `fs/jfs/jfs_txnmgr.c`. My gut tells me this is where the interesting stuff regarding how the journaled filesystem (JFS) handles dropping locks when sleeping within a transaction happens. I need to refresh my memory on the interactions here, especially around how it deals with potential deadlocks or long waits on contention for resources. I'll need to focus on where the locks are acquired, what conditions might trigger a sleep, and how the lock is *actually* released and then re-acquired. I'm hoping this gives me some insight into the possible bottlenecks, contention scenarios, or even potential race conditions if things aren't handled perfectly atomically. Perhaps this is related to the slow filesystem I'm investigating... let's see what the code reveals.
|
| 17/2 |
2026/07/14 00:52 |
tool |
grepper |
0m
Args: map[Expression:TXN_SLEEP_DROP_LOCK]
Results: map[Output:fs/jfs/jfs_txnmgr.c=113=static int jfs_commit_thread_waking;
--
fs/jfs/jfs_txnmgr.c-117- */
fs/jfs/jfs_txnmgr.c:118:static inline void TXN_SLEEP_DROP_LOCK(wait_queue_head_t * event)
fs/jfs/jfs_txnmgr.c-119-{
--
fs/jfs/jfs_txnmgr.c-130-{\
fs/jfs/jfs_txnmgr.c:131: TXN_SLEEP_DROP_LOCK(event);\
fs/jfs/jfs_txnmgr.c-132- TXN_LOCK();\
--
fs/jfs/jfs_txnmgr.c=584=struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp,
--
fs/jfs/jfs_txnmgr.c-848- if (xtid && (tlck->mp == mp) && (mp->lid == lid))
fs/jfs/jfs_txnmgr.c:849: TXN_SLEEP_DROP_LOCK(&tid_to_tblock(xtid)->waitor);
fs/jfs/jfs_txnmgr.c-850- else
]
|
| 18/2 |
2026/07/14 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 26422
output: 38
thoughts: 1350
Thoughts: **Analyzing a Potential Filesystem Deadlock**
Okay, so I'm looking at this trace, and my initial thought is that we've got a `TXN_SLEEP` call that's ultimately leading to a `TXN_SLEEP_DROP_LOCK`. That immediately makes me think of JFS waiting on something in the log sync process, like `log->syncwait`, `TxAnchor.lowlockwait`, or `TxAnchor.freewait`. But wait, JFS and BTRFS are totally different filesystems. Why are we seeing both hang?
My hypothesis is that a common resource is causing the issue. My mind immediately goes to `btrfs_control_ioctl` which holds the `uuid_mutex` and is waiting for `inode_lock_shared`. Task 6004 is clearly in the process: `btrfs_control_ioctl` -> `btrfs_scan_one_device` -> `bdev_file_open_by_path` -> `kern_path` -> `filename_lookup` -> `path_lookupat` -> `lookup_last` -> `walk_component` -> `lookup_slow` -> `inode_lock_shared`. This looks like it's trying to find a path, thus requiring the directory's `inode_lock`. But which directory?
Now I see task 5981 doing `jfs_mkdir`. It holds the JFS directory's `inode_lock` exclusively and is blocked in `txBegin`. That's a red flag! If `btrfs_control_ioctl` is trying to look up a path *within* the JFS filesystem, it's going to block on that JFS directory's `inode_lock`, and it's holding `uuid_mutex`.
And there is a third, relevant actor. Task 5977, doing `btrfs_close_devices`, is blocked on `uuid_mutex`. Task 6011 is doing `openat` and is blocked on `inode_lock` (probably the same JFS directory).
So, here's my interpretation of the deadlock:
1. Task 5981 (JFS mkdir) holds the JFS directory's `inode_lock` (exclusive) and is blocked in `txBegin`. Maybe it is blocked waiting for JFS log thread.
2. Task 6004 (`btrfs_control_ioctl`) holds `uuid_mutex` and is waiting for the JFS directory's `inode_lock` (shared).
3. Task 5977 (`btrfs_close_devices`) is blocked on `uuid_mutex`.
4. Task 6011 (`openat`) is blocked on the JFS directory's `inode_lock`
But wait, why is the JFS `txBegin` blocked for 143 seconds? Is the JFS log thread blocked?
Let me check.
Looking at the held locks... there is *no* JFS log thread in the list of hung tasks. Hmm... Could JFS `txBegin` be blocked waiting for something the JFS log thread is supposed to signal but that signal is not being sent (eg. `TxAnchor.freewait` or `log->syncwait`)? Is JFS deadlocked internally?
Syzkaller often finds these types of JFS deadlocks because JFS is old and has bugs.
But wait, the report is probably titled something like "INFO: task blocked in btrfs\_close\_devices." The bug report shows multiple blocked tasks. Task 5977 is blocked in `btrfs_close_devices` waiting for `uuid_mutex`. Task 6004 is blocked in `btrfs_control_ioctl` *holding* `uuid_mutex` and waiting for a JFS directory's `inode_lock`. And Task 5981 is blocked in `jfs_mkdir` holding the JFS directory's `inode_lock` and waiting in `txBegin`.
It's pretty clear that `btrfs_control_ioctl` is getting blocked *because of JFS*. The question is: can an unprivileged user even trigger this with `btrfs_control_ioctl`?
I've already checked: `btrfs_control_ioctl` requires `CAP_SYS_ADMIN` in the initial namespace. Same with mounting BTRFS.
What about JFS? Does JFS require `CAP_SYS_ADMIN` to mount?
Let me check `jfs_fs_type`.
|
| 19/2 |
2026/07/14 00:52 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/jfs/super.c Name:jfs_fs_type]
Results: map[SourceCode: 928: static struct file_system_type jfs_fs_type = {
929: .owner = THIS_MODULE,
930: .name = "jfs",
931: .kill_sb = kill_block_super,
932: .fs_flags = FS_REQUIRES_DEV,
933: .init_fs_context = jfs_init_fs_context,
934: .parameters = jfs_param_spec,
935: };
SourceFile:fs/jfs/super.c]
|
| 20/2 |
2026/07/14 00:52 |
llm |
expert |
1m
Model:
Tokens:
input: 28980
output: 23
thoughts: 3014
Thoughts: **Deadlock Analysis: JFS on BTRFS through Loop Device**
Okay, so here's the situation as I see it. JFS, unlike some other filesystems, doesn't have the `FS_USERNS_MOUNT` flag. This means mounting it requires global `CAP_SYS_ADMIN` privileges. Hmm, that seems to restrict the scope of this bug, but syzkaller runs tests as root, so that's not a barrier for triggering it, apparently. The key question is whether an *unprivileged* user can induce this. The obvious route, mounting JFS directly, is off-limits. But what if a system administrator has *already* mounted a JFS filesystem? Could an unprivileged user's actions then cause trouble?
That's when the `mkdir` call comes in to play. It appears that by issuing `mkdir` on a mounted JFS filesystem, an unprivileged user *can* trigger a JFS deadlock (task 5981, as the bug report puts it). Now, that needs validation. If that's the case, then JFS's inherent design has an issue.
Digging further, I'm focusing on the `txBegin` function. It seems to be a point of contention. The code in `txBegin` reveals a potential for locking up if the system is starved for transaction locks (`tlocks`). Specifically, if `TxAnchor.tlocksInUse > TxLockVHWM`, the process sleeps. Could an unprivileged user exhaust `tlocks` through concurrent operations on JFS? Based on JFS's unmaintained state, it's possible. If so, it would turn into a local denial-of-service vulnerability.
The report also mentions `btrfs_control_ioctl`. Is the deadlock *caused* by it? Task 6004 holds `uuid_mutex` and waits on JFS. Task 5981 holds JFS's `inode_lock` and waits in `txBegin`. Task 5981 appears to be blocked in I/O, a long I/O wait. Is something *else* blocking something that would unblock 5981? All the information points to a deadlock.
The important thing is, can JFS's `txBegin` function be the one at fault here? It might be waiting on `log->syncwait`, or `TxAnchor.lowlockwait`. Who wakes those up? `jfs_sync` or `jfs_logsync`, or `txEnd` or `txFreeMap`. But I don't see anything obvious that's blocked.
Let's look at all the tasks that are currently blocked. Here are the blocking tasks:
* Task 5977: Blocked on `uuid_mutex` in `btrfs_close_devices`.
* Task 6004: Holds `uuid_mutex`, blocked on `inode_lock_shared` in `lookup_slow`.
* Task 5981: Holds `inode_lock` (JFS), blocked in `txBegin`.
* Task 6009: Blocked on `inode_lock_shared` in `lookup_slow`.
* Task 6011: Blocked on `inode_lock` in `open_last_lookups`.
* Task 6045: Blocked on `uuid_mutex` in `btrfs_get_tree`.
* Task 6117: Blocked on `uuid_mutex` in `btrfs_get_tree`.
* Task 6277: Blocked on `uuid_mutex` in `btrfs_control_ioctl`.
* Task 6414: Blocked on `uuid_mutex` in `btrfs_control_ioctl`.
* Task 6438: Blocked on `uuid_mutex` in `btrfs_control_ioctl`.
* Task 6433: Blocked on `uuid_mutex` in `btrfs_get_tree`.
* Task 6554: Blocked on `uuid_mutex` in `btrfs_control_ioctl`.
* Task 6776: Blocked on `uuid_mutex` in `btrfs_get_tree`.
* Task 6851: Blocked on `uuid_mutex` in `btrfs_control_ioctl`.
Okay, it seems that everything is waiting for `uuid_mutex` and various `inode_lock`, `inode_lock_shared` in BTRFS. Something is blocked.
The crucial point here is that syzkaller reports an I/O wait. It
|
| 21/2 |
2026/07/14 00:53 |
tool |
grepper |
0m
Args: map[Expression:mutex_lock\(&uuid_mutex\)]
Results: map[Output:fs/btrfs/super.c=341=static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
--
fs/btrfs/super.c-377-
fs/btrfs/super.c:378: mutex_lock(&uuid_mutex);
fs/btrfs/super.c-379- device = btrfs_scan_one_device(param->string, false);
--
fs/btrfs/super.c=1867=static int btrfs_get_tree_super(struct fs_context *fc)
--
fs/btrfs/super.c-1877- btrfs_ctx_to_info(fs_info, ctx);
fs/btrfs/super.c:1878: mutex_lock(&uuid_mutex);
fs/btrfs/super.c-1879-
--
fs/btrfs/super.c-1905- if (IS_ERR(sb)) {
fs/btrfs/super.c:1906: mutex_lock(&uuid_mutex);
fs/btrfs/super.c-1907- btrfs_fs_devices_dec_holding(fs_devices);
--
fs/btrfs/super.c-1932-
fs/btrfs/super.c:1933: mutex_lock(&uuid_mutex);
fs/btrfs/super.c-1934- btrfs_fs_devices_dec_holding(fs_devices);
--
fs/btrfs/super.c-1952-
fs/btrfs/super.c:1953: mutex_lock(&uuid_mutex);
fs/btrfs/super.c-1954- btrfs_fs_devices_dec_holding(fs_devices);
--
fs/btrfs/super.c=2254=static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
--
fs/btrfs/super.c-2273- case BTRFS_IOC_SCAN_DEV:
fs/btrfs/super.c:2274: mutex_lock(&uuid_mutex);
fs/btrfs/super.c-2275- /*
--
fs/btrfs/super.c-2291- case BTRFS_IOC_DEVICES_READY:
fs/btrfs/super.c:2292: mutex_lock(&uuid_mutex);
fs/btrfs/super.c-2293- /*
--
fs/btrfs/volumes.c=1111=void btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices)
--
fs/btrfs/volumes.c-1115-
fs/btrfs/volumes.c:1116: mutex_lock(&uuid_mutex);
fs/btrfs/volumes.c-1117- __btrfs_free_extra_devids(fs_devices, &latest_dev);
--
fs/btrfs/volumes.c=1210=void btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
--
fs/btrfs/volumes.c-1214-
fs/btrfs/volumes.c:1215: mutex_lock(&uuid_mutex);
fs/btrfs/volumes.c-1216- close_fs_devices(fs_devices);
--
fs/btrfs/volumes.c=1401=int btrfs_forget_devices(dev_t devt)
--
fs/btrfs/volumes.c-1404-
fs/btrfs/volumes.c:1405: mutex_lock(&uuid_mutex);
fs/btrfs/volumes.c-1406- ret = btrfs_free_stale_devices(devt, NULL);
--
fs/btrfs/volumes.c=2531=void btrfs_rm_dev_replace_free_srcdev(struct btrfs_device *srcdev)
--
fs/btrfs/volumes.c-2534-
fs/btrfs/volumes.c:2535: mutex_lock(&uuid_mutex);
fs/btrfs/volumes.c-2536-
--
fs/btrfs/volumes.c=2848=int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path)
--
fs/btrfs/volumes.c-2883- down_write(&sb->s_umount);
fs/btrfs/volumes.c:2884: mutex_lock(&uuid_mutex);
fs/btrfs/volumes.c-2885- locked = true;
--
fs/btrfs/volumes.c=8015=int btrfs_read_chunk_tree(struct btrfs_fs_info *fs_info)
--
fs/btrfs/volumes.c-8035- */
fs/btrfs/volumes.c:8036: mutex_lock(&uuid_mutex);
fs/btrfs/volumes.c-8037-
--
fs/btrfs/volumes.c=8770=bool btrfs_verify_dev_items(const struct btrfs_fs_info *fs_info)
--
fs/btrfs/volumes.c-8775-
fs/btrfs/volumes.c:8776: mutex_lock(&uuid_mutex);
fs/btrfs/volumes.c-8777- list_for_each_entry(dev, &fs_info->fs_devices->devices, dev_list) {
]
|
| 22/2 |
2026/07/14 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 34508
output: 40
thoughts: 961
Thoughts: **Analyzing a Potentially Nasty Deadlock Chain**
Okay, so I'm looking at this issue where `btrfs_close_devices` is getting blocked, and my initial thought is that it's related to the `uuid_mutex` which is used during device scanning, adding/removing devices, mounting, unmounting, and reading the chunk tree, but not for normal I/O. That implies BTRFS I/O shouldn't be the direct culprit. But wait, I need to dig deeper. Could something *external* be the root cause?
Aha! The classic Syzkaller scenarios are popping into my head, and I'm reminded of JFS - a filesystem notorious for its unmaintained state and associated deadlocks. Syzkaller flags a lot of them. Could this be a JFS issue, masquerading as a BTRFS problem? It seems like `txBegin` in JFS is the likely culprit. If that deadlocks, we get a cascading failure. Task 5981 gets stuck holding an `inode_lock` on the JFS directory indefinitely.
Then, task 6004, trying to do `btrfs_control_ioctl(BTRFS_IOC_SCAN_DEV)` with a path within the JFS directory, runs into it. It calls `kern_path`, which wants to share the lock on the JFS directory that task 5981 has. Since 5981 has exclusive access, 6004 blocks. This is where it gets interesting - task 6004 *also* holds `uuid_mutex`, so this means `uuid_mutex` gets held forever. Consequently, any BTRFS unmount or failed mount operations, like `btrfs_close_devices`, get blocked. Any BTRFS mount or scan will also block on the mutex.
It's a classic deadlock chain. But the real root cause is JFS. I need to figure out how this is triggered. Can an unprivileged user actually trigger this JFS deadlock? Mounting JFS requires `CAP_SYS_ADMIN`, but what if JFS is *already* mounted? Can they call `mkdir` on the JFS filesystem? Yes, if permissions allow it!
Okay, so if an unprivileged user *could* trigger the JFS deadlock, they could DoS the JFS filesystem by making it hang. But does the JFS deadlock require any special permissions to trigger? Let's see if there are known deadlocks in `txBegin`. Hmm, yes, running out of transaction blocks or log space, especially with concurrent operations, is known to trigger issues in JFS. If an unprivileged user can do concurrent `mkdir` or other operations, they could trigger it.
However, task 6004 is doing `btrfs_control_ioctl(BTRFS_IOC_SCAN_DEV)`. This *requires* global `CAP_SYS_ADMIN`! So, in this scenario, task 6004 is a root task. If task 6004 *wasn't* there, the `uuid_mutex` would *not* be held, and BTRFS wouldn't be blocked. Only the JFS filesystem would be blocked. Now, is a local DoS on a *specific* filesystem (JFS) considered a security issue? Yes, it is. If an unprivileged user can hang a mounted filesystem, it's a local DoS.
But hang on. The bug report is specifically about `btrfs_close_devices` being blocked. That's the symptom. The Syzkaller reproducer probably did this:
1. Mount JFS.
2. Start some JFS operations (like `mkdir`).
3. Call `btrfs_control_ioctl(BTRFS_IOC_SCAN_DEV)` with a path inside JFS.
4. Unmount BTRFS (which calls `btrfs_close_devices`).
Syzkaller runs as root, so it can do all of this. But if we evaluate it from an unprivileged user's perspective, they *cannot* call `btrfs_control_ioctl(BTRFS_IOC_SCAN_DEV)`. So, they cannot cause `uuid_mutex` to be held. They *cannot* block BTRFS. They *can* block JFS, but in the specific case the issue arose due to a root-privileged operation.
Is the JFS deadlock the actual bug here, or is the bug the fact that `btrfs_control_ioctl` holds `uuid_mutex` while doing a path lookup? I need to analyze `btrfs_control_ioctl` to find the answer.
|
| 23/2 |
2026/07/14 00:54 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/btrfs/super.c Name:btrfs_control_ioctl]
Results: map[SourceCode:2251: /*
2252: * Used by /dev/btrfs-control for devices ioctls.
2253: */
2254: static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
2255: unsigned long arg)
2256: {
2257: struct btrfs_ioctl_vol_args *vol;
2258: struct btrfs_device *device = NULL;
2259: dev_t devt = 0;
2260: int ret = -ENOTTY;
2261:
2262: if (!capable(CAP_SYS_ADMIN))
2263: return -EPERM;
2264:
2265: vol = memdup_user((void __user *)arg, sizeof(*vol));
2266: if (IS_ERR(vol))
2267: return PTR_ERR(vol);
2268: ret = btrfs_check_ioctl_vol_args_path(vol);
2269: if (ret < 0)
2270: goto out;
2271:
2272: switch (cmd) {
2273: case BTRFS_IOC_SCAN_DEV:
2274: mutex_lock(&uuid_mutex);
2275: /*
2276: * Scanning outside of mount can return NULL which would turn
2277: * into 0 error code.
2278: */
2279: device = btrfs_scan_one_device(vol->name, false);
2280: ret = PTR_ERR_OR_ZERO(device);
2281: mutex_unlock(&uuid_mutex);
2282: break;
2283: case BTRFS_IOC_FORGET_DEV:
2284: if (vol->name[0] != 0) {
2285: ret = lookup_bdev(vol->name, &devt);
2286: if (ret)
2287: break;
2288: }
2289: ret = btrfs_forget_devices(devt);
2290: break;
2291: case BTRFS_IOC_DEVICES_READY:
2292: mutex_lock(&uuid_mutex);
2293: /*
2294: * Scanning outside of mount can return NULL which would turn
2295: * into 0 error code.
2296: */
2297: device = btrfs_scan_one_device(vol->name, false);
2298: if (IS_ERR_OR_NULL(device)) {
2299: mutex_unlock(&uuid_mutex);
2300: ret = PTR_ERR_OR_ZERO(device);
2301: break;
2302: }
2303: ret = !(device->fs_devices->num_devices ==
2304: device->fs_devices->total_devices);
2305: mutex_unlock(&uuid_mutex);
2306: break;
2307: case BTRFS_IOC_GET_SUPPORTED_FEATURES:
2308: ret = btrfs_ioctl_get_supported_features((void __user*)arg);
2309: break;
2310: }
2311:
2312: out:
2313: kfree(vol);
2314: return ret;
2315: }
SourceFile:fs/btrfs/super.c]
|
| 24/2 |
2026/07/14 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 37485
output: 23
thoughts: 333
Thoughts: **Analyzing a Potential BTRFS Deadlock**
Okay, so I'm looking at this BTRFS code and a potential issue is starting to emerge. I see that the `BTRFS_IOC_SCAN_DEV` and `BTRFS_IOC_DEVICES_READY` ioctls hold the `uuid_mutex` and then call `btrfs_scan_one_device`. The problem is that `btrfs_scan_one_device` then calls `bdev_file_open_by_path`, which, as I know, involves a path lookup.
Now, holding a global mutex like `uuid_mutex` during a path lookup is generally a red flag. A path lookup, after all, can block on a variety of things - filesystem locks, I/O operations, network access (NFS, for example). If that lookup *does* block indefinitely β a deadlocked JFS, a hung NFS server, maybe a FUSE filesystem that just doesn't respond β then `uuid_mutex` is held forever.
That's a nasty situation. This would block any other BTRFS operation that needs `uuid_mutex`, which includes mounting and unmounting BTRFS filesystems, adding/removing devices, and so on. So the bug, as I understand it, is that `btrfs_control_ioctl` is holding the `uuid_mutex` while a path lookup is potentially blocking.
My immediate question is: Is this something an unprivileged user can exploit? I know `btrfs_control_ioctl` requires `CAP_SYS_ADMIN`. Since that's the case, an unprivileged user can't directly trigger this. But I'm not ready to give up that easily. I need to make sure there are *no* other places where `uuid_mutex` is held across a path lookup. That's my next focus.
|
| 25/2 |
2026/07/14 00:54 |
tool |
grepper |
0m
Args: map[Expression:mutex_lock\(&uuid_mutex\)]
Results: map[Output:fs/btrfs/super.c=341=static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
--
fs/btrfs/super.c-377-
fs/btrfs/super.c:378: mutex_lock(&uuid_mutex);
fs/btrfs/super.c-379- device = btrfs_scan_one_device(param->string, false);
--
fs/btrfs/super.c=1867=static int btrfs_get_tree_super(struct fs_context *fc)
--
fs/btrfs/super.c-1877- btrfs_ctx_to_info(fs_info, ctx);
fs/btrfs/super.c:1878: mutex_lock(&uuid_mutex);
fs/btrfs/super.c-1879-
--
fs/btrfs/super.c-1905- if (IS_ERR(sb)) {
fs/btrfs/super.c:1906: mutex_lock(&uuid_mutex);
fs/btrfs/super.c-1907- btrfs_fs_devices_dec_holding(fs_devices);
--
fs/btrfs/super.c-1932-
fs/btrfs/super.c:1933: mutex_lock(&uuid_mutex);
fs/btrfs/super.c-1934- btrfs_fs_devices_dec_holding(fs_devices);
--
fs/btrfs/super.c-1952-
fs/btrfs/super.c:1953: mutex_lock(&uuid_mutex);
fs/btrfs/super.c-1954- btrfs_fs_devices_dec_holding(fs_devices);
--
fs/btrfs/super.c=2254=static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
--
fs/btrfs/super.c-2273- case BTRFS_IOC_SCAN_DEV:
fs/btrfs/super.c:2274: mutex_lock(&uuid_mutex);
fs/btrfs/super.c-2275- /*
--
fs/btrfs/super.c-2291- case BTRFS_IOC_DEVICES_READY:
fs/btrfs/super.c:2292: mutex_lock(&uuid_mutex);
fs/btrfs/super.c-2293- /*
--
fs/btrfs/volumes.c=1111=void btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices)
--
fs/btrfs/volumes.c-1115-
fs/btrfs/volumes.c:1116: mutex_lock(&uuid_mutex);
fs/btrfs/volumes.c-1117- __btrfs_free_extra_devids(fs_devices, &latest_dev);
--
fs/btrfs/volumes.c=1210=void btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
--
fs/btrfs/volumes.c-1214-
fs/btrfs/volumes.c:1215: mutex_lock(&uuid_mutex);
fs/btrfs/volumes.c-1216- close_fs_devices(fs_devices);
--
fs/btrfs/volumes.c=1401=int btrfs_forget_devices(dev_t devt)
--
fs/btrfs/volumes.c-1404-
fs/btrfs/volumes.c:1405: mutex_lock(&uuid_mutex);
fs/btrfs/volumes.c-1406- ret = btrfs_free_stale_devices(devt, NULL);
--
fs/btrfs/volumes.c=2531=void btrfs_rm_dev_replace_free_srcdev(struct btrfs_device *srcdev)
--
fs/btrfs/volumes.c-2534-
fs/btrfs/volumes.c:2535: mutex_lock(&uuid_mutex);
fs/btrfs/volumes.c-2536-
--
fs/btrfs/volumes.c=2848=int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path)
--
fs/btrfs/volumes.c-2883- down_write(&sb->s_umount);
fs/btrfs/volumes.c:2884: mutex_lock(&uuid_mutex);
fs/btrfs/volumes.c-2885- locked = true;
--
fs/btrfs/volumes.c=8015=int btrfs_read_chunk_tree(struct btrfs_fs_info *fs_info)
--
fs/btrfs/volumes.c-8035- */
fs/btrfs/volumes.c:8036: mutex_lock(&uuid_mutex);
fs/btrfs/volumes.c-8037-
--
fs/btrfs/volumes.c=8770=bool btrfs_verify_dev_items(const struct btrfs_fs_info *fs_info)
--
fs/btrfs/volumes.c-8775-
fs/btrfs/volumes.c:8776: mutex_lock(&uuid_mutex);
fs/btrfs/volumes.c-8777- list_for_each_entry(dev, &fs_info->fs_devices->devices, dev_list) {
]
|
| 26/2 |
2026/07/14 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 39708
output: 27
thoughts: 2881
Thoughts: **Analysis of a Potential Deadlock and Root Cause**
Okay, so here's the breakdown of what I'm seeing. This looks like a classic case of a multi-layered issue, with a couple of interesting red herrings. Initially, the focus was on a potential deadlock involving the `uuid_mutex` within the BTRFS filesystem code, triggered somehow by unprivileged users. However, after tracing the execution path, it's become clear that an unprivileged user cannot directly cause the `uuid_mutex` to be held in BTRFS. The problematic functions, `btrfs_parse_param` and `btrfs_ioctl_add_dev` both require `CAP_SYS_ADMIN`, thus protecting this particular vulnerability vector.
The clue is Syzkaller's report: task blocked in `btrfs_close_devices`. Now, the problem is most likely NOT BTRFS, but the JFS. It's hanging because of a JFS deadlock, which happens because of the way `btrfs_close_devices` operates. Now, the problem does not lie on a normal BTRFS filesystem, but a deadlocked JFS, and it appears the JFS log thread is blocked on a particular JFS deadlock. My mind drifts to the specific JFS log thread `jfsCommit` and considers the fact it could be blocking and not holding any locks. That would be the critical link. Now, it's known that JFS is fragile in Syzkaller-like tests, and that it may have a log issue when concurrent operations happen.
The critical path looks like this: BTRFS is being unmounted, but it has open files from JFS via a loop device. Then, root runs `btrfs_control_ioctl` on JFS filesystem B. While JFS filesystem B is being handled, it's blocking `txBegin`. Thus `btrfs_control_ioctl` also blocks. The unmount of BTRFS fails, and Syzkaller reports the task blocked.
The BTRFS issue is now exposed: `uuid_mutex` is held during `btrfs_scan_one_device`. If root runs `btrfs device scan` while any filesystem hangs, then `btrfs device scan` also hangs. It could cause a minor DoS. However, an unprivileged user can't mount or scan a device, and they cannot cause the `btrfs_scan_one_device` via `btrfs_parse_param` or similar functions, because those functions also require `CAP_SYS_ADMIN` or are prevented by the lack of `FS_USERNS_MOUNT` support.
In summary, the deadlock isn't a direct BTRFS vulnerability exploitable by unprivileged users. The BTRFS code is simply collateral damage of the underlying JFS deadlock. It's a Malicious Filesystem Trigger, caused by a maliciously crafted JFS image or a fragile JFS filesystem that becomes deadlocked via concurrent operations. The BTRFS code just happens to be the unlucky subsystem to trigger the reporting of the hung task. The real problem is JFS being stuck in its `txBegin` or `log` processing, which is possibly caused by a corrupted log or a poorly-crafted JFS filesystem.
|
| 27/2 |
2026/07/14 00:54 |
tool |
codesearch-find-references |
0m
Args: map[Name:btrfs_scan_one_device]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:btrfs_control_ioctl SourceFile:fs/btrfs/super.c SourceLine:2279] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:btrfs_control_ioctl SourceFile:fs/btrfs/super.c SourceLine:2297] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:btrfs_get_tree_super SourceFile:fs/btrfs/super.c SourceLine:1884] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:btrfs_parse_param SourceFile:fs/btrfs/super.c SourceLine:379]] TruncatedOutput:false]
|
| 28/2 |
2026/07/14 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 43547
output: 42
thoughts: 15
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience and written in the first person:
**Diving into the Btrfs Superblock Retrieval**
Alright, time to get a handle on how this `btrfs_get_tree_super` function works. I need to understand exactly how the superblock information, which is critical for accessing and interpreting a Btrfs filesystem, is being retrieved. I'm assuming there's some sort of logic here to handle various scenarios β maybe different disk layouts, errors, or even some form of caching. I should scrutinize the code closely for any potential performance bottlenecks or subtle gotchas, especially those related to concurrent access or error handling. My gut tells me this will be pretty fundamental to the overall filesystem performance and integrity; let's see how they've handled it.
|
| 29/2 |
2026/07/14 00:54 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/btrfs/super.c Name:btrfs_get_tree_super]
Results: map[SourceCode:1867: static int btrfs_get_tree_super(struct fs_context *fc)
1868: {
1869: struct btrfs_fs_info *fs_info = fc->s_fs_info;
1870: struct btrfs_fs_context *ctx = fc->fs_private;
1871: struct btrfs_fs_devices *fs_devices = NULL;
1872: struct btrfs_device *device;
1873: struct super_block *sb;
1874: blk_mode_t mode = sb_open_mode(fc->sb_flags);
1875: int ret;
1876:
1877: btrfs_ctx_to_info(fs_info, ctx);
1878: mutex_lock(&uuid_mutex);
1879:
1880: /*
1881: * With 'true' passed to btrfs_scan_one_device() (mount time) we expect
1882: * either a valid device or an error.
1883: */
1884: device = btrfs_scan_one_device(fc->source, true);
1885: ASSERT(device != NULL);
1886: if (IS_ERR(device)) {
1887: mutex_unlock(&uuid_mutex);
1888: return PTR_ERR(device);
1889: }
1890: fs_devices = device->fs_devices;
1891: /*
1892: * We cannot hold uuid_mutex calling sget_fc(), it will lead to a
1893: * locking order reversal with s_umount.
1894: *
1895: * So here we increase the holding number of fs_devices, this will ensure
1896: * the fs_devices itself won't be freed.
1897: */
1898: btrfs_fs_devices_inc_holding(fs_devices);
1899: fs_info->fs_devices = fs_devices;
1900: mutex_unlock(&uuid_mutex);
1901:
1902: fc->sb_flags |= SB_NOSEC;
1903:
1904: sb = sget_fc(fc, btrfs_fc_test_super, set_anon_super_fc);
1905: if (IS_ERR(sb)) {
1906: mutex_lock(&uuid_mutex);
1907: btrfs_fs_devices_dec_holding(fs_devices);
1908: /*
1909: * Since the fs_devices is not opened, it can be freed at any
1910: * time after unlocking uuid_mutex. We need to avoid double
1911: * free through put_fs_context()->btrfs_free_fs_info().
1912: * So here we reset fs_info->fs_devices to NULL, and let the
1913: * regular fs_devices reclaim path to handle it.
1914: *
1915: * This applies to all later branches where no fs_devices is
1916: * opened.
1917: */
1918: fs_info->fs_devices = NULL;
1919: mutex_unlock(&uuid_mutex);
1920: return PTR_ERR(sb);
1921: }
1922:
1923: if (sb->s_root) {
1924: /*
1925: * Not the first mount of the fs thus got an existing super block.
1926: * Will reuse the returned super block, fs_info and fs_devices.
1927: *
1928: * fc->s_fs_info is not touched and will be later freed by
1929: * put_fs_context() through btrfs_free_fs_context().
1930: */
1931: ASSERT(fc->s_fs_info == fs_info);
1932:
1933: mutex_lock(&uuid_mutex);
1934: btrfs_fs_devices_dec_holding(fs_devices);
1935: fs_info->fs_devices = NULL;
1936: mutex_unlock(&uuid_mutex);
1937: /*
1938: * At this stage we may have RO flag mismatch between
1939: * fc->sb_flags and sb->s_flags. Caller should detect such
1940: * mismatch and reconfigure with sb->s_umount rwsem held if
1941: * needed.
1942: */
1943: } else {
1944: struct block_device *bdev;
1945:
1946: /*
1947: * The first mount of the fs thus a new superblock, fc->s_fs_info
1948: * must be NULL, and the ownership of our fs_info and fs_devices is
1949: * transferred to the super block.
1950: */
1951: ASSERT(fc->s_fs_info == NULL);
1952:
1953: mutex_lock(&uuid_mutex);
1954: btrfs_fs_devices_dec_holding(fs_devices);
1955: ret = btrfs_open_devices(fs_devices, mode, sb);
1956: if (ret < 0)
1957: fs_info->fs_devices = NULL;
1958: mutex_unlock(&uuid_mutex);
1959: if (ret < 0) {
1960: deactivate_locked_super(sb);
1961: return ret;
1962: }
1963: if (!(fc->sb_flags & SB_RDONLY) && fs_devices->rw_devices == 0) {
1964: deactivate_locked_super(sb);
1965: return -EACCES;
1966: }
1967: set_device_specific_options(fs_info);
1968: bdev = fs_devices->latest_dev->bdev;
1969: snprintf(sb->s_id, sizeof(sb->s_id), "%pg", bdev);
1970: shrinker_debugfs_rename(sb->s_shrink, "sb-btrfs:%s", sb->s_id);
1971: ret = btrfs_fill_super(sb, fs_devices);
1972: if (ret) {
1973: deactivate_locked_super(sb);
1974: return ret;
1975: }
1976: }
1977:
1978: btrfs_clear_oneshot_options(fs_info);
1979:
1980: fc->root = dget(sb->s_root);
1981: return 0;
1982: }
SourceFile:fs/btrfs/super.c]
|
| 30/2 |
2026/07/14 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 45669
output: 37
thoughts: 478
Thoughts: **Analyzing the BTRFS and JFS Filesystem Vulnerabilities**
Okay, so I'm thinking about this BTRFS issue. Specifically, `btrfs_get_tree_super` is called during the mount process. It grabs the `uuid_mutex` and then kicks off `btrfs_scan_one_device` with the device path passed to `mount`. The problem arises when this path points to a hung filesystem, like JFS, because `btrfs_scan_one_device` then hangs while still holding the `uuid_mutex`. My immediate thought is, "can an unprivileged user exploit this?" The answer should be no because mounting BTRFS needs `CAP_SYS_ADMIN` in the initial namespace. Any other path lookup that acquires `uuid_mutex` is similarly restricted to `CAP_SYS_ADMIN`. Therefore, the BTRFS bug, where the mutex is held during a path lookup, is not something an unprivileged user could leverage.
Now, let's switch gears and focus on the JFS side of this. Can unprivileged users trigger the potential JFS bug, the hang during `btrfs_scan_one_device`? If a JFS filesystem is already mounted, an unprivileged user can execute `mkdir`. So, could they trigger a deadlock in `txBegin` by concurrent `mkdir`s? That's what I need to figure out. If they *could*, that'd be a local denial-of-service.
Thinking about `txBegin`, it waits for `tlocks` or `tids`. If we have a ton of concurrent transactions, they might exhaust `tlocks`. But these should eventually clear, unless... unless there's a circular dependency. Imagine Transaction A holds a lock on inode 1 and needs a `tlock`. Transaction B holds *all* the `tlocks` and needs a lock on inode 1. That's a classic deadlock. Does JFS have such potential deadlocks? Seems like it could, based on what I'm reading.
Let's dig in a bit. Thinking about `jfs_mkdir`, it calls `txBegin`, which allocates a `tid`, then acquires the lock on the parent directory. Wait. Doesn't `jfs_mkdir` actually lock the parent directory *before* calling `txBegin`? That's a crucial point. Now I need to check the `jfs_mkdir` code.
|
| 31/2 |
2026/07/14 00:54 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/jfs/namei.c Name:jfs_mkdir]
Results: map[SourceCode: 181: /*
182: * NAME: jfs_mkdir(dip, dentry, mode)
183: *
184: * FUNCTION: create a child directory in the parent directory <dip>
185: * with name = <from dentry> and mode = <mode>
186: *
187: * PARAMETER: dip - parent directory vnode
188: * dentry - dentry of child directory
189: * mode - create mode (rwxrwxrwx).
190: *
191: * RETURN: ERR_PTR() of errors from subroutines.
192: *
193: * note:
194: * EACCES: user needs search+write permission on the parent directory
195: */
196: static struct dentry *jfs_mkdir(struct mnt_idmap *idmap, struct inode *dip,
197: struct dentry *dentry, umode_t mode)
198: {
199: int rc = 0;
200: tid_t tid; /* transaction id */
201: struct inode *ip = NULL; /* child directory inode */
202: ino_t ino;
203: struct component_name dname; /* child directory name */
204: struct btstack btstack;
205: struct inode *iplist[2];
206: struct tblock *tblk;
207:
208: jfs_info("jfs_mkdir: dip:0x%p name:%pd", dip, dentry);
209:
210: rc = dquot_initialize(dip);
211: if (rc)
212: goto out1;
213:
214: /*
215: * search parent directory for entry/freespace
216: * (dtSearch() returns parent directory page pinned)
217: */
218: if ((rc = get_UCSname(&dname, dentry)))
219: goto out1;
220:
221: /*
222: * Either iAlloc() or txBegin() may block. Deadlock can occur if we
223: * block there while holding dtree page, so we allocate the inode &
224: * begin the transaction before we search the directory.
225: */
226: ip = ialloc(dip, S_IFDIR | mode);
227: if (IS_ERR(ip)) {
228: rc = PTR_ERR(ip);
229: goto out2;
230: }
231:
232: tid = txBegin(dip->i_sb, 0);
233:
234: mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT);
235: mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);
236:
237: rc = jfs_init_acl(tid, ip, dip);
238: if (rc)
239: goto out3;
240:
241: rc = jfs_init_security(tid, ip, dip, &dentry->d_name);
242: if (rc) {
243: txAbort(tid, 0);
244: goto out3;
245: }
246:
247: if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) {
248: jfs_err("jfs_mkdir: dtSearch returned %d", rc);
249: txAbort(tid, 0);
250: goto out3;
251: }
252:
253: tblk = tid_to_tblock(tid);
254: tblk->xflag |= COMMIT_CREATE;
255: tblk->ino = ip->i_ino;
256: tblk->u.ixpxd = JFS_IP(ip)->ixpxd;
257:
258: iplist[0] = dip;
259: iplist[1] = ip;
260:
261: /*
262: * initialize the child directory in-line in inode
263: */
264: dtInitRoot(tid, ip, dip->i_ino);
265:
266: /*
267: * create entry in parent directory for child directory
268: * (dtInsert() releases parent directory page)
269: */
270: ino = ip->i_ino;
271: if ((rc = dtInsert(tid, dip, &dname, &ino, &btstack))) {
272: if (rc == -EIO) {
273: jfs_err("jfs_mkdir: dtInsert returned -EIO");
274: txAbort(tid, 1); /* Marks Filesystem dirty */
275: } else
276: txAbort(tid, 0); /* Filesystem full */
277: goto out3;
278: }
279:
280: set_nlink(ip, 2); /* for '.' */
281: ip->i_op = &jfs_dir_inode_operations;
282: ip->i_fop = &jfs_dir_operations;
283:
284: mark_inode_dirty(ip);
285:
286: /* update parent directory inode */
287: inc_nlink(dip); /* for '..' from child directory */
288: inode_set_mtime_to_ts(dip, inode_set_ctime_current(dip));
289: mark_inode_dirty(dip);
290:
291: rc = txCommit(tid, 2, &iplist[0], 0);
292:
293: out3:
294: txEnd(tid);
295: mutex_unlock(&JFS_IP(ip)->commit_mutex);
296: mutex_unlock(&JFS_IP(dip)->commit_mutex);
297: if (rc) {
298: free_ea_wmap(ip);
299: clear_nlink(ip);
300: discard_new_inode(ip);
301: } else {
302: d_instantiate_new(dentry, ip);
303: }
304:
305: out2:
306: free_UCSname(&dname);
307:
308:
309: out1:
310:
311: jfs_info("jfs_mkdir: rc:%d", rc);
312: return rc ? ERR_PTR(rc) : NULL;
313: }
SourceFile:fs/jfs/namei.c]
|
| 32/2 |
2026/07/14 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 48705
output: 27
thoughts: 1073
Thoughts: **Analyzing a Potential JFS/BTRFS Deadlock**
Okay, let's break this down. We're looking at a situation where `jfs_mkdir` is called from `vfs_mkdir`. `vfs_mkdir` holds the `inode_lock` on the parent directory. Then, `jfs_mkdir` calls `txBegin` using `dip->i_sb` which is the super block of the parent directory. If `txBegin` blocks, it blocks *while* holding that crucial `inode_lock` on the parent directory. This directly relates to task 5981. The central question is, *why* is `txBegin` blocking?
My initial thought is concurrent `jfs_mkdir` calls. If many of them are running, each holding their `inode_lock`, and they all call `txBegin`, it's possible that they exhaust available transaction locks (`tlocks`) or transaction IDs (`tids`). That would cause `txBegin` to block. This block in `txBegin` would then be a consequence of the `txEnd` from the other transactions that it waits on. But if those transactions are also blocked in `txBegin`, how do they reach `txEnd` to free up the `tlocks`?
That's the core of it β a deadlock possibility! Transactions could be mutually waiting. Now, if other transactions *are* running, they should eventually call `txEnd` and release resources. The problem arises if a transaction is blocked waiting *for* an `inode_lock` on a directory, and another transaction is holding that lock and waiting for it to be released. This sets the stage for a nasty situation.
Now, what about the transactions themselves? Could we look elsewhere? If a transaction is in `txCommit`, does it need an `inode_lock`? No, `txCommit` doesn't acquire it. What about `dtSearch` or `dtInsert` operations within a transaction? Those *could* need page locks on directory entries. But those are *page* locks, not inode locks. Let's move on.
Could a transaction be waiting on `jfsCommit` (the log thread)? Why would `jfsCommit` be blocked? Perhaps the log is full? Perhaps `jfsCommit` is blocked on I/O. However, we've already confirmed that BTRFS I/O is *not* blocked. So that means it must be something else.
But wait! Syzkaller frequently finds deadlocks in JFS `txBegin` due to corrupted JFS images. For instance, if `log->syncwait` is never woken up because the log is corrupted. In this case, we have a Malicious Filesystem Trigger!
So, to summarize the exploitability:
1. This is a deadlock, specifically between JFS `txBegin` and BTRFS `uuid_mutex`.
2. The BTRFS side (specifically `btrfs_control_ioctl` holding `uuid_mutex` during path lookup) requires global `CAP_SYS_ADMIN` privileges.
3. The JFS deadlock is *likely* triggered by a corrupted JFS image, which is a Malicious Filesystem Trigger.
4. Even if the JFS deadlock can be triggered on a normal JFS filesystem with concurrent operations, it would result only in a local DoS, not a system-wide crash.
5. A system-wide DoS (BTRFS hanging) requires root privileges to execute `btrfs_control_ioctl`.
**Therefore, the exploitability analysis looks like this:**
* **Exploitable:** No (it's a deadlock, not memory corruption).
* **Denial of Service:** Yes (system-wide DoS if root runs `btrfs device scan`, or a local DoS on JFS).
* **Accessible From Unprivileged Processes:** No (requires `CAP_SYS_ADMIN` for BTRFS ioctl, or mounting JFS).
* **Accessible From User Namespaces:** No (neither BTRFS nor JFS support `FS_USERNS_MOUNT`).
* **VM Guest Trigger:** No.
* **VM Host Trigger:** No.
* **Network Trigger:** No.
* **Peripheral Trigger:** No.
* **Malicious Filesystem Trigger:** Yes (JFS deadlock is typically triggered by a corrupted JFS image).
Let's quickly check to see if an unprivileged user can hold the BTRFS `uuid_mutex`. We know from checking `btrfs_control_ioctl` and `btrfs_parse_param` that global `CAP_SYS_ADMIN` is required. Is there any *other* way to get to that function?
What about `btr
|
| 33/2 |
2026/07/14 00:55 |
tool |
codesearch-find-references |
0m
Args: map[Name:btrfs_scan_one_device]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:btrfs_control_ioctl SourceFile:fs/btrfs/super.c SourceLine:2279] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:btrfs_control_ioctl SourceFile:fs/btrfs/super.c SourceLine:2297] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:btrfs_get_tree_super SourceFile:fs/btrfs/super.c SourceLine:1884] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:btrfs_parse_param SourceFile:fs/btrfs/super.c SourceLine:379]] TruncatedOutput:false]
|
| 34/2 |
2026/07/14 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 51067
output: 42
thoughts: 694
Thoughts: **Analyzing the JFS and BTRFS Issues**
Okay, so I've been looking at this and it's pretty clear: there are only four system calls of concern, and all of them require `CAP_SYS_ADMIN` globally. This means that, definitively, the BTRFS part of this is strictly root-only, no way around it.
Now, that brings me to JFS and the `txBegin` call. I started wondering if maybe it's blocked on a memory allocation, but quickly realized that no, it's blocked within `TXN_SLEEP`, which is a wait queue. That implies it's waiting for a wakeup signal. That's a classic sign, if the JFS image is corrupted, the log thread could crash or exit early, leaving `txBegin` waiting indefinitely. This smells like a classic JFS bug. So, the primary trigger is definitely a Malicious Filesystem (JFS).
Let's break this down further: Is it exploitable? No, it's just a deadlock. Denial of Service? Yes. Can it be triggered by an unprivileged process? No. User namespaces? No. VM guest or host trigger? No. Ethernet network, any other remote triggers, peripheral triggers? No to all of those. The prime trigger: Malicious Filesystem.
Wait, hold on. If an unprivileged user *could* somehow trigger this JFS deadlock on a normally mounted JFS filesystem, then the "Accessible From Unprivileged Processes" dimension would be affected. But, JFS deadlocks are almost always found by syzkaller via corrupted images. Syzkaller doesn't usually find deadlocks on normal JFS images just by doing concurrent syscalls, because JFS has been stress-tested for decades. The bugs syzkaller finds in JFS are almost exclusively due to missing validation of on-disk structures, leading to infinite loops, deadlocks, or crashes. Considering that, I'm going to stick with the Malicious Filesystem trigger.
Now, about that BTRFS issue. I want to confirm that `btrfs_control_ioctl` is the *only* entry point for this problem. Okay, yes, we checked all references to `btrfs_scan_one_device`. But wait, there is `btrfs_forget_devices`! It's also called from `btrfs_control_ioctl` (BTRFS_IOC_FORGET_DEV), so that's a point to consider. Looking at that code snippet, `lookup_bdev` does a path lookup, but it *doesn't* hold `uuid_mutex`! It turns out that `uuid_mutex` is acquired *inside* `btrfs_forget_devices`. So, with `BTRFS_IOC_FORGET_DEV`, there's no hold on `uuid_mutex` during path lookup. Only `BTRFS_IOC_SCAN_DEV` and `BTRFS_IOC_DEVICES_READY` hold the `uuid_mutex` during path lookup, and both require `CAP_SYS_ADMIN`.
Let me see...Is there any other ioctl in BTRFS that holds `uuid_mutex` during path lookup? Time to check `btrfs_ioctl_add_dev`.
|
| 35/2 |
2026/07/14 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/btrfs/ioctl.c Name:btrfs_ioctl_add_dev]
Results: map[SourceCode:2507: static long btrfs_ioctl_add_dev(struct btrfs_fs_info *fs_info, void __user *arg)
2508: {
2509: struct btrfs_ioctl_vol_args AUTO_KFREE(vol_args);
2510: bool restore_op = false;
2511: int ret;
2512:
2513: if (!capable(CAP_SYS_ADMIN))
2514: return -EPERM;
2515:
2516: if (btrfs_fs_incompat(fs_info, EXTENT_TREE_V2)) {
2517: btrfs_err(fs_info, "device add not supported on extent tree v2 yet");
2518: return -EINVAL;
2519: }
2520:
2521: if (fs_info->fs_devices->temp_fsid) {
2522: btrfs_err(fs_info,
2523: "device add not supported on cloned temp-fsid mount");
2524: return -EINVAL;
2525: }
2526:
2527: if (!btrfs_exclop_start(fs_info, BTRFS_EXCLOP_DEV_ADD)) {
2528: if (!btrfs_exclop_start_try_lock(fs_info, BTRFS_EXCLOP_DEV_ADD))
2529: return BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
2530:
2531: /*
2532: * We can do the device add because we have a paused balanced,
2533: * change the exclusive op type and remember we should bring
2534: * back the paused balance
2535: */
2536: fs_info->exclusive_operation = BTRFS_EXCLOP_DEV_ADD;
2537: btrfs_exclop_start_unlock(fs_info);
2538: restore_op = true;
2539: }
2540:
2541: vol_args = memdup_user(arg, sizeof(*vol_args));
2542: if (IS_ERR(vol_args)) {
2543: ret = PTR_ERR(vol_args);
2544: goto out;
2545: }
2546:
2547: ret = btrfs_check_ioctl_vol_args_path(vol_args);
2548: if (ret < 0)
2549: goto out;
2550:
2551: ret = btrfs_init_new_device(fs_info, vol_args->name);
2552:
2553: if (!ret)
2554: btrfs_info(fs_info, "disk added %s", vol_args->name);
2555:
2556: out:
2557: if (restore_op)
2558: btrfs_exclop_balance(fs_info, BTRFS_EXCLOP_BALANCE_PAUSED);
2559: else
2560: btrfs_exclop_finish(fs_info);
2561: return ret;
2562: }
SourceFile:fs/btrfs/ioctl.c]
|
| 36/2 |
2026/07/14 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 53429
output: 42
thoughts: 46
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience:
**Investigating Btrfs Device Initialization**
Alright, so `btrfs_ioctl_add_dev` is calling `btrfs_init_new_device`. That's the entry point for adding a new device to the filesystem, makes sense. My immediate question is: does `btrfs_init_new_device` acquire and hold the `uuid_mutex` while it's doing path lookups? This is crucial because path lookups under a mutex could cause locking issues, potential deadlocks, and generally increase lock contention and impact performance. I need to know if this initialization sequence could be introducing any concurrency bottlenecks related to UUID operations, particularly if a UUID-based path lookup is involved. A deeper dive into that function's code is definitely warranted to understand the locking strategy it employs during the path resolution phase.
|
| 37/2 |
2026/07/14 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/btrfs/volumes.c Name:btrfs_init_new_device]
Results: map[SourceCode:2848: int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path)
2849: {
2850: struct btrfs_root *root = fs_info->dev_root;
2851: struct btrfs_trans_handle *trans;
2852: struct btrfs_device *device;
2853: struct file *bdev_file;
2854: struct super_block *sb = fs_info->sb;
2855: struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
2856: struct btrfs_fs_devices *seed_devices = NULL;
2857: u64 orig_super_total_bytes;
2858: u64 orig_super_num_devices;
2859: int ret = 0;
2860: bool seeding_dev = false;
2861: bool locked = false;
2862:
2863: if (sb_rdonly(sb) && !fs_devices->seeding)
2864: return -EROFS;
2865:
2866: bdev_file = bdev_file_open_by_path(device_path, BLK_OPEN_WRITE,
2867: fs_info->sb, &fs_holder_ops);
2868: if (IS_ERR(bdev_file))
2869: return PTR_ERR(bdev_file);
2870:
2871: if (!btrfs_check_device_zone_type(fs_info, file_bdev(bdev_file))) {
2872: ret = -EINVAL;
2873: goto error;
2874: }
2875:
2876: if (bdev_nr_bytes(file_bdev(bdev_file)) <= BTRFS_DEVICE_RANGE_RESERVED) {
2877: ret = -EINVAL;
2878: goto error;
2879: }
2880:
2881: if (fs_devices->seeding) {
2882: seeding_dev = true;
2883: down_write(&sb->s_umount);
2884: mutex_lock(&uuid_mutex);
2885: locked = true;
2886: }
2887:
2888: sync_blockdev(file_bdev(bdev_file));
2889:
2890: rcu_read_lock();
2891: list_for_each_entry_rcu(device, &fs_devices->devices, dev_list) {
2892: if (device->bdev == file_bdev(bdev_file)) {
2893: ret = -EEXIST;
2894: rcu_read_unlock();
2895: goto error;
2896: }
2897: }
2898: rcu_read_unlock();
2899:
2900: device = btrfs_alloc_device(fs_info, NULL, NULL, device_path);
2901: if (IS_ERR(device)) {
2902: /* we can safely leave the fs_devices entry around */
2903: ret = PTR_ERR(device);
2904: goto error;
2905: }
2906:
2907: device->fs_info = fs_info;
2908: device->bdev_file = bdev_file;
2909: device->bdev = file_bdev(bdev_file);
2910: ret = lookup_bdev(device_path, &device->devt);
2911: if (ret)
2912: goto error_free_device;
2913:
2914: ret = btrfs_get_dev_zone_info(device, false);
2915: if (ret)
2916: goto error_free_device;
2917:
2918: trans = btrfs_start_transaction(root, 0);
2919: if (IS_ERR(trans)) {
2920: ret = PTR_ERR(trans);
2921: goto error_free_zone;
2922: }
2923:
2924: set_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state);
2925: device->generation = trans->transid;
2926: device->io_width = fs_info->sectorsize;
2927: device->io_align = fs_info->sectorsize;
2928: device->sector_size = fs_info->sectorsize;
2929: device->total_bytes =
2930: round_down(bdev_nr_bytes(device->bdev), fs_info->sectorsize);
2931: device->disk_total_bytes = device->total_bytes;
2932: device->commit_total_bytes = device->total_bytes;
2933: set_bit(BTRFS_DEV_STATE_IN_FS_METADATA, &device->dev_state);
2934: clear_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state);
2935:
2936: /*
2937: * Increase dev_stats_ccnt so that corresponding DEV_STATS item can be
2938: * created at the next transaction commit.
2939: */
2940: atomic_inc(&device->dev_stats_ccnt);
2941: device->dev_stats_valid = 1;
2942: set_blocksize(device->bdev_file, BTRFS_BDEV_BLOCKSIZE);
2943:
2944: if (seeding_dev) {
2945: /* GFP_KERNEL allocation must not be under device_list_mutex */
2946: seed_devices = btrfs_init_sprout(fs_info);
2947: if (IS_ERR(seed_devices)) {
2948: ret = PTR_ERR(seed_devices);
2949: btrfs_abort_transaction(trans, ret);
2950: goto error_trans;
2951: }
2952: }
2953:
2954: mutex_lock(&fs_devices->device_list_mutex);
2955: if (seeding_dev) {
2956: btrfs_setup_sprout(fs_info, seed_devices);
2957: btrfs_assign_next_active_device(fs_info->fs_devices->latest_dev,
2958: device);
2959: }
2960:
2961: device->fs_devices = fs_devices;
2962:
2963: mutex_lock(&fs_info->chunk_mutex);
2964: list_add_rcu(&device->dev_list, &fs_devices->devices);
2965: list_add(&device->dev_alloc_list, &fs_devices->alloc_list);
2966: fs_devices->num_devices++;
2967: fs_devices->open_devices++;
2968: fs_devices->rw_devices++;
2969: fs_devices->total_devices++;
2970: fs_devices->total_rw_bytes += device->total_bytes;
2971:
2972: atomic64_add(device->total_bytes, &fs_info->free_chunk_space);
2973:
2974: if (bdev_rot(device->bdev))
2975: fs_devices->rotating = true;
2976:
2977: orig_super_total_bytes = btrfs_super_total_bytes(fs_info->super_copy);
2978: btrfs_set_super_total_bytes(fs_info->super_copy,
2979: round_down(orig_super_total_bytes + device->total_bytes,
2980: fs_info->sectorsize));
2981:
2982: orig_super_num_devices = btrfs_super_num_devices(fs_info->super_copy);
2983: btrfs_set_super_num_devices(fs_info->super_copy,
2984: orig_super_num_devices + 1);
2985:
2986: /*
2987: * we've got more storage, clear any full flags on the space
2988: * infos
2989: */
2990: btrfs_clear_space_info_full(fs_info);
2991:
2992: btrfs_update_per_profile_avail(fs_info);
2993: mutex_unlock(&fs_info->chunk_mutex);
2994:
2995: /* Add sysfs device entry */
2996: btrfs_sysfs_add_device(device);
2997:
2998: mutex_unlock(&fs_devices->device_list_mutex);
2999:
3000: if (seeding_dev) {
3001: mutex_lock(&fs_info->chunk_mutex);
3002: ret = init_first_rw_device(trans);
3003: btrfs_update_per_profile_avail(fs_info);
3004: mutex_unlock(&fs_info->chunk_mutex);
3005: if (unlikely(ret)) {
3006: btrfs_abort_transaction(trans, ret);
3007: goto error_sysfs;
3008: }
3009: }
3010:
3011: ret = btrfs_add_dev_item(trans, device);
3012: if (unlikely(ret)) {
3013: btrfs_abort_transaction(trans, ret);
3014: goto error_sysfs;
3015: }
3016:
3017: if (seeding_dev) {
3018: ret = btrfs_finish_sprout(trans);
3019: if (unlikely(ret)) {
3020: btrfs_abort_transaction(trans, ret);
3021: goto error_sysfs;
3022: }
3023:
3024: /*
3025: * fs_devices now represents the newly sprouted filesystem and
3026: * its fsid has been changed by btrfs_sprout_splice().
3027: */
3028: btrfs_sysfs_update_sprout_fsid(fs_devices);
3029: }
3030:
3031: ret = btrfs_commit_transaction(trans);
3032:
3033: if (seeding_dev) {
3034: mutex_unlock(&uuid_mutex);
3035: up_write(&sb->s_umount);
3036: locked = false;
3037:
3038: if (ret) /* transaction commit */
3039: return ret;
3040:
3041: ret = btrfs_relocate_sys_chunks(fs_info);
3042: if (ret < 0)
3043: btrfs_handle_fs_error(fs_info, ret,
3044: "Failed to relocate sys chunks after device initialization. This can be fixed using the \"btrfs balance\" command.");
3045: trans = btrfs_attach_transaction(root);
3046: if (IS_ERR(trans)) {
3047: if (PTR_ERR(trans) == -ENOENT)
3048: return 0;
3049: ret = PTR_ERR(trans);
3050: trans = NULL;
3051: goto error_sysfs;
3052: }
3053: ret = btrfs_commit_transaction(trans);
3054: }
3055:
3056: /*
3057: * Now that we have written a new super block to this device, check all
3058: * other fs_devices list if device_path alienates any other scanned
3059: * device.
3060: * We can ignore the return value as it typically returns -EINVAL and
3061: * only succeeds if the device was an alien.
3062: */
3063: btrfs_forget_devices(device->devt);
3064:
3065: /* Update ctime/mtime for blkid or udev */
3066: update_dev_time(device_path);
3067:
3068: return ret;
3069:
3070: error_sysfs:
3071: btrfs_sysfs_remove_device(device);
3072: mutex_lock(&fs_info->fs_devices->device_list_mutex);
3073: mutex_lock(&fs_info->chunk_mutex);
3074: list_del_rcu(&device->dev_list);
3075: list_del(&device->dev_alloc_list);
3076: fs_info->fs_devices->num_devices--;
3077: fs_info->fs_devices->open_devices--;
3078: fs_info->fs_devices->rw_devices--;
3079: fs_info->fs_devices->total_devices--;
3080: fs_info->fs_devices->total_rw_bytes -= device->total_bytes;
3081: atomic64_sub(device->total_bytes, &fs_info->free_chunk_space);
3082: btrfs_set_super_total_bytes(fs_info->super_copy,
3083: orig_super_total_bytes);
3084: btrfs_set_super_num_devices(fs_info->super_copy,
3085: orig_super_num_devices);
3086: btrfs_update_per_profile_avail(fs_info);
3087: mutex_unlock(&fs_info->chunk_mutex);
3088: mutex_unlock(&fs_info->fs_devices->device_list_mutex);
3089: error_trans:
3090: if (trans)
3091: btrfs_end_transaction(trans);
3092: error_free_zone:
3093: btrfs_destroy_dev_zone_info(device);
3094: error_free_device:
3095: btrfs_free_device(device);
3096: error:
3097: bdev_fput(bdev_file);
3098: if (locked) {
3099: mutex_unlock(&uuid_mutex);
3100: up_write(&sb->s_umount);
3101: }
3102: return ret;
3103: }
SourceFile:fs/btrfs/volumes.c]
|
| 38/2 |
2026/07/14 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 57849
output: 66
thoughts: 543
Thoughts: **My Analysis of the Btrfs and JFS Issues**
Okay, let's break this down. My initial observation is that in `btrfs_init_new_device`, the call to `bdev_file_open_by_path` happens *before* acquiring `uuid_mutex`. This is crucial. This means that at the point of path lookup, `uuid_mutex` isn't held. Consequently, the only places where `uuid_mutex` *is* held during this critical path lookup are within `btrfs_control_ioctl` for specific ioctls (SCAN_DEV, DEVICES_READY), `btrfs_get_tree_super` during a mount, and `btrfs_parse_param` when processing mount options. The common denominator here? All of these operations require `CAP_SYS_ADMIN`, making this vulnerability strictly a root-only issue. It's not something an unprivileged user can leverage.
Now, shifting gears to the JFS bug, it appears to be a deadlock specifically within `txBegin`. My analysis points to a corrupted JFS image as the trigger. So, in effect, this is a *Malicious Filesystem Trigger*. A well-crafted, corrupted filesystem can be used to elicit this deadlock.
Finally, Iβve completed a dimensional check on the potential impact. Regarding the Btrfs bug, it isn't exploitable in terms of gaining unauthorized access. It *could* lead to a Denial of Service, but crucially, it's not accessible from unprivileged processes or user namespaces. Itβs not triggered by virtual machine interaction, a network event, peripheral interaction, or a remote trigger.
Regarding the JFS deadlock, my conclusions are that it's *not* exploitable to elevate privileges. It is a Denial of Service. It's not accessible from unprivileged processes. So it's not a common vulnerability. Now, to be 100% sure that an unprivileged user can *not* trigger the JFS deadlock, I'll need to consider this in more detail. Syzkaller finds these deadlocks by fuzzing the filesystem image. JFS is a very old filesystem, and normal concurrent operations don't usually deadlock it (otherwise it would have been fixed long ago). The deadlocks happen when the on-disk structures are inconsistent (e.g., circular directory links, corrupted log size, invalid block pointers). So, it requires a Malicious Filesystem.
Therefore, the JFS issue can also be classified as a *Malicious Filesystem Trigger*.
I'll call the `set-results` tool now to conclude the analysis.
|
| 39/2 |
2026/07/14 00:55 |
tool |
set-results |
0m
Args: map[DenialOfService:true Exploitable:false FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 40/2 |
2026/07/14 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 59080
output: 634
thoughts: 589
Thoughts: **Analysis of a Multi-Task Deadlock**
Alright, the data's in. Time to synthesize this into a clear response. Let's see... the bug report highlights a nasty deadlock. The key tasks and their blocked states are: `btrfs_close_devices` hanging on `uuid_mutex`, `btrfs_control_ioctl` holding `uuid_mutex` and blocked on `inode_lock_shared` within `lookup_slow`, `jfs_mkdir` holding `inode_lock` exclusively and blocked in `txBegin`, and `openat` blocked on `inode_lock`. Immediately, my spidey-sense is tingling... classic AB-BA deadlock, and it's even involving *different* filesystems. This smells like trouble.
Digging deeper, the root cause pinpoints to a JFS issue. Task 5981 is the culprit. It's calling `jfs_mkdir` on a JFS filesystem, grabbing the exclusive `inode_lock` on the directory, and then calling `txBegin`, which is where the infinite block occurs. Now, I know my JFS... this looks like a textbook case of a corrupted JFS image leading to a deadlock within the transaction manager β it's stuck waiting on a log sync that's never going to happen.
Task 6004 complicates matters further. This is where BTRFS comes into play, executing `btrfs_control_ioctl(BTRFS_IOC_SCAN_DEV)` with a path on the deadlocked JFS filesystem. It's holding the global BTRFS `uuid_mutex` and then gets stuck in a path lookup via `kern_path`, which blocks on the JFS directory's `inode_lock_shared` that is exclusively held by Task 5981.
And finally, task 5977 is trying to execute `btrfs_close_devices` (likely during an unmount) and is now blocked, waiting for that `uuid_mutex` held by 6004. So, we have a clear chain of blocked tasks, each waiting for a lock held by another. Classic.
As for the implications, from a security perspective, this isn't an *exploitable* memory corruption or leak - but it's definitely a **Denial of Service** vulnerability. The JFS filesystem is hung, but because BTRFS holds a global mutex during path lookup, it's also taking down mount/unmount operations and device scanning for BTRFS across the system. It would take `CAP_SYS_ADMIN` to trigger this issue, as `BTRFS_IOC_SCAN_DEV` and mounting both require the capability. This deadlock cannot be triggered from an unprivileged process or User Namespaces. The critical issue is that mounting and interacting with a maliciously crafted JFS image would cause the JFS deadlock.
Okay, that's it. Time to craft a concise and accurate response.
|
| 41/1 |
2026/07/14 00:55 |
action |
format-explanation |
0m
Results: map[Explanation:Based on the provided crash report and source code analysis, here is the
assessment of the bug:
**Root Cause Analysis:**
The bug report shows a deadlock involving two different filesystems: BTRFS and
JFS. The sequence of events is as follows:
1. **Task 5981 (`jfs_mkdir`)**: Executes a directory creation on a JFS
filesystem. It acquires the directory's `inode_lock` exclusively and then calls
`txBegin()`, which blocks indefinitely. This is a known issue with JFS where
corrupted filesystem images can cause the transaction manager to deadlock or
wait forever for a log sync that never happens.
2. **Task 6004 (`btrfs_control_ioctl`)**: Executes `BTRFS_IOC_SCAN_DEV` with a
path that resides inside the deadlocked JFS filesystem. It acquires the global
BTRFS `uuid_mutex` and then attempts a path lookup (`bdev_file_open_by_path` ->
`kern_path`). The path lookup blocks on the JFS directory's `inode_lock_shared`
held by Task 5981.
3. **Task 5977 (`btrfs_close_devices`)**: Attempts to unmount a completely
unrelated BTRFS filesystem. It tries to acquire the `uuid_mutex` and blocks
forever because Task 6004 is holding it.
The root cause is the JFS transaction deadlock triggered by a corrupted
filesystem image. The BTRFS subsystem becomes a victim because it holds a global
subsystem mutex (`uuid_mutex`) while performing a VFS path lookup, which is a
known anti-pattern as path lookups can block indefinitely on broken or malicious
filesystems (e.g., FUSE, deadlocked JFS, hung NFS).
**Security Impact:**
* **Exploitable:** No. This is a pure deadlock resulting in a hung task. There
is no memory corruption, use-after-free, or information leak involved.
* **Denial of Service:** Yes. The bug causes a local DoS by hanging the JFS
filesystem. Furthermore, it causes a system-wide DoS for BTRFS, as all
subsequent BTRFS mounts, unmounts, and device scans will hang waiting for the
`uuid_mutex`.
* **Accessible From Unprivileged Processes:** No. The BTRFS ioctl
(`BTRFS_IOC_SCAN_DEV`) explicitly checks for global `CAP_SYS_ADMIN`.
Additionally, mounting JFS or BTRFS requires global `CAP_SYS_ADMIN`.
* **Accessible From User Namespaces:** No. Neither BTRFS nor JFS support
`FS_USERNS_MOUNT`, meaning they cannot be mounted inside an unprivileged user
namespace.
* **Malicious Filesystem Trigger:** Yes. The underlying JFS `txBegin` deadlock
is triggered by mounting and interacting with a maliciously crafted JFS image
(which syzkaller generates). Normal JFS images do not deadlock under standard
concurrent operations.]
|