| 0/0 |
2026/06/02 18:24 |
flow |
assessment-security |
45m
Results: map[DenialOfService:true Explanation:**Analysis of the Bug Report**
**1. Root Cause Analysis:**
The bug report indicates that the `udevd` process has been blocked in an
uninterruptible sleep state (`D` state) for over 143 seconds, triggering the
kernel's hung task detector.
Looking at the stack trace, `udevd` is attempting to scan a newly discovered
block device for partitions. It is executing the Acorn POWERTEC partition parser
(`adfspart_check_POWERTEC`), which reads sector 0 of the block device via
`read_part_sector()`. Under the hood, this calls into the page cache
(`read_mapping_folio()` -> `do_read_cache_folio()`).
The task is specifically blocked in `folio_put_wait_locked()`. This happens when
the page cache folio for the requested sector is already locked by another
thread that initiated the I/O and is currently waiting for the block device to
complete the read request. Because the underlying block device is completely
unresponsive (hung), the I/O never completes, the folio is never unlocked, and
any subsequent tasks trying to read that sector (like `udevd`) will hang
indefinitely in I/O wait.
**2. Security Impact:**
* **Exploitable:** **No.** This is a pure concurrency/I/O wait state issue
caused by an unresponsive hardware/software block device. There is no memory
corruption, out-of-bounds access, or use-after-free involved.
* **Denial of Service (DoS):** **Yes.** If `udevd` hangs while probing a device,
it ties up a worker thread. If enough devices hang, `udevd` can be completely
exhausted, preventing the system from processing any new hardware events or
mounting legitimate drives.
* **Unprivileged / User Namespace Access:** **No.** To trigger this via
software, an attacker would need to create a malicious block device (e.g., a
loop device backed by a hanging FUSE filesystem, or an NBD device). Creating
block devices requires `CAP_SYS_ADMIN` in the *initial* user namespace (e.g.,
`/dev/loop-control` is restricted to root, and NBD netlink creation explicitly
checks for init namespace capabilities). Therefore, unprivileged users cannot
trigger this, even within a user namespace.
* **Peripheral Trigger:** **Yes.** A malicious physical device, such as a rogue
USB storage drive, could intentionally stop responding to SCSI read commands
after being plugged in. The kernel would wait for the I/O to complete (subject
to SCSI timeouts, which can be several minutes long and exceed the 120-second
hung task threshold), causing `udevd` and any other probing tasks to hang.
**Conclusion:**
This is not a vulnerability in the partition parsing code itself, but rather a
known consequence of how the Linux kernel handles unresponsive block devices.
Syzkaller frequently triggers this by intentionally injecting faults into block
devices or creating NBD/loop devices that drop I/O requests. While it represents
a DoS vector via malicious physical USB devices, it cannot be exploited for
privilege escalation or triggered by unprivileged local attackers. Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/06/02 18:24 |
action |
syz-repro-to-c-repro |
0m
Results:
|
| 2/1 |
2026/06/02 18:24 |
action |
kernel-checkouter |
0m
Results: map[KernelSrc:/app/workdir/cache/src/116cd263b902234cb5408e237e95296533c171cd]
|
| 3/1 |
2026/06/02 18:24 |
action |
kernel-builder |
24m
Results: map[KernelObj:/app/workdir/cache/build/6eaa6de93b4317aa7a1f048aa0efd60f32e41638]
|
| 4/1 |
2026/06/02 18:49 |
action |
codesearch-prepare |
17m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/06/02 19:07 |
agent |
expert |
3m
Model:
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:false 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 grepping
".config" file for "CONFIG_CMDLINE=". Assume sysctl parameters have default values.
But analyze for the corresponding production build w/o debugging tools enabled (like KASAN, KMSAN, UBSAN).
Try different strategies when analyzing the bug:
- think of ways in which the vulnerable code is unreachable
- or the other way around: try to come up with different ideas of how an unprivileged user can reach the bug
If still unsure err on the side of the bug being non-exploitable/not-accessible.
In the final reply, provide a reasoning for your assessment.
Analysis dimensions:
* Exploitable:
Determine if the bug can result in memory corruption 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 completely wild pointer access
(e.g. user-space address, or non-canonical address, but not on NULL or address corresponding to KASAN shadow
for NULL address), including both data accesses and control transfers, that also usually implies possibility
of exploitation. Such reports usually say "unable to handle kernel paging request".
Uses of uninitialized values detected by KMSAN may be exploitable b/c attacker frequently can affect uninit
values with spraying techniques. However, for these exploitability depends on how exactly the uninit value
is used in the code, and what it affects.
Think of what happens after the bug is triggered. Some bugs cause kernel panic and halt execution,
they are harder to exploit. For example, BUG reports halts the kernel. However, WARNING reports don't halt
execution in production builds. Debug bug detection tools (like KASAN, KMSAN, KCSAN, UBSAN) are also not enabled
in production builds, so attacker can freely exploit these bugs w/o being detected by these tools.
If you see an integer overflow, think how the overflowed value used later (if it's used as allocation size,
or an array index). If you see an out-of-bounds read, think if it's followed by an out-of-bounds write as well.
Some KCSAN data-races may be exploitable by skilled attackers as well. Think what data structures got corrupted
as the result of data races and how. However, note that kernel has lots of "benign" data races that don't lead
to any runtime misbehavior at all.
* Denial Of Service:
Determine if the bug can result in denial-of-service. Most bugs can, since they cause system crash,
hangs, deadlocks, or resource leaks. This is mostly applicable to WARNING bugs that won't cause system crash
in production. For these think what will be consequences of the violation of the kernel assumptions flagged
by the WARNING. In some cases the unexpected condition is also properly handled by the normal control flow
(e.g. with "if (WARN_ON(...))"), these won't cause denial-of-service. If the condition is not handled,
then it may or may not cause denial-of-service.
* Accessible From Unprivileged Processes:
Determine if the bug can be reached from a typical (non-root) user process that does NOT have any special capabilities
(like CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON) or access to device nodes restricted to root.
Assume that unprivileged_bpf_disabled=1, that is eBPF loading is not accessible. However, cBPF (classical BPF)
is still accessible to non-root processes.
Assume that user namespaces are not accessible, that is, the process cannot get the mentioned capabilities even
within a new user namespace (checked by ns_capable() function in the kernel sources).
* Accessible From User Namespaces:
Determine if the bug can be reached within a user-namespace where the process has all capabilities
(including CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON). Such capabilities are checked with ns_capable()
function in the kernel sources.
* VM Guest Trigger:
Determine if the bug can be triggered from the context of a typical KVM guest (e.g., set up by a QEMU VMM).
Consider accesses to standard Linux host paravirtualized features (virtio-blk, virtio-net, etc.),
and handling of VM exits in the KVM code.
* VM Host Trigger in The Confidential Computing Context:
Determine if the bug can be triggered in a confidential computing guest kernel from the context of a KVM host.
Consider access to standard Linux guest paravirtualized features (virtio-blk, virtio-net, etc.).
* Ethernet Network Trigger:
Determine if the bug can be triggered by processing ingress network Ethernet traffic, either directly (network stack)
or via drivers exposed to network data.
* Other Remote Trigger:
Determine if the bug can be triggered by processing remote traffic other than Ethernet (Wifi, Bluetooth, NFC, etc).
* Peripheral Trigger:
Determine if the bug can be triggered via an untrusted peripheral device that can be physically plugged
into a system, such as a USB device or a niche hardware driver handling external hardware inputs.
This is particularly important for mobile and desktop environments where users can plug in unknown devices.
* Malicious Filesystem Trigger:
Determine if the bug can be triggered by the kernel mounting and parsing a malicious filesystem image.
This is highly critical for Desktop and Mobile environments where external media or downloaded images
might be auto-mounted.
Don't make assumptions about the kernel source code (it may be different from what you assume it is).
Extensively use the provided code access tools (codesearch-*, git-*, grepper, etc)
to examine the actual source code, and confirm any assumptions.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt:
The kernel bug report is:
INFO: task udevd:4696 blocked in I/O wait for more than 143 seconds.
Tainted: G L syzkaller #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:udevd state:D stack:0 pid:4696 tgid:4696 ppid:4337 task_flags:0x400140 flags:0x00800011
Call trace:
__switch_to+0x2b0/0x6e0 arch/arm64/kernel/process.c:810 (T)
context_switch kernel/sched/core.c:5388 [inline]
__schedule+0x1bec/0x2dcc kernel/sched/core.c:7189
__schedule_loop kernel/sched/core.c:7268 [inline]
schedule+0x140/0x218 kernel/sched/core.c:7283
io_schedule+0x1c/0xe0 kernel/sched/core.c:8110
folio_wait_bit_common+0x66c/0x9e4 mm/filemap.c:1324
folio_put_wait_locked mm/filemap.c:1493 [inline]
do_read_cache_folio+0x240/0x5b8 mm/filemap.c:4089
read_cache_folio+0x68/0x84 mm/filemap.c:4139
read_mapping_folio include/linux/pagemap.h:1017 [inline]
read_part_sector+0xcc/0x708 block/partitions/core.c:724
adfspart_check_POWERTEC+0x98/0x5ac block/partitions/acorn.c:450
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x6fc/0x11c8 block/partitions/core.c:695
blkdev_get_whole+0x15c/0x240 block/bdev.c:756
bdev_open+0x2d8/0x8cc block/bdev.c:965
blkdev_open+0x2d8/0x404 block/fops.c:697
do_dentry_open+0x5c4/0xfc8 fs/open.c:947
vfs_open+0x44/0x2d4 fs/open.c:1079
do_open fs/namei.c:4699 [inline]
path_openat+0x2234/0x2a6c fs/namei.c:4858
do_file_open+0x1c4/0x2e4 fs/namei.c:4887
do_sys_openat2+0x114/0x1e8 fs/open.c:1364
do_sys_open+0xac/0xdc fs/open.c:1370
__do_sys_openat fs/open.c:1386 [inline]
__se_sys_openat fs/open.c:1381 [inline]
__arm64_sys_openat+0x9c/0xb8 fs/open.c:1381
__invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
invoke_syscall+0x98/0x244 arch/arm64/kernel/syscall.c:49
el0_svc_common+0xe8/0x23c arch/arm64/kernel/syscall.c:121
do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:140
el0_svc+0x64/0x260 arch/arm64/kernel/entry-common.c:740
el0t_64_sync_handler+0x48/0x148 arch/arm64/kernel/entry-common.c:759
el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:594
Showing all locks held in the system:
1 lock held by khungtaskd/31:
#0: ffff800088b672a0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#0: ffff800088b672a0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:838 [inline]
#0: ffff800088b672a0 (rcu_read_lock){....}-{1:3}, at: debug_show_all_locks+0x4c/0x188 kernel/locking/lockdep.c:6775
2 locks held by getty/4487:
#0: ffff0000cf1c60a0 (&tty->ldisc_sem){++++}-{0:0}, at: ldsem_down_read+0x3c/0x4c drivers/tty/tty_ldsem.c:340
#1: ffff80009232e2e8 (&ldata->atomic_read_lock){+.+.}-{4:4}, at: n_tty_read+0x354/0xf84 drivers/tty/n_tty.c:2211
1 lock held by udevd/4696:
#0: ffff0000c8226350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xcc/0x8cc block/bdev.c:953
2 locks held by kworker/u8:26/9926:
=============================================
Reply: **Analysis of the Bug Report**
**1. Root Cause Analysis:**
The bug report indicates that the `udevd` process has been blocked in an uninterruptible sleep state (`D` state) for over 143 seconds, triggering the kernel's hung task detector.
Looking at the stack trace, `udevd` is attempting to scan a newly discovered block device for partitions. It is executing the Acorn POWERTEC partition parser (`adfspart_check_POWERTEC`), which reads sector 0 of the block device via `read_part_sector()`. Under the hood, this calls into the page cache (`read_mapping_folio()` -> `do_read_cache_folio()`).
The task is specifically blocked in `folio_put_wait_locked()`. This happens when the page cache folio for the requested sector is already locked by another thread that initiated the I/O and is currently waiting for the block device to complete the read request. Because the underlying block device is completely unresponsive (hung), the I/O never completes, the folio is never unlocked, and any subsequent tasks trying to read that sector (like `udevd`) will hang indefinitely in I/O wait.
**2. Security Impact:**
* **Exploitable:** **No.** This is a pure concurrency/I/O wait state issue caused by an unresponsive hardware/software block device. There is no memory corruption, out-of-bounds access, or use-after-free involved.
* **Denial of Service (DoS):** **Yes.** If `udevd` hangs while probing a device, it ties up a worker thread. If enough devices hang, `udevd` can be completely exhausted, preventing the system from processing any new hardware events or mounting legitimate drives.
* **Unprivileged / User Namespace Access:** **No.** To trigger this via software, an attacker would need to create a malicious block device (e.g., a loop device backed by a hanging FUSE filesystem, or an NBD device). Creating block devices requires `CAP_SYS_ADMIN` in the *initial* user namespace (e.g., `/dev/loop-control` is restricted to root, and NBD netlink creation explicitly checks for init namespace capabilities). Therefore, unprivileged users cannot trigger this, even within a user namespace.
* **Peripheral Trigger:** **Yes.** A malicious physical device, such as a rogue USB storage drive, could intentionally stop responding to SCSI read commands after being plugged in. The kernel would wait for the I/O to complete (subject to SCSI timeouts, which can be several minutes long and exceed the 120-second hung task threshold), causing `udevd` and any other probing tasks to hang.
**Conclusion:**
This is not a vulnerability in the partition parsing code itself, but rather a known consequence of how the Linux kernel handles unresponsive block devices. Syzkaller frequently triggers this by intentionally injecting faults into block devices or creating NBD/loop devices that drop I/O requests. While it represents a DoS vector via malicious physical USB devices, it cannot be exploited for privilege escalation or triggered by unprivileged local attackers.
|
| 6/2 |
2026/06/02 19:07 |
llm |
expert |
0m
Model:
Tokens:
input: 6984
output: 40
thoughts: 729
Thoughts: **Analyzing a Blocked I/O Wait in `udevd`**
Okay, I've got a bug report here: a `udevd` task is blocked, complaining about an I/O wait exceeding 143 seconds. That's a significant amount of time. The stack trace is what I need to dig into. Let's see... it looks like the hold-up is deep inside the block I/O subsystem: `folio_wait_bit_common`, down into `read_mapping_folio`. Right, so we're talking about reading a file folio, and specifically the wait function. It's hanging in a `read_part_sector` call, which is part of the `adfspart_check_POWERTEC` function. Now that I understand this, I can see that it means that it is reading a sector on a block device during partition scanning, probably trying to determine the partition table layout.
So, `udevd` is blocked waiting on I/O while trying to parse or check an Acorn partition table, which is an old partition scheme, interesting. I'm immediately suspicious of that `adfspart_check_POWERTEC` function. I need to examine its implementation closely. This could very well be a bug related to how we handle or interpret an Acorn partition. The I/O wait suggests either a device issue, or something that's gone wrong in that particular parsing. I'll bet it is something in acorn partition parsing. Let's start there.
|
| 7/2 |
2026/06/02 19:07 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:block/partitions/acorn.c Name:adfspart_check_POWERTEC]
Results: map[SourceCode: 432: /*
433: * Purpose: allocate ICS partitions.
434: * Params : hd - pointer to gendisk structure to store partition info.
435: * dev - device number to access.
436: * Returns: -1 on error, 0 for no ICS table, 1 for partitions ok.
437: * Alloc : hda = whole drive
438: * hda1 = ADFS partition 0 on first drive.
439: * hda2 = ADFS partition 1 on first drive.
440: * ..etc..
441: */
442: int adfspart_check_POWERTEC(struct parsed_partitions *state)
443: {
444: Sector sect;
445: const unsigned char *data;
446: const struct ptec_part *p;
447: int slot = 1;
448: int i;
449:
450: data = read_part_sector(state, 0, §);
451: if (!data)
452: return -1;
453:
454: if (!valid_ptec_sector(data)) {
455: put_dev_sector(sect);
456: return 0;
457: }
458:
459: seq_buf_puts(&state->pp_buf, " [POWERTEC]");
460:
461: for (i = 0, p = (const struct ptec_part *)data; i < 12; i++, p++) {
462: u32 start = le32_to_cpu(p->start);
463: u32 size = le32_to_cpu(p->size);
464:
465: if (size)
466: put_partition(state, slot++, start, size);
467: }
468:
469: put_dev_sector(sect);
470: seq_buf_puts(&state->pp_buf, "\n");
471: return 1;
472: }
SourceFile:block/partitions/acorn.c]
|
| 8/2 |
2026/06/02 19:07 |
llm |
expert |
0m
Model:
Tokens:
input: 8715
output: 22
thoughts: 220
Thoughts: **Debugging a Blocked Task**
Okay, so I'm looking at this task that's hung, specifically reading sector 0, and it's been blocked for a whopping 143 seconds. That immediately raises a red flag. Why is it taking so long? My first instinct is that the block device itself is simply not responding. Given that this is coming from syzkaller, it's highly likely we're dealing with either a loop device or some form of fault injection. Syzkaller leverages these techniques frequently.
If it's a loop device, and that loop device is backed by a slow filesystem, or if there's been a fault injected, or even if we're dealing with a Network Block Device (NBD) that's gone unresponsive, that would explain the I/O wait. I need to understand the path that led to this read. Let me trace back to `adfspart_check_POWERTEC` - does that function introduce a loop? No, it's just reading sector 0, which points directly at the call to `read_part_sector(state, 0, §)`.
So, it's the `read_part_sector` function that's the culprit. Is this a legitimate kernel bug, or just a slow or unresponsive block device, either simulated or real? If a block device is truly hung, any read operation will hang indefinitely, right? Remembering syzkaller's modus operandi, it's very possible it created an NBD or loop device and then failed to respond to requests, intentionally or unintentionally, leading to this hung task. My primary thought is, this is a simulated condition, not a code defect. Let's see if there are other reports of similar events.
|
| 9/2 |
2026/06/02 19:07 |
tool |
grepper |
0m
Args: map[Expression:adfspart_check_POWERTEC]
Results: map[Output:block/partitions/acorn.c=414=static inline int valid_ptec_sector(const unsigned char *data)
--
block/partitions/acorn.c-441- */
block/partitions/acorn.c:442:int adfspart_check_POWERTEC(struct parsed_partitions *state)
block/partitions/acorn.c-443-{
--
block/partitions/check.h=51=int adfspart_check_ICS(struct parsed_partitions *state);
block/partitions/check.h:52:int adfspart_check_POWERTEC(struct parsed_partitions *state);
block/partitions/check.h-53-int aix_partition(struct parsed_partitions *state);
--
block/partitions/core.c=17=static int (*const check_part[])(struct parsed_partitions *) = {
--
block/partitions/core.c-25-#ifdef CONFIG_ACORN_PARTITION_POWERTEC
block/partitions/core.c:26: adfspart_check_POWERTEC,
block/partitions/core.c-27-#endif
]
|
| 10/2 |
2026/06/02 19:07 |
llm |
expert |
0m
Model:
Tokens:
input: 9608
output: 34
thoughts: 735
Thoughts: **Analyzing a Hung Task in the Kernel**
Okay, so I've got this hung task. Looks like it's stuck waiting on a folio read, specifically within the `do_read_cache_folio` function. Following the call stack, I see it's related to reading partition tables – pretty standard stuff. This is all happening within the context of `read_part_sector`.
Right, if the underlying block device is unresponsive, like a hung loop device, an NBD device with a dead server, or even a userfaultfd-backed loop device, `read_part_sector` will just hang. The immediate thought is, "Is this a security issue?" A denial-of-service, certainly, if an unprivileged user can trigger a kernel thread or another process to hang. But in this case, the task that's hung is `udevd` or maybe `getty` or a `kworker` thread. Ah, it's `udevd`, and it's opening the block device.
So, if `udevd` is opening a block device, it triggers partition scanning, which makes sense. And if that block device is malicious or simply unresponsive, `udevd` will hang. Is this a kernel bug, then? Usually, these hung tasks on unresponsive block devices are considered either working as intended or a known issue with those particular drivers. Let's dig deeper and see if there's any specific vulnerability here.
Okay, `udevd` opens the device, which triggers `bdev_disk_changed`, which triggers `blk_add_partitions`, which finally calls `check_partition`. `check_partition` iterates over all the registered partition parsers. Ah, `adfspart_check_POWERTEC` is just *one* of those parsers. It reads sector 0. If the device is unresponsive, it will hang.
Is there any chance of memory corruption? No, it's just a hung task. But it *is* a DoS, because it hangs `udevd`. The question is, can an unprivileged user trigger this? They can't usually create loop or NBD devices unless they have `CAP_SYS_ADMIN` or `CAP_NET_ADMIN` in the initial namespace, or unless they're in a user namespace. Wait, loop devices can be created if `loop-control` is accessible, but it usually still requires privileges to set the backing file.
Let's see if there's anything specifically unique about `POWERTEC` partitions. Nope, it just reads sector 0. Any partition parser doing that on an unresponsive device would hang. Why did syzkaller flag this with `adfspart_check_POWERTEC` specifically? Maybe it's the first partition parser that reads sector 0, or it's just the one that happened to be running when the timeout hit. Let's look at the `check_part` array in `block/partitions/core.c` to see the sequence.
|
| 11/2 |
2026/06/02 19:07 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:block/partitions/core.c Name:check_part]
Results: map[SourceCode: 17: static int (*const check_part[])(struct parsed_partitions *) = {
18: /*
19: * Probe partition formats with tables at disk address 0
20: * that also have an ADFS boot block at 0xdc0.
21: */
22: #ifdef CONFIG_ACORN_PARTITION_ICS
23: adfspart_check_ICS,
24: #endif
25: #ifdef CONFIG_ACORN_PARTITION_POWERTEC
26: adfspart_check_POWERTEC,
27: #endif
28: #ifdef CONFIG_ACORN_PARTITION_EESOX
29: adfspart_check_EESOX,
30: #endif
31:
32: /*
33: * Now move on to formats that only have partition info at
34: * disk address 0xdc0. Since these may also have stale
35: * PC/BIOS partition tables, they need to come before
36: * the msdos entry.
37: */
38: #ifdef CONFIG_ACORN_PARTITION_CUMANA
39: adfspart_check_CUMANA,
40: #endif
41: #ifdef CONFIG_ACORN_PARTITION_ADFS
42: adfspart_check_ADFS,
43: #endif
44:
45: #ifdef CONFIG_CMDLINE_PARTITION
46: cmdline_partition,
47: #endif
48: #ifdef CONFIG_OF_PARTITION
49: of_partition, /* cmdline have priority to OF */
50: #endif
51: #ifdef CONFIG_EFI_PARTITION
52: efi_partition, /* this must come before msdos */
53: #endif
54: #ifdef CONFIG_SGI_PARTITION
55: sgi_partition,
56: #endif
57: #ifdef CONFIG_LDM_PARTITION
58: ldm_partition, /* this must come before msdos */
59: #endif
60: #ifdef CONFIG_MSDOS_PARTITION
61: msdos_partition,
62: #endif
63: #ifdef CONFIG_OSF_PARTITION
64: osf_partition,
65: #endif
66: #ifdef CONFIG_SUN_PARTITION
67: sun_partition,
68: #endif
69: #ifdef CONFIG_AMIGA_PARTITION
70: amiga_partition,
71: #endif
72: #ifdef CONFIG_ATARI_PARTITION
73: atari_partition,
74: #endif
75: #ifdef CONFIG_MAC_PARTITION
76: mac_partition,
77: #endif
78: #ifdef CONFIG_ULTRIX_PARTITION
79: ultrix_partition,
80: #endif
81: #ifdef CONFIG_IBM_PARTITION
82: ibm_partition,
83: #endif
84: #ifdef CONFIG_KARMA_PARTITION
85: karma_partition,
86: #endif
87: #ifdef CONFIG_SYSV68_PARTITION
88: sysv68_partition,
89: #endif
90: NULL
91: };
SourceFile:block/partitions/core.c]
|
| 12/2 |
2026/06/02 19:07 |
llm |
expert |
0m
Model:
Tokens:
input: 11963
output: 39
thoughts: 135
Thoughts: **Partition Parsing Optimization**
Okay, so `adfspart_check_POWERTEC` – that's one of the *very* initial partition parsers that gets invoked, right after `adfspart_check_ICS`. Both of them kick off by reading sector zero. The problem I'm trying to avoid is, if the block device is completely dead, a read operation will hang. But wait, since both check sector 0, and `read_part_sector` caches, that means if the first, `adfspart_check_ICS`, runs the sector will be cached. So I should probably check how `adfspart_check_ICS` is working.
|
| 13/2 |
2026/06/02 19:07 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:block/partitions/acorn.c Name:adfspart_check_ICS]
Results: map[SourceCode: 336: /*
337: * Purpose: allocate ICS partitions.
338: * Params : hd - pointer to gendisk structure to store partition info.
339: * dev - device number to access.
340: * Returns: -1 on error, 0 for no ICS table, 1 for partitions ok.
341: * Alloc : hda = whole drive
342: * hda1 = ADFS partition 0 on first drive.
343: * hda2 = ADFS partition 1 on first drive.
344: * ..etc..
345: */
346: int adfspart_check_ICS(struct parsed_partitions *state)
347: {
348: const unsigned char *data;
349: const struct ics_part *p;
350: int slot;
351: Sector sect;
352:
353: /*
354: * Try ICS style partitions - sector 0 contains partition info.
355: */
356: data = read_part_sector(state, 0, §);
357: if (!data)
358: return -1;
359:
360: if (!valid_ics_sector(data)) {
361: put_dev_sector(sect);
362: return 0;
363: }
364:
365: seq_buf_puts(&state->pp_buf, " [ICS]");
366:
367: for (slot = 1, p = (const struct ics_part *)data; p->size; p++) {
368: u32 start = le32_to_cpu(p->start);
369: s32 size = le32_to_cpu(p->size); /* yes, it's signed. */
370:
371: if (slot == state->limit)
372: break;
373:
374: /*
375: * Negative sizes tell the RISC OS ICS driver to ignore
376: * this partition - in effect it says that this does not
377: * contain an ADFS filesystem.
378: */
379: if (size < 0) {
380: size = -size;
381:
382: /*
383: * Our own extension - We use the first sector
384: * of the partition to identify what type this
385: * partition is. We must not make this visible
386: * to the filesystem.
387: */
388: if (size > 1 && adfspart_check_ICSLinux(state, start)) {
389: start += 1;
390: size -= 1;
391: }
392: }
393:
394: if (size)
395: put_partition(state, slot++, start, size);
396: }
397:
398: put_dev_sector(sect);
399: seq_buf_puts(&state->pp_buf, "\n");
400: return 1;
401: }
SourceFile:block/partitions/acorn.c]
|
| 14/2 |
2026/06/02 19:07 |
llm |
expert |
0m
Model:
Tokens:
input: 13242
output: 36
thoughts: 217
Thoughts: **Analyzing the Partition Check Hang**
Okay, so I'm looking at this stack trace and it's pointing to a hang in `adfspart_check_POWERTEC`, but the initial thought is that `adfspart_check_ICS` is the culprit, especially since it's reading sector 0. If the device is unresponsive, `adfspart_check_ICS` would definitely hang, but the trace is telling a different story.
Right, so the first thing I need to confirm is whether `CONFIG_ACORN_PARTITION_ICS` is actually enabled. Or perhaps `adfspart_check_ICS` completed successfully (or failed quickly) and then `adfspart_check_POWERTEC` is the issue?
Aha! `adfspart_check_ICS` reads sector 0 and throws it into the page cache. If that read succeeds, then `adfspart_check_POWERTEC` *should* find sector 0 already cached. So why the hang? `adfspart_check_POWERTEC` shouldn't be hanging on a read of sector 0 if `adfspart_check_ICS` has already hit it.
This doesn't make sense. I'll need to dig deeper, specifically into `read_part_sector` to understand the flow here.
|
| 15/2 |
2026/06/02 19:07 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:block/partitions/core.c Name:read_part_sector]
Results: map[SourceCode: 714: void *read_part_sector(struct parsed_partitions *state, sector_t n, Sector *p)
715: {
716: struct address_space *mapping = state->disk->part0->bd_mapping;
717: struct folio *folio;
718:
719: if (n >= get_capacity(state->disk)) {
720: state->access_beyond_eod = true;
721: goto out;
722: }
723:
724: folio = read_mapping_folio(mapping, n >> PAGE_SECTORS_SHIFT, NULL);
725: if (IS_ERR(folio))
726: goto out;
727:
728: p->v = folio;
729: return folio_address(folio) + offset_in_folio(folio, n * SECTOR_SIZE);
730: out:
731: p->v = NULL;
732: return NULL;
733: }
SourceFile:block/partitions/core.c]
|
| 16/2 |
2026/06/02 19:07 |
llm |
expert |
0m
Model:
Tokens:
input: 14097
output: 36
thoughts: 47
Thoughts: Okay, here's my interpretation of that code snippet, delivered as if it's my own thought process:
**Decoding the `adfspart_check_ICS` Function's Logic**
Alright, let me break this down. So, `adfspart_check_ICS` is clearly some kind of partition check function. The key here is what happens when it reads sector 0. It's calling `read_part_sector(state, 0, §)`. That makes perfect sense; sector 0 is the typical place to find partition information, like the Master Boot Record or equivalent. It's likely trying to figure out the partition layout on this device.
The `read_part_sector` function is presumably responsible for actually going to the device, reading sector 0, and storing the data somewhere – I'm guessing in that `sect` buffer. Then, it moves on, calling `put_dev_sector(sect)`. This part is interesting, likely this is a function that makes this accessible for checking.
Essentially, the function is trying to read the first sector from a particular device using `read_part_sector()` and then it takes the data read from `sect` and uses it in `put_dev_sector()`.
I would like to look into those two functions now, to understand how the data is stored and checked.
|
| 17/2 |
2026/06/02 19:07 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:block/partitions/core.c Name:put_dev_sector]
Results: map[SourceCode: 32: static inline void put_dev_sector(Sector p)
33: {
34: folio_put(p.v);
35: }
SourceFile:block/partitions/check.h]
|
| 18/2 |
2026/06/02 19:07 |
llm |
expert |
0m
Model:
Tokens:
input: 14546
output: 37
thoughts: 228
Thoughts: **Debugging a Folio Cache Interaction**
Okay, so `put_dev_sector` just places the folio; it doesn't actually invalidate it from the page cache. That's good to know. Now, if the folio is *already* in the page cache, then `read_mapping_folio` called from `adfspart_check_POWERTEC` *should* just find it there and return immediately. So why the wait in `folio_wait_bit_common`? That's the real question.
Right, I see it now. `read_mapping_folio` calls `read_cache_folio`, which in turn calls `do_read_cache_folio`. And *that's* where the waiting can occur. If the folio is in the cache, but the `PG_uptodate` bit isn't set, or if another thread is currently reading it, we have to block.
Wait a second, if `adfspart_check_ICS` successfully read the data, the folio would be marked as uptodate, right? So we shouldn't be hitting that condition... Unless… what if `adfspart_check_ICS` failed – say, due to an I/O error – but the folio somehow *still* ended up in the page cache, but without its `PG_uptodate` bit set? *That* would explain it! I think that's the likely scenario. Let's dig into `do_read_cache_folio` to confirm this suspicion.
|
| 19/2 |
2026/06/02 19:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:mm/filemap.c Name:do_read_cache_folio]
Results: map[SourceCode:4059: static struct folio *do_read_cache_folio(struct address_space *mapping,
4060: pgoff_t index, filler_t filler, struct file *file, gfp_t gfp)
4061: {
4062: struct folio *folio;
4063: int err;
4064:
4065: if (!filler)
4066: filler = mapping->a_ops->read_folio;
4067: repeat:
4068: folio = filemap_get_folio(mapping, index);
4069: if (IS_ERR(folio)) {
4070: folio = filemap_alloc_folio(gfp, mapping_min_folio_order(mapping), NULL);
4071: if (!folio)
4072: return ERR_PTR(-ENOMEM);
4073: index = mapping_align_index(mapping, index);
4074: err = filemap_add_folio(mapping, folio, index, gfp);
4075: if (unlikely(err)) {
4076: folio_put(folio);
4077: if (err == -EEXIST)
4078: goto repeat;
4079: /* Presumably ENOMEM for xarray node */
4080: return ERR_PTR(err);
4081: }
4082:
4083: goto filler;
4084: }
4085: if (folio_test_uptodate(folio))
4086: goto out;
4087:
4088: if (!folio_trylock(folio)) {
4089: folio_put_wait_locked(folio, TASK_UNINTERRUPTIBLE);
4090: goto repeat;
4091: }
4092:
4093: /* Folio was truncated from mapping */
4094: if (!folio->mapping) {
4095: folio_unlock(folio);
4096: folio_put(folio);
4097: goto repeat;
4098: }
4099:
4100: /* Someone else locked and filled the page in a very small window */
4101: if (folio_test_uptodate(folio)) {
4102: folio_unlock(folio);
4103: goto out;
4104: }
4105:
4106: filler:
4107: err = filemap_read_folio(file, filler, folio);
4108: if (err) {
4109: folio_put(folio);
4110: if (err == AOP_TRUNCATED_PAGE)
4111: goto repeat;
4112: return ERR_PTR(err);
4113: }
4114:
4115: out:
4116: folio_mark_accessed(folio);
4117: return folio;
4118: }
SourceFile:mm/filemap.c]
|
| 20/2 |
2026/06/02 19:08 |
llm |
expert |
0m
Model:
Tokens:
input: 15972
output: 39
thoughts: 1177
Thoughts: **Analyzing a udevd Hang**
Okay, so `folio_put_wait_locked` is being called, which means the folio is locked by another thread. My initial thought is that a thread is currently reading it. This looks like `udevd` is trying to read the folio, but another thread is already reading it, and that thread is hung. The stack trace confirms `udevd` is blocked, indicating another thread holds the folio lock.
The culprit is likely another thread performing I/O on the same block device, maybe a `kworker` thread or another `udevd` instance. If the block device is hung, the I/O thread will be stuck in the block layer, waiting for a request to finish. `udevd` is just a secondary victim, waiting for the folio lock to become available. If the block device is hung, that I/O thread will be stuck in the `D` state. The hung task detector would have picked that up, and since `udevd` is in the `D` state for 143 seconds, that’s consistent.
Is this a kernel bug, or just the expected behavior of a hung block device? If a block device hangs, any task trying to read from it will hang. This is normal. The real question is: can an unprivileged user trigger this?
If a user can create a loop device and back it with something like FUSE or userfaultfd, they could potentially hang the block device. Then, if they can get `udevd` to read from it, `udevd` would hang, too. And yes, `udevd` scans new block devices automatically. If an unprivileged user creates a loop device, `udevd` will automatically try to scan it for partitions, so if they could hang the backing file, `udevd` would hang. This is a DoS, because `udevd` is critical, and if its workers are exhausted, no new devices can be processed.
But, can an unprivileged user even *create* a loop device? Usually, `/dev/loop-control` is only accessible to root. User namespaces might offer a way, allowing a user with `CAP_SYS_ADMIN` to create a loop device. However, loop devices are not namespace-aware. This means the user would still need access to the host’s `/dev/loop-control` and `/dev/loopX` devices, which are root-owned. So, it looks unlikely.
Wait a second, though. Syzkaller runs as root or with capabilities. If syzkaller created a hung block device, it *has* the privileges to do so. So, this might be a valid test case.
But let's think about this a bit more. What if it's not a hung block device, but a deadlock? Let's check the locks held:
```
1 lock held by udevd/4696:
#0: ffff0000c8226350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xcc/0x8cc block/bdev.c:953
```
`udevd` *is* holding `disk->open_mutex`. If another thread is doing I/O and holding the folio lock, does it also hold the `disk->open_mutex`? If another thread is doing `bdev_open`, it would need `disk->open_mutex`, but `udevd` already has it! If `udevd` has `disk->open_mutex` and it's waiting for the folio lock, who *has* the folio lock? Could `udevd` have locked the folio and forgotten to unlock it?
Let's look at the `adfspart_check_POWERTEC` path. It calls `read_part_sector(state, 0, §)`. Does `read_part_sector` lock the folio? No, `read_part_sector` calls `read_mapping_folio`, which returns an unlocked folio if it’s up-to-date. In fact, `do_read_cache_folio` *always* returns an unlocked folio if the folio is up-to-date.
```c
if (folio_test_uptodate(folio)) {
folio_unlock(folio);
goto out;
}
```
And `filemap_read_folio` unlocks the folio when the read completes. So, `do_read_cache_folio` *should* always return an unlocked folio. If `udevd` is waiting for the folio lock in `do_read_cache_folio`, someone else *has* it locked. It could be that the block device is just slow or hung, and the
|
| 21/2 |
2026/06/02 19:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:block/partitions/acorn.c Name:adfspart_check_ICS]
Results: map[SourceCode: 336: /*
337: * Purpose: allocate ICS partitions.
338: * Params : hd - pointer to gendisk structure to store partition info.
339: * dev - device number to access.
340: * Returns: -1 on error, 0 for no ICS table, 1 for partitions ok.
341: * Alloc : hda = whole drive
342: * hda1 = ADFS partition 0 on first drive.
343: * hda2 = ADFS partition 1 on first drive.
344: * ..etc..
345: */
346: int adfspart_check_ICS(struct parsed_partitions *state)
347: {
348: const unsigned char *data;
349: const struct ics_part *p;
350: int slot;
351: Sector sect;
352:
353: /*
354: * Try ICS style partitions - sector 0 contains partition info.
355: */
356: data = read_part_sector(state, 0, §);
357: if (!data)
358: return -1;
359:
360: if (!valid_ics_sector(data)) {
361: put_dev_sector(sect);
362: return 0;
363: }
364:
365: seq_buf_puts(&state->pp_buf, " [ICS]");
366:
367: for (slot = 1, p = (const struct ics_part *)data; p->size; p++) {
368: u32 start = le32_to_cpu(p->start);
369: s32 size = le32_to_cpu(p->size); /* yes, it's signed. */
370:
371: if (slot == state->limit)
372: break;
373:
374: /*
375: * Negative sizes tell the RISC OS ICS driver to ignore
376: * this partition - in effect it says that this does not
377: * contain an ADFS filesystem.
378: */
379: if (size < 0) {
380: size = -size;
381:
382: /*
383: * Our own extension - We use the first sector
384: * of the partition to identify what type this
385: * partition is. We must not make this visible
386: * to the filesystem.
387: */
388: if (size > 1 && adfspart_check_ICSLinux(state, start)) {
389: start += 1;
390: size -= 1;
391: }
392: }
393:
394: if (size)
395: put_partition(state, slot++, start, size);
396: }
397:
398: put_dev_sector(sect);
399: seq_buf_puts(&state->pp_buf, "\n");
400: return 1;
401: }
SourceFile:block/partitions/acorn.c]
|
| 22/2 |
2026/06/02 19:08 |
llm |
expert |
0m
Model:
Tokens:
input: 19175
output: 42
thoughts: 71
Thoughts: **Analyzing the ADFS Partition Check**
Okay, so `adfspart_check_ICS` is pretty straightforward. It calls `read_part_sector`, and that function hands back an unlocked folio. Then, we use `put_dev_sector`, which ultimately just calls `folio_put`. That seems clean; there's no obvious folio lock leakage happening here. I'm reasonably confident in that assessment. But...wait. I need to be absolutely certain. My initial scan focused on the obvious path. What about related functions? We know that this isn't the entire story. What is happening within `adfspart_check_ICSLinux`? I need to check that context and see if there are other, hidden side effects. I won't just trust a basic check.
|
| 23/2 |
2026/06/02 19:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:block/partitions/acorn.c Name:adfspart_check_ICSLinux]
Results: map[SourceCode: 304: static int adfspart_check_ICSLinux(struct parsed_partitions *state,
305: unsigned long block)
306: {
307: Sector sect;
308: unsigned char *data = read_part_sector(state, block, §);
309: int result = 0;
310:
311: if (data) {
312: if (memcmp(data, "LinuxPart", 9) == 0)
313: result = 1;
314: put_dev_sector(sect);
315: }
316:
317: return result;
318: }
SourceFile:block/partitions/acorn.c]
|
| 24/2 |
2026/06/02 19:08 |
llm |
expert |
0m
Model:
Tokens:
input: 19687
output: 36
thoughts: 350
Thoughts: **Debugging a Potential File System Lock Issue**
Okay, so I've eliminated the possibility of a lock leak. The folio isn't supposed to be locked, so why is it? Ah, I see, the I/O is still in progress! That makes sense because `read_part_sector` *should* wait for the folio lock if the I/O is active. Now, if `adfspart_check_ICS` were to call `read_part_sector(0)`, it would wait for that I/O to finish, and return with an unlocked folio. Then `adfspart_check_POWERTEC` is called, and the folio should be uptodate, returning immediately!
But why is `adfspart_check_POWERTEC` waiting for that folio lock? Hmm, what if `adfspart_check_ICS` is *not* enabled? I can't check the config right now, but maybe syzkaller has disabled `CONFIG_ACORN_PARTITION_ICS` and enabled `CONFIG_ACORN_PARTITION_POWERTEC`. If this is the first partition parser to run, then it will initiate the I/O for sector 0.
Wait a second. If it starts the I/O, that will call `read_mapping_folio`, which will allocate the folio, lock it, and then call `filemap_read_folio`. `filemap_read_folio` will then submit the I/O and wait for its completion, right? Right, and `filemap_read_folio` calls `mapping->a_ops->read_folio`. Okay, for block devices, that function is `blkdev_read_folio`.
|
| 25/2 |
2026/06/02 19:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:block/fops.c Name:blkdev_read_folio]
Results: map[SourceCode: 492: static int blkdev_read_folio(struct file *file, struct folio *folio)
493: {
494: return block_read_full_folio(folio, blkdev_get_block);
495: }
SourceFile:block/fops.c]
|
| 26/2 |
2026/06/02 19:08 |
llm |
expert |
0m
Model:
Tokens:
input: 20530
output: 36
thoughts: 58
Thoughts: **My Immediate Thoughts on the `block_read_full_folio` Function**
Okay, so `block_read_full_folio` is responsible for initiating the I/O operation and then... it just *returns*? That's not what I initially expected. I need to be absolutely sure about this. The assumption was that it would block, at least in some circumstances, for the I/O to complete before returning. But it looks like it's a non-blocking submit. It hands off the request and moves on.
Now I need to clarify what the function `filemap_read_folio` does. My understanding has to change. Is this function is the next step to wait for the I/O, or something else? I need to look into it to understand the flow of execution and how the data ultimately gets read and made available. My assumptions were wrong, I need to understand this new I/O operation.
|
| 27/2 |
2026/06/02 19:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:mm/filemap.c Name:filemap_read_folio]
Results: map[SourceCode:2492: static int filemap_read_folio(struct file *file, filler_t filler,
2493: struct folio *folio)
2494: {
2495: bool workingset = folio_test_workingset(folio);
2496: unsigned long pflags;
2497: int error;
2498:
2499: /* Start the actual read. The read will unlock the page. */
2500: if (unlikely(workingset))
2501: psi_memstall_enter(&pflags);
2502: error = filler(file, folio);
2503: if (unlikely(workingset))
2504: psi_memstall_leave(&pflags);
2505: if (error)
2506: return error;
2507:
2508: error = folio_wait_locked_killable(folio);
2509: if (error)
2510: return error;
2511: if (folio_test_uptodate(folio))
2512: return 0;
2513: if (file)
2514: shrink_readahead_size_eio(&file->f_ra);
2515: return -EIO;
2516: }
SourceFile:mm/filemap.c]
|
| 28/2 |
2026/06/02 19:08 |
llm |
expert |
0m
Model:
Tokens:
input: 21200
output: 37
thoughts: 165
Thoughts: **Debugging a Filemap Read**
Okay, so I'm tracking down this issue, and it looks like `filemap_read_folio` is the culprit, which then calls `folio_wait_locked_killable(folio)`. Hmm, now the stack trace is telling me something interesting. It's hanging in `folio_wait_bit_common`, and then that gets called by `folio_put_wait_locked`, which is actually called by `do_read_cache_folio`. So, it seems like we are blocked in `folio_put_wait_locked`, likely because of something happening within `do_read_cache_folio`. It makes sense to examine `do_read_cache_folio` more closely.
|
| 29/2 |
2026/06/02 19:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:mm/filemap.c Name:do_read_cache_folio]
Results: map[SourceCode:4059: static struct folio *do_read_cache_folio(struct address_space *mapping,
4060: pgoff_t index, filler_t filler, struct file *file, gfp_t gfp)
4061: {
4062: struct folio *folio;
4063: int err;
4064:
4065: if (!filler)
4066: filler = mapping->a_ops->read_folio;
4067: repeat:
4068: folio = filemap_get_folio(mapping, index);
4069: if (IS_ERR(folio)) {
4070: folio = filemap_alloc_folio(gfp, mapping_min_folio_order(mapping), NULL);
4071: if (!folio)
4072: return ERR_PTR(-ENOMEM);
4073: index = mapping_align_index(mapping, index);
4074: err = filemap_add_folio(mapping, folio, index, gfp);
4075: if (unlikely(err)) {
4076: folio_put(folio);
4077: if (err == -EEXIST)
4078: goto repeat;
4079: /* Presumably ENOMEM for xarray node */
4080: return ERR_PTR(err);
4081: }
4082:
4083: goto filler;
4084: }
4085: if (folio_test_uptodate(folio))
4086: goto out;
4087:
4088: if (!folio_trylock(folio)) {
4089: folio_put_wait_locked(folio, TASK_UNINTERRUPTIBLE);
4090: goto repeat;
4091: }
4092:
4093: /* Folio was truncated from mapping */
4094: if (!folio->mapping) {
4095: folio_unlock(folio);
4096: folio_put(folio);
4097: goto repeat;
4098: }
4099:
4100: /* Someone else locked and filled the page in a very small window */
4101: if (folio_test_uptodate(folio)) {
4102: folio_unlock(folio);
4103: goto out;
4104: }
4105:
4106: filler:
4107: err = filemap_read_folio(file, filler, folio);
4108: if (err) {
4109: folio_put(folio);
4110: if (err == AOP_TRUNCATED_PAGE)
4111: goto repeat;
4112: return ERR_PTR(err);
4113: }
4114:
4115: out:
4116: folio_mark_accessed(folio);
4117: return folio;
4118: }
SourceFile:mm/filemap.c]
|
| 30/2 |
2026/06/02 19:08 |
llm |
expert |
0m
Model:
Tokens:
input: 22395
output: 34
thoughts: 938
Thoughts: **Analyzing a Block Device Hang**
Okay, so `udevd` is stuck in `folio_put_wait_locked`. That tells me `filemap_get_folio` worked, but the folio wasn't up-to-date and `folio_trylock` failed. That means another thread beat `udevd` to locking the folio for I/O and is presumably filling it or has finished and is about to release it. Since the block device is hung, the I/O will never complete. The other thread is probably in `filemap_read_folio` and then `folio_wait_locked_killable`. Wait...if it's in `folio_wait_locked_killable` it's in `TASK_KILLABLE`, which is a variation of `TASK_UNINTERRUPTIBLE`. Shouldn't the hung task detector catch *that* thread too?
I need to re-examine the bug report. All it shows is `udevd`. Perhaps the other thread was reported earlier, or maybe it’s *not* in a `D` state? Wait, I'm sure `folio_wait_locked_killable` is `TASK_KILLABLE`, and that is `TASK_WAKEKILL | TASK_UNINTERRUPTIBLE`. The hung task detector *does* check for `TASK_UNINTERRUPTIBLE`. So it *should* have been reported! Maybe syzkaller only extracted the `udevd` report, or it's just the first one.
Regardless, the root cause is a hung block device. Is there a vulnerability here? If a user *can* create a hung block device, they can DoS any task trying to read from it. This is a known issue, loop devices with FUSE or NBD devices can do this. Usually, this is not a security problem as creating such devices requires privileges, or it's a known DoS vector that is accepted. Wait, could an unprivileged user actually trigger this?
Let's see, what is actually happening in the `adfspart_check_POWERTEC` function? It's just reading sector 0, it's not specific to that code! Any partition parser would do the same. The stack trace is just happening to be there because it's first, or it's the first time sector 0 is read if `ICS` is disabled. Maybe `adfspart_check_POWERTEC` is called to read sector 0, but there's a bug in `read_part_sector` or something? No, that's just standard page cache code.
What if `udevd` is the *only* thread, and it's deadlocked? How could `udevd` deadlock itself? If it locked the folio, then called `do_read_cache_folio` again on the same folio? Let's check the call stack of `udevd`:
`read_part_sector` calls `adfspart_check_POWERTEC` and that calls `read_part_sector`. This is the *first* time `read_part_sector` is called on sector 0 in this thread! Could it be that `check_partition` already read sector 0? It looks like it is not.
|
| 31/2 |
2026/06/02 19:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:block/partitions/core.c Name:check_partition]
Results: map[SourceCode: 119: static struct parsed_partitions *check_partition(struct gendisk *hd)
120: {
121: struct parsed_partitions *state;
122: int i, res, err;
123:
124: state = allocate_partitions(hd);
125: if (!state)
126: return NULL;
127: state->pp_buf.buffer = (char *)__get_free_page(GFP_KERNEL);
128: if (!state->pp_buf.buffer) {
129: free_partitions(state);
130: return NULL;
131: }
132: seq_buf_init(&state->pp_buf, state->pp_buf.buffer, PAGE_SIZE);
133:
134: state->disk = hd;
135: strscpy(state->name, hd->disk_name);
136: seq_buf_printf(&state->pp_buf, " %s:", state->name);
137: if (isdigit(state->name[strlen(state->name)-1]))
138: sprintf(state->name, "p");
139:
140: i = res = err = 0;
141: while (!res && check_part[i]) {
142: memset(state->parts, 0, state->limit * sizeof(state->parts[0]));
143: res = check_part[i++](state);
144: if (res < 0) {
145: /*
146: * We have hit an I/O error which we don't report now.
147: * But record it, and let the others do their job.
148: */
149: err = res;
150: res = 0;
151: }
152:
153: }
154: if (res > 0) {
155: printk(KERN_INFO "%s", seq_buf_str(&state->pp_buf));
156:
157: free_page((unsigned long)state->pp_buf.buffer);
158: return state;
159: }
160: if (state->access_beyond_eod)
161: err = -ENOSPC;
162: /*
163: * The partition is unrecognized. So report I/O errors if there were any
164: */
165: if (err)
166: res = err;
167: if (res) {
168: seq_buf_puts(&state->pp_buf,
169: " unable to read partition table\n");
170: printk(KERN_INFO "%s", seq_buf_str(&state->pp_buf));
171: }
172:
173: free_page((unsigned long)state->pp_buf.buffer);
174: free_partitions(state);
175: return ERR_PTR(res);
176: }
SourceFile:block/partitions/core.c]
|
| 32/2 |
2026/06/02 19:08 |
llm |
expert |
0m
Model:
Tokens:
input: 24949
output: 22
thoughts: 1241
Thoughts: **Analyzing a Potential Block Device Hang and Its Implications**
Okay, so I'm stepping through this code, `check_partition` iterating over `check_part`, and immediately I see `adfspart_check_ICS` running first, which in turn calls `read_part_sector(0)`. If that returns an error – like an I/O error – `res` is set to 0, and the loop continues, so no big deal, right? Wait, hold on. If `adfspart_check_ICS` returns `< 0`, then `read_part_sector` returned NULL. This hints that `read_mapping_folio` returned an error, likely because of an `IS_ERR(folio)`. If that's the case, the folio isn't left locked. So, `adfspart_check_POWERTEC` *should* just try to read it again and fail the same way. What if `adfspart_check_ICS` returns 0? That means `valid_ics_sector(data)` is false. In that case, `put_dev_sector(sect)` *is* called, which puts the folio. The folio should be uptodate and unlocked, and `adfspart_check_POWERTEC` should return quickly after that. But why would it block in `folio_put_wait_locked`? Aha! It's because the folio is locked by another process!
Who's locking the folio? Could it be another process opening the same block device concurrently? No, because `bdev_disk_changed` is protected by `disk->open_mutex`, which only allows one process to be in `bdev_disk_changed` for a given disk.
Could another process be reading from the block device directly, like with `dd`? Yes, that's possible. They could lock the folio, be waiting on I/O, and if the block device is hung, they’d hang. Then, `udevd` comes along, tries to open the device, calls `bdev_disk_changed`, tries to read sector 0, and hangs waiting for the folio lock! That perfectly explains it. A hung block device is the root cause. `udevd` is an innocent bystander, blocked because it's trying to scan a hung device.
Is this a bug? It is, because it's a DoS if an unprivileged user can trigger it. Can they? No, because creating loop or NBD devices is not possible for unprivileged users due to permissions. What about malicious hardware? If a malicious USB device just stops responding to SCSI commands, then the SCSI error handling kicks in, and eventually, the device is marked offline. But the hang during the timeout period is what causes a hung task. If the hung task timeout is 120 seconds, and the SCSI timeout is longer, it will trigger a hung task warning, a known behavior and not a security vulnerability.
Wait, is there another possible deadlock? What if `udevd` is the ONLY task, and deadlocks itself? `read_mapping_folio` allocates, locks, and submits I/O for a folio. The I/O completion unlocks it. If the completion handler is never called, it hangs. Why? A bug in the block device driver that loses the request! Syzkaller often finds such bugs. If a request is lost, the folio is locked forever. The partition code is just the victim.
Now, let me search syzbot for this type of issue. I'll search for "task udevd:4696 blocked in I/O wait for more than 143 seconds" and `adfspart_check_POWERTEC`. Hopefully, this will lead me to a pre-existing report.
|
| 33/2 |
2026/06/02 19:09 |
tool |
grepper |
0m
Args: map[Expression:adfspart_check_POWERTEC]
Results: map[Output:block/partitions/acorn.c=414=static inline int valid_ptec_sector(const unsigned char *data)
--
block/partitions/acorn.c-441- */
block/partitions/acorn.c:442:int adfspart_check_POWERTEC(struct parsed_partitions *state)
block/partitions/acorn.c-443-{
--
block/partitions/check.h=51=int adfspart_check_ICS(struct parsed_partitions *state);
block/partitions/check.h:52:int adfspart_check_POWERTEC(struct parsed_partitions *state);
block/partitions/check.h-53-int aix_partition(struct parsed_partitions *state);
--
block/partitions/core.c=17=static int (*const check_part[])(struct parsed_partitions *) = {
--
block/partitions/core.c-25-#ifdef CONFIG_ACORN_PARTITION_POWERTEC
block/partitions/core.c:26: adfspart_check_POWERTEC,
block/partitions/core.c-27-#endif
]
|
| 34/2 |
2026/06/02 19:09 |
llm |
expert |
0m
Model:
Tokens:
input: 27295
output: 34
thoughts: 904
Thoughts: **Analyzing the Hung Task: A Deep Dive**
Okay, so I can't directly query syzbot for this specific issue, but I've got the bug report in front of me, which is a hung task. The first thing I always do is start evaluating exploitability, of course. Is this something that can be used to take control? No, it looks like a straightforward DoS – a hung task.
Next, I need to understand the attack surface. Can this be triggered by an unprivileged process? No, creating block devices, which is what seems to be the trigger, requires root privileges. User namespaces are out too; block devices aren't namespaced.
Could a malicious filesystem cause this? No, we're talking about partition parsing here, not filesystem operations. However, this parsing reads from a block device, and that's the key. Could a malicious block device (e.g., a USB drive that simply doesn't respond) trigger it? Potentially, yes. But, I need to know the entire context and understand what the underlying I/O is doing.
What about a VM guest? If the host exposes a block device to the guest, and the guest can make the host hang, that's not the case. The bug is in the *guest* kernel hanging, not the host. This implies the host isn't vulnerable to this particular DoS.
Let me take another look at the code:
```c
data = read_part_sector(state, 0, §);
if (!data)
return -1;
if (!valid_ptec_sector(data)) {
put_dev_sector(sect);
return 0;
}
seq_buf_puts(&state->pp_buf, " [POWERTEC]");
for (i = 0, p = (const struct ptec_part *)data; i < 12; i++, p++) {
u32 start = le32_to_cpu(p->start);
u32 size = le32_to_cpu(p->size);
if (size)
put_partition(state, slot++, start, size);
}
put_dev_sector(sect);
seq_buf_puts(&state->pp_buf, "\n");
return 1;
```
This code is exceptionally straightforward. It reads a sector, validates it, and extracts partition information. There are no obvious loops or complex locking mechanisms that could lead to a deadlock.
The hang must be within `read_part_sector`, which eventually goes to `read_mapping_folio` and then `folio_wait_bit_common`. Ah, that's the crux. It's waiting for a folio to be unlocked. This happens when I/O requests to the underlying block device are not completing. This is syzkaller's modus operandi, right? We've seen it trigger issues before with fault injection to drop I/O, or by setting up a loop device backed by something like userfaultfd that hangs, or by using NBD and never replying to a request.
`udevd` automatically scans for new block devices, and that's precisely where syzkaller is exploiting. If a device it creates hangs, the scan hangs. We've seen this before, and it's generally considered a non-bug or a limitation of the hung task detector. It's detecting a task hung on I/O, which is *expected* if the I/O device is hung.
Okay, let's summarize the dimensions of this vulnerability:
- **Exploitable**: No, it's a DoS.
- **Denial of Service**: Yes, it can cause `udevd` to hang, potentially blocking device initialization.
- **Unprivileged Access**: No.
- **User Namespaces**: No.
- **VM Guest Trigger**: No.
- **Confidential Computing**: No.
- **Network Trigger**: No.
- **Remote Trigger**: No.
- **Peripheral Trigger**: Yes. A malicious USB storage device could cause hangs by failing to respond to read requests. But the SCSI subsystem has timeouts, so this would depend on whether the hung task timeout is shorter than the SCSI timeout.
- **Malicious Filesystem**: No, as we're dealing with partition parsing.
Hmm, is there something I'm overlooking? Could `put_partition` be doing something blocking? No, it appears it is simply updating the internal `state->parts` structure. The evidence so far suggests that this issue is as suspected, which is a hung task.
|
| 35/2 |
2026/06/02 19:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:block/partitions/core.c Name:put_partition]
Results: map[SourceCode: 37: static inline void
38: put_partition(struct parsed_partitions *p, int n, sector_t from, sector_t size)
39: {
40: if (n < p->limit) {
41: p->parts[n].from = from;
42: p->parts[n].size = size;
43: seq_buf_printf(&p->pp_buf, " %s%d", p->name, n);
44: }
45: }
SourceFile:block/partitions/check.h]
|
| 36/2 |
2026/06/02 19:09 |
llm |
expert |
0m
Model:
Tokens:
input: 29398
output: 38
thoughts: 23
Thoughts: Okay, here's my summary, tailored as requested:
**Unpacking the Implication of Non-Blocking Operations**
Right, so it's a recording mechanism, that much is clear. The key is that this is *non-blocking*. That’s the crucial distinction here. It's designed to capture the information without halting any other processes. The focus is on the mechanism of recording, that is obvious, the next question is if the `valid_ptec_sector` function could have blocking behaviour. I need to take into account that if `valid_ptec_sector` blocks then it negates the original intention.
|
| 37/2 |
2026/06/02 19:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:block/partitions/acorn.c Name:valid_ptec_sector]
Results: map[SourceCode: 414: static inline int valid_ptec_sector(const unsigned char *data)
415: {
416: unsigned char checksum = 0x2a;
417: int i;
418:
419: /*
420: * If it looks like a PC/BIOS partition, then it
421: * probably isn't PowerTec.
422: */
423: if (data[510] == 0x55 && data[511] == 0xaa)
424: return 0;
425:
426: for (i = 0; i < 511; i++)
427: checksum += data[i];
428:
429: return checksum == data[511];
430: }
SourceFile:block/partitions/acorn.c]
|
| 38/2 |
2026/06/02 19:09 |
llm |
expert |
0m
Model:
Tokens:
input: 29858
output: 39
thoughts: 289
Thoughts: **Analyzing a Potential Hang**
Okay, so this isn't a complex computation; it's just calculating a checksum. The hang is definitely within `read_part_sector`. Classic I/O wait, as the "INFO: task udevd" message confirms - that's a long time to be blocked. This smells like one of those syzkaller false positives or a known issue where it creates a hung block device, triggering the hung task detector. Since there's no memory corruption, we aren't dealing with an exploitable vulnerability. It's a DoS, alright, but requires elevated privileges to create the faulty block device. Or, you'd need physical access to plug in a broken USB drive.
Let me double-check if an unprivileged user can create loop devices. Checking `/dev/loop-control`, it's `crw-rw---- 1 root disk`. Nope, no go. No opening that. Now, what about a user namespace with `CAP_SYS_ADMIN`? Still a no-go, because device nodes aren't owned by the user namespace and lack the permissions. And even *if* they could, loop devices aren't isolated by user namespaces, so it would affect the host - but they can't.
Alright, let's explore NBD devices. Can unprivileged users create those? NBD uses netlink, so I need to check how that netlink interface is restricted.
|
| 39/2 |
2026/06/02 19:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/nbd.c Name:nbd_genl_family]
Results: map[SourceCode:2476: static struct genl_family nbd_genl_family __ro_after_init = {
2477: .hdrsize = 0,
2478: .name = NBD_GENL_FAMILY_NAME,
2479: .version = NBD_GENL_VERSION,
2480: .module = THIS_MODULE,
2481: .small_ops = nbd_connect_genl_ops,
2482: .n_small_ops = ARRAY_SIZE(nbd_connect_genl_ops),
2483: .resv_start_op = NBD_CMD_STATUS + 1,
2484: .maxattr = NBD_ATTR_MAX,
2485: .netnsok = 1,
2486: .policy = nbd_attr_policy,
2487: .mcgrps = nbd_mcast_grps,
2488: .n_mcgrps = ARRAY_SIZE(nbd_mcast_grps),
2489: };
SourceFile:drivers/block/nbd.c]
|
| 40/2 |
2026/06/02 19:09 |
llm |
expert |
0m
Model:
Tokens:
input: 30808
output: 41
thoughts: 38
Thoughts: Okay, let's see...
**Network Namespace Discovery: A Promising Start**
Aha! `netnsok = 1`. This is good news. It tells me that NBD netlink access *is* supported within network namespaces, and I can start moving forward with my task. Now, let's turn our attention to `nbd_connect_genl_ops`. We know the presence of this structure is significant, so it's time to dig into its details. This is key to accessing NBD from within different network namespaces. Let me check its members and see if it can help me with what I have in mind.
|
| 41/2 |
2026/06/02 19:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/nbd.c Name:nbd_connect_genl_ops]
Results: map[SourceCode:2449: static const struct genl_small_ops nbd_connect_genl_ops[] = {
2450: {
2451: .cmd = NBD_CMD_CONNECT,
2452: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
2453: .doit = nbd_genl_connect,
2454: },
2455: {
2456: .cmd = NBD_CMD_DISCONNECT,
2457: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
2458: .doit = nbd_genl_disconnect,
2459: },
2460: {
2461: .cmd = NBD_CMD_RECONFIGURE,
2462: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
2463: .doit = nbd_genl_reconfigure,
2464: },
2465: {
2466: .cmd = NBD_CMD_STATUS,
2467: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
2468: .doit = nbd_genl_status,
2469: },
2470: };
SourceFile:drivers/block/nbd.c]
|
| 42/2 |
2026/06/02 19:09 |
llm |
expert |
0m
Model:
Tokens:
input: 31437
output: 39
thoughts: 13
Thoughts: Okay, let's dive into this. Here's my understanding, presented as my own mental processing:
**Analyzing `nbd_genl_connect`**
Alright, time to get a handle on this `nbd_genl_connect` function. I need to refresh my memory on exactly where this fits in the overall NBD architecture. Is this part of the user-space interaction, or is it deeper, kernel-side? I'm assuming it's related to the Genl (Generic Netlink) interface, given the name. So, it's likely responsible for establishing a connection, perhaps a handshake of some kind, between the user-space NBD client and the NBD server in the kernel.
I need to recall the details of the Genl protocol in this context. Is it using a specific family ID? What messages are involved? What information is being exchanged during the connection establishment? I want to verify the parameters being passed to the function, what data structures it manipulates, and how it handles potential errors. I'll need to look for any potential race conditions or locking issues that could arise during concurrent connection attempts. Also, I'll need to confirm that resource allocation is handled correctly; are there memory leaks or potential denial-of-service vulnerabilities if the server is bombarded with connection requests?
I'm thinking I'll start by reviewing the function's declaration and then trace the execution path. The goal is to fully understand its function and ensure this critical connection path is robust and secure. Let's see how this thing *works*.
|
| 43/2 |
2026/06/02 19:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/nbd.c Name:nbd_genl_connect]
Results: map[SourceCode:2073: static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info)
2074: {
2075: struct nbd_device *nbd;
2076: struct nbd_config *config;
2077: int index = -1;
2078: int ret;
2079: bool put_dev = false;
2080:
2081: if (!netlink_capable(skb, CAP_SYS_ADMIN))
2082: return -EPERM;
2083:
2084: if (info->attrs[NBD_ATTR_INDEX]) {
2085: index = nla_get_u32(info->attrs[NBD_ATTR_INDEX]);
2086:
2087: /*
2088: * Too big first_minor can cause duplicate creation of
2089: * sysfs files/links, since index << part_shift might overflow, or
2090: * MKDEV() expect that the max bits of first_minor is 20.
2091: */
2092: if (index < 0 || index > MINORMASK >> part_shift) {
2093: pr_err("illegal input index %d\n", index);
2094: return -EINVAL;
2095: }
2096: }
2097: if (GENL_REQ_ATTR_CHECK(info, NBD_ATTR_SOCKETS)) {
2098: pr_err("must specify at least one socket\n");
2099: return -EINVAL;
2100: }
2101: if (GENL_REQ_ATTR_CHECK(info, NBD_ATTR_SIZE_BYTES)) {
2102: pr_err("must specify a size in bytes for the device\n");
2103: return -EINVAL;
2104: }
2105: again:
2106: mutex_lock(&nbd_index_mutex);
2107: if (index == -1) {
2108: nbd = nbd_find_get_unused();
2109: } else {
2110: nbd = idr_find(&nbd_index_idr, index);
2111: if (nbd) {
2112: if ((test_bit(NBD_DESTROY_ON_DISCONNECT, &nbd->flags) &&
2113: test_bit(NBD_DISCONNECT_REQUESTED, &nbd->flags)) ||
2114: !refcount_inc_not_zero(&nbd->refs)) {
2115: mutex_unlock(&nbd_index_mutex);
2116: pr_err("device at index %d is going down\n",
2117: index);
2118: return -EINVAL;
2119: }
2120: }
2121: }
2122: mutex_unlock(&nbd_index_mutex);
2123:
2124: if (!nbd) {
2125: nbd = nbd_dev_add(index, 2);
2126: if (IS_ERR(nbd)) {
2127: pr_err("failed to add new device\n");
2128: return PTR_ERR(nbd);
2129: }
2130: }
2131:
2132: mutex_lock(&nbd->config_lock);
2133: if (refcount_read(&nbd->config_refs)) {
2134: mutex_unlock(&nbd->config_lock);
2135: nbd_put(nbd);
2136: if (index == -1)
2137: goto again;
2138: pr_err("nbd%d already in use\n", index);
2139: return -EBUSY;
2140: }
2141:
2142: ret = nbd_alloc_and_init_config(nbd);
2143: if (ret) {
2144: mutex_unlock(&nbd->config_lock);
2145: nbd_put(nbd);
2146: pr_err("couldn't allocate config\n");
2147: return ret;
2148: }
2149:
2150: config = nbd->config;
2151: set_bit(NBD_RT_BOUND, &config->runtime_flags);
2152: ret = nbd_genl_size_set(info, nbd);
2153: if (ret)
2154: goto out;
2155:
2156: if (info->attrs[NBD_ATTR_TIMEOUT])
2157: nbd_set_cmd_timeout(nbd,
2158: nla_get_u64(info->attrs[NBD_ATTR_TIMEOUT]));
2159: if (info->attrs[NBD_ATTR_DEAD_CONN_TIMEOUT]) {
2160: config->dead_conn_timeout =
2161: nla_get_u64(info->attrs[NBD_ATTR_DEAD_CONN_TIMEOUT]);
2162: config->dead_conn_timeout *= HZ;
2163: }
2164: if (info->attrs[NBD_ATTR_SERVER_FLAGS])
2165: config->flags =
2166: nla_get_u64(info->attrs[NBD_ATTR_SERVER_FLAGS]);
2167: if (info->attrs[NBD_ATTR_CLIENT_FLAGS]) {
2168: u64 flags = nla_get_u64(info->attrs[NBD_ATTR_CLIENT_FLAGS]);
2169: if (flags & NBD_CFLAG_DESTROY_ON_DISCONNECT) {
2170: /*
2171: * We have 1 ref to keep the device around, and then 1
2172: * ref for our current operation here, which will be
2173: * inherited by the config. If we already have
2174: * DESTROY_ON_DISCONNECT set then we know we don't have
2175: * that extra ref already held so we don't need the
2176: * put_dev.
2177: */
2178: if (!test_and_set_bit(NBD_DESTROY_ON_DISCONNECT,
2179: &nbd->flags))
2180: put_dev = true;
2181: } else {
2182: if (test_and_clear_bit(NBD_DESTROY_ON_DISCONNECT,
2183: &nbd->flags))
2184: refcount_inc(&nbd->refs);
2185: }
2186: if (flags & NBD_CFLAG_DISCONNECT_ON_CLOSE) {
2187: set_bit(NBD_RT_DISCONNECT_ON_CLOSE,
2188: &config->runtime_flags);
2189: }
2190: }
2191:
2192: if (info->attrs[NBD_ATTR_SOCKETS]) {
2193: struct nlattr *attr;
2194: int rem, fd;
2195:
2196: nla_for_each_nested(attr, info->attrs[NBD_ATTR_SOCKETS],
2197: rem) {
2198: struct nlattr *socks[NBD_SOCK_MAX+1];
2199:
2200: if (nla_type(attr) != NBD_SOCK_ITEM) {
2201: pr_err("socks must be embedded in a SOCK_ITEM attr\n");
2202: ret = -EINVAL;
2203: goto out;
2204: }
2205: ret = nla_parse_nested_deprecated(socks, NBD_SOCK_MAX,
2206: attr,
2207: nbd_sock_policy,
2208: info->extack);
2209: if (ret != 0) {
2210: pr_err("error processing sock list\n");
2211: ret = -EINVAL;
2212: goto out;
2213: }
2214: if (!socks[NBD_SOCK_FD])
2215: continue;
2216: fd = (int)nla_get_u32(socks[NBD_SOCK_FD]);
2217: ret = nbd_add_socket(nbd, fd, true);
2218: if (ret)
2219: goto out;
2220: }
2221: }
2222:
2223: if (info->attrs[NBD_ATTR_BACKEND_IDENTIFIER]) {
2224: nbd->backend = nla_strdup(info->attrs[NBD_ATTR_BACKEND_IDENTIFIER],
2225: GFP_KERNEL);
2226: if (!nbd->backend) {
2227: ret = -ENOMEM;
2228: goto out;
2229: }
2230: }
2231: ret = device_create_file(disk_to_dev(nbd->disk), &backend_attr);
2232: if (ret) {
2233: dev_err(disk_to_dev(nbd->disk),
2234: "device_create_file failed for backend!\n");
2235: goto out;
2236: }
2237: set_bit(NBD_RT_HAS_BACKEND_FILE, &config->runtime_flags);
2238:
2239: ret = nbd_start_device(nbd);
2240: out:
2241: if (!ret) {
2242: set_bit(NBD_RT_HAS_CONFIG_REF, &config->runtime_flags);
2243: refcount_inc(&nbd->config_refs);
2244: nbd_connect_reply(info, nbd->index);
2245: }
2246: mutex_unlock(&nbd->config_lock);
2247:
2248: nbd_config_put(nbd);
2249: if (put_dev)
2250: nbd_put(nbd);
2251: return ret;
2252: }
SourceFile:drivers/block/nbd.c]
|
| 44/2 |
2026/06/02 19:09 |
llm |
expert |
0m
Model:
Tokens:
input: 34704
output: 39
thoughts: 81
Thoughts: Okay, here's my interpretation of that code snippet, delivered as if it's my own thought process:
**Decoding that Netlink Check**
Right, so I'm looking at this bit of code: `if (!netlink_capable(skb, CAP_SYS_ADMIN))`. My initial thought is to immediately dissect `netlink_capable`. I know this function is crucial. Seems like the code is verifying that the sender of a netlink message (`skb`) possesses the required privileges. Specifically, it's checking `CAP_SYS_ADMIN`, which is a powerful capability.
The interesting part is the mention of "user namespace of the netlink socket". That's key. This isn't just a global check; it's scoped to the user namespace associated with the netlink socket being used. That means the capability check is contextual.
So, just to confirm my understanding: `netlink_capable` is essentially verifying whether the sender, within *its* user namespace context, holds the `CAP_SYS_ADMIN` capability necessary to perform this action. I want to double-check my understanding, let's explore `netlink_capable` to ensure I'm on the right track.
|
| 45/2 |
2026/06/02 19:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netlink/af_netlink.c Name:netlink_capable]
Results: map[SourceCode: 873: /**
874: * netlink_capable - Netlink global message capability test
875: * @skb: socket buffer holding a netlink command from userspace
876: * @cap: The capability to use
877: *
878: * Test to see if the opener of the socket we received the message
879: * from had when the netlink socket was created and the sender of the
880: * message has the capability @cap in all user namespaces.
881: */
882: bool netlink_capable(const struct sk_buff *skb, int cap)
883: {
884: return netlink_ns_capable(skb, &init_user_ns, cap);
885: }
SourceFile:net/netlink/af_netlink.c]
|
| 46/2 |
2026/06/02 19:09 |
llm |
expert |
0m
Model:
Tokens:
input: 35325
output: 36
thoughts: 659
Thoughts: **My Analysis of the Block Device Hanging Bug**
Okay, let's break this down systematically. My initial thought process zeros in on the privilege requirements. The fact that `netlink_capable` requires `CAP_SYS_ADMIN` in the *initial* user namespace immediately rules out unprivileged users, even those operating within user namespaces, from creating NBD devices. That's a good starting point.
Next, I considered loop devices. They're created through `/dev/loop-control`, which is a misc device. Since unprivileged users generally can't open misc devices, that path is blocked as well. Zram is also out because configuring it also needs `CAP_SYS_ADMIN`. Fault injection is tied to `debugfs`, which is root-only.
So, *directly* creating a block device that hangs via an unprivileged method appears impossible. Therefore, this particular bug isn't something an attacker could trigger from an unprivileged process or within a user namespace. The best we're looking at is a denial-of-service, but with privilege escalation as a requirement.
But, I can't leave it there. I need to make sure I've explored every possibility. Can a malicious filesystem image be involved? No. The block device is the underlying layer; the filesystem operates on top of it. Unless there's a latent bug in the block device driver that the filesystem somehow exploits (which, in fairness, is always possible), the filesystem itself can't directly *cause* a block device to hang. That would be a different bug in a different part of the stack.
Then it hits me: what about a malicious USB drive? Yes. A USB drive can simply stop responding to SCSI commands. That's a classic scenario. When that happens, tasks reading from the drive will hang until the SCSI timeout expires. If the SCSI timeout is significantly longer than the hung task timeout, the hung task detector kicks in. That's a known behavior, and it is a path to the DoS.
Let's summarise that:
* **Exploitable**: No.
* **Denial of Service**: Yes, but requires either privileges or physical access to the machine.
* **Accessible from Unprivileged Processes**: No.
* **Accessible from User Namespaces**: No.
* **VM Guest Trigger**: No.
* **VM Host Trigger in the Confidential Computing Context**: No.
* **Ethernet Network Trigger**: No.
* **Other Remote Trigger**: No.
* **Peripheral Trigger**: Yes. Malicious USB device can trigger the hang by not responding to reads.
* **Malicious Filesystem Trigger**: No.
Wait, I also need to go back and check. I should check again the code itself. Is there a possibility of an out-of-bounds read in that `adfspart_check_POWERTEC` function? I see the code:
```c
for (i = 0, p = (const struct ptec_part *)data; i < 12; i++, p++) {
u32 start = le32_to_cpu(p->start);
u32 size = le32_to_cpu(p->size);
if (size)
put_partition(state, slot++, start, size);
}
```
`data` is a pointer to the 512-byte sector. `struct ptec_part` is some size. I need to know the size of that structure to know if it can cause an out-of-bounds read or not. I'd need to look at the definition of `struct ptec_part` to confirm. If that structure is bigger than sector size, there is a potential out-of-bounds read here.
|
| 47/2 |
2026/06/02 19:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:block/partitions/acorn.c Name:ptec_part]
Results: map[SourceCode: 405: struct ptec_part {
406: __le32 unused1;
407: __le32 unused2;
408: __le32 start;
409: __le32 size;
410: __le32 unused5;
411: char type[8];
412: };
SourceFile:block/partitions/acorn.c]
|
| 48/2 |
2026/06/02 19:09 |
llm |
expert |
0m
Model:
Tokens:
input: 36961
output: 66
thoughts: 513
Thoughts: **Assessment of the Block Device Hang**
Okay, let's break this down. First, the `struct ptec_part` size is 28 bytes, and 12 of them fit neatly into a 512-byte sector. That means no buffer overruns. The `valid_ptec_sector` function also reads exactly 512 bytes, so there's no out-of-bounds issue there either.
The core problem is a hung task, and it's stemming from an unresponsive block device. Syzkaller, with its intentional fault injection on devices like NBD or loop, is designed to generate these unresponsive scenarios. The kernel's hung task detector is correctly identifying the hang, but since the device is *intentionally* unresponsive by Syzkaller, it's a false positive in the context of a kernel bug hunt. However, that doesn't necessarily mean it's not a *problem* from a security viewpoint.
Thinking like an attacker, if someone can plug in a malicious USB device, they could potentially cause `udevd` to hang. This could prevent other devices from initializing, resulting in a denial-of-service (DoS) condition. That would qualify as a Peripheral Trigger, yes.
Let's do a quick re-assessment of the dimensions:
* Exploitable: No.
* Denial Of Service: Yes.
* Accessible From Unprivileged Processes: No.
* Accessible From User Namespaces: No.
* VM Guest Trigger: No.
* VM Host Trigger in The Confidential Computing Context: No.
* Ethernet Network Trigger: No.
* Other Remote Trigger: No.
* Peripheral Trigger: Yes.
* Malicious Filesystem Trigger: No.
Now, what if we consider NBD specifically and network dropouts? If the network connection to an NBD device drops, NBD will eventually timeout. During this timeout, tasks will hang, as expected. Can an unprivileged user trigger this over the network? If the system is *already* configured to use an NBD device, an attacker could indeed drop packets and cause the NBD device to hang. But that's essentially network disruption causing a block device hang, and that's the *expected* result. The crucial question is whether the bug can be triggered directly by processing ingress Ethernet traffic on the network. No. It's not a network processing bug.
I'm comfortable with this conclusion. Time to call `set-results`.
|
| 49/2 |
2026/06/02 19:10 |
tool |
set-results |
0m
Args: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 50/2 |
2026/06/02 19:10 |
llm |
expert |
0m
Model:
Tokens:
input: 38136
output: 657
thoughts: 423
Thoughts: **Final Analysis of the Hanging `udevd` Task**
Okay, the data's in, time to synthesize this into a final response. Let's recap what we've got:
1. We have a confirmed hung task—specifically, `udevd`, and it's been stuck for over 143 seconds. That's a clear red flag.
2. The stack trace reveals the crux of the problem: `udevd` is blocked within `folio_put_wait_locked`. It's trying to access sector 0 of a block device, during a partition scan triggered by `adfspart_check_POWERTEC` calling `read_part_sector`. The `folio_put_wait_locked` function strongly suggests another thread has a lock on that page cache folio. This lock means the other thread is actively performing I/O. `udevd` is effectively waiting for that I/O to finish.
3. The root cause? An unresponsive block device. This is classic behavior in fuzzing environments, especially when we're dealing with tools like syzkaller. It's almost certainly a hung FUSE filesystem, an NBD device that's failed to respond, or some intentional I/O request dropping via fault injection. Essentially, any scenario where the block device doesn't acknowledge or complete read requests.
4. Any process that attempts to read from this unresponsive block device will end up in an I/O wait state and hang. `udevd` is particularly vulnerable because it automatically scans newly-detected block devices for partitions. It's just doing its job, but it becomes the victim of this unresponsive device.
5. Important: This isn't a memory corruption issue, nor is it immediately exploitable for privilege escalation. We can breathe a sigh of relief on that front.
6. However, this *is* a Denial of Service (DoS) vulnerability. By exhausting `udevd` worker threads, it will effectively prevent the system from properly initializing new devices. That's a real problem.
7. The good news is unprivileged users cannot trigger this, because creating block devices (e.g., loop, NBD) inherently requires privileges like `CAP_SYS_ADMIN` in the initial namespace. Block devices are also not namespace-aware, so user namespaces don't provide a workaround.
8. The risk comes from malicious peripherals. Imagine a USB storage device that is intentionally programmed to stop responding to SCSI read commands. Any task attempting to read from it, like `udevd`, would hang until the SCSI timeout expires, and those can be quite long, which can be even longer than the hung task timeout. So, while not trivial to trigger, it's certainly plausible and has implications in a potentially hostile environment.
|
| 51/1 |
2026/06/02 19:10 |
action |
format-explanation |
0m
Results: map[Explanation:**Analysis of the Bug Report**
**1. Root Cause Analysis:**
The bug report indicates that the `udevd` process has been blocked in an
uninterruptible sleep state (`D` state) for over 143 seconds, triggering the
kernel's hung task detector.
Looking at the stack trace, `udevd` is attempting to scan a newly discovered
block device for partitions. It is executing the Acorn POWERTEC partition parser
(`adfspart_check_POWERTEC`), which reads sector 0 of the block device via
`read_part_sector()`. Under the hood, this calls into the page cache
(`read_mapping_folio()` -> `do_read_cache_folio()`).
The task is specifically blocked in `folio_put_wait_locked()`. This happens when
the page cache folio for the requested sector is already locked by another
thread that initiated the I/O and is currently waiting for the block device to
complete the read request. Because the underlying block device is completely
unresponsive (hung), the I/O never completes, the folio is never unlocked, and
any subsequent tasks trying to read that sector (like `udevd`) will hang
indefinitely in I/O wait.
**2. Security Impact:**
* **Exploitable:** **No.** This is a pure concurrency/I/O wait state issue
caused by an unresponsive hardware/software block device. There is no memory
corruption, out-of-bounds access, or use-after-free involved.
* **Denial of Service (DoS):** **Yes.** If `udevd` hangs while probing a device,
it ties up a worker thread. If enough devices hang, `udevd` can be completely
exhausted, preventing the system from processing any new hardware events or
mounting legitimate drives.
* **Unprivileged / User Namespace Access:** **No.** To trigger this via
software, an attacker would need to create a malicious block device (e.g., a
loop device backed by a hanging FUSE filesystem, or an NBD device). Creating
block devices requires `CAP_SYS_ADMIN` in the *initial* user namespace (e.g.,
`/dev/loop-control` is restricted to root, and NBD netlink creation explicitly
checks for init namespace capabilities). Therefore, unprivileged users cannot
trigger this, even within a user namespace.
* **Peripheral Trigger:** **Yes.** A malicious physical device, such as a rogue
USB storage drive, could intentionally stop responding to SCSI read commands
after being plugged in. The kernel would wait for the I/O to complete (subject
to SCSI timeouts, which can be several minutes long and exceed the 120-second
hung task threshold), causing `udevd` and any other probing tasks to hang.
**Conclusion:**
This is not a vulnerability in the partition parsing code itself, but rather a
known consequence of how the Linux kernel handles unresponsive block devices.
Syzkaller frequently triggers this by intentionally injecting faults into block
devices or creating NBD/loop devices that drop I/O requests. While it represents
a DoS vector via malicious physical USB devices, it cannot be exploited for
privilege escalation or triggered by unprivileged local attackers.]
|