| 0/0 |
2026/05/24 06:48 |
flow |
assessment-security |
47m
Results: map[DenialOfService:true Explanation:Based on the analysis of the bug report and the kernel source code, here is the
assessment of the security impact:
### Root Cause Analysis
The bug is a hung task timeout (Denial of Service) caused by mounting a
malicious `ext4` filesystem image.
During the mount process, `ext4_fill_super()` calls `ext4_orphan_cleanup()` to
process any unlinked but open inodes (orphans) left over from a previous crash.
The function iterates over the orphan list using a `while (es->s_last_orphan)`
loop.
If an attacker crafts a malicious `ext4` image with a massive number of valid
orphan inodes (the maximum inode count `s_inodes_count` can be up to 2^32), this
loop will run for an extremely long time. The loop lacks `cond_resched()`, and
for each inode, it calls `ext4_process_orphan()` which evicts the inode and
performs quota updates. When the image is mounted via a loop device, this
generates millions of bios and a massive amount of dirty data on the backing
filesystem.
In this specific syzkaller trace, the massive I/O load and dirty pages generated
by the loop worker (`kworker/u8:10`) caused a subsequent `FIFREEZE` `ioctl`
(which calls `freeze_super()` -> `sync_filesystem()`) to block for more than 143
seconds while trying to write out the dirty data. This, in turn, blocked the
`syz.1.125` task in `sb_start_write()` waiting for the filesystem to thaw,
triggering the hung task panic.
### Security Impact
* **Exploitable:** No. This is a resource exhaustion and CPU/IO hogging issue.
There is no memory corruption, use-after-free, or out-of-bounds access involved
that could lead to privilege escalation or arbitrary code execution.
* **Denial of Service:** Yes. Mounting the malicious image will severely
overload the system's I/O and CPU, leading to hung tasks, RCU stalls, and
overall system unresponsiveness.
* **Accessible From Unprivileged Processes / User Namespaces:** No. The `ext4`
filesystem does not have the `FS_USERNS_MOUNT` flag. Therefore, it cannot be
mounted by unprivileged users, even if they have `CAP_SYS_ADMIN` within a user
namespace. Mounting it requires `CAP_SYS_ADMIN` in the initial (root) namespace.
* **Malicious Filesystem / Peripheral Trigger:** Yes. Because it is triggered by
parsing a malicious filesystem image, it serves as a classic peripheral attack
vector. If a user plugs in a USB thumb drive containing this malicious `ext4`
image, desktop environments (like GNOME or KDE) that auto-mount external media
will trigger the bug and hang the system. Exploitable:false FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/05/24 06:48 |
action |
syz-repro-to-c-repro |
0m
Results:
|
| 2/1 |
2026/05/24 06:48 |
action |
kernel-checkouter |
1m
Results: map[KernelSrc:/app/workdir/cache/src/a26f29b85b1f392045a8e6cb3d857ee9e1c765af]
|
| 3/1 |
2026/05/24 06:50 |
action |
kernel-builder |
23m
Results: map[KernelObj:/app/workdir/cache/build/75f66159e0fe30a31fe87e60d899c6661ebd39fa]
|
| 4/1 |
2026/05/24 07:13 |
action |
codesearch-prepare |
15m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/05/24 07:29 |
agent |
expert |
6m
Model:
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:true 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 greeping
".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 or elevated privileges.
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 completly 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 tranfers, that's 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 exploitabability depends on how exactly the uninit value
is used in the code, and what it affects.
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 Confidetial 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.1.125:6522 blocked for more than 143 seconds.
Not tainted syzkaller #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz.1.125 state:D stack:25160 pid:6522 tgid:6521 ppid:5599 task_flags:0x400140 flags:0x00080002
Call Trace:
<TASK>
context_switch kernel/sched/core.c:5388 [inline]
__schedule+0x16ec/0x5620 kernel/sched/core.c:7189
__schedule_loop kernel/sched/core.c:7268 [inline]
schedule+0x164/0x360 kernel/sched/core.c:7283
percpu_rwsem_wait+0x317/0x480 kernel/locking/percpu-rwsem.c:164
__percpu_down_read+0xfc/0x140 kernel/locking/percpu-rwsem.c:180
percpu_down_read_internal include/linux/percpu-rwsem.h:67 [inline]
percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline]
__sb_start_write include/linux/fs/super.h:19 [inline]
sb_start_write+0x18e/0x1c0 include/linux/fs/super.h:125
mnt_want_write+0x41/0x90 fs/namespace.c:493
open_last_lookups fs/namei.c:4600 [inline]
path_openat+0xaec/0x38a0 fs/namei.c:4855
do_file_open+0x23e/0x4a0 fs/namei.c:4887
do_sys_openat2+0x113/0x200 fs/open.c:1364
do_sys_open fs/open.c:1370 [inline]
__do_sys_openat fs/open.c:1386 [inline]
__se_sys_openat fs/open.c:1381 [inline]
__x64_sys_openat+0x138/0x170 fs/open.c:1381
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x15f/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f803ac1ce59
RSP: 002b:00007f8038e76028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f803ae95fa0 RCX: 00007f803ac1ce59
RDX: 0000000000143042 RSI: 0000200000000040 RDI: ffffffffffffff9c
RBP: 00007f803acb2d6f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000138 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f803ae96038 R14: 00007f803ae95fa0 R15: 00007fff4cab04a8
</TASK>
Showing all locks held in the system:
2 locks held by kworker/u8:0/12:
#0: ffff88801a074138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3289 [inline]
#0: ffff88801a074138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_scheduled_works+0xa35/0x1860 kernel/workqueue.c:3397
#1: ffffc90000117c40 ((reaper_work).work){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3290 [inline]
#1: ffffc90000117c40 ((reaper_work).work){+.+.}-{0:0}, at: process_scheduled_works+0xa70/0x1860 kernel/workqueue.c:3397
1 lock held by khungtaskd/38:
#0: ffffffff8dfc8080 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#0: ffffffff8dfc8080 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:838 [inline]
#0: ffffffff8dfc8080 (rcu_read_lock){....}-{1:3}, at: debug_show_all_locks+0x2e/0x180 kernel/locking/lockdep.c:6775
3 locks held by kworker/u8:2/43:
#0: ffff88803221d138 ((wq_completion)ipv6_addrconf){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3289 [inline]
#0: ffff88803221d138 ((wq_completion)ipv6_addrconf){+.+.}-{0:0}, at: process_scheduled_works+0xa35/0x1860 kernel/workqueue.c:3397
#1: ffffc90000b57c40 ((work_completion)(&(&net->ipv6.addr_chk_work)->work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3290 [inline]
#1: ffffc90000b57c40 ((work_completion)(&(&net->ipv6.addr_chk_work)->work)){+.+.}-{0:0}, at: process_scheduled_works+0xa70/0x1860 kernel/workqueue.c:3397
#2: ffffffff8f3584f8 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_net_lock include/linux/rtnetlink.h:130 [inline]
#2: ffffffff8f3584f8 (rtnl_mutex){+.+.}-{4:4}, at: addrconf_verify_work+0x19/0x30 net/ipv6/addrconf.c:4746
2 locks held by kworker/u8:4/66:
#0: ffff88801a074138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3289 [inline]
#0: ffff88801a074138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_scheduled_works+0xa35/0x1860 kernel/workqueue.c:3397
#1: ffffc9000151fc40 (connector_reaper_work){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3290 [inline]
#1: ffffc9000151fc40 (connector_reaper_work){+.+.}-{0:0}, at: process_scheduled_works+0xa70/0x1860 kernel/workqueue.c:3397
3 locks held by kworker/u8:7/166:
#0: ffff88801a074138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3289 [inline]
#0: ffff88801a074138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_scheduled_works+0xa35/0x1860 kernel/workqueue.c:3397
#1: ffffc9000397fc40 ((linkwatch_work).work){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3290 [inline]
#1: ffffc9000397fc40 ((linkwatch_work).work){+.+.}-{0:0}, at: process_scheduled_works+0xa70/0x1860 kernel/workqueue.c:3397
#2: ffffffff8f3584f8 (rtnl_mutex){+.+.}-{4:4}, at: linkwatch_event+0xe/0x60 net/core/link_watch.c:313
3 locks held by kworker/u8:10/1351:
#0: ffff888064dbf138 ((wq_completion)loop2){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3289 [inline]
#0: ffff888064dbf138 ((wq_completion)loop2){+.+.}-{0:0}, at: process_scheduled_works+0xa35/0x1860 kernel/workqueue.c:3397
#1: ffffc90006707c40 ((work_completion)(&worker->work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3290 [inline]
#1: ffffc90006707c40 ((work_completion)(&worker->work)){+.+.}-{0:0}, at: process_scheduled_works+0xa70/0x1860 kernel/workqueue.c:3397
#2: ffff888026392160 (&lo->lo_work_lock){+.+.}-{3:3}, at: spin_lock_irq include/linux/spinlock_rt.h:96 [inline]
#2: ffff888026392160 (&lo->lo_work_lock){+.+.}-{3:3}, at: loop_process_work+0x125/0x11b0 drivers/block/loop.c:1953
4 locks held by kworker/u8:12/1419:
#0: ffff88801b290938 ((wq_completion)netns){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3289 [inline]
#0: ffff88801b290938 ((wq_completion)netns){+.+.}-{0:0}, at: process_scheduled_works+0xa35/0x1860 kernel/workqueue.c:3397
#1: ffffc90006a07c40 (net_cleanup_work){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3290 [inline]
#1: ffffc90006a07c40 (net_cleanup_work){+.+.}-{0:0}, at: process_scheduled_works+0xa70/0x1860 kernel/workqueue.c:3397
#2: ffffffff8f3497a0 (pernet_ops_rwsem){++++}-{4:4}, at: cleanup_net+0xf4/0x800 net/core/net_namespace.c:673
#3: ffffffff8f3584f8 (rtnl_mutex){+.+.}-{4:4}, at: default_device_exit_batch+0xe5/0x9e0 net/core/dev.c:13062
2 locks held by dhcpcd/5260:
#0: ffff888036130928 (nlk_cb_mutex-ROUTE){+.+.}-{4:4}, at: __netlink_dump_start+0xfe/0x7e0 net/netlink/af_netlink.c:2404
#1: ffffffff8f3584f8 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_lock net/core/rtnetlink.c:80 [inline]
#1: ffffffff8f3584f8 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_dumpit+0x92/0x200 net/core/rtnetlink.c:6864
2 locks held by getty/5354:
#0: ffff888036c550a0 (&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+0x462/0x13a0 drivers/tty/n_tty.c:2211
1 lock held by syz-executor/5600:
#0: ffff888063d86480 (sb_writers#5){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:493
2 locks held by udevd/5706:
1 lock held by udevd/5802:
#0: ffff8880115d6480 (sb_writers#5){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:493
1 lock held by udevd/5804:
#0: ffff8880115d6480 (sb_writers#5){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:493
1 lock held by syz.1.125/6522:
#0: ffff88803596e480 (sb_writers#14){++++}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:493
1 lock held by syz-executor/8032:
#0: ffffffff8f3584f8 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_lock net/core/rtnetlink.c:80 [inline]
#0: ffffffff8f3584f8 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_nets_lock net/core/rtnetlink.c:341 [inline]
#0: ffffffff8f3584f8 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_newlink+0x883/0x1bb0 net/core/rtnetlink.c:4109
2 locks held by syz.3.399/8267:
6 locks held by syz.2.401/8270:
=============================================
NMI backtrace for cpu 1
CPU: 1 UID: 0 PID: 38 Comm: khungtaskd Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
nmi_cpu_backtrace+0x274/0x2d0 lib/nmi_backtrace.c:113
nmi_trigger_cpumask_backtrace+0x17a/0x300 lib/nmi_backtrace.c:62
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+0xfd3/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 1 to CPUs 0:
NMI backtrace for cpu 0
CPU: 0 UID: 0 PID: 8270 Comm: syz.2.401 Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
RIP: 0010:__bfs kernel/locking/lockdep.c:1815 [inline]
RIP: 0010:__bfs_backwards kernel/locking/lockdep.c:1860 [inline]
RIP: 0010:check_irq_usage kernel/locking/lockdep.c:2796 [inline]
RIP: 0010:check_prev_add kernel/locking/lockdep.c:3169 [inline]
RIP: 0010:check_prevs_add kernel/locking/lockdep.c:3284 [inline]
RIP: 0010:validate_chain kernel/locking/lockdep.c:3908 [inline]
RIP: 0010:__lock_acquire+0x197b/0x2cf0 kernel/locking/lockdep.c:5237
Code: 13 25 ff 0f 00 00 39 05 bf 55 d2 11 73 06 89 05 b7 55 d2 11 48 8b 02 48 89 df 4c 39 e8 0f 84 2c fe ff ff 4c 89 60 30 48 8b 00 <4c> 39 e8 75 f4 48 89 df e9 18 fe ff ff 48 89 fb 48 c7 c7 70 53 e9
RSP: 0018:ffffc9001f7f66c8 EFLAGS: 00000002
RAX: ffffffff960fe908 RBX: 00000000000003cc RCX: 000000000000004d
RDX: ffffffff95f7ab88 RSI: ffff88802d6ee900 RDI: 00000000000003cc
RBP: e551e745617b6525 R08: ffffc9001f7f6690 R09: 0000000000000020
R10: dffffc0000000000 R11: ffffffff81a0b320 R12: ffffffff95f7abf8
R13: ffffffff9314eca8 R14: ffff88802d6edc40 R15: 000000000000004c
FS: 00007f8c29fa66c0(0000) GS:ffff888126171000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055556427ba68 CR3: 000000003ff22000 CR4: 00000000003526f0
Call Trace:
<TASK>
lock_acquire+0x106/0x350 kernel/locking/lockdep.c:5868
__raw_spin_lock include/linux/spinlock_api_smp.h:158 [inline]
_raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:158
mark_wakeup_next_waiter kernel/locking/rtmutex.c:1327 [inline]
rt_mutex_slowunlock+0x18e/0x8b0 kernel/locking/rtmutex.c:1475
spin_unlock_irq include/linux/spinlock_rt.h:122 [inline]
loop_queue_work drivers/block/loop.c:863 [inline]
loop_queue_rq+0x9f8/0xb00 drivers/block/loop.c:1889
__blk_mq_issue_directly block/blk-mq.c:2725 [inline]
blk_mq_request_issue_directly+0x3be/0x6d0 block/blk-mq.c:2812
blk_mq_issue_direct+0x2a0/0x660 block/blk-mq.c:2833
blk_mq_dispatch_queue_requests+0x6fe/0x800 block/blk-mq.c:2908
blk_mq_flush_plug_list+0x456/0x570 block/blk-mq.c:2991
__blk_flush_plug+0x3ed/0x4d0 block/blk-core.c:1230
blk_finish_plug block/blk-core.c:1257 [inline]
__submit_bio+0x28d/0x580 block/blk-core.c:649
__submit_bio_noacct_mq block/blk-core.c:722 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:753
__ext4_read_bh fs/ext4/super.c:181 [inline]
ext4_read_bh+0x1af/0x260 fs/ext4/super.c:206
ext4_bread+0x12d/0x180 fs/ext4/inode.c:1061
ext4_quota_write+0x239/0x580 fs/ext4/super.c:7398
write_blk fs/quota/quota_tree.c:70 [inline]
get_free_dqblk+0x368/0x720 fs/quota/quota_tree.c:136
do_insert_tree+0x256/0x11d0 fs/quota/quota_tree.c:347
do_insert_tree+0x9d7/0x11d0 fs/quota/quota_tree.c:402
do_insert_tree+0x9b2/0x11d0 fs/quota/quota_tree.c:402
dq_insert_tree fs/quota/quota_tree.c:432 [inline]
qtree_write_dquot+0x4b1/0x5e0 fs/quota/quota_tree.c:451
v2_write_dquot+0x183/0x260 fs/quota/quota_v2.c:372
dquot_acquire+0x328/0x620 fs/quota/dquot.c:498
ext4_acquire_dquot+0x2e9/0x4c0 fs/ext4/super.c:7030
dqget+0x744/0xc60 fs/quota/dquot.c:1002
__dquot_initialize+0x3ba/0xd30 fs/quota/dquot.c:1530
ext4_process_orphan+0x54/0x300 fs/ext4/orphan.c:327
ext4_orphan_cleanup+0xc38/0x1470 fs/ext4/orphan.c:472
__ext4_fill_super fs/ext4/super.c:5701 [inline]
ext4_fill_super+0x59bb/0x62d0 fs/ext4/super.c:5824
get_tree_bdev_flags+0x431/0x4f0 fs/super.c:1694
vfs_get_tree+0x92/0x2a0 fs/super.c:1754
fc_mount fs/namespace.c:1193 [inline]
do_new_mount_fc fs/namespace.c:3758 [inline]
do_new_mount+0x341/0xd30 fs/namespace.c:3834
do_mount fs/namespace.c:4167 [inline]
__do_sys_mount fs/namespace.c:4383 [inline]
__se_sys_mount+0x31d/0x420 fs/namespace.c:4360
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x15f/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f8c2bd4e0ca
Code: 48 c7 c2 e8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f8c29fa5e58 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f8c29fa5ee0 RCX: 00007f8c2bd4e0ca
RDX: 0000200000000140 RSI: 0000200000000040 RDI: 00007f8c29fa5ea0
RBP: 0000200000000140 R08: 00007f8c29fa5ee0 R09: 0000000001018e58
R10: 0000000001018e58 R11: 0000000000000246 R12: 0000200000000040
R13: 00007f8c29fa5ea0 R14: 000000000000061f R15: 0000200000000000
</TASK>
Reply: Based on the analysis of the bug report and the kernel source code, here is the assessment of the security impact:
### Root Cause Analysis
The bug is a hung task timeout (Denial of Service) caused by mounting a malicious `ext4` filesystem image.
During the mount process, `ext4_fill_super()` calls `ext4_orphan_cleanup()` to process any unlinked but open inodes (orphans) left over from a previous crash. The function iterates over the orphan list using a `while (es->s_last_orphan)` loop.
If an attacker crafts a malicious `ext4` image with a massive number of valid orphan inodes (the maximum inode count `s_inodes_count` can be up to 2^32), this loop will run for an extremely long time. The loop lacks `cond_resched()`, and for each inode, it calls `ext4_process_orphan()` which evicts the inode and performs quota updates. When the image is mounted via a loop device, this generates millions of bios and a massive amount of dirty data on the backing filesystem.
In this specific syzkaller trace, the massive I/O load and dirty pages generated by the loop worker (`kworker/u8:10`) caused a subsequent `FIFREEZE` `ioctl` (which calls `freeze_super()` -> `sync_filesystem()`) to block for more than 143 seconds while trying to write out the dirty data. This, in turn, blocked the `syz.1.125` task in `sb_start_write()` waiting for the filesystem to thaw, triggering the hung task panic.
### Security Impact
* **Exploitable:** No. This is a resource exhaustion and CPU/IO hogging issue. There is no memory corruption, use-after-free, or out-of-bounds access involved that could lead to privilege escalation or arbitrary code execution.
* **Denial of Service:** Yes. Mounting the malicious image will severely overload the system's I/O and CPU, leading to hung tasks, RCU stalls, and overall system unresponsiveness.
* **Accessible From Unprivileged Processes / User Namespaces:** No. The `ext4` filesystem does not have the `FS_USERNS_MOUNT` flag. Therefore, it cannot be mounted by unprivileged users, even if they have `CAP_SYS_ADMIN` within a user namespace. Mounting it requires `CAP_SYS_ADMIN` in the initial (root) namespace.
* **Malicious Filesystem / Peripheral Trigger:** Yes. Because it is triggered by parsing a malicious filesystem image, it serves as a classic peripheral attack vector. If a user plugs in a USB thumb drive containing this malicious `ext4` image, desktop environments (like GNOME or KDE) that auto-mount external media will trigger the bug and hang the system.
|
| 6/2 |
2026/05/24 07:29 |
llm |
expert |
0m
Model:
Tokens:
input: 12703
output: 43
thoughts: 2536
Thoughts: **Analysis of a Hung Task in a PREEMPT_RT Kernel**
Okay, so I'm looking at this bug report, and it appears we have a hung task timeout β specifically, a task named `syz.1.125` has been blocked for quite a while. The backtrace tells me this task is stuck in the `__sb_start_write` path, which ultimately involves the `sb_writers` lock. Initially, it looks like a simple superblock write lock contention issue. It seems `syz.1.125` is trying to open something via `path_openat`.
But then the Non-Maskable Interrupt (NMI) backtrace comes in, and things get a lot more interesting. `syz.2.401` is running on CPU 0 and the trace suggests a complex interaction involving a mount operation, specifically, an ext4 filesystem mount. It is calling `ext4_fill_super`, then `ext4_orphan_cleanup`, which, in turn, deals with quotas, and *that* somehow triggers a bio to a loop device (`loop_queue_rq`). The critical path here looks to be through `loop_queue_work`, which under PREEMPT_RT kernels, as shown by the NMI backtrace with "PREEMPT_{RT,(full)}", calls `rt_mutex_slowunlock`, that ultimately calls `lock_acquire`.
The problem is, `kworker/u8:10` holds `lo->lo_work_lock`. My immediate thought is that `kworker/u8:10` is blocked and not making progress, or that `syz.2.401` is spinning on `lo->lo_work_lock`. The backtrace shows `syz.2.401` is doing lockdep things in `__bfs`, so maybe lockdep graph search is just taking too long to complete. This graph search can become very slow on large graphs.
Hereβs the breakdown as I understand it:
* `syz.2.401` is attempting an ext4 mount.
* The mount involves `ext4_orphan_cleanup`, quota initialization, and a bio submission to a loop device, through `loop_queue_work`.
* Because this is a PREEMPT_RT kernel, `loop_queue_work` calls `rt_mutex_slowunlock`.
* Lockdep is running (as evidenced by the backtrace mentioning `__bfs`).
* The hang is likely due to `lock_acquire` in `__bfs`, which can be very slow or even stuck in an infinite loop due to a large lockdep graph.
The hung task `syz.1.125` is trying to acquire the `sb_writers` lock. So the question is: *why* is the superblock writer lock, held by some other process, blocking `syz.1.125`? Another process, `syz-executor/5600`, holds `sb_writers#5`, and then `udevd/5802` which prevents the mount operation from proceeding.
* It could be that `ext4_orphan_cleanup` itself is taking a very long time.
My current hypothesis: This is a performance issue related to the interaction between PREEMPT_RT, the loop device, and lockdep. A malicious ext4 image could be causing `ext4_orphan_cleanup` to process a vast number of orphans, or a huge quota tree, resulting in an enormous lockdep graph and an extremely slow or infinite loop, hence a hung task. Let's verify this hypothesis.
|
| 7/2 |
2026/05/24 07:30 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/ext4/orphan.c IncludeLines:true Name:ext4_orphan_cleanup]
Results: map[SourceCode: 361: /* ext4_orphan_cleanup() walks a singly-linked list of inodes (starting at
362: * the superblock) which were deleted from all directories, but held open by
363: * a process at the time of a crash. We walk the list and try to delete these
364: * inodes at recovery time (only with a read-write filesystem).
365: *
366: * In order to keep the orphan inode chain consistent during traversal (in
367: * case of crash during recovery), we link each inode into the superblock
368: * orphan list_head and handle it the same way as an inode deletion during
369: * normal operation (which journals the operations for us).
370: *
371: * We only do an iget() and an iput() on each inode, which is very safe if we
372: * accidentally point at an in-use or already deleted inode. The worst that
373: * can happen in this case is that we get a "bit already cleared" message from
374: * ext4_free_inode(). The only reason we would point at a wrong inode is if
375: * e2fsck was run on this filesystem, and it must have already done the orphan
376: * inode cleanup for us, so we can safely abort without any further action.
377: */
378: void ext4_orphan_cleanup(struct super_block *sb, struct ext4_super_block *es)
379: {
380: unsigned int s_flags = sb->s_flags;
381: int nr_orphans = 0, nr_truncates = 0;
382: struct inode *inode;
383: int i, j;
384: #ifdef CONFIG_QUOTA
385: int quota_update = 0;
386: #endif
387: __le32 *bdata;
388: struct ext4_orphan_info *oi = &EXT4_SB(sb)->s_orphan_info;
389: int inodes_per_ob = ext4_inodes_per_orphan_block(sb);
390:
391: if (!es->s_last_orphan && !oi->of_blocks) {
392: ext4_debug("no orphan inodes to clean up\n");
393: return;
394: }
395:
396: if (bdev_read_only(sb->s_bdev)) {
397: ext4_msg(sb, KERN_ERR, "write access "
398: "unavailable, skipping orphan cleanup");
399: return;
400: }
401:
402: /* Check if feature set would not allow a r/w mount */
403: if (!ext4_feature_set_ok(sb, 0)) {
404: ext4_msg(sb, KERN_INFO, "Skipping orphan cleanup due to "
405: "unknown ROCOMPAT features");
406: return;
407: }
408:
409: if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) {
410: /* don't clear list on RO mount w/ errors */
411: if (es->s_last_orphan && !(s_flags & SB_RDONLY)) {
412: ext4_msg(sb, KERN_INFO, "Errors on filesystem, "
413: "clearing orphan list.");
414: es->s_last_orphan = 0;
415: }
416: ext4_debug("Skipping orphan recovery on fs with errors.\n");
417: return;
418: }
419:
420: if (s_flags & SB_RDONLY) {
421: ext4_msg(sb, KERN_INFO, "orphan cleanup on readonly fs");
422: sb->s_flags &= ~SB_RDONLY;
423: }
424: #ifdef CONFIG_QUOTA
425: /*
426: * Turn on quotas which were not enabled for read-only mounts if
427: * filesystem has quota feature, so that they are updated correctly.
428: */
429: if (ext4_has_feature_quota(sb) && (s_flags & SB_RDONLY)) {
430: int ret = ext4_enable_quotas(sb);
431:
432: if (!ret)
433: quota_update = 1;
434: else
435: ext4_msg(sb, KERN_ERR,
436: "Cannot turn on quotas: error %d", ret);
437: }
438:
439: /* Turn on journaled quotas used for old sytle */
440: for (i = 0; i < EXT4_MAXQUOTAS; i++) {
441: if (EXT4_SB(sb)->s_qf_names[i]) {
442: int ret = ext4_quota_on_mount(sb, i);
443:
444: if (!ret)
445: quota_update = 1;
446: else
447: ext4_msg(sb, KERN_ERR,
448: "Cannot turn on journaled "
449: "quota: type %d: error %d", i, ret);
450: }
451: }
452: #endif
453:
454: while (es->s_last_orphan) {
455: /*
456: * We may have encountered an error during cleanup; if
457: * so, skip the rest.
458: */
459: if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) {
460: ext4_debug("Skipping orphan recovery on fs with errors.\n");
461: es->s_last_orphan = 0;
462: break;
463: }
464:
465: inode = ext4_orphan_get(sb, le32_to_cpu(es->s_last_orphan));
466: if (IS_ERR(inode)) {
467: es->s_last_orphan = 0;
468: break;
469: }
470:
471: list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan);
472: ext4_process_orphan(inode, &nr_truncates, &nr_orphans);
473: }
474:
475: for (i = 0; i < oi->of_blocks; i++) {
476: bdata = (__le32 *)(oi->of_binfo[i].ob_bh->b_data);
477: for (j = 0; j < inodes_per_ob; j++) {
478: if (!bdata[j])
479: continue;
480: inode = ext4_orphan_get(sb, le32_to_cpu(bdata[j]));
481: if (IS_ERR(inode))
482: continue;
483: ext4_set_inode_state(inode, EXT4_STATE_ORPHAN_FILE);
484: EXT4_I(inode)->i_orphan_idx = i * inodes_per_ob + j;
485: ext4_process_orphan(inode, &nr_truncates, &nr_orphans);
486: }
487: }
488:
489: #define PLURAL(x) (x), ((x) == 1) ? "" : "s"
490:
491: if (nr_orphans)
492: ext4_msg(sb, KERN_INFO, "%d orphan inode%s deleted",
493: PLURAL(nr_orphans));
494: if (nr_truncates)
495: ext4_msg(sb, KERN_INFO, "%d truncate%s cleaned up",
496: PLURAL(nr_truncates));
497: #ifdef CONFIG_QUOTA
498: /* Turn off quotas if they were enabled for orphan cleanup */
499: if (quota_update) {
500: for (i = 0; i < EXT4_MAXQUOTAS; i++) {
501: if (sb_dqopt(sb)->files[i])
502: dquot_quota_off(sb, i);
503: }
504: }
505: #endif
506: sb->s_flags = s_flags; /* Restore SB_RDONLY status */
507: }
SourceFile:fs/ext4/orphan.c]
|
| 8/2 |
2026/05/24 07:30 |
llm |
expert |
0m
Model:
Tokens:
input: 18562
output: 43
thoughts: 76
Thoughts: Okay, let me break this down.
**Orphan Inode Cleanup in ext4**
Right, so I'm thinking about the `ext4_orphan_cleanup` function. It's designed to handle orphaned inodes, the ones that are marked for deletion but haven't been fully removed yet, usually due to a crash or system interruption. The function iterates through the `es->s_last_orphan` list, and I assume it processes each inode it finds there. That makes sense.
Wait a second, now I'm remembering that `ext4_orphan_get` is the function responsible for retrieving these inodes from the orphan list. And it returns an inode, which is what `ext4_orphan_cleanup` needs, naturally.
The thought that's kicking in now is about potential problems. What happens if the orphan list itself is somehow corrupted, possibly forming a loop? It would be terrible to get stuck in an infinite loop there. I wonder if `ext4_orphan_get` has some kind of built-in check to detect a looped orphan list.
I should probably go back and refresh my memory on the implementation of `ext4_orphan_get`. I really need to examine it more closely.
|
| 9/2 |
2026/05/24 07:30 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/ext4/orphan.c IncludeLines:true Name:ext4_orphan_get]
Results: map[SourceCode:1371: /* Verify that we are loading a valid orphan from disk */
1372: struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino)
1373: {
1374: unsigned long max_ino = le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count);
1375: ext4_group_t block_group;
1376: int bit;
1377: struct buffer_head *bitmap_bh = NULL;
1378: struct inode *inode = NULL;
1379: int err = -EFSCORRUPTED;
1380:
1381: if (ino < EXT4_FIRST_INO(sb) || ino > max_ino)
1382: goto bad_orphan;
1383:
1384: block_group = (ino - 1) / EXT4_INODES_PER_GROUP(sb);
1385: bit = (ino - 1) % EXT4_INODES_PER_GROUP(sb);
1386: bitmap_bh = ext4_read_inode_bitmap(sb, block_group);
1387: if (IS_ERR(bitmap_bh))
1388: return ERR_CAST(bitmap_bh);
1389:
1390: /* Having the inode bit set should be a 100% indicator that this
1391: * is a valid orphan (no e2fsck run on fs). Orphans also include
1392: * inodes that were being truncated, so we can't check i_nlink==0.
1393: */
1394: if (!ext4_test_bit(bit, bitmap_bh->b_data))
1395: goto bad_orphan;
1396:
1397: inode = ext4_iget(sb, ino, EXT4_IGET_NORMAL);
1398: if (IS_ERR(inode)) {
1399: err = PTR_ERR(inode);
1400: ext4_error_err(sb, -err,
1401: "couldn't read orphan inode %lu (err %d)",
1402: ino, err);
1403: brelse(bitmap_bh);
1404: return inode;
1405: }
1406:
1407: /*
1408: * If the orphans has i_nlinks > 0 then it should be able to
1409: * be truncated, otherwise it won't be removed from the orphan
1410: * list during processing and an infinite loop will result.
1411: * Similarly, it must not be a bad inode.
1412: */
1413: if ((inode->i_nlink && !ext4_can_truncate(inode)) ||
1414: is_bad_inode(inode))
1415: goto bad_orphan;
1416:
1417: if (NEXT_ORPHAN(inode) > max_ino)
1418: goto bad_orphan;
1419: brelse(bitmap_bh);
1420: return inode;
1421:
1422: bad_orphan:
1423: ext4_error(sb, "bad orphan inode %lu", ino);
1424: if (bitmap_bh)
1425: printk(KERN_ERR "ext4_test_bit(bit=%d, block=%llu) = %d\n",
1426: bit, (unsigned long long)bitmap_bh->b_blocknr,
1427: ext4_test_bit(bit, bitmap_bh->b_data));
1428: if (inode) {
1429: printk(KERN_ERR "is_bad_inode(inode)=%d\n",
1430: is_bad_inode(inode));
1431: printk(KERN_ERR "NEXT_ORPHAN(inode)=%u\n",
1432: NEXT_ORPHAN(inode));
1433: printk(KERN_ERR "max_ino=%lu\n", max_ino);
1434: printk(KERN_ERR "i_nlink=%u\n", inode->i_nlink);
1435: /* Avoid freeing blocks if we got a bad deleted inode */
1436: if (inode->i_nlink == 0)
1437: inode->i_blocks = 0;
1438: iput(inode);
1439: }
1440: brelse(bitmap_bh);
1441: return ERR_PTR(err);
1442: }
SourceFile:fs/ext4/ialloc.c]
|
| 10/2 |
2026/05/24 07:30 |
llm |
expert |
0m
Model:
Tokens:
input: 20217
output: 43
thoughts: 83
Thoughts: Okay, let me think this through.
**Orphan Inode List Loophole in ext4**
Right, so `ext4_orphan_get` β wait a second, it doesn't actually validate the orphan list for circular references? That's concerning. If there's a loop in that list, which is entirely possible given the nature of managing orphaned inodes, then `ext4_orphan_cleanup` would get stuck in an infinite loop? Yikes. I need to be sure that can't happen. Hold on... I recall that `ext4_process_orphan` *does* remove the inode from the orphan list and updates `es->s_last_orphan`. Okay, so it's not a simple traversal and delete. I need to refresh my memory on the mechanics of `ext4_process_orphan` to see how it prevents such a catastrophic situation. Time to dive into that function and see what's actually happening under the hood. I have a feeling I'm going to find some interesting logic here.
|
| 11/2 |
2026/05/24 07:30 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/ext4/orphan.c IncludeLines:true Name:ext4_process_orphan]
Results: map[SourceCode: 321: static void ext4_process_orphan(struct inode *inode,
322: int *nr_truncates, int *nr_orphans)
323: {
324: struct super_block *sb = inode->i_sb;
325: int ret;
326:
327: dquot_initialize(inode);
328: if (inode->i_nlink) {
329: if (test_opt(sb, DEBUG))
330: ext4_msg(sb, KERN_DEBUG,
331: "%s: truncating inode %llu to %lld bytes",
332: __func__, inode->i_ino, inode->i_size);
333: ext4_debug("truncating inode %llu to %lld bytes\n",
334: inode->i_ino, inode->i_size);
335: inode_lock(inode);
336: truncate_inode_pages(inode->i_mapping, inode->i_size);
337: ret = ext4_truncate(inode);
338: if (ret) {
339: /*
340: * We need to clean up the in-core orphan list
341: * manually if ext4_truncate() failed to get a
342: * transaction handle.
343: */
344: ext4_orphan_del(NULL, inode);
345: ext4_std_error(inode->i_sb, ret);
346: }
347: inode_unlock(inode);
348: (*nr_truncates)++;
349: } else {
350: if (test_opt(sb, DEBUG))
351: ext4_msg(sb, KERN_DEBUG,
352: "%s: deleting unreferenced inode %llu",
353: __func__, inode->i_ino);
354: ext4_debug("deleting unreferenced inode %llu\n",
355: inode->i_ino);
356: (*nr_orphans)++;
357: }
358: iput(inode); /* The delete magic happens here! */
359: }
SourceFile:fs/ext4/orphan.c]
|
| 12/2 |
2026/05/24 07:30 |
llm |
expert |
0m
Model:
Tokens:
input: 21206
output: 41
thoughts: 5207
Thoughts: **Analyzing a Potential Denial-of-Service Vulnerability in ext4 Orphan Cleanup**
Okay, so I'm thinking through this issue. The core of it seems to be how `ext4_orphan_cleanup` handles potentially very long orphan lists. I recall that `ext4_process_orphan` calls `iput`, which can lead to `ext4_evict_inode` being called, removing the inode. The question is, if the orphan list has a loop or can't be cleaned up, what happens? My initial thought is it would loop forever, but then I remember that `ext4_orphan_del` updates `es->s_last_orphan` and eventually, if `ext4_orphan_get` fails on a deleted inode, the loop should break.
However, a very large list could still be a problem, maybe a malicious image could trigger a huge orphan count, taking too long to process. My mind goes to the maximum inode count and how long that could take. Now, I see this NMI backtrace, and it's pointing at `__bfs` inside `lock_acquire`, and that's concerning. It's usually in lockdep, when a lock is taken for the first time. Lockdep seems to be doing lockdep graph search for a while, and that's not good. The key is in `loop_queue_work`. My thinking goes through the process. Huge number of orphan inodes leads to lots of bios through quota updates. Now I see that `lockdep` is doing `__bfs` if a new dependency is added, but usually the lock classes are static.
Wait, looking at the backtrace, it's adding a new dependency with a new lock. It's related to the `loop_queue_work` calls which happen for every bio submitted to the loop device. This is related to `rt_mutex_slowunlock` and `mark_wakeup_next_waiter`. I get it! `mark_wakeup_next_waiter` is grabbing the `pi_lock` of the task being woken up - that's a per-task lock. That's a huge potential for a performance issue and lockdep getting hung up. So that would explain why `__bfs` is taking so long. `queue_work` wakes up the worker. I remember that `spin_unlock_irq` calls `rt_mutex_slowunlock`, and that might wake up a waiter on `lo->lo_work_lock`. So the `kworker` is actually holding the `lo->lo_work_lock`. So `syz.2.401` has the lock and then releases it, so the work queue can continue. Now I check lockdep. It's showing that the `kworker` holds the lock, but in PREEMPT_RT, spin_lock is a rt_mutex, so `syz.2.401` must be unlocking.
So now I look at `loop_queue_work` and see the lock is acquired and released. `syz.2.401` must have acquired it and then released it. Now I check what the lock is and why lockdep is saying that the `kworker` holds it. Ah, I see that other worker threads have it too! It's a different `loop` device. So now I'm thinking, is the BFS slow because the graph is huge, or is the graph corrupted? The key is the repeated `loop_queue_work` calls, and it comes back to the quota updates via `ext4_orphan_cleanup`. This means that `ext4_orphan_cleanup` can process millions of orphans, but since `kworker` is taking the bios it'll take more than 143 seconds. `syz.2.401` is holding the umount, which will block other umount requests on the same filesystem. I keep getting blocked by another process. Wait, the trace says `syz.1.125` is waiting for `sb_writers#14` and that means the mount is taking a long time. So the umount calls must be from a separate process. It can be blocked by `mnt_want_write`.
Who holds `sb_writers`? The task to hold sb_writers is `sb_start_write` or `freeze_super`. Now, could someone be freezing the filesystem? No. So I check, is `ext4_fill_super` freezing the filesystem. Then I remember that `ext4_orphan_cleanup` may turn on the quota, meaning it's submitting bios. Now, `syz.2.401` is doing mount. Is `syz.1.125`
|
| 13/2 |
2026/05/24 07:31 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/loop.c IncludeLines:true Name:loop_process_work]
Results: map[SourceCode:1946: static void loop_process_work(struct loop_worker *worker,
1947: struct list_head *cmd_list, struct loop_device *lo)
1948: {
1949: int orig_flags = current->flags;
1950: struct loop_cmd *cmd;
1951:
1952: current->flags |= PF_LOCAL_THROTTLE | PF_MEMALLOC_NOIO;
1953: spin_lock_irq(&lo->lo_work_lock);
1954: while (!list_empty(cmd_list)) {
1955: cmd = container_of(
1956: cmd_list->next, struct loop_cmd, list_entry);
1957: list_del(cmd_list->next);
1958: spin_unlock_irq(&lo->lo_work_lock);
1959:
1960: loop_handle_cmd(cmd);
1961: cond_resched();
1962:
1963: spin_lock_irq(&lo->lo_work_lock);
1964: }
1965:
1966: /*
1967: * We only add to the idle list if there are no pending cmds
1968: * *and* the worker will not run again which ensures that it
1969: * is safe to free any worker on the idle list
1970: */
1971: if (worker && !work_pending(&worker->work)) {
1972: worker->last_ran_at = jiffies;
1973: list_add_tail(&worker->idle_list, &lo->idle_worker_list);
1974: loop_set_timer(lo);
1975: }
1976: spin_unlock_irq(&lo->lo_work_lock);
1977: current->flags = orig_flags;
1978: }
SourceFile:drivers/block/loop.c]
|
| 14/2 |
2026/05/24 07:31 |
llm |
expert |
0m
Model:
Tokens:
input: 28029
output: 41
thoughts: 47
Thoughts: Okay, here's my interpretation of those thoughts, tailored for an expert audience:
**Analyzing the Write Operations in `loop_handle_cmd`**
Alright, a red flag just went up. I'm focusing on `loop_handle_cmd` because I suspect a potential write bottleneck. I need to clarify how it interacts with the backing file. Specifically, I'm concerned that it's *writing* directly to the backing file, as opposed to performing any buffering or caching.
If that's the case β and this is my current hypothesis β each write operation would inherently require acquiring and using `sb_writers` from the backing file's filesystem. That's not ideal, as those are potentially held globally and can easily become a point of contention. The number of writers can impact performance. This would likely cause lock contention and reduced throughput if `loop_handle_cmd` is called often. The more writes and, thus, the number of filesystems being written to, the more this becomes an issue.
Therefore, it's time to dive into the code and rigorously examine `loop_handle_cmd` to confirm my suspicions and pinpoint the precise write behavior. I need to track down the exact locations where it's writing to the backing file.
|
| 15/2 |
2026/05/24 07:31 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/loop.c IncludeLines:true Name:loop_handle_cmd]
Results: map[SourceCode:1894: static void loop_handle_cmd(struct loop_cmd *cmd)
1895: {
1896: struct cgroup_subsys_state *cmd_blkcg_css = cmd->blkcg_css;
1897: struct cgroup_subsys_state *cmd_memcg_css = cmd->memcg_css;
1898: struct request *rq = blk_mq_rq_from_pdu(cmd);
1899: const bool write = op_is_write(req_op(rq));
1900: struct loop_device *lo = rq->q->queuedata;
1901: int ret = 0;
1902: struct mem_cgroup *old_memcg = NULL;
1903:
1904: if (write && (lo->lo_flags & LO_FLAGS_READ_ONLY)) {
1905: ret = -EIO;
1906: goto failed;
1907: }
1908:
1909: /* We can block in this context, so ignore REQ_NOWAIT. */
1910: if (rq->cmd_flags & REQ_NOWAIT)
1911: rq->cmd_flags &= ~REQ_NOWAIT;
1912:
1913: if (cmd_blkcg_css)
1914: kthread_associate_blkcg(cmd_blkcg_css);
1915: if (cmd_memcg_css)
1916: old_memcg = set_active_memcg(
1917: mem_cgroup_from_css(cmd_memcg_css));
1918:
1919: /*
1920: * do_req_filebacked() may call blk_mq_complete_request() synchronously
1921: * or asynchronously if using aio. Hence, do not touch 'cmd' after
1922: * do_req_filebacked() has returned unless we are sure that 'cmd' has
1923: * not yet been completed.
1924: */
1925: ret = do_req_filebacked(lo, rq);
1926:
1927: if (cmd_blkcg_css)
1928: kthread_associate_blkcg(NULL);
1929:
1930: if (cmd_memcg_css) {
1931: set_active_memcg(old_memcg);
1932: css_put(cmd_memcg_css);
1933: }
1934: failed:
1935: /* complete non-aio request */
1936: if (ret != -EIOCBQUEUED) {
1937: if (ret == -EOPNOTSUPP)
1938: cmd->ret = ret;
1939: else
1940: cmd->ret = ret ? -EIO : 0;
1941: if (likely(!blk_should_fake_timeout(rq->q)))
1942: blk_mq_complete_request(rq);
1943: }
1944: }
SourceFile:drivers/block/loop.c]
|
| 16/2 |
2026/05/24 07:31 |
llm |
expert |
0m
Model:
Tokens:
input: 29245
output: 41
thoughts: 82
Thoughts: Here's my analysis of the code flow:
**Analyzing the File I/O Path**
Okay, so `do_req_filebacked` seems to be the entry point for file-backed requests. It branches out to three key functions: `lo_rw_aio`, `lo_fallocate`, or `lo_req_flush`. The focus, for me, is on the write path, so I need to understand how data is actually written to the underlying storage. That points directly to `lo_rw_aio`.
Looking deeper, `lo_rw_aio` itself calls `vfs_iter_write`. Ah, *there* it is - the virtual filesystem write iterator! And I see that `vfs_iter_write` *immediately* calls `sb_start_write`! Right, that's the standard superblock-based write locking that is fundamental to many file systems.
My next step is to examine `vfs_iter_write`, or potentially, the function it *ultimately* calls, `call_write_iter`, to confirm that the `sb_start_write` call is expected, the correct place, and that there are no obvious problems with its implementation. This is likely the crucial spot where the write operation is orchestrated.
|
| 17/2 |
2026/05/24 07:31 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/loop.c IncludeLines:true Name:lo_rw_aio]
Results: map[SourceCode: 340: static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd,
341: loff_t pos, int rw)
342: {
343: struct iov_iter iter;
344: struct req_iterator rq_iter;
345: struct bio_vec *bvec;
346: struct request *rq = blk_mq_rq_from_pdu(cmd);
347: struct bio *bio = rq->bio;
348: struct file *file = lo->lo_backing_file;
349: struct bio_vec tmp;
350: unsigned int offset;
351: unsigned int nr_bvec;
352: int ret;
353:
354: nr_bvec = blk_rq_nr_bvec(rq);
355:
356: if (rq->bio != rq->biotail) {
357:
358: bvec = kmalloc_objs(struct bio_vec, nr_bvec, GFP_NOIO);
359: if (!bvec)
360: return -EIO;
361: cmd->bvec = bvec;
362:
363: /*
364: * The bios of the request may be started from the middle of
365: * the 'bvec' because of bio splitting, so we can't directly
366: * copy bio->bi_iov_vec to new bvec. The rq_for_each_bvec
367: * API will take care of all details for us.
368: */
369: rq_for_each_bvec(tmp, rq, rq_iter) {
370: *bvec = tmp;
371: bvec++;
372: }
373: bvec = cmd->bvec;
374: offset = 0;
375: } else {
376: /*
377: * Same here, this bio may be started from the middle of the
378: * 'bvec' because of bio splitting, so offset from the bvec
379: * must be passed to iov iterator
380: */
381: offset = bio->bi_iter.bi_bvec_done;
382: bvec = __bvec_iter_bvec(bio->bi_io_vec, bio->bi_iter);
383: }
384: atomic_set(&cmd->ref, 2);
385:
386: iov_iter_bvec(&iter, rw, bvec, nr_bvec, blk_rq_bytes(rq));
387: iter.iov_offset = offset;
388:
389: cmd->iocb.ki_pos = pos;
390: cmd->iocb.ki_filp = file;
391: cmd->iocb.ki_ioprio = req_get_ioprio(rq);
392: if (cmd->use_aio) {
393: cmd->iocb.ki_complete = lo_rw_aio_complete;
394: cmd->iocb.ki_flags = IOCB_DIRECT;
395: } else {
396: cmd->iocb.ki_complete = NULL;
397: cmd->iocb.ki_flags = 0;
398: }
399:
400: if (rw == ITER_SOURCE) {
401: kiocb_start_write(&cmd->iocb);
402: ret = file->f_op->write_iter(&cmd->iocb, &iter);
403: } else
404: ret = file->f_op->read_iter(&cmd->iocb, &iter);
405:
406: lo_rw_aio_do_completion(cmd);
407:
408: if (ret != -EIOCBQUEUED)
409: lo_rw_aio_complete(&cmd->iocb, ret);
410: return -EIOCBQUEUED;
411: }
SourceFile:drivers/block/loop.c]
|
| 18/2 |
2026/05/24 07:31 |
llm |
expert |
0m
Model:
Tokens:
input: 30816
output: 43
thoughts: 3743
Thoughts: **Analyzing a PerCPU Read/Write Semaphore Contention in the Loop Device Context**
Alright, let's break this down. We're looking at a scenario where a syzkaller test case is getting blocked, seemingly on a percpu read/write semaphore (`sb_writers#14`), within the context of loop device operations. The initial clue is `kiocb_start_write`, which calls `sb_start_write` if the file is opened for writing. This immediately flags the potential for write contention on the filesystem.
My thinking then jumps to the lockdep output. We see that `kworker/u8:10`, our loop worker, is involved, and it acquires `lo->lo_work_lock`. However, it *doesn't* hold `sb_writers`, which is crucial. So, `kiocb_start_write` must be called from somewhere *inside* `lo_rw_aio` that is *outside* the `lo->lo_work_lock`. The loop worker releases its lock, potentially making a write call, and then reacquires its lock. Fine. We see that some other syz task (`syz.1.125`) is blocked on `sb_writers#14`. Lockdep confirms that nobody is listed as holding the write lock.
I know that `sb_writers` is a percpu read/write semaphore. My experience tells me this implies the `syz.1.125` is blocked trying to acquire the read lock. This means a write lock is *held* (or pending) and this new reader is blocked, preventing writer starvation.
We need to identify the writer. The lockdep output points to either a corrupted `percpu_rwsem` or pending writer.
The interesting lead is the long duration `syz.1.125` has been blocked. `syz.2.401` appears in the stack traces, involved in a mount operation which calls `ext4_fill_super`. It's definitely mounting a loop device. So, `syz.2.401` submits bios to a loop device, which in turn writes to the backing file which *is* on `sb_writers#14`. So, `kworker/u8:10` takes the read lock on the semaphore, releases it, and repeats the process for each write, which is fine, because reads can be done concurrently. So far so good. `kworker` takes the read lock and releases it for each bio it processes, but that shouldn't block other readers, unless someone is attempting to get a write lock!
The critical question now: who is attempting to take the write lock? My intuition jumps to a possible `FIFREEZE` ioctl call from syzkaller, which would trigger `freeze_super`, but `kworker` *should* release quickly, so any writer should not be blocked for very long. But, then `kworker` will be blocked the other way, and maybe not submit bios to `syz.2.401`.
But, wait... `syz.2.401` is not blocked on any queue! It's running inside `__bfs` as part of the lockdep graph search! It *should* only be in `__bfs` at the time a new dependency is being searched... not all the time! This should be fast. If it's running in `__bfs` for a long time, the lockdep code is probably stuck in an infinite loop! Also, while `__bfs` is running, the `lockdep_lock` is held, and no other task can acquire any other lock at all. Is `syz.1.125` being blocked on this lock? No, that can't be, because `syz.1.125` calls `schedule()` inside the semaphore code, so it doesn't hold `lockdep_lock`. However, `syz.2.401` must be submitted millions of bios, since this takes 143 seconds. Does it take a long time to search for a new dependency? If the cache is full, it has to repeat the calculation to re-calculate a lock graph dependency. Is the number of dependencies the problem?
If `kworker` is NOT submitting bios, `syz.2.401` should block, but is not blocked. What's wrong? Is `kworker` processing too slow?
Now, the other possibility is that `syz.1.125` is being blocked because `syz.2.401` somehow *holds* the `sb_writers#14`. How could that happen? During a mount? No, the mount syscall does not
|
| 19/2 |
2026/05/24 07:32 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/ext4/super.c IncludeLines:true Name:ext4_fill_super]
Results: map[SourceCode:5804: static int ext4_fill_super(struct super_block *sb, struct fs_context *fc)
5805: {
5806: struct ext4_fs_context *ctx = fc->fs_private;
5807: struct ext4_sb_info *sbi;
5808: const char *descr;
5809: int ret;
5810:
5811: sbi = ext4_alloc_sbi(sb);
5812: if (!sbi)
5813: return -ENOMEM;
5814:
5815: fc->s_fs_info = sbi;
5816:
5817: /* Cleanup superblock name */
5818: strreplace(sb->s_id, '/', '!');
5819:
5820: sbi->s_sb_block = 1; /* Default super block location */
5821: if (ctx->spec & EXT4_SPEC_s_sb_block)
5822: sbi->s_sb_block = ctx->s_sb_block;
5823:
5824: ret = __ext4_fill_super(fc, sb);
5825: if (ret < 0)
5826: goto free_sbi;
5827:
5828: if (sbi->s_journal) {
5829: if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
5830: descr = " journalled data mode";
5831: else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
5832: descr = " ordered data mode";
5833: else
5834: descr = " writeback data mode";
5835: } else
5836: descr = "out journal";
5837:
5838: if (___ratelimit(&ext4_mount_msg_ratelimit, "EXT4-fs mount"))
5839: ext4_msg(sb, KERN_INFO, "mounted filesystem %pU %s with%s. "
5840: "Quota mode: %s.", &sb->s_uuid,
5841: sb_rdonly(sb) ? "ro" : "r/w", descr,
5842: ext4_quota_mode(sb));
5843:
5844: /* Update the s_overhead_clusters if necessary */
5845: ext4_update_overhead(sb, false);
5846: return 0;
5847:
5848: free_sbi:
5849: ext4_free_sbi(sbi);
5850: fc->s_fs_info = NULL;
5851: return ret;
5852: }
SourceFile:fs/ext4/super.c]
|
| 20/2 |
2026/05/24 07:32 |
llm |
expert |
0m
Model:
Tokens:
input: 36432
output: 44
thoughts: 13
Thoughts: Okay, let's dive into this. Here's my thought process on this:
**Analyzing `__ext4_fill_super`**
Alright, the objective is pretty clear. I need to take a good, hard look at `__ext4_fill_super`. It's the core of how the ext4 filesystem gets mounted and its metadata structures are populated. I know that function is responsible for initializing the superblock and filling in the critical details the kernel needs to understand the filesystem. My focus needs to be thorough. I'm thinking about the control flow, the data structures it manipulates, and the potential error conditions that could arise. I need to refresh my knowledge of the ext4 superblock format, the structure of its inode table and journal. I'll need to look at how it deals with device I/O and potential issues with corrupt or inconsistent filesystem data. Understanding this function is pivotal for understanding the ext4 filesystem, so I'll approach this systematically.
|
| 21/2 |
2026/05/24 07:32 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/ext4/super.c IncludeLines:true Name:__ext4_fill_super]
Results: map[SourceCode:5334: static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
5335: {
5336: struct ext4_super_block *es = NULL;
5337: struct ext4_sb_info *sbi = EXT4_SB(sb);
5338: ext4_fsblk_t logical_sb_block;
5339: struct inode *root;
5340: int needs_recovery;
5341: int err;
5342: ext4_group_t first_not_zeroed;
5343: struct ext4_fs_context *ctx = fc->fs_private;
5344: int silent = fc->sb_flags & SB_SILENT;
5345:
5346: /* Set defaults for the variables that will be set during parsing */
5347: if (!(ctx->spec & EXT4_SPEC_JOURNAL_IOPRIO))
5348: ctx->journal_ioprio = EXT4_DEF_JOURNAL_IOPRIO;
5349:
5350: sbi->s_inode_readahead_blks = EXT4_DEF_INODE_READAHEAD_BLKS;
5351: sbi->s_sectors_written_start =
5352: part_stat_read(sb->s_bdev, sectors[STAT_WRITE]);
5353:
5354: err = ext4_load_super(sb, &logical_sb_block, silent);
5355: if (err)
5356: goto out_fail;
5357:
5358: es = sbi->s_es;
5359: sbi->s_kbytes_written = le64_to_cpu(es->s_kbytes_written);
5360:
5361: err = ext4_init_metadata_csum(sb, es);
5362: if (err)
5363: goto failed_mount;
5364:
5365: ext4_set_def_opts(sb, es);
5366:
5367: sbi->s_resuid = make_kuid(&init_user_ns, ext4_get_resuid(es));
5368: sbi->s_resgid = make_kgid(&init_user_ns, ext4_get_resuid(es));
5369: sbi->s_commit_interval = JBD2_DEFAULT_MAX_COMMIT_AGE * HZ;
5370: sbi->s_min_batch_time = EXT4_DEF_MIN_BATCH_TIME;
5371: sbi->s_max_batch_time = EXT4_DEF_MAX_BATCH_TIME;
5372: sbi->s_sb_update_kb = EXT4_DEF_SB_UPDATE_INTERVAL_KB;
5373: sbi->s_sb_update_sec = EXT4_DEF_SB_UPDATE_INTERVAL_SEC;
5374:
5375: /*
5376: * set default s_li_wait_mult for lazyinit, for the case there is
5377: * no mount option specified.
5378: */
5379: sbi->s_li_wait_mult = EXT4_DEF_LI_WAIT_MULT;
5380:
5381: err = ext4_inode_info_init(sb, es);
5382: if (err)
5383: goto failed_mount;
5384:
5385: err = parse_apply_sb_mount_options(sb, ctx);
5386: if (err < 0)
5387: goto failed_mount;
5388:
5389: sbi->s_def_mount_opt = sbi->s_mount_opt;
5390: sbi->s_def_mount_opt2 = sbi->s_mount_opt2;
5391:
5392: err = ext4_check_opt_consistency(fc, sb);
5393: if (err < 0)
5394: goto failed_mount;
5395:
5396: ext4_apply_options(fc, sb);
5397:
5398: err = ext4_check_large_folio(sb);
5399: if (err < 0)
5400: goto failed_mount;
5401:
5402: err = ext4_encoding_init(sb, es);
5403: if (err)
5404: goto failed_mount;
5405:
5406: err = ext4_check_journal_data_mode(sb);
5407: if (err)
5408: goto failed_mount;
5409:
5410: sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
5411: (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
5412:
5413: /* HSM events are allowed by default. */
5414: sb->s_iflags |= SB_I_ALLOW_HSM;
5415:
5416: err = ext4_check_feature_compatibility(sb, es, silent);
5417: if (err)
5418: goto failed_mount;
5419:
5420: err = ext4_block_group_meta_init(sb, silent);
5421: if (err)
5422: goto failed_mount;
5423:
5424: err = ext4_hash_info_init(sb);
5425: if (err)
5426: goto failed_mount;
5427:
5428: err = ext4_handle_clustersize(sb);
5429: if (err)
5430: goto failed_mount;
5431:
5432: err = ext4_check_geometry(sb, es);
5433: if (err)
5434: goto failed_mount;
5435:
5436: timer_setup(&sbi->s_err_report, print_daily_error_info, 0);
5437: spin_lock_init(&sbi->s_error_lock);
5438: mutex_init(&sbi->s_error_notify_mutex);
5439: INIT_WORK(&sbi->s_sb_upd_work, update_super_work);
5440:
5441: err = ext4_group_desc_init(sb, es, logical_sb_block, &first_not_zeroed);
5442: if (err)
5443: goto failed_mount3;
5444:
5445: err = ext4_es_register_shrinker(sbi);
5446: if (err)
5447: goto failed_mount3;
5448:
5449: sbi->s_stripe = ext4_get_stripe_size(sbi);
5450: if (ext4_is_stripe_incompatible(sb, sbi->s_stripe)) {
5451: ext4_msg(sb, KERN_WARNING,
5452: "stripe (%lu) is not aligned with cluster size (%u), "
5453: "stripe is disabled",
5454: sbi->s_stripe, sbi->s_cluster_ratio);
5455: sbi->s_stripe = 0;
5456: }
5457: sbi->s_extent_max_zeroout_kb = 32;
5458:
5459: /*
5460: * set up enough so that it can read an inode
5461: */
5462: sb->s_op = &ext4_sops;
5463: sb->s_export_op = &ext4_export_ops;
5464: sb->s_xattr = ext4_xattr_handlers;
5465: #ifdef CONFIG_FS_ENCRYPTION
5466: sb->s_cop = &ext4_cryptops;
5467: #endif
5468: #ifdef CONFIG_FS_VERITY
5469: sb->s_vop = &ext4_verityops;
5470: #endif
5471: #ifdef CONFIG_QUOTA
5472: sb->dq_op = &ext4_quota_operations;
5473: if (ext4_has_feature_quota(sb))
5474: sb->s_qcop = &dquot_quotactl_sysfile_ops;
5475: else
5476: sb->s_qcop = &ext4_qctl_operations;
5477: sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;
5478: #endif
5479: super_set_uuid(sb, es->s_uuid, sizeof(es->s_uuid));
5480: super_set_sysfs_name_bdev(sb);
5481:
5482: INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
5483: mutex_init(&sbi->s_orphan_lock);
5484:
5485: spin_lock_init(&sbi->s_bdev_wb_lock);
5486:
5487: ext4_atomic_write_init(sb);
5488: ext4_fast_commit_init(sb);
5489:
5490: sb->s_root = NULL;
5491:
5492: needs_recovery = (es->s_last_orphan != 0 ||
5493: ext4_has_feature_orphan_present(sb) ||
5494: ext4_has_feature_journal_needs_recovery(sb));
5495:
5496: if (ext4_has_feature_mmp(sb) && !sb_rdonly(sb)) {
5497: err = ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block));
5498: if (err)
5499: goto failed_mount3a;
5500: }
5501:
5502: err = -EINVAL;
5503: /*
5504: * The first inode we look at is the journal inode. Don't try
5505: * root first: it may be modified in the journal!
5506: */
5507: if (!test_opt(sb, NOLOAD) && ext4_has_feature_journal(sb)) {
5508: err = ext4_load_and_init_journal(sb, es, ctx);
5509: if (err)
5510: goto failed_mount3a;
5511: if (bdev_read_only(sb->s_bdev))
5512: needs_recovery = 0;
5513: } else if (test_opt(sb, NOLOAD) && !sb_rdonly(sb) &&
5514: ext4_has_feature_journal_needs_recovery(sb)) {
5515: ext4_msg(sb, KERN_ERR, "required journal recovery "
5516: "suppressed and not mounted read-only");
5517: goto failed_mount3a;
5518: } else {
5519: const char *journal_option;
5520:
5521: /* Nojournal mode, all journal mount options are illegal */
5522: journal_option = ext4_has_journal_option(sb);
5523: if (journal_option != NULL) {
5524: ext4_msg(sb, KERN_ERR,
5525: "can't mount with %s, fs mounted w/o journal",
5526: journal_option);
5527: goto failed_mount3a;
5528: }
5529:
5530: sbi->s_def_mount_opt &= ~EXT4_MOUNT_JOURNAL_CHECKSUM;
5531: clear_opt(sb, JOURNAL_CHECKSUM);
5532: clear_opt(sb, DATA_FLAGS);
5533: clear_opt2(sb, JOURNAL_FAST_COMMIT);
5534: sbi->s_journal = NULL;
5535: needs_recovery = 0;
5536: }
5537:
5538: if (!test_opt(sb, NO_MBCACHE)) {
5539: sbi->s_ea_block_cache = ext4_xattr_create_cache();
5540: if (!sbi->s_ea_block_cache) {
5541: ext4_msg(sb, KERN_ERR,
5542: "Failed to create ea_block_cache");
5543: err = -EINVAL;
5544: goto failed_mount_wq;
5545: }
5546:
5547: if (ext4_has_feature_ea_inode(sb)) {
5548: sbi->s_ea_inode_cache = ext4_xattr_create_cache();
5549: if (!sbi->s_ea_inode_cache) {
5550: ext4_msg(sb, KERN_ERR,
5551: "Failed to create ea_inode_cache");
5552: err = -EINVAL;
5553: goto failed_mount_wq;
5554: }
5555: }
5556: }
5557:
5558: /*
5559: * Get the # of file system overhead blocks from the
5560: * superblock if present.
5561: */
5562: sbi->s_overhead = le32_to_cpu(es->s_overhead_clusters);
5563: /* ignore the precalculated value if it is ridiculous */
5564: if (sbi->s_overhead > ext4_blocks_count(es))
5565: sbi->s_overhead = 0;
5566: /*
5567: * If the bigalloc feature is not enabled recalculating the
5568: * overhead doesn't take long, so we might as well just redo
5569: * it to make sure we are using the correct value.
5570: */
5571: if (!ext4_has_feature_bigalloc(sb))
5572: sbi->s_overhead = 0;
5573: if (sbi->s_overhead == 0) {
5574: err = ext4_calculate_overhead(sb);
5575: if (err)
5576: goto failed_mount_wq;
5577: }
5578:
5579: /*
5580: * The maximum number of concurrent works can be high and
5581: * concurrency isn't really necessary. Limit it to 1.
5582: */
5583: EXT4_SB(sb)->rsv_conversion_wq =
5584: alloc_workqueue("ext4-rsv-conversion", WQ_MEM_RECLAIM | WQ_UNBOUND, 1);
5585: if (!EXT4_SB(sb)->rsv_conversion_wq) {
5586: printk(KERN_ERR "EXT4-fs: failed to create workqueue\n");
5587: err = -ENOMEM;
5588: goto failed_mount4;
5589: }
5590:
5591: /*
5592: * The jbd2_journal_load will have done any necessary log recovery,
5593: * so we can safely mount the rest of the filesystem now.
5594: */
5595:
5596: root = ext4_iget(sb, EXT4_ROOT_INO, EXT4_IGET_SPECIAL);
5597: if (IS_ERR(root)) {
5598: ext4_msg(sb, KERN_ERR, "get root inode failed");
5599: err = PTR_ERR(root);
5600: root = NULL;
5601: goto failed_mount4;
5602: }
5603: if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
5604: ext4_msg(sb, KERN_ERR, "corrupt root inode, run e2fsck");
5605: iput(root);
5606: err = -EFSCORRUPTED;
5607: goto failed_mount4;
5608: }
5609:
5610: generic_set_sb_d_ops(sb);
5611: sb->s_root = d_make_root(root);
5612: if (!sb->s_root) {
5613: ext4_msg(sb, KERN_ERR, "get root dentry failed");
5614: err = -ENOMEM;
5615: goto failed_mount4;
5616: }
5617:
5618: err = ext4_setup_super(sb, es, sb_rdonly(sb));
5619: if (err == -EROFS) {
5620: sb->s_flags |= SB_RDONLY;
5621: } else if (err)
5622: goto failed_mount4a;
5623:
5624: ext4_set_resv_clusters(sb);
5625:
5626: if (test_opt(sb, BLOCK_VALIDITY)) {
5627: err = ext4_setup_system_zone(sb);
5628: if (err) {
5629: ext4_msg(sb, KERN_ERR, "failed to initialize system "
5630: "zone (%d)", err);
5631: goto failed_mount4a;
5632: }
5633: }
5634: ext4_fc_replay_cleanup(sb);
5635:
5636: ext4_ext_init(sb);
5637:
5638: /*
5639: * Enable optimize_scan if number of groups is > threshold. This can be
5640: * turned off by passing "mb_optimize_scan=0". This can also be
5641: * turned on forcefully by passing "mb_optimize_scan=1".
5642: */
5643: if (!(ctx->spec & EXT4_SPEC_mb_optimize_scan)) {
5644: if (sbi->s_groups_count >= MB_DEFAULT_LINEAR_SCAN_THRESHOLD)
5645: set_opt2(sb, MB_OPTIMIZE_SCAN);
5646: else
5647: clear_opt2(sb, MB_OPTIMIZE_SCAN);
5648: }
5649:
5650: err = ext4_percpu_param_init(sbi);
5651: if (err)
5652: goto failed_mount5;
5653:
5654: err = ext4_mb_init(sb);
5655: if (err) {
5656: ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)",
5657: err);
5658: goto failed_mount5;
5659: }
5660:
5661: /*
5662: * We can only set up the journal commit callback once
5663: * mballoc is initialized
5664: */
5665: if (sbi->s_journal)
5666: sbi->s_journal->j_commit_callback =
5667: ext4_journal_commit_callback;
5668:
5669: if (ext4_has_feature_flex_bg(sb))
5670: if (!ext4_fill_flex_info(sb)) {
5671: ext4_msg(sb, KERN_ERR,
5672: "unable to initialize "
5673: "flex_bg meta info!");
5674: err = -ENOMEM;
5675: goto failed_mount6;
5676: }
5677:
5678: err = ext4_register_li_request(sb, first_not_zeroed);
5679: if (err)
5680: goto failed_mount6;
5681:
5682: err = ext4_init_orphan_info(sb);
5683: if (err)
5684: goto failed_mount7;
5685: #ifdef CONFIG_QUOTA
5686: /* Enable quota usage during mount. */
5687: if (ext4_has_feature_quota(sb) && !sb_rdonly(sb)) {
5688: err = ext4_enable_quotas(sb);
5689: if (err)
5690: goto failed_mount8;
5691: }
5692: #endif /* CONFIG_QUOTA */
5693:
5694: /*
5695: * Save the original bdev mapping's wb_err value which could be
5696: * used to detect the metadata async write error.
5697: */
5698: errseq_check_and_advance(&sb->s_bdev->bd_mapping->wb_err,
5699: &sbi->s_bdev_wb_err);
5700: EXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS;
5701: ext4_orphan_cleanup(sb, es);
5702: EXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS;
5703: /*
5704: * Update the checksum after updating free space/inode counters and
5705: * ext4_orphan_cleanup. Otherwise the superblock can have an incorrect
5706: * checksum in the buffer cache until it is written out and
5707: * e2fsprogs programs trying to open a file system immediately
5708: * after it is mounted can fail.
5709: */
5710: ext4_superblock_csum_set(sb);
5711: if (needs_recovery) {
5712: ext4_msg(sb, KERN_INFO, "recovery complete");
5713: err = ext4_mark_recovery_complete(sb, es);
5714: if (err)
5715: goto failed_mount9;
5716: }
5717:
5718: if (test_opt(sb, DISCARD) && !bdev_max_discard_sectors(sb->s_bdev)) {
5719: ext4_msg(sb, KERN_WARNING,
5720: "mounting with \"discard\" option, but the device does not support discard");
5721: clear_opt(sb, DISCARD);
5722: }
5723:
5724: if (es->s_error_count) {
5725: sbi->s_err_report_sec = 5*60; /* first time 5 minutes */
5726: mod_timer(&sbi->s_err_report,
5727: jiffies + secs_to_jiffies(sbi->s_err_report_sec));
5728: }
5729: sbi->s_err_report_sec = 24*60*60; /* Once a day */
5730:
5731: /* Enable message ratelimiting. Default is 10 messages per 5 secs. */
5732: ratelimit_state_init(&sbi->s_err_ratelimit_state, 5 * HZ, 10);
5733: ratelimit_state_init(&sbi->s_warning_ratelimit_state, 5 * HZ, 10);
5734: ratelimit_state_init(&sbi->s_msg_ratelimit_state, 5 * HZ, 10);
5735: atomic_set(&sbi->s_warning_count, 0);
5736: atomic_set(&sbi->s_msg_count, 0);
5737:
5738: /* Register sysfs after all initializations are complete. */
5739: err = ext4_register_sysfs(sb);
5740: if (err)
5741: goto failed_mount9;
5742:
5743: return 0;
5744:
5745: failed_mount9:
5746: ext4_quotas_off(sb, EXT4_MAXQUOTAS);
5747: failed_mount8: __maybe_unused
5748: ext4_release_orphan_info(sb);
5749: failed_mount7:
5750: ext4_unregister_li_request(sb);
5751: failed_mount6:
5752: ext4_mb_release(sb);
5753: ext4_flex_groups_free(sbi);
5754: failed_mount5:
5755: ext4_percpu_param_destroy(sbi);
5756: ext4_ext_release(sb);
5757: ext4_release_system_zone(sb);
5758: failed_mount4a:
5759: dput(sb->s_root);
5760: sb->s_root = NULL;
5761: failed_mount4:
5762: ext4_msg(sb, KERN_ERR, "mount failed");
5763: if (EXT4_SB(sb)->rsv_conversion_wq)
5764: destroy_workqueue(EXT4_SB(sb)->rsv_conversion_wq);
5765: failed_mount_wq:
5766: ext4_xattr_destroy_cache(sbi->s_ea_inode_cache);
5767: sbi->s_ea_inode_cache = NULL;
5768:
5769: ext4_xattr_destroy_cache(sbi->s_ea_block_cache);
5770: sbi->s_ea_block_cache = NULL;
5771:
5772: if (sbi->s_journal) {
5773: ext4_journal_destroy(sbi, sbi->s_journal);
5774: }
5775: failed_mount3a:
5776: ext4_es_unregister_shrinker(sbi);
5777: failed_mount3:
5778: /* flush s_sb_upd_work before sbi destroy */
5779: flush_work(&sbi->s_sb_upd_work);
5780: ext4_stop_mmpd(sbi);
5781: timer_delete_sync(&sbi->s_err_report);
5782: ext4_group_desc_free(sbi);
5783: failed_mount:
5784: #if IS_ENABLED(CONFIG_UNICODE)
5785: utf8_unload(sb->s_encoding);
5786: #endif
5787:
5788: #ifdef CONFIG_QUOTA
5789: for (unsigned int i = 0; i < EXT4_MAXQUOTAS; i++)
5790: kfree(get_qf_name(sb, sbi, i));
5791: #endif
5792: fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy);
5793: brelse(sbi->s_sbh);
5794: if (sbi->s_journal_bdev_file) {
5795: invalidate_bdev(file_bdev(sbi->s_journal_bdev_file));
5796: bdev_fput(sbi->s_journal_bdev_file);
5797: }
5798: out_fail:
5799: invalidate_bdev(sb->s_bdev);
5800: sb->s_fs_info = NULL;
5801: return err;
5802: }
SourceFile:fs/ext4/super.c]
|
| 22/2 |
2026/05/24 07:32 |
llm |
expert |
0m
Model:
Tokens:
input: 44490
output: 43
thoughts: 1150
Thoughts: **Analyzing a Mount/Lock Contention in ext4**
Okay, let's break this down. First, I need to consider the order of operations concerning `ext4_orphan_cleanup`, which is called before `ext4_register_sysfs`, but *after* `generic_set_sb_d_ops(sb)` and `sb->s_root = d_make_root(root)`. It's crucial to understand if `ext4_orphan_cleanup` potentially holds `sb_writers`, but I've already confirmed it does not.
Now, the core issue seems to be `syz.1.125` being blocked in `mnt_want_write`. This indicates a write operation is contending for a mount. `mnt_want_write` calls `sb_start_write`, so `syz.1.125` is attempting a write on *some* filesystem. The question is, *which* one?
If `syz.1.125` is doing an `openat`, it's interacting with a file. If this is on the root filesystem, it's taking `sb_writers` of the root. However, another possibility is a loop device mounted on the root. A `kworker` process might be taking and releasing this lock as part of the loop device mounting process, which wouldn't *necessarily* block unless there was a *pending* writer. But this doesn't seem to be the case. The question is, does the mount of the loop device have a pending writer?
I need to circle back and look at the specifics. The fact that `syz.1.125` is blocked in `percpu_rwsem_wait` suggests it's waiting for a read lock. This means there's a writer somewhere. But the loop device's filesystem isn't fully mounted yet, since `ext4_fill_super` hasn't finished, so that's not the answer.
Could `syz.1.125` be opening a block device directly, using `/dev/loop2` for instance? Opening a block device *shouldn't* take `sb_writers` of the block device's filesystem (devtmpfs or tmpfs). So, that's unlikely. `sb_start_write` takes `sb_writers` of the mount where the file *resides*. Opening `/dev/loop2` should take `sb_writers` of `devtmpfs`. Is `devtmpfs` frozen? I think that's unlikely.
Okay, let's revisit the lockdep output. It's critical. `syz-executor`, `udevd`, and `udevd` are holding `sb_writers#5`. `syz.1.125` is holding `sb_writers#14`. Lockdep confirms `syz.1.125` *has* acquired the lock! But if it has the lock, why is it blocked in `percpu_rwsem_wait`?
Aha! `sb_writers` is multilevel! It's not just a single lock; there's `SB_FREEZE_WRITE`, `SB_FREEZE_PAGEFAULT`, and `SB_FREEZE_FS`. `mnt_want_write` calls `sb_start_write`, which acquires `SB_FREEZE_WRITE`. Now I need to drill down into the mechanics of `sb_start_write` and, with this additional understanding, I should be able to track down the lock contention.
|
| 23/2 |
2026/05/24 07:33 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:include/linux/fs/super.h IncludeLines:true Name:sb_start_write]
Results: map[SourceCode: 104: /**
105: * sb_start_write - get write access to a superblock
106: * @sb: the super we write to
107: *
108: * When a process wants to write data or metadata to a file system (i.e. dirty
109: * a page or an inode), it should embed the operation in a sb_start_write() -
110: * sb_end_write() pair to get exclusion against file system freezing. This
111: * function increments number of writers preventing freezing. If the file
112: * system is already frozen, the function waits until the file system is
113: * thawed.
114: *
115: * Since freeze protection behaves as a lock, users have to preserve
116: * ordering of freeze protection and other filesystem locks. Generally,
117: * freeze protection should be the outermost lock. In particular, we have:
118: *
119: * sb_start_write
120: * -> i_rwsem (write path, truncate, directory ops, ...)
121: * -> s_umount (freeze_super, thaw_super)
122: */
123: static inline void sb_start_write(struct super_block *sb)
124: {
125: __sb_start_write(sb, SB_FREEZE_WRITE);
126: }
SourceFile:include/linux/fs/super.h]
|
| 24/2 |
2026/05/24 07:33 |
llm |
expert |
0m
Model:
Tokens:
input: 46872
output: 46
thoughts: 688
Thoughts: **Analyzing a Concurrency Puzzle**
Okay, let's break this down. I'm looking at `__sb_start_write` which, as I see it, acquires `s_writers.rw_sem[level-1]`. I'm focused on why a task, specifically `syz.1.125`, seems to be blocked on `rw_sem[0]` (implied by `percpu_rwsem_wait`), while lockdep reports it *already* holds `sb_writers#14`. That sounds contradictory.
Ah, right. The key is how `percpu_down_read` functions. It calls `rwsem_acquire_read` *before* potentially blocking. This is clever; lockdep records the lock as acquired *before* the actual wait happens. So, `syz.1.125` is indeed waiting for `sb_writers#14`, the read lock. Makes sense now.
Now, the really intriguing bit: the lockdep output *doesn't* show anyone holding the *write* lock. But, if a task held that write lock, it *should* appear in the list of locks held. And the output *should* show all tasks. It does, as shown by 'Showing all locks held in the system:' followed by a list. So where is it?
Could it be that the writer isn't running and doesn't hold any *other* locks, so it's not being printed? No, the output *should* show *any* lock. And it shows `kworker/u8:0/12`.
Could the writer be a task that has exited? Wait, `freeze_super` is tied to the mount, so that's probably not it.
What if the write lock isn't held, but a writer is *pending*? If a task is waiting to become a writer, it means it's called `percpu_down_write`, which sets `sem->block = true` and is waiting for readers to drain. At this stage, it's not holding the write lock *yet*, but, it should still be listed, since `percpu_down_write` calls `rwsem_acquire(&sem->rw_sem.dep_map, 0, 0, _RET_IP_)` *before* the wait! So, it *should* be in the "locks held" list.
So... why isn't *anyone* listed as holding `sb_writers#14`? I need to check `percpu_down_write` again to make sure I haven't missed something.
|
| 25/2 |
2026/05/24 07:33 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/locking/percpu-rwsem.c IncludeLines:true Name:percpu_down_write]
Results: map[SourceCode: 227: void __sched percpu_down_write(struct percpu_rw_semaphore *sem)
228: {
229: bool contended = false;
230:
231: might_sleep();
232: rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_);
233:
234: /* Notify readers to take the slow path. */
235: rcu_sync_enter(&sem->rss);
236:
237: /*
238: * Try set sem->block; this provides writer-writer exclusion.
239: * Having sem->block set makes new readers block.
240: */
241: if (!__percpu_down_write_trylock(sem)) {
242: trace_contention_begin(sem, LCB_F_PERCPU | LCB_F_WRITE);
243: percpu_rwsem_wait(sem, /* .reader = */ false, false);
244: contended = true;
245: }
246:
247: /* smp_mb() implied by __percpu_down_write_trylock() on success -- D matches A */
248:
249: /*
250: * If they don't see our store of sem->block, then we are guaranteed to
251: * see their sem->read_count increment, and therefore will wait for
252: * them.
253: */
254:
255: /* Wait for all active readers to complete. */
256: rcuwait_wait_event(&sem->writer, readers_active_check(sem), TASK_UNINTERRUPTIBLE);
257: if (contended)
258: trace_contention_end(sem, 0);
259: }
SourceFile:kernel/locking/percpu-rwsem.c]
|
| 26/2 |
2026/05/24 07:33 |
llm |
expert |
0m
Model:
Tokens:
input: 48722
output: 38
thoughts: 688
Thoughts: **The Mystery of the Missing Writer**
Okay, let's break this down. My initial thought was that `percpu_down_write` would kick things off by calling `rwsem_acquire`, and if a writer was pending, lockdep would *definitely* show it. And, I see from the output that indeed `syz.1.125` *is* holding `sb_writers#14`! The key here is the output:
```
1 lock held by syz.1.125/6522:
#0: ffff88803596e480 (sb_writers#14){++++}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:493
```
But, `syz.1.125` is blocked in `percpu_rwsem_wait`, and since it's the only one holding the lock, I'm now scratching my head and wondering why. `percpu_rwsem_wait` gets called from `__percpu_down_read` if a trylock fails, which is logical, right?
Looking deeper, `__percpu_down_read_trylock` has to check `sem->block`. If that's set, there's a writer active or pending. That's the core of the issue. A writer should be calling `percpu_down_write`, which should be calling `rwsem_acquire`, so *that* task should be listed in lockdep! This is a classic conundrum. Why is there no writer listed?
Wait a second. I remember that `freeze_super` calls `percpu_down_write`. Could there be *another* way `sem->block` is set? No, there isn't. So the only possible source would be `freeze_super`. Could the writer have just exited without releasing the lock? If so, lockdep would raise a warning. This is very interesting, a bit more investigation is needed here...
Aha! `freeze_super` is called by `ioctl(FIFREEZE)`! This is where the lightbulb goes off. A task calls `ioctl(FIFREEZE)`, successfully freezes the filesystem, but then it returns to *user space*! The filesystem is frozen, but it's *holding the lock*!
Yes, that's it! `FIFREEZE` keeps the filesystem frozen until `FITHAW` is called. Bingo! `ioctl(FIFREEZE)` *returns to user space WITH THE LOCK HELD*! That's the root cause. This is how the percpu semaphore can be blocked. The key is in how it's handled by lockdep now, I need to check the lockdep interaction in this case, but I have a pretty good idea of what's going on now.
|
| 27/2 |
2026/05/24 07:33 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/ioctl.c IncludeLines:true Name:ioctl_fsfreeze]
Results: map[SourceCode: 385: static int ioctl_fsfreeze(struct file *filp)
386: {
387: struct super_block *sb = file_inode(filp)->i_sb;
388:
389: if (!ns_capable(sb->s_user_ns, CAP_SYS_ADMIN))
390: return -EPERM;
391:
392: /* If filesystem doesn't support freeze feature, return. */
393: if (sb->s_op->freeze_fs == NULL && sb->s_op->freeze_super == NULL)
394: return -EOPNOTSUPP;
395:
396: /* Freeze */
397: if (sb->s_op->freeze_super)
398: return sb->s_op->freeze_super(sb, FREEZE_HOLDER_USERSPACE, NULL);
399: return freeze_super(sb, FREEZE_HOLDER_USERSPACE, NULL);
400: }
SourceFile:fs/ioctl.c]
|
| 28/2 |
2026/05/24 07:33 |
llm |
expert |
0m
Model:
Tokens:
input: 50378
output: 37
thoughts: 9
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:
**Quick Check on `freeze_super`**
Alright, I'm thinking about a section of the codebase and need to verify the state of `freeze_super`. It's a key variable in this area. I need to quickly recall where it's used and what its significance is. I'm probably looking at a potential issue β maybe a race condition, a bug report, or a change I'm about to implement. The fact that `freeze_super` popped into my head means it's likely a critical piece of the puzzle. Iβm doing a mental walk through, anticipating what interactions I need to focus on. Let's see if this requires a deep dive or a quick scan.
|
| 29/2 |
2026/05/24 07:33 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/super.c IncludeLines:true Name:freeze_super]
Results: map[SourceCode:2014: /**
2015: * freeze_super - lock the filesystem and force it into a consistent state
2016: * @sb: the super to lock
2017: * @who: context that wants to freeze
2018: * @freeze_owner: owner of the freeze
2019: *
2020: * Syncs the super to make sure the filesystem is consistent and calls the fs's
2021: * freeze_fs. Subsequent calls to this without first thawing the fs may return
2022: * -EBUSY.
2023: *
2024: * @who should be:
2025: * * %FREEZE_HOLDER_USERSPACE if userspace wants to freeze the fs;
2026: * * %FREEZE_HOLDER_KERNEL if the kernel wants to freeze the fs.
2027: * * %FREEZE_MAY_NEST whether nesting freeze and thaw requests is allowed.
2028: *
2029: * The @who argument distinguishes between the kernel and userspace trying to
2030: * freeze the filesystem. Although there cannot be multiple kernel freezes or
2031: * multiple userspace freezes in effect at any given time, the kernel and
2032: * userspace can both hold a filesystem frozen. The filesystem remains frozen
2033: * until there are no kernel or userspace freezes in effect.
2034: *
2035: * A filesystem may hold multiple devices and thus a filesystems may be
2036: * frozen through the block layer via multiple block devices. In this
2037: * case the request is marked as being allowed to nest by passing
2038: * FREEZE_MAY_NEST. The filesystem remains frozen until all block
2039: * devices are unfrozen. If multiple freezes are attempted without
2040: * FREEZE_MAY_NEST -EBUSY will be returned.
2041: *
2042: * During this function, sb->s_writers.frozen goes through these values:
2043: *
2044: * SB_UNFROZEN: File system is normal, all writes progress as usual.
2045: *
2046: * SB_FREEZE_WRITE: The file system is in the process of being frozen. New
2047: * writes should be blocked, though page faults are still allowed. We wait for
2048: * all writes to complete and then proceed to the next stage.
2049: *
2050: * SB_FREEZE_PAGEFAULT: Freezing continues. Now also page faults are blocked
2051: * but internal fs threads can still modify the filesystem (although they
2052: * should not dirty new pages or inodes), writeback can run etc. After waiting
2053: * for all running page faults we sync the filesystem which will clean all
2054: * dirty pages and inodes (no new dirty pages or inodes can be created when
2055: * sync is running).
2056: *
2057: * SB_FREEZE_FS: The file system is frozen. Now all internal sources of fs
2058: * modification are blocked (e.g. XFS preallocation truncation on inode
2059: * reclaim). This is usually implemented by blocking new transactions for
2060: * filesystems that have them and need this additional guard. After all
2061: * internal writers are finished we call ->freeze_fs() to finish filesystem
2062: * freezing. Then we transition to SB_FREEZE_COMPLETE state. This state is
2063: * mostly auxiliary for filesystems to verify they do not modify frozen fs.
2064: *
2065: * sb->s_writers.frozen is protected by sb->s_umount.
2066: *
2067: * Return: If the freeze was successful zero is returned. If the freeze
2068: * failed a negative error code is returned.
2069: */
2070: int freeze_super(struct super_block *sb, enum freeze_holder who, const void *freeze_owner)
2071: {
2072: int ret;
2073:
2074: if (!super_lock_excl(sb)) {
2075: WARN_ON_ONCE("Dying superblock while freezing!");
2076: return -EINVAL;
2077: }
2078: atomic_inc(&sb->s_active);
2079:
2080: retry:
2081: if (sb->s_writers.frozen == SB_FREEZE_COMPLETE) {
2082: if (may_freeze(sb, who, freeze_owner))
2083: ret = !!WARN_ON_ONCE(freeze_inc(sb, who) == 1);
2084: else
2085: ret = -EBUSY;
2086: /* All freezers share a single active reference. */
2087: deactivate_locked_super(sb);
2088: return ret;
2089: }
2090:
2091: if (sb->s_writers.frozen != SB_UNFROZEN) {
2092: ret = wait_for_partially_frozen(sb);
2093: if (ret) {
2094: deactivate_locked_super(sb);
2095: return ret;
2096: }
2097:
2098: goto retry;
2099: }
2100:
2101: if (sb_rdonly(sb)) {
2102: /* Nothing to do really... */
2103: WARN_ON_ONCE(freeze_inc(sb, who) > 1);
2104: sb->s_writers.freeze_owner = freeze_owner;
2105: sb->s_writers.frozen = SB_FREEZE_COMPLETE;
2106: wake_up_var(&sb->s_writers.frozen);
2107: super_unlock_excl(sb);
2108: return 0;
2109: }
2110:
2111: sb->s_writers.frozen = SB_FREEZE_WRITE;
2112: /* Release s_umount to preserve sb_start_write -> s_umount ordering */
2113: super_unlock_excl(sb);
2114: sb_wait_write(sb, SB_FREEZE_WRITE);
2115: __super_lock_excl(sb);
2116:
2117: /* Now we go and block page faults... */
2118: sb->s_writers.frozen = SB_FREEZE_PAGEFAULT;
2119: sb_wait_write(sb, SB_FREEZE_PAGEFAULT);
2120:
2121: /* All writers are done so after syncing there won't be dirty data */
2122: ret = sync_filesystem(sb);
2123: if (ret) {
2124: sb->s_writers.frozen = SB_UNFROZEN;
2125: sb_freeze_unlock(sb, SB_FREEZE_PAGEFAULT);
2126: wake_up_var(&sb->s_writers.frozen);
2127: deactivate_locked_super(sb);
2128: return ret;
2129: }
2130:
2131: /* Now wait for internal filesystem counter */
2132: sb->s_writers.frozen = SB_FREEZE_FS;
2133: sb_wait_write(sb, SB_FREEZE_FS);
2134:
2135: if (sb->s_op->freeze_fs) {
2136: ret = sb->s_op->freeze_fs(sb);
2137: if (ret) {
2138: printk(KERN_ERR
2139: "VFS:Filesystem freeze failed\n");
2140: sb->s_writers.frozen = SB_UNFROZEN;
2141: sb_freeze_unlock(sb, SB_FREEZE_FS);
2142: wake_up_var(&sb->s_writers.frozen);
2143: deactivate_locked_super(sb);
2144: return ret;
2145: }
2146: }
2147: /*
2148: * For debugging purposes so that fs can warn if it sees write activity
2149: * when frozen is set to SB_FREEZE_COMPLETE, and for thaw_super().
2150: */
2151: WARN_ON_ONCE(freeze_inc(sb, who) > 1);
2152: sb->s_writers.freeze_owner = freeze_owner;
2153: sb->s_writers.frozen = SB_FREEZE_COMPLETE;
2154: wake_up_var(&sb->s_writers.frozen);
2155: lockdep_sb_freeze_release(sb);
2156: super_unlock_excl(sb);
2157: return 0;
2158: }
SourceFile:fs/super.c]
|
| 30/2 |
2026/05/24 07:33 |
llm |
expert |
0m
Model:
Tokens:
input: 53046
output: 39
thoughts: 138
Thoughts: **My Analysis of Filesystem Freezing and Lock Management**
Okay, so I'm digging into this filesystem freezing process and I've just hit a key point: `lockdep_sb_freeze_release(sb);` is called at the end of `freeze_super`. That's important. It means, after `freeze_super` finishes executing, the lock is *released* from the lockdep perspective. Effectively, it's telling lockdep that the write lock is no longer held. The filesystem is frozen at this point, but the lock doesn't appear held according to lockdep. The `sem->block` flag is set as well (or rather, the `percpu_rwsem` is being held for a write, but lockdep doesn't track this state).
That discrepancy is interesting. My gut is telling me to investigate how `sb_wait_write` is using that semaphore, because that function is called by `percpu_down_write`. I'm going to check `sb_wait_write` and see what it's doing.
|
| 31/2 |
2026/05/24 07:33 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/super.c IncludeLines:true Name:sb_wait_write]
Results: map[SourceCode:1840: /**
1841: * sb_wait_write - wait until all writers to given file system finish
1842: * @sb: the super for which we wait
1843: * @level: type of writers we wait for (normal vs page fault)
1844: *
1845: * This function waits until there are no writers of given type to given file
1846: * system.
1847: */
1848: static void sb_wait_write(struct super_block *sb, int level)
1849: {
1850: percpu_down_write(sb->s_writers.rw_sem + level-1);
1851: }
SourceFile:fs/super.c]
|
| 32/2 |
2026/05/24 07:33 |
llm |
expert |
0m
Model:
Tokens:
input: 53667
output: 43
thoughts: 1522
Thoughts: **Analyzing a File System Freeze and Task Hang**
Okay, so here's what's going through my mind as I dig into this issue. It starts with a `sb_wait_write` call, which triggers `percpu_down_write`. Then, a `freeze_super` call is made which calls `lockdep_sb_freeze_release(sb)`. This is where it gets interesting, as `lockdep` gets notified that the write locks are released. This explains why lockdep shows no one holding `sb_writers#14` for write because the filesystem was successfully frozen via `FIFREEZE` and returned to userspace. The filesystem is now frozen.
Any task trying to write to this frozen filesystem will block in `sb_start_write`, waiting for the read lock. Since it's frozen, the write lock is effectively held (even if lockdep doesn't reflect it), causing the task (like `syz.1.125` doing `openat`) to block indefinitely until someone calls `FITHAW`. The problem is, `syzkaller` might not call `FITHAW`, or the task that *should* call it might die, although anyone with `CAP_SYS_ADMIN` can thaw. This is a potential hang scenario.
The `ioctl_fsfreeze` check reveals that a user in a user namespace *can* freeze a filesystem if they own the superblock β say, they mounted it. If they freeze it, other tasks trying to write will hang, which seems like a genuine issue. But is this expected? My initial thought is it's a known behavior of `FIFREEZE`, and not a kernel bug, just userspace being...well, userspace. However, the 143-second timeout reported by `syzkaller` needs further investigation.
Then I see the NMI backtrace: CPU 0 is in `__bfs` inside `lock_acquire`. Why is `syz.2.401` doing `__bfs` for so long? Is this potentially holding `lockdep_lock`? If `syz.2.401` holds `lockdep_lock` for 143 seconds, then any task trying to acquire any lock for the *first time* would block. However, `syz.1.125` is blocked in `percpu_rwsem_wait`, which suggests it's waiting for the rwsem which `FIFREEZE` holds. This aligns with the known `syzkaller` issue with hangs, but usually there are rules or its just ignored.
What if `syz.2.401` *isn't* stuck in `__bfs`? What if it's doing `ext4_orphan_cleanup`? That could take a VERY long time on a malicious image. If it's processing millions of orphans, that generates millions of bios, each touching `lo->lo_work_lock`. Lockdep's overhead will be compounded with the time to process each bio. The NMI just happened to catch it in `__bfs`.
But wait, `__bfs` is only called when adding a new dependency, it can't be called millions of times. And the lockdep graph size is limited. So `__bfs` alone cannot take 143 seconds. Maybe it's coincidence.
Then it hits me: if `syz.2.401` is doing `ext4_orphan_cleanup` for 143 seconds, that means `ext4_orphan_cleanup` itself is too slow. Are there known issues with hang tasks due to malicious images? Yes! A malicious ext4 image can contain a huge number of orphans. `ext4_orphan_cleanup` iterates through `es->s_last_orphan`. Though I'm sure we checked for a loop (where `ext4_orphan_get` would fail), what if the image has a MASSIVE number of *valid* orphans? If `s_inodes_count` (which is capped at 2^32) is almost filled with orphans, then `ext4_orphan_cleanup` might process millions of inodes. Processing millions of inodes is going to take way more than 143 seconds.
So this is a DoS! Mounting a malicious ext4 image can cause a hung task because `ext4_orphan_cleanup` takes too long. Now, the last question: Does `ext4_orphan_cleanup` have a `cond_resched()`? I need to check it again.
|
| 33/2 |
2026/05/24 07:33 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/ext4/orphan.c IncludeLines:true Name:ext4_orphan_cleanup]
Results: map[SourceCode: 361: /* ext4_orphan_cleanup() walks a singly-linked list of inodes (starting at
362: * the superblock) which were deleted from all directories, but held open by
363: * a process at the time of a crash. We walk the list and try to delete these
364: * inodes at recovery time (only with a read-write filesystem).
365: *
366: * In order to keep the orphan inode chain consistent during traversal (in
367: * case of crash during recovery), we link each inode into the superblock
368: * orphan list_head and handle it the same way as an inode deletion during
369: * normal operation (which journals the operations for us).
370: *
371: * We only do an iget() and an iput() on each inode, which is very safe if we
372: * accidentally point at an in-use or already deleted inode. The worst that
373: * can happen in this case is that we get a "bit already cleared" message from
374: * ext4_free_inode(). The only reason we would point at a wrong inode is if
375: * e2fsck was run on this filesystem, and it must have already done the orphan
376: * inode cleanup for us, so we can safely abort without any further action.
377: */
378: void ext4_orphan_cleanup(struct super_block *sb, struct ext4_super_block *es)
379: {
380: unsigned int s_flags = sb->s_flags;
381: int nr_orphans = 0, nr_truncates = 0;
382: struct inode *inode;
383: int i, j;
384: #ifdef CONFIG_QUOTA
385: int quota_update = 0;
386: #endif
387: __le32 *bdata;
388: struct ext4_orphan_info *oi = &EXT4_SB(sb)->s_orphan_info;
389: int inodes_per_ob = ext4_inodes_per_orphan_block(sb);
390:
391: if (!es->s_last_orphan && !oi->of_blocks) {
392: ext4_debug("no orphan inodes to clean up\n");
393: return;
394: }
395:
396: if (bdev_read_only(sb->s_bdev)) {
397: ext4_msg(sb, KERN_ERR, "write access "
398: "unavailable, skipping orphan cleanup");
399: return;
400: }
401:
402: /* Check if feature set would not allow a r/w mount */
403: if (!ext4_feature_set_ok(sb, 0)) {
404: ext4_msg(sb, KERN_INFO, "Skipping orphan cleanup due to "
405: "unknown ROCOMPAT features");
406: return;
407: }
408:
409: if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) {
410: /* don't clear list on RO mount w/ errors */
411: if (es->s_last_orphan && !(s_flags & SB_RDONLY)) {
412: ext4_msg(sb, KERN_INFO, "Errors on filesystem, "
413: "clearing orphan list.");
414: es->s_last_orphan = 0;
415: }
416: ext4_debug("Skipping orphan recovery on fs with errors.\n");
417: return;
418: }
419:
420: if (s_flags & SB_RDONLY) {
421: ext4_msg(sb, KERN_INFO, "orphan cleanup on readonly fs");
422: sb->s_flags &= ~SB_RDONLY;
423: }
424: #ifdef CONFIG_QUOTA
425: /*
426: * Turn on quotas which were not enabled for read-only mounts if
427: * filesystem has quota feature, so that they are updated correctly.
428: */
429: if (ext4_has_feature_quota(sb) && (s_flags & SB_RDONLY)) {
430: int ret = ext4_enable_quotas(sb);
431:
432: if (!ret)
433: quota_update = 1;
434: else
435: ext4_msg(sb, KERN_ERR,
436: "Cannot turn on quotas: error %d", ret);
437: }
438:
439: /* Turn on journaled quotas used for old sytle */
440: for (i = 0; i < EXT4_MAXQUOTAS; i++) {
441: if (EXT4_SB(sb)->s_qf_names[i]) {
442: int ret = ext4_quota_on_mount(sb, i);
443:
444: if (!ret)
445: quota_update = 1;
446: else
447: ext4_msg(sb, KERN_ERR,
448: "Cannot turn on journaled "
449: "quota: type %d: error %d", i, ret);
450: }
451: }
452: #endif
453:
454: while (es->s_last_orphan) {
455: /*
456: * We may have encountered an error during cleanup; if
457: * so, skip the rest.
458: */
459: if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) {
460: ext4_debug("Skipping orphan recovery on fs with errors.\n");
461: es->s_last_orphan = 0;
462: break;
463: }
464:
465: inode = ext4_orphan_get(sb, le32_to_cpu(es->s_last_orphan));
466: if (IS_ERR(inode)) {
467: es->s_last_orphan = 0;
468: break;
469: }
470:
471: list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan);
472: ext4_process_orphan(inode, &nr_truncates, &nr_orphans);
473: }
474:
475: for (i = 0; i < oi->of_blocks; i++) {
476: bdata = (__le32 *)(oi->of_binfo[i].ob_bh->b_data);
477: for (j = 0; j < inodes_per_ob; j++) {
478: if (!bdata[j])
479: continue;
480: inode = ext4_orphan_get(sb, le32_to_cpu(bdata[j]));
481: if (IS_ERR(inode))
482: continue;
483: ext4_set_inode_state(inode, EXT4_STATE_ORPHAN_FILE);
484: EXT4_I(inode)->i_orphan_idx = i * inodes_per_ob + j;
485: ext4_process_orphan(inode, &nr_truncates, &nr_orphans);
486: }
487: }
488:
489: #define PLURAL(x) (x), ((x) == 1) ? "" : "s"
490:
491: if (nr_orphans)
492: ext4_msg(sb, KERN_INFO, "%d orphan inode%s deleted",
493: PLURAL(nr_orphans));
494: if (nr_truncates)
495: ext4_msg(sb, KERN_INFO, "%d truncate%s cleaned up",
496: PLURAL(nr_truncates));
497: #ifdef CONFIG_QUOTA
498: /* Turn off quotas if they were enabled for orphan cleanup */
499: if (quota_update) {
500: for (i = 0; i < EXT4_MAXQUOTAS; i++) {
501: if (sb_dqopt(sb)->files[i])
502: dquot_quota_off(sb, i);
503: }
504: }
505: #endif
506: sb->s_flags = s_flags; /* Restore SB_RDONLY status */
507: }
SourceFile:fs/ext4/orphan.c]
|
| 34/2 |
2026/05/24 07:33 |
llm |
expert |
1m
Model:
Tokens:
input: 58706
output: 43
thoughts: 6725
Thoughts: **Analysis of Orphan Cleanup and Hung Task Timeout**
Okay, so I've got this scenario: `ext4_orphan_cleanup` is potentially running amok without `cond_resched()`, which means it could hog the CPU if faced with millions of orphans. My initial thought was, if it hogs the CPU, a softlockup or RCU stall would be reported, but it isn't. Instead, we're seeing a hung task timeout (143 seconds) for `syz.1.125` blocked in `percpu_rwsem_wait`, specifically for a read lock on `sb_writers#14`.
The question becomes, why is this happening? `ext4_orphan_cleanup` during mount does *not* hold this write lock, so it's not directly blocking it. Initially, I considered a loop device scenario where `syz.2.401` mounts a loop device, the backing file of which resides on the same filesystem that `syz.1.125` is trying to write to. `syz.2.401` could be the one writing to this, as it may be invoking `ext4_orphan_cleanup`, and by this action, it generates millions of bios to loop device. This potentially causes contention of the lock, which does not block `syz.1.125` from taking its read lock on `sb_writers#14` UNLESS `FIFREEZE` is involved.
However, the problem is not a simple I/O blockage. The `kworker` thread processing the bios *should* be taking the read lock and releasing it, preventing `syz.1.125` from being blocked. The assumption now is that if `FIFREEZE` is involved, and we are going to start with the hypothesis that `syz.1.125` attempts to take the read lock for a file on `sb_writers#14`. Syzkaller *can* call `FIFREEZE`, and it *does* use user namespaces, granting it `CAP_SYS_ADMIN` in its own namespace but *not* the root one. Therefore, the hang is likely due to the user namespace's filesystem freezing, which is a known and usually ignored syzkaller behavior. This leads us to investigate the trace for `syz.1.125`, and it is indeed reading the superblock, and is being blocked on `sb_writers` due to a pending writer. But if syzkaller is creating a new mount, then the scenario discussed where there are read and write locks being contended is impossible. Instead, the only possible scenario is one where a filesystem *is* being frozen. However, it *cannot* be the root filesystem because syzkaller can't freeze it. Therefore, this leads us to the tmpfs filesystem within syzkaller's namespace.
However, this still does not explain the NMI backtrace. Now the investigation turns towards `syz.2.401`, which is running inside `loop_queue_work`. `syz.2.401` has the process lock, and the lock is in the state that is shown when the NMI backtrace is captured. Since `syz.2.401` is actively running, it seems that there is an event which is happening on another thread, and the NMI is triggered while `syz.2.401` is active.
Therefore, the NMI occurred because `syz.1.125` hung for 143 seconds. `syz.2.401` happened to be running during the NMI, and the backtrace is misleading. Thus, it looks like `ext4_orphan_cleanup` *can* take an unbounded amount of time. Even though `iput` and `ext4_evict_inode` might yield the CPU with I/O, on fast devices like loop devices, this yielding might be insufficient. Mounting a filesystem with a huge number of orphans could lead to a Denial of Service, which is a known issue.
|
| 35/2 |
2026/05/24 07:34 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/ext4/super.c IncludeLines:true Name:ext4_fs_type]
Results: map[SourceCode:7498: static struct file_system_type ext4_fs_type = {
7499: .owner = THIS_MODULE,
7500: .name = "ext4",
7501: .init_fs_context = ext4_init_fs_context,
7502: .parameters = ext4_param_specs,
7503: .kill_sb = ext4_kill_sb,
7504: .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME |
7505: FS_LBS,
7506: };
SourceFile:fs/ext4/super.c]
|
| 36/2 |
2026/05/24 07:35 |
llm |
expert |
0m
Model:
Tokens:
input: 66545
output: 44
thoughts: 443
Thoughts: **Analyzing the Security Implications of Slow Ext4 Mounts**
Okay, here's what's running through my head. Ext4 doesn't support `FS_USERNS_MOUNT`, so an unprivileged user can't mount it directly in a user namespace. That means if syzkaller is exercising this, it's either running as root, using a helper, or leveraging a device that auto-mounts, like USB. From the bug report, it seems syzkaller is running with elevated privileges, or has some way around this.
If mounting ext4 requires root, then a slow mount itself isn't directly a security issue *for unprivileged users*. But, and this is crucial, it *is* a security issue in the context of a "Malicious Filesystem Trigger," like an auto-mounting USB device. Imagine someone plugging in a USB drive with a deliberately corrupted ext4 image. If mounting that image takes hours, it's a denial-of-service vulnerability. That's a serious problem.
Now, let's circle back to the hung task, `syz.1.125`. Is it blocked on `sb_writers#14` because `syz.2.401` is holding it? Initially, I thought that was the case, but we checked and that's not the root cause. But wait! `ext4_orphan_cleanup` calls `ext4_process_orphan`, which in turn calls `dquot_initialize(inode)`. I initially assumed `dquot_initialize` might be taking `sb_writers`, but that's incorrect. I keep forgetting that `dquot_initialize` can't take `sb_writers`.
Ah, but *`ext4_orphan_cleanup`* itself does:
```c
if (ext4_has_feature_quota(sb) && (s_flags & SB_RDONLY)) {
int ret = ext4_enable_quotas(sb);
```
Does `ext4_enable_quotas` grab `sb_writers`? I need to check the code for `ext4_enable_quotas`. That's the key.
|
| 37/2 |
2026/05/24 07:35 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/ext4/super.c IncludeLines:true Name:ext4_enable_quotas]
Results: map[SourceCode:7243: /* Enable usage tracking for all quota types. */
7244: int ext4_enable_quotas(struct super_block *sb)
7245: {
7246: int type, err = 0;
7247: unsigned long qf_inums[EXT4_MAXQUOTAS] = {
7248: le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum),
7249: le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum),
7250: le32_to_cpu(EXT4_SB(sb)->s_es->s_prj_quota_inum)
7251: };
7252: bool quota_mopt[EXT4_MAXQUOTAS] = {
7253: test_opt(sb, USRQUOTA),
7254: test_opt(sb, GRPQUOTA),
7255: test_opt(sb, PRJQUOTA),
7256: };
7257:
7258: sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE | DQUOT_NOLIST_DIRTY;
7259: for (type = 0; type < EXT4_MAXQUOTAS; type++) {
7260: if (qf_inums[type]) {
7261: err = ext4_quota_enable(sb, type, QFMT_VFS_V1,
7262: DQUOT_USAGE_ENABLED |
7263: (quota_mopt[type] ? DQUOT_LIMITS_ENABLED : 0));
7264: if (err) {
7265: ext4_warning(sb,
7266: "Failed to enable quota tracking "
7267: "(type=%d, err=%d, ino=%lu). "
7268: "Please run e2fsck to fix.", type,
7269: err, qf_inums[type]);
7270:
7271: ext4_quotas_off(sb, type);
7272: return err;
7273: }
7274: }
7275: }
7276: return 0;
7277: }
SourceFile:fs/ext4/super.c]
|
| 38/2 |
2026/05/24 07:35 |
llm |
expert |
0m
Model:
Tokens:
input: 68151
output: 42
thoughts: 2568
Thoughts: **Analysis of an ext4 Filesystem DoS Vulnerability**
Okay, let's break this down. First, the initial scenario of `ext4_quota_enable` getting us to `dquot_enable` β it's irrelevant, so let's skip that. Then we're seeing a hung task, and we suspect the root cause is system overload triggered by some malicious loop writes by `syz.2.401`.
The lightbulb goes on: `syz.2.401`'s millions of loop writes are generating huge I/O on the root filesystem, which seems to explain the issue. If that root FS' journal is getting hammered, or if the overall I/O load skyrockets, other processes are going to block. That `sb_start_write` call is an interesting point of contention. It shouldn't block *just* because of I/O load, so there MUST be a writer present to block it.
Aha! `sb_start_write` only blocks if there's a writer (i.e., `freeze_super`). So, could there be a `freeze_super` that is *itself* blocked? Yes. If someone called `FIFREEZE` on the root filesystem, that freezes the FS, `freeze_super` grabs the write lock, and then calls `sync_filesystem(sb)`. And if `kworker` has generated a ton of dirty data on the root FS, `sync_filesystem` is going to take *forever* to write everything out. During this time, `freeze_super` holds that write lock, so any new reader (like `syz.1.125` calling `sb_start_write`) will hang until it's finished.
Therefore, `syz.1.125` is stuck waiting for `freeze_super`, and `freeze_super` is stuck in `sync_filesystem`, waiting for all the dirty pages from `syz.2.401`'s writes to be written to disk. And since `syz.2.401` is creating millions of writes, `sync_filesystem` might be taking more than 143 seconds. That perfectly explains everything:
1. `syz.2.401` mounts a malicious ext4 image.
2. `ext4_orphan_cleanup` processes it, with millions of orphans, submitting millions of bios to the loop device.
3. `kworker` handles the I/O, writing to the backing file and generating dirty pages.
4. Another task calls `FIFREEZE` on the root.
5. `FIFREEZE` calls `freeze_super`, which then calls `sync_filesystem`.
6. `sync_filesystem` takes a while due to the dirty data generated.
7. `syz.1.125` calls `sb_start_write` and gets blocked on `freeze_super`.
8. After 143 seconds, `khungtaskd` detects a hung `syz.1.125`, and triggers an NMI backtrace.
9. The backtrace finds `syz.2.401` still actively doing bios.
This is brilliant! It connects everything: why `syz.1.125` is blocked, why `syz.2.401` is in `loop_queue_work`, and the long delay. The root cause? `ext4_orphan_cleanup` can generate unbounded work, leading to a DoS by system overload, huge dirty data, and slow sync.
We need to dive deeper here. Is it just the data volume, or is `ext4_orphan_cleanup` *itself* a DoS? It is! Processing millions of orphans is a known DoS vector. A malicious filesystem can have a massive `s_inodes_count`, so a huge number of orphans means `ext4_orphan_cleanup` will take forever.
Let's check the code:
`while (es->s_last_orphan)`
`inode = ext4_orphan_get(sb, le32_to_cpu(es->s_last_orphan))`
`list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan)`
`ext4_process_orphan(inode, &nr_truncates, &nr_orphans)`
Is there a limit on this loop? No. It goes until `es->s_last_orphan` is zero. `ext4_process_orphan` removes the inode and updates `es->s_last_orphan`. Is there a loop check? When an inode is deleted,
|
| 39/2 |
2026/05/24 07:35 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/ext4/super.c IncludeLines:true Name:ext4_reconfigure]
Results: map[SourceCode:6878: static int ext4_reconfigure(struct fs_context *fc)
6879: {
6880: struct super_block *sb = fc->root->d_sb;
6881: int ret;
6882: bool old_ro = sb_rdonly(sb);
6883:
6884: fc->s_fs_info = EXT4_SB(sb);
6885:
6886: ret = ext4_check_opt_consistency(fc, sb);
6887: if (ret < 0)
6888: return ret;
6889:
6890: ret = __ext4_remount(fc, sb);
6891: if (ret < 0)
6892: return ret;
6893:
6894: ext4_msg(sb, KERN_INFO, "re-mounted %pU%s.",
6895: &sb->s_uuid,
6896: (old_ro != sb_rdonly(sb)) ? (sb_rdonly(sb) ? " ro" : " r/w") : "");
6897:
6898: return 0;
6899: }
SourceFile:fs/ext4/super.c]
|
| 40/2 |
2026/05/24 07:35 |
llm |
expert |
0m
Model:
Tokens:
input: 72147
output: 43
thoughts: 12
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience, presented in the first person:
**Analyzing the Remount Procedure**
Right, let's dive straight in. I need to refresh my memory and pinpoint the critical aspects of the ext4 remount operation, specifically `__ext4_remount`. There are several nuances and potential gotchas with remounting filesystems, and I want to ensure my understanding is razor sharp. I'll need to consider how this procedure handles flags, updates mount options, and any associated consistency checks it performs. What about interactions with journaling? Is there a particular sequence that must be observed to maintain data integrity during the remount? Are there any known areas of vulnerability or edge cases I should be aware of, perhaps related to specific ext4 configuration parameters? I'll probably start by looking at the core function's structure and then trace the most critical code paths. I need to understand this to have a solid grasp of how a remount affects the running system.
|
| 41/2 |
2026/05/24 07:35 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:fs/ext4/super.c IncludeLines:true Name:__ext4_remount]
Results: map[SourceCode:6551: static int __ext4_remount(struct fs_context *fc, struct super_block *sb)
6552: {
6553: struct ext4_fs_context *ctx = fc->fs_private;
6554: struct ext4_super_block *es;
6555: struct ext4_sb_info *sbi = EXT4_SB(sb);
6556: unsigned long old_sb_flags;
6557: struct ext4_mount_options old_opts;
6558: ext4_group_t g;
6559: int err = 0;
6560: int alloc_ctx;
6561: #ifdef CONFIG_QUOTA
6562: int enable_quota = 0;
6563: int i, j;
6564: char *to_free[EXT4_MAXQUOTAS];
6565: #endif
6566:
6567:
6568: /* Store the original options */
6569: old_sb_flags = sb->s_flags;
6570: old_opts.s_mount_opt = sbi->s_mount_opt;
6571: old_opts.s_mount_opt2 = sbi->s_mount_opt2;
6572: old_opts.s_resuid = sbi->s_resuid;
6573: old_opts.s_resgid = sbi->s_resgid;
6574: old_opts.s_commit_interval = sbi->s_commit_interval;
6575: old_opts.s_min_batch_time = sbi->s_min_batch_time;
6576: old_opts.s_max_batch_time = sbi->s_max_batch_time;
6577: #ifdef CONFIG_QUOTA
6578: old_opts.s_jquota_fmt = sbi->s_jquota_fmt;
6579: for (i = 0; i < EXT4_MAXQUOTAS; i++)
6580: if (sbi->s_qf_names[i]) {
6581: char *qf_name = get_qf_name(sb, sbi, i);
6582:
6583: old_opts.s_qf_names[i] = kstrdup(qf_name, GFP_KERNEL);
6584: if (!old_opts.s_qf_names[i]) {
6585: for (j = 0; j < i; j++)
6586: kfree(old_opts.s_qf_names[j]);
6587: return -ENOMEM;
6588: }
6589: } else
6590: old_opts.s_qf_names[i] = NULL;
6591: #endif
6592: if (!(ctx->spec & EXT4_SPEC_JOURNAL_IOPRIO)) {
6593: if (sbi->s_journal && sbi->s_journal->j_task->io_context)
6594: ctx->journal_ioprio =
6595: sbi->s_journal->j_task->io_context->ioprio;
6596: else
6597: ctx->journal_ioprio = EXT4_DEF_JOURNAL_IOPRIO;
6598:
6599: }
6600:
6601: if ((ctx->spec & EXT4_SPEC_s_stripe) &&
6602: ext4_is_stripe_incompatible(sb, ctx->s_stripe)) {
6603: ext4_msg(sb, KERN_WARNING,
6604: "stripe (%lu) is not aligned with cluster size (%u), "
6605: "stripe is disabled",
6606: ctx->s_stripe, sbi->s_cluster_ratio);
6607: ctx->s_stripe = 0;
6608: }
6609:
6610: /*
6611: * Changing the DIOREAD_NOLOCK or DELALLOC mount options may cause
6612: * two calls to ext4_should_dioread_nolock() to return inconsistent
6613: * values, triggering WARN_ON in ext4_add_complete_io(). we grab
6614: * here s_writepages_rwsem to avoid race between writepages ops and
6615: * remount.
6616: */
6617: alloc_ctx = ext4_writepages_down_write(sb);
6618: ext4_apply_options(fc, sb);
6619: ext4_writepages_up_write(sb, alloc_ctx);
6620:
6621: if ((old_opts.s_mount_opt & EXT4_MOUNT_JOURNAL_CHECKSUM) ^
6622: test_opt(sb, JOURNAL_CHECKSUM)) {
6623: ext4_msg(sb, KERN_ERR, "changing journal_checksum "
6624: "during remount not supported; ignoring");
6625: sbi->s_mount_opt ^= EXT4_MOUNT_JOURNAL_CHECKSUM;
6626: }
6627:
6628: if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
6629: if (test_opt2(sb, EXPLICIT_DELALLOC)) {
6630: ext4_msg(sb, KERN_ERR, "can't mount with "
6631: "both data=journal and delalloc");
6632: err = -EINVAL;
6633: goto restore_opts;
6634: }
6635: if (test_opt(sb, DIOREAD_NOLOCK)) {
6636: ext4_msg(sb, KERN_ERR, "can't mount with "
6637: "both data=journal and dioread_nolock");
6638: err = -EINVAL;
6639: goto restore_opts;
6640: }
6641: } else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA) {
6642: if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
6643: ext4_msg(sb, KERN_ERR, "can't mount with "
6644: "journal_async_commit in data=ordered mode");
6645: err = -EINVAL;
6646: goto restore_opts;
6647: }
6648: }
6649:
6650: if ((sbi->s_mount_opt ^ old_opts.s_mount_opt) & EXT4_MOUNT_NO_MBCACHE) {
6651: ext4_msg(sb, KERN_ERR, "can't enable nombcache during remount");
6652: err = -EINVAL;
6653: goto restore_opts;
6654: }
6655:
6656: if ((old_opts.s_mount_opt & EXT4_MOUNT_DELALLOC) &&
6657: !test_opt(sb, DELALLOC)) {
6658: ext4_msg(sb, KERN_ERR, "can't disable delalloc during remount");
6659: err = -EINVAL;
6660: goto restore_opts;
6661: }
6662:
6663: sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
6664: (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
6665:
6666: es = sbi->s_es;
6667:
6668: if (sbi->s_journal) {
6669: ext4_init_journal_params(sb, sbi->s_journal);
6670: set_task_ioprio(sbi->s_journal->j_task, ctx->journal_ioprio);
6671: }
6672:
6673: /* Flush outstanding errors before changing fs state */
6674: flush_work(&sbi->s_sb_upd_work);
6675:
6676: if ((bool)(fc->sb_flags & SB_RDONLY) != sb_rdonly(sb)) {
6677: if (ext4_emergency_state(sb)) {
6678: err = -EROFS;
6679: goto restore_opts;
6680: }
6681:
6682: if (fc->sb_flags & SB_RDONLY) {
6683: err = sync_filesystem(sb);
6684: if (err < 0)
6685: goto restore_opts;
6686: err = dquot_suspend(sb, -1);
6687: if (err < 0)
6688: goto restore_opts;
6689:
6690: /*
6691: * First of all, the unconditional stuff we have to do
6692: * to disable replay of the journal when we next remount
6693: */
6694: sb->s_flags |= SB_RDONLY;
6695:
6696: /*
6697: * OK, test if we are remounting a valid rw partition
6698: * readonly, and if so set the rdonly flag and then
6699: * mark the partition as valid again.
6700: */
6701: if (!(es->s_state & cpu_to_le16(EXT4_VALID_FS)) &&
6702: (sbi->s_mount_state & EXT4_VALID_FS))
6703: es->s_state = cpu_to_le16(sbi->s_mount_state);
6704:
6705: if (sbi->s_journal) {
6706: /*
6707: * We let remount-ro finish even if marking fs
6708: * as clean failed...
6709: */
6710: ext4_mark_recovery_complete(sb, es);
6711: }
6712: } else {
6713: /* Make sure we can mount this feature set readwrite */
6714: if (ext4_has_feature_readonly(sb) ||
6715: !ext4_feature_set_ok(sb, 0)) {
6716: err = -EROFS;
6717: goto restore_opts;
6718: }
6719: /*
6720: * Make sure the group descriptor checksums
6721: * are sane. If they aren't, refuse to remount r/w.
6722: */
6723: for (g = 0; g < sbi->s_groups_count; g++) {
6724: struct ext4_group_desc *gdp =
6725: ext4_get_group_desc(sb, g, NULL);
6726:
6727: if (!ext4_group_desc_csum_verify(sb, g, gdp)) {
6728: ext4_msg(sb, KERN_ERR,
6729: "ext4_remount: Checksum for group %u failed (%u!=%u)",
6730: g, le16_to_cpu(ext4_group_desc_csum(sb, g, gdp)),
6731: le16_to_cpu(gdp->bg_checksum));
6732: err = -EFSBADCRC;
6733: goto restore_opts;
6734: }
6735: }
6736:
6737: /*
6738: * If we have an unprocessed orphan list hanging
6739: * around from a previously readonly bdev mount,
6740: * require a full umount/remount for now.
6741: */
6742: if (es->s_last_orphan || !ext4_orphan_file_empty(sb)) {
6743: ext4_msg(sb, KERN_WARNING, "Couldn't "
6744: "remount RDWR because of unprocessed "
6745: "orphan inode list. Please "
6746: "umount/remount instead");
6747: err = -EINVAL;
6748: goto restore_opts;
6749: }
6750:
6751: /*
6752: * Mounting a RDONLY partition read-write, so reread
6753: * and store the current valid flag. (It may have
6754: * been changed by e2fsck since we originally mounted
6755: * the partition.)
6756: */
6757: if (sbi->s_journal) {
6758: err = ext4_clear_journal_err(sb, es);
6759: if (err)
6760: goto restore_opts;
6761: }
6762: sbi->s_mount_state = (le16_to_cpu(es->s_state) &
6763: ~EXT4_FC_REPLAY);
6764:
6765: err = ext4_setup_super(sb, es, 0);
6766: if (err)
6767: goto restore_opts;
6768:
6769: sb->s_flags &= ~SB_RDONLY;
6770: if (ext4_has_feature_mmp(sb)) {
6771: err = ext4_multi_mount_protect(sb,
6772: le64_to_cpu(es->s_mmp_block));
6773: if (err)
6774: goto restore_opts;
6775: }
6776: #ifdef CONFIG_QUOTA
6777: enable_quota = 1;
6778: #endif
6779: }
6780: }
6781:
6782: /*
6783: * Handle creation of system zone data early because it can fail.
6784: * Releasing of existing data is done when we are sure remount will
6785: * succeed.
6786: */
6787: if (test_opt(sb, BLOCK_VALIDITY) && !sbi->s_system_blks) {
6788: err = ext4_setup_system_zone(sb);
6789: if (err)
6790: goto restore_opts;
6791: }
6792:
6793: if (sbi->s_journal == NULL && !(old_sb_flags & SB_RDONLY)) {
6794: err = ext4_commit_super(sb);
6795: if (err)
6796: goto restore_opts;
6797: }
6798:
6799: #ifdef CONFIG_QUOTA
6800: if (enable_quota) {
6801: if (sb_any_quota_suspended(sb))
6802: dquot_resume(sb, -1);
6803: else if (ext4_has_feature_quota(sb)) {
6804: err = ext4_enable_quotas(sb);
6805: if (err)
6806: goto restore_opts;
6807: }
6808: }
6809: /* Release old quota file names */
6810: for (i = 0; i < EXT4_MAXQUOTAS; i++)
6811: kfree(old_opts.s_qf_names[i]);
6812: #endif
6813: if (!test_opt(sb, BLOCK_VALIDITY) && sbi->s_system_blks)
6814: ext4_release_system_zone(sb);
6815:
6816: /*
6817: * Reinitialize lazy itable initialization thread based on
6818: * current settings
6819: */
6820: if (sb_rdonly(sb) || !test_opt(sb, INIT_INODE_TABLE))
6821: ext4_unregister_li_request(sb);
6822: else {
6823: ext4_group_t first_not_zeroed;
6824: first_not_zeroed = ext4_has_uninit_itable(sb);
6825: ext4_register_li_request(sb, first_not_zeroed);
6826: }
6827:
6828: if (!ext4_has_feature_mmp(sb) || sb_rdonly(sb))
6829: ext4_stop_mmpd(sbi);
6830:
6831: /*
6832: * Handle aborting the filesystem as the last thing during remount to
6833: * avoid obsure errors during remount when some option changes fail to
6834: * apply due to shutdown filesystem.
6835: */
6836: if (test_opt2(sb, ABORT))
6837: ext4_abort(sb, ESHUTDOWN, "Abort forced by user");
6838:
6839: return 0;
6840:
6841: restore_opts:
6842: /*
6843: * If there was a failing r/w to ro transition, we may need to
6844: * re-enable quota
6845: */
6846: if (sb_rdonly(sb) && !(old_sb_flags & SB_RDONLY) &&
6847: sb_any_quota_suspended(sb))
6848: dquot_resume(sb, -1);
6849:
6850: alloc_ctx = ext4_writepages_down_write(sb);
6851: sb->s_flags = old_sb_flags;
6852: sbi->s_mount_opt = old_opts.s_mount_opt;
6853: sbi->s_mount_opt2 = old_opts.s_mount_opt2;
6854: sbi->s_resuid = old_opts.s_resuid;
6855: sbi->s_resgid = old_opts.s_resgid;
6856: sbi->s_commit_interval = old_opts.s_commit_interval;
6857: sbi->s_min_batch_time = old_opts.s_min_batch_time;
6858: sbi->s_max_batch_time = old_opts.s_max_batch_time;
6859: ext4_writepages_up_write(sb, alloc_ctx);
6860:
6861: if (!test_opt(sb, BLOCK_VALIDITY) && sbi->s_system_blks)
6862: ext4_release_system_zone(sb);
6863: #ifdef CONFIG_QUOTA
6864: sbi->s_jquota_fmt = old_opts.s_jquota_fmt;
6865: for (i = 0; i < EXT4_MAXQUOTAS; i++) {
6866: to_free[i] = get_qf_name(sb, sbi, i);
6867: rcu_assign_pointer(sbi->s_qf_names[i], old_opts.s_qf_names[i]);
6868: }
6869: synchronize_rcu();
6870: for (i = 0; i < EXT4_MAXQUOTAS; i++)
6871: kfree(to_free[i]);
6872: #endif
6873: if (!ext4_has_feature_mmp(sb) || sb_rdonly(sb))
6874: ext4_stop_mmpd(sbi);
6875: return err;
6876: }
SourceFile:fs/ext4/super.c]
|
| 42/2 |
2026/05/24 07:35 |
llm |
expert |
0m
Model:
Tokens:
input: 77915
output: 66
thoughts: 641
Thoughts: **My Analysis of the ext4 Orphan Cleanup DoS Vulnerability**
Okay, wait a minute, `__ext4_remount` *doesn't* call `ext4_orphan_cleanup`! The code clearly says that if there's an unprocessed orphan list from a read-only mount, a full umount/remount is required. So, `ext4_orphan_cleanup` is ONLY called during the initial mount. This changes the threat model somewhat.
Since it's on mount, the filesystem isn't visible yet. The potential impact is purely CPU hogging and I/O generation. This makes it a Malicious Filesystem Trigger. Can an unprivileged process trigger this? Nope, ext4 *doesn't* have `FS_USERNS_MOUNT`. User namespaces are out too. Network trigger? No. Peripheral trigger? Yes, specifically through things like USB auto-mount. And it's exploitable, but as a DoS, nothing more.
Let me summarize: The core issue is a hung task timeout because `ext4_orphan_cleanup` takes an unbounded amount of time when dealing with a massive orphan list on a malicious ext4 image. Itβs caused by `ext4_orphan_cleanup` lacking `cond_resched()`, generating a massive amount of I/O, particularly if it's a loop device, overloading the system, and potentially hanging other tasks (like those waiting for `sync_filesystem` during `FIFREEZE` or just suffering from I/O starvation). The vulnerability can only be triggered by root or through automounts and cannot be triggered by unprivileged users because ext4 requires `FS_USERNS_MOUNT`, so it's a Denial of Service, triggered by a Malicious Filesystem or Peripheral, not unprivileged or user namespace access.
Wait, is there any other way for an unprivileged user to mount ext4? Nope. `FS_USERNS_MOUNT` is strictly enforced for `mount` in a user namespace. What about `fsconfig` / `fsopen`? Same deal, they also check for `FS_USERNS_MOUNT`:
```c
if (!(type->fs_flags & FS_USERNS_MOUNT) &&
!capable(CAP_SYS_ADMIN))
return -EPERM;
```
So, definitely no unprivileged mounts of ext4. I'll set my findings accordingly.
|
| 43/2 |
2026/05/24 07:35 |
tool |
set-results |
0m
Args: map[DenialOfService:true Exploitable:false FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 44/2 |
2026/05/24 07:35 |
llm |
expert |
0m
Model:
Tokens:
input: 79203
output: 607
thoughts: 377
Thoughts: **Finalizing the Response: Ext4 Orphan Cleanup Vulnerability**
Okay, the analysis is done, and the results are clear. Time to put this into words for the report. So, this boils down to a hung task timeout, and it's caused by a nasty little bug in how `ext4_orphan_cleanup()` handles malicious ext4 filesystem images during the mount process.
Basically, if a poisoned image is crafted with a huge number of valid orphan inodes β potentially up to the maximum limit, which is a whopping 2^32 β `ext4_orphan_cleanup()` gets stuck in a really long loop. The critical flaw is that this loop lacks `cond_resched()`. This means it keeps running without yielding, and it generates a massive amount of I/O, like submitting millions of bios to a loop device. My hypothesis is that, as an expert in the field, this massive amount of I/O hogs both the CPU and the disk I/O, which, as expected, is what's overloading the system and causing other tasks to hang. Specifically, the syzkaller report shows how the loop worker generating dirty data blocks `sync_filesystem()`, which is triggered by `FIFREEZE` / `freeze_super`, for more than 143 seconds. That then blocks `syz.1.125` in `sb_start_write()`.
Now, regarding the security impact:
* **Exploitable?** No, thankfully. It's a resource exhaustion and an infinite loop scenario, not a memory corruption vulnerability, which is always the worst-case scenario.
* **Denial of Service?** Yes, absolutely. It results in hung tasks and a completely unresponsive system.
* **Unprivileged / User Namespace?** No, which is good. Ext4 doesn't have the `FS_USERNS_MOUNT` flag enabled. This means it can't be mounted by unprivileged users, even inside a user namespace. `CAP_SYS_ADMIN` in the initial namespace is needed for this.
* **Malicious Filesystem / Peripheral Trigger?** Yes, and this is where it gets concerning. The attack vector is realistic. It can be triggered by mounting a crafted, malicious ext4 image. Think about desktop environments that auto-mount USB drives. That's a definite vulnerability. It means someone could create a malicious USB drive, and if it's plugged in and auto-mounted, you could be in trouble. We need a fix, and fast.
|
| 45/1 |
2026/05/24 07:36 |
action |
format-explanation |
0m
Results: map[Explanation:Based on the analysis of the bug report and the kernel source code, here is the
assessment of the security impact:
### Root Cause Analysis
The bug is a hung task timeout (Denial of Service) caused by mounting a
malicious `ext4` filesystem image.
During the mount process, `ext4_fill_super()` calls `ext4_orphan_cleanup()` to
process any unlinked but open inodes (orphans) left over from a previous crash.
The function iterates over the orphan list using a `while (es->s_last_orphan)`
loop.
If an attacker crafts a malicious `ext4` image with a massive number of valid
orphan inodes (the maximum inode count `s_inodes_count` can be up to 2^32), this
loop will run for an extremely long time. The loop lacks `cond_resched()`, and
for each inode, it calls `ext4_process_orphan()` which evicts the inode and
performs quota updates. When the image is mounted via a loop device, this
generates millions of bios and a massive amount of dirty data on the backing
filesystem.
In this specific syzkaller trace, the massive I/O load and dirty pages generated
by the loop worker (`kworker/u8:10`) caused a subsequent `FIFREEZE` `ioctl`
(which calls `freeze_super()` -> `sync_filesystem()`) to block for more than 143
seconds while trying to write out the dirty data. This, in turn, blocked the
`syz.1.125` task in `sb_start_write()` waiting for the filesystem to thaw,
triggering the hung task panic.
### Security Impact
* **Exploitable:** No. This is a resource exhaustion and CPU/IO hogging issue.
There is no memory corruption, use-after-free, or out-of-bounds access involved
that could lead to privilege escalation or arbitrary code execution.
* **Denial of Service:** Yes. Mounting the malicious image will severely
overload the system's I/O and CPU, leading to hung tasks, RCU stalls, and
overall system unresponsiveness.
* **Accessible From Unprivileged Processes / User Namespaces:** No. The `ext4`
filesystem does not have the `FS_USERNS_MOUNT` flag. Therefore, it cannot be
mounted by unprivileged users, even if they have `CAP_SYS_ADMIN` within a user
namespace. Mounting it requires `CAP_SYS_ADMIN` in the initial (root) namespace.
* **Malicious Filesystem / Peripheral Trigger:** Yes. Because it is triggered by
parsing a malicious filesystem image, it serves as a classic peripheral attack
vector. If a user plugs in a USB thumb drive containing this malicious `ext4`
image, desktop environments (like GNOME or KDE) that auto-mount external media
will trigger the bug and hang the system.]
|