| 0/0 |
2026/08/13 21:34 |
flow |
repro-c |
41m
Results: map[EquivalenceAnalysis:The reproducer successfully triggered the expected crash. The crash signature and call trace match the original bug description exactly: a sleeping function (`__mutex_lock`) is called from an invalid context (inside `rcu_read_lock` held by `blk_mq_submit_bio`) via `null_process_zoned_cmd` -> `null_lock_zone`. OtherCrashReports:<nil> ReproC:#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
#include <errno.h>
void write_file(const char *path, const char *val) {
int fd = open(path, O_WRONLY);
if (fd < 0) {
printf("[-] Failed to open %s: %s\n", path, strerror(errno));
exit(1);
}
if (write(fd, val, strlen(val)) < 0) {
printf("[-] Failed to write to %s: %s\n", path, strerror(errno));
close(fd);
exit(1);
}
close(fd);
printf("[+] Wrote '%s' to %s\n", val, path);
}
int main() {
int res;
res = mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
if (res < 0 && errno != EBUSY) {
printf("[-] Failed to mount configfs: %s\n", strerror(errno));
} else {
printf("[+] configfs mounted or already mounted.\n");
}
// Cleanup previous state if any
int fd = open("/sys/kernel/config/nullb/mydev/power", O_WRONLY);
if (fd >= 0) {
if (write(fd, "0\n", 2) < 0) {}
close(fd);
}
rmdir("/sys/kernel/config/nullb/mydev");
res = mkdir("/sys/kernel/config/nullb/mydev", 0755);
if (res < 0) {
printf("[-] Failed to create mydev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Created mydev successfully.\n");
write_file("/sys/kernel/config/nullb/mydev/zoned", "1\n");
write_file("/sys/kernel/config/nullb/mydev/memory_backed", "1\n");
write_file("/sys/kernel/config/nullb/mydev/shared_tags", "1\n");
// This should trigger the bug
write_file("/sys/kernel/config/nullb/mydev/power", "1\n");
// Sleep to allow asynchronous tasks to finish if needed
sleep(2);
return 0;
}
Reproduced:true ReproducedBugTitle:BUG: sleeping function called from invalid context in null_process_zoned_cmd ReproducedCrashReport:BUG: sleeping function called from invalid context at kernel/locking/mutex.c:623
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5838, name: syz-executor260
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
6 locks held by syz-executor260/5838:
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#1: ffff88810728f080 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#3: ffffffff9ab67760 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#4: ffff8881145e8350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
CPU: 0 UID: 0 PID: 5838 Comm: syz-executor260 Not tainted syzkaller #1 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x378/0x4d0 kernel/sched/core.c:9197
__mutex_lock_common kernel/locking/mutex.c:623 [inline]
__mutex_lock+0x118/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc940d6d2f7
Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
</TASK>
=============================
[ BUG: Invalid wait context ]
syzkaller #1 Tainted: G W
-----------------------------
syz-executor260/5838 is trying to lock:
ffff888122ac0060 (&zone->mutex){+.+.}-{4:4}, at: null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
ffff888122ac0060 (&zone->mutex){+.+.}-{4:4}, at: null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
other info that might help us debug this:
context-{5:5}
6 locks held by syz-executor260/5838:
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#1: ffff88810728f080 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#3: ffffffff9ab67760 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#4: ffff8881145e8350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
stack backtrace:
CPU: 0 UID: 0 PID: 5838 Comm: syz-executor260 Tainted: G W syzkaller #1 PREEMPT(full)
Tainted: [W]=WARN
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
print_lock_invalid_wait_context kernel/locking/lockdep.c:4830 [inline]
check_wait_context kernel/locking/lockdep.c:4902 [inline]
__lock_acquire+0xe39/0x2cf0 kernel/locking/lockdep.c:5187
lock_acquire+0x106/0x350 kernel/locking/lockdep.c:5868
__mutex_lock_common kernel/locking/mutex.c:646 [inline]
__mutex_lock+0x19d/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc940d6d2f7
Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
</TASK>
null_blk: disk mydev created
]
|
| 1/1 |
2026/08/13 21:34 |
action |
kernel-checkouter |
1m
Results: map[KernelSrc:/app/workdir/cache/src/54b9d644efd7acd3624acb3b50d4d5660dbab56b]
|
| 2/1 |
2026/08/13 21:35 |
action |
kernel-builder |
17m
Results: map[KernelObj:/app/workdir/cache/build/3502dfe6419c93d9a204ba9a9ee37f1d963a30f1]
|
| 3/1 |
2026/08/13 21:53 |
action |
codesearch-prepare |
11m
Results: map[Index:codesearch-index]
|
| 4/1 |
2026/08/13 22:04 |
agent |
initial-researcher |
5m
Model:
Instruction: You are a security researcher with deep Linux kernel background.
Your goal is to analyze a Linux kernel bug description and propose a strategy to reproduce it
with a minimal, standalone C program for the strictly defensive purpose of verifying a bugfix.
=== TOOL SELECTION GUIDELINES ===
- When looking up C function or struct definitions, prefer codesearch-definition-source
and codesearch-struct-layout first.
- Fall back to read-file or grepper only if symbol lookup fails or when inspecting macros,
headers, or non-C files.
=== CRITICAL PROHIBITIONS ===
- Do NOT propose an exploit. Focus solely on minimal technical reproduction of the bug state.
- Do NOT write long explanations. Keep your analysis and strategy proposal concise.
- Do NOT assume that the target bug has already been fixed just because a git commit title
or description mentions a similar bug or fix. Commit messages often reference related issues
or partial fixes. Proceed with proposing a reproduction strategy regardless of historical fix commits.
Prefer calling several tools at the same time to save round-trips.
Prompt: Bug Description: BUG: sleeping function called from invalid context in null_process_zoned_cmd
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:623
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 19399, name: syz.6.4428
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
7 locks held by syz.6.4428/19399:
#0: ffff888030e500f0 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x246/0x320 fs/file.c:1259
#1: ffff88801d756450 (sb_writers#12){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#1: ffff88801d756450 (sb_writers#12){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#2: ffff888029822280 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#3: ffff888057f6c870 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#3: ffff888057f6c870 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#4: ffffffff9aaec560 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#5: ffff888051072350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
CPU: 0 UID: 0 PID: 19399 Comm: syz.6.4428 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x378/0x4d0 kernel/sched/core.c:9197
__mutex_lock_common kernel/locking/mutex.c:623 [inline]
__mutex_lock+0x118/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f95ef39e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f95f019b028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f95ef625fa0 RCX: 00007f95ef39e0d9
RDX: 0000000000000002 RSI: 0000200000000700 RDI: 0000000000000005
RBP: 00007f95ef435024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f95ef626038 R14: 00007f95ef625fa0 R15: 00007ffe19f02fb8
</TASK>
------------[ cut here ]------------
DEBUG_LOCKS_WARN_ON(lock->magic != lock)
WARNING: kernel/locking/mutex.c:625 at __mutex_lock_common kernel/locking/mutex.c:625 [inline], CPU#0: syz.6.4428/19399
WARNING: kernel/locking/mutex.c:625 at __mutex_lock+0x12d8/0x1550 kernel/locking/mutex.c:821, CPU#0: syz.6.4428/19399
Modules linked in:
CPU: 0 UID: 0 PID: 19399 Comm: syz.6.4428 Tainted: G W L syzkaller #0 PREEMPT(full)
Tainted: [W]=WARN, [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
RIP: 0010:__mutex_lock_common kernel/locking/mutex.c:625 [inline]
RIP: 0010:__mutex_lock+0x12df/0x1550 kernel/locking/mutex.c:821
Code: 7a 57 90 48 c1 e8 03 0f b6 04 18 84 c0 0f 85 47 02 00 00 83 3d 45 38 85 04 00 75 13 48 8d 3d c8 87 88 04 48 c7 c6 40 f7 ec 8b <67> 48 0f b9 3a 90 e9 75 ee ff ff 90 0f 0b 90 e9 48 f2 ff ff 90 0f
RSP: 0018:ffffc9001182ed40 EFLAGS: 00010246
RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000080000
RDX: ffffc90012289000 RSI: ffffffff8becf740 RDI: ffffffff905ac9d0
RBP: ffffc9001182eed0 R08: ffffffff90577a43 R09: 1ffffffff20aef48
R10: dffffc0000000000 R11: fffffbfff20aef49 R12: ffff88804b9c0000
R13: 0000000000000000 R14: 1ffff92002305dbc R15: 0000000000000000
FS: 00007f95f019b6c0(0000) GS:ffff888124f55000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2f81bff8 CR3: 000000007cb27000 CR4: 0000000000350ef0
Call Trace:
<TASK>
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f95ef39e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f95f019b028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f95ef625fa0 RCX: 00007f95ef39e0d9
RDX: 0000000000000002 RSI: 0000200000000700 RDI: 0000000000000005
RBP: 00007f95ef435024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f95ef626038 R14: 00007f95ef625fa0 R15: 00007ffe19f02fb8
</TASK>
----------------
Code disassembly (best guess):
0: 7a 57 jp 0x59
2: 90 nop
3: 48 c1 e8 03 shr $0x3,%rax
7: 0f b6 04 18 movzbl (%rax,%rbx,1),%eax
b: 84 c0 test %al,%al
d: 0f 85 47 02 00 00 jne 0x25a
13: 83 3d 45 38 85 04 00 cmpl $0x0,0x4853845(%rip) # 0x485385f
1a: 75 13 jne 0x2f
1c: 48 8d 3d c8 87 88 04 lea 0x48887c8(%rip),%rdi # 0x48887eb
23: 48 c7 c6 40 f7 ec 8b mov $0xffffffff8becf740,%rsi
* 2a: 67 48 0f b9 3a ud1 (%edx),%rdi <-- trapping instruction
2f: 90 nop
30: e9 75 ee ff ff jmp 0xffffeeaa
35: 90 nop
36: 0f 0b ud2
38: 90 nop
39: e9 48 f2 ff ff jmp 0xfffff286
3e: 90 nop
3f: 0f .byte 0xf
Reply: An analysis of the bug report and kernel source code reveals the root cause of the issue:
1. **The Bug Mechanism**:
The stack trace shows a "sleeping function called from invalid context" warning triggered by `mutex_lock()` in `null_lock_zone()`. This happens while handling a bio submission (`blk_mq_submit_bio()`) under an `rcu_read_lock()`.
2. **Why `mutex_lock()` is called**:
In `drivers/block/null_blk/zoned.c`, `null_lock_zone()` uses a `spinlock` by default, but switches to a `mutex` if the device is configured as `memory_backed` (`dev->memory_backed == true`).
3. **Why it executes under `rcu_read_lock()`**:
When a bio is submitted, `blk_mq_submit_bio()` checks if the request queue's tag set has the `BLK_MQ_F_BLOCKING` flag. If it does, it uses `srcu_read_lock()` (which allows sleeping). If it doesn't, it falls back to `rcu_read_lock()` (which disables preemption and forbids sleeping).
4. **The Configuration Mismatch**:
When a `null_blk` device is created via configfs with `memory_backed=1`, `null_validate_conf()` correctly sets `dev->blocking = true` to indicate that the queue needs to allow blocking/sleeping.
However, if the device is also configured with `shared_tags=1`, `null_setup_tagset()` ignores the per-device `dev->blocking` flag and instead uses the global `tag_set`. The global `tag_set` is initialized based on the module parameter `g_blocking`, which defaults to `false`.
As a result, the `BLK_MQ_F_BLOCKING` flag is **not** set on the queue, causing `blk_mq_submit_bio()` to issue requests under `rcu_read_lock()`.
5. **Triggering the Bug**:
Powering on the device (`power=1`) triggers `add_disk()`, which initiates a partition scan. The partition scan submits a read bio for sector 0. This read request is dispatched under `rcu_read_lock()` and reaches `null_process_zoned_cmd()`, which calls `null_lock_zone()`. Because `memory_backed=1`, it attempts to acquire a mutex, triggering the BUG.
### Minimal Reproducer
The following standalone C program reproduces the bug by creating a `null_blk` device via configfs with the exact conflicting attributes (`zoned=1`, `memory_backed=1`, `shared_tags=1`) and then powering it on.
```c
// save as repro.c and compile with: gcc repro.c -o repro
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
void write_file(const char *path, const char *val) {
int fd = open(path, O_WRONLY);
if (fd >= 0) {
write(fd, val, strlen(val));
close(fd);
}
}
int main() {
// Ensure configfs is mounted (usually mounted at /sys/kernel/config by default)
mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
// Create a new null_blk device via configfs
mkdir("/sys/kernel/config/nullb/mydev", 0755);
// Enable zoned mode
write_file("/sys/kernel/config/nullb/mydev/zoned", "1");
// Enable memory backed mode. This forces the device to require a blocking queue
// because memory allocation and zone locking can sleep.
write_file("/sys/kernel/config/nullb/mydev/memory_backed", "1");
// Enable shared tags. This causes the device to use the global tag set.
// The global tag set is initialized based on module parameters (g_blocking),
// which defaults to false. Thus, the queue will NOT have BLK_MQ_F_BLOCKING set,
// despite the device requiring a blocking queue.
write_file("/sys/kernel/config/nullb/mydev/shared_tags", "1");
// Power on the device. This triggers add_disk(), which scans partitions.
// Partition scanning submits a read bio. Since BLK_MQ_F_BLOCKING is missing,
// blk_mq_submit_bio() issues the request under rcu_read_lock().
// The request reaches null_process_zoned_cmd() -> null_lock_zone(), which
// calls mutex_lock() (because memory_backed=1), triggering the BUG.
write_file("/sys/kernel/config/nullb/mydev/power", "1");
return 0;
}
```
|
| 5/2 |
2026/08/13 22:04 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 7900
output: 40
thoughts: 642
Thoughts: **A Deep Dive into the Null Block Layer's Zoned Mode Conundrum**
Alright, so I've been handed a bug report that's a classic of the genre: a sleeping function called from an invalid context, specifically within `null_process_zoned_cmd`. The stack trace painted a clear, albeit concerning, picture. It seems `null_process_zoned_cmd` is attempting to acquire a mutex via `null_lock_zone` and then `__mutex_lock`. The real kicker, though, is where this all originates. Tracing it back, we see it bubbling up through `null_handle_cmd`, `null_queue_rq`, `__blk_mq_issue_directly`, `blk_mq_try_issue_directly`, and finally landing on `blk_mq_submit_bio`. And what's happening at `blk_mq_submit_bio`? Ah, yes, it's holding an `rcu_read_lock`. So, the core of the problem is evident: a blocking mutex acquisition is happening while we're in an RCU read-side critical section, which is a definite no-go.
My immediate instinct was to pore over the relevant code. I'm digging into `drivers/block/null_blk/zoned.c` for `null_lock_zone` and `null_process_zoned_cmd`, and `drivers/block/null_blk/main.c` for `null_queue_rq`. I need to understand precisely how these functions interact and where that mutex is being held.
Then, I stumbled upon the reproduction path, and it made a lot of sense. This isn't some obscure race condition that's hard to trigger. No, it's directly tied to writing to the configfs interface. The sequence is: `nullb_device_power_store` calls `null_add_dev`, which then calls `add_disk`. From `add_disk`, we descend into `disk_scan_partitions`. This is the critical part: `disk_scan_partitions` needs to read the partition table, which it does by calling `bdev_open`, leading to `blkdev_get_whole`, then `bdev_disk_changed`, `blk_add_partitions`, `check_partition`, `adfspart_check_ICS`, `read_part_sector`, `read_mapping_folio`, `do_read_cache_folio`, `filemap_read_folio`, `block_read_full_folio`, `bh_submit`, `submit_bio_noacct_nocheck`, `__submit_bio_noacct_mq`, and finally, that familiar `blk_mq_submit_bio`. So, the reproduction is surprisingly simple: set up a null_blk device in zoned mode, and then simply "power it on" through configfs.
Let me quickly check the configfs setup itself to confirm my understanding. It looks like the standard procedure: `mkdir /sys/kernel/config/nullb/mydev`, then `echo 1 > /sys/kernel/config/nullb/mydev/zoned`, and finally `echo 1 > /sys/kernel/config/nullb/mydev/power`. This confirms that the mere act of setting the `power` attribute triggers the read operations necessary for partition scanning.
The crucial realization is that `null_process_zoned_cmd` is invoked *because* a bio is being submitted. And that bio is submitted as part of the partition scanning process, which, naturally, reads sector 0 (among others) to identify partitions. If the device is configured as zoned, this read operation is funneled through `null_process_zoned_cmd`. The core question remains: does `null_process_zoned_cmd`, or more specifically `null_lock_zone` it calls, *always* attempt to lock a mutex? My current suspicion, given the bug report, is that it does, and this is precisely where the RCU lock is being violated. I need to scrutinize the logic within `null_lock_zone` and `null_process_zoned_cmd` to confirm the mutex locking behavior and its interaction with zoned mode.
|
| 6/2 |
2026/08/13 22:05 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/null_blk/zoned.c Name:null_lock_zone]
Results: map[SourceCode: 33: static inline void null_lock_zone(struct nullb_device *dev,
34: struct nullb_zone *zone)
35: {
36: if (!dev->memory_backed)
37: spin_lock_irq(&zone->spinlock);
38: else
39: mutex_lock(&zone->mutex);
40: }
SourceFile:drivers/block/null_blk/zoned.c]
|
| 7/2 |
2026/08/13 22:05 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 8700
output: 31
thoughts: 411
Thoughts: **The Sleeping Beast: A Deep Dive into Potential `null_blk` Deadlocks**
My initial observation, and frankly, the genesis of this whole thought train, is the conditional locking mechanism within `null_lock_zone`. I've realized that `null_lock_zone` behaves quite differently depending on the `dev->memory_backed` flag. When `memory_backed` is true, it opts for `mutex_lock`. Conversely, if `memory_backed` is false, it resorts to the more immediate `spin_lock_irq`. This distinction is crucial.
My mind immediately jumps to a scenario: what if I were to construct a `null_blk` device that is both memory-backed *and* zoned? When a bio (block I/O request) is submitted to such a device, my expectation is that the execution path will lead to `null_process_zoned_cmd`, and from there, to `null_lock_zone`. And as we've established, with `memory_backed` set to true, this means calling `mutex_lock`.
Here's where the alarm bells start ringing. I know that `null_queue_rq` is the entry point for handling requests, and it's ultimately invoked by `blk_mq_submit_bio`. Now, and this is a critical piece of context for me, `blk_mq_submit_bio` operates under the protective umbrella of `rcu_read_lock`. It then proceeds through `blk_mq_try_issue_directly` and `__blk_mq_issue_directly` before finally calling the device's specific `queue_rq` operation, which in our case is `null_queue_rq`.
Therefore, I can confidently state that the `queue_rq` handler, and by extension `null_queue_rq`, is being executed while an `rcu_read_lock` is held. And as we traced, `null_queue_rq` flows through `null_handle_cmd` to `null_process_zoned_cmd` and then to `null_lock_zone`. This is where the problem becomes starkly apparent: `null_lock_zone` attempts to acquire a `mutex_lock` if `memory_backed` is true.
The fundamental conflict, and what I perceive as a clear bug, is that a function invoked under an `rcu_read_lock` (our `queue_rq`) is attempting to acquire a lock that *can sleep* (`mutex_lock`). This is a direct violation of the rules of RCU; operations under `rcu_read_lock` must not sleep, as it can lead to deadlocks or system instability. A sleeping lock acquisition within an RCU-protected context is a recipe for disaster.
Naturally, my next step is to understand precisely how one would even arrive at this problematic configuration. I need to confirm how to set up a memory-backed zoned `null_blk` device. My current understanding is that by default, `memory_backed` is disabled (set to 0). However, I've seen indications that it's controllable via configfs. The sequence I'm considering involves creating a `nullb` device, enabling its zoned mode, and then specifically enabling `memory_backed`. The commands I'm thinking of are:
```bash
mkdir /sys/kernel/config/nullb/mydev
echo 1 > /sys/kernel/config/nullb/mydev/zoned
echo 1 > /sys/kernel/config/nullb/mydev/memory_backed
echo 1 > /sys/kernel/config/nullb/mydev/power
```
My immediate follow-up task is to verify, with certainty, that `memory_backed` is indeed a valid and functional configuration attribute for `null_blk` through configfs. This confirmation is critical to solidifying my understanding of the potential exploit path.
|
| 8/2 |
2026/08/13 22:05 |
tool |
grepper |
0m
Args: map[Expression:memory_backed PathPrefix:drivers/block/null_blk/]
Results: map[Output:drivers/block/null_blk/main.c=214=MODULE_PARM_DESC(use_per_node_hctx, "Use per-node allocation for hardware context queues. Default: false");
drivers/block/null_blk/main.c-215-
drivers/block/null_blk/main.c:216:static bool g_memory_backed;
drivers/block/null_blk/main.c:217:module_param_named(memory_backed, g_memory_backed, bool, 0444);
drivers/block/null_blk/main.c:218:MODULE_PARM_DESC(memory_backed, "Create a memory-backed block device. Default: false");
drivers/block/null_blk/main.c-219-
--
drivers/block/null_blk/main.c=457=NULLB_DEVICE_ATTR(use_per_node_hctx, bool, NULL);
drivers/block/null_blk/main.c:458:NULLB_DEVICE_ATTR(memory_backed, bool, NULL);
drivers/block/null_blk/main.c-459-NULLB_DEVICE_ATTR(discard, bool, NULL);
--
drivers/block/null_blk/main.c=596=static struct configfs_attribute *nullb_device_attrs[] = {
--
drivers/block/null_blk/main.c-611- &nullb_device_attr_mbps,
drivers/block/null_blk/main.c:612: &nullb_device_attr_memory_backed,
drivers/block/null_blk/main.c-613- &nullb_device_attr_no_sched,
--
drivers/block/null_blk/main.c=777=static struct nullb_device *null_alloc_dev(void)
--
drivers/block/null_blk/main.c-810- dev->blocking = g_blocking;
drivers/block/null_blk/main.c:811: dev->memory_backed = g_memory_backed;
drivers/block/null_blk/main.c-812- dev->discard = g_discard;
--
drivers/block/null_blk/main.c=1346=blk_status_t null_handle_badblocks(struct nullb_cmd *cmd, sector_t sector,
--
drivers/block/null_blk/main.c-1371-
drivers/block/null_blk/main.c:1372:blk_status_t null_handle_memory_backed(struct nullb_cmd *cmd, enum req_op op,
drivers/block/null_blk/main.c-1373- sector_t sector, sector_t nr_sectors)
--
drivers/block/null_blk/main.c=1383=static void nullb_zero_read_cmd_buffer(struct nullb_cmd *cmd)
--
drivers/block/null_blk/main.c-1388-
drivers/block/null_blk/main.c:1389: if (!dev->memory_backed && req_op(rq) == REQ_OP_READ) {
drivers/block/null_blk/main.c-1390- __rq_for_each_bio(bio, rq)
--
drivers/block/null_blk/main.c=1423=blk_status_t null_process_cmd(struct nullb_cmd *cmd, enum req_op op,
--
drivers/block/null_blk/main.c-1432-
drivers/block/null_blk/main.c:1433: if (dev->memory_backed && nr_sectors) {
drivers/block/null_blk/main.c:1434: ret = null_handle_memory_backed(cmd, op, sector, nr_sectors);
drivers/block/null_blk/main.c-1435- if (ret != BLK_STS_OK)
--
drivers/block/null_blk/main.c=1789=static void null_config_discard(struct nullb *nullb, struct queue_limits *lim)
--
drivers/block/null_blk/main.c-1793-
drivers/block/null_blk/main.c:1794: if (!nullb->dev->memory_backed) {
drivers/block/null_blk/main.c-1795- nullb->dev->discard = false;
--
drivers/block/null_blk/main.c=1885=static int null_validate_conf(struct nullb_device *dev)
--
drivers/block/null_blk/main.c-1910- /* Do memory allocation, so set blocking */
drivers/block/null_blk/main.c:1911: if (dev->memory_backed)
drivers/block/null_blk/main.c-1912- dev->blocking = true;
--
drivers/block/null_blk/null_blk.h=53=struct nullb_device {
--
drivers/block/null_blk/null_blk.h-102- bool power; /* power on/off the device */
drivers/block/null_blk/null_blk.h:103: bool memory_backed; /* if data is stored in memory */
drivers/block/null_blk/null_blk.h-104- bool discard; /* if support discard */
--
drivers/block/null_blk/null_blk.h=136=blk_status_t null_handle_badblocks(struct nullb_cmd *cmd, sector_t sector,
drivers/block/null_blk/null_blk.h-137- unsigned int *nr_sectors);
drivers/block/null_blk/null_blk.h:138:blk_status_t null_handle_memory_backed(struct nullb_cmd *cmd, enum req_op op,
drivers/block/null_blk/null_blk.h-139- sector_t sector, sector_t nr_sectors);
--
drivers/block/null_blk/zoned.c=24=static inline void null_init_zone_lock(struct nullb_device *dev,
--
drivers/block/null_blk/zoned.c-26-{
drivers/block/null_blk/zoned.c:27: if (!dev->memory_backed)
drivers/block/null_blk/zoned.c-28- spin_lock_init(&zone->spinlock);
--
drivers/block/null_blk/zoned.c=33=static inline void null_lock_zone(struct nullb_device *dev,
--
drivers/block/null_blk/zoned.c-35-{
drivers/block/null_blk/zoned.c:36: if (!dev->memory_backed)
drivers/block/null_blk/zoned.c-37- spin_lock_irq(&zone->spinlock);
--
drivers/block/null_blk/zoned.c=42=static inline void null_unlock_zone(struct nullb_device *dev,
--
drivers/block/null_blk/zoned.c-44-{
drivers/block/null_blk/zoned.c:45: if (!dev->memory_backed)
drivers/block/null_blk/zoned.c-46- spin_unlock_irq(&zone->spinlock);
--
drivers/block/null_blk/zoned.c=350=static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,
--
drivers/block/null_blk/zoned.c-423-
drivers/block/null_blk/zoned.c:424: if (dev->memory_backed) {
drivers/block/null_blk/zoned.c:425: ret = null_handle_memory_backed(cmd, REQ_OP_WRITE, sector,
drivers/block/null_blk/zoned.c-426- nr_sectors);
--
drivers/block/null_blk/zoned.c=607=static blk_status_t null_reset_zone(struct nullb_device *dev,
--
drivers/block/null_blk/zoned.c-639-
drivers/block/null_blk/zoned.c:640: if (dev->memory_backed)
drivers/block/null_blk/zoned.c-641- return null_handle_discard(dev, zone->start, zone->len);
--
drivers/block/null_blk/zoned.c=742=static void null_set_zone_cond(struct nullb_device *dev,
--
drivers/block/null_blk/zoned.c-760- zone->wp = zone->start;
drivers/block/null_blk/zoned.c:761: if (dev->memory_backed)
drivers/block/null_blk/zoned.c-762- null_handle_discard(dev, zone->start, zone->len);
]
|
| 9/2 |
2026/08/13 22:05 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 11343
output: 40
thoughts: 121
Thoughts: **My Thought Process Regarding `null_blk`'s Blocking Behavior**
Observing the code at `drivers/block/null_blk/main.c:1911`, I immediately noted a conditional setting of `dev->blocking = true;` if `dev->memory_backed` is also true. This immediately raised a question in my mind: if `dev->blocking` is indeed set to true, does that imply that the `null_queue_rq` function should *not* be directly invoked while within an RCU read lock? My initial intuition here is that a "blocking" flag often signifies a departure from immediate, non-blocking operations, and RCU read locks are fundamentally designed for non-blocking access.
To clarify this potential conflict or nuance, I need to understand precisely what `blocking` signifies in the context of `null_blk`. Does it imply an alternative queueing mechanism, one that might not be compatible with the strict guarantees of an RCU read lock? My next step, therefore, is to delve into the `null_add_dev` function and examine how the `blocking` flag influences the overall queueing behavior of the `null_blk` device. I'm trying to trace the implications of this flag from its setting to its effect on request handling.
|
| 10/2 |
2026/08/13 22:05 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/null_blk/main.c Name:null_add_dev]
Results: map[SourceCode:1955: static int null_add_dev(struct nullb_device *dev)
1956: {
1957: struct queue_limits lim = {
1958: .logical_block_size = dev->blocksize,
1959: .physical_block_size = dev->blocksize,
1960: .max_hw_sectors = dev->max_sectors,
1961: .dma_alignment = 1,
1962: };
1963:
1964: struct nullb *nullb;
1965: int rv;
1966:
1967: rv = null_validate_conf(dev);
1968: if (rv)
1969: return rv;
1970:
1971: nullb = kzalloc_node(sizeof(*nullb), GFP_KERNEL, dev->home_node);
1972: if (!nullb) {
1973: rv = -ENOMEM;
1974: goto out;
1975: }
1976: nullb->dev = dev;
1977: dev->nullb = nullb;
1978:
1979: spin_lock_init(&nullb->lock);
1980:
1981: rv = setup_queues(nullb);
1982: if (rv)
1983: goto out_free_nullb;
1984:
1985: rv = null_setup_tagset(nullb);
1986: if (rv)
1987: goto out_cleanup_queues;
1988:
1989: if (dev->virt_boundary)
1990: lim.virt_boundary_mask = PAGE_SIZE - 1;
1991: null_config_discard(nullb, &lim);
1992: if (dev->zoned) {
1993: rv = null_init_zoned_dev(dev, &lim);
1994: if (rv)
1995: goto out_cleanup_tags;
1996: }
1997:
1998: if (dev->cache_size > 0) {
1999: set_bit(NULLB_DEV_FL_CACHE, &nullb->dev->flags);
2000: lim.features |= BLK_FEAT_WRITE_CACHE;
2001: if (dev->fua)
2002: lim.features |= BLK_FEAT_FUA;
2003: }
2004:
2005: if (dev->rotational)
2006: lim.features |= BLK_FEAT_ROTATIONAL;
2007:
2008: nullb->disk = blk_mq_alloc_disk(nullb->tag_set, &lim, nullb);
2009: if (IS_ERR(nullb->disk)) {
2010: rv = PTR_ERR(nullb->disk);
2011: goto out_cleanup_zone;
2012: }
2013: nullb->q = nullb->disk->queue;
2014:
2015: if (dev->mbps) {
2016: set_bit(NULLB_DEV_FL_THROTTLED, &dev->flags);
2017: nullb_setup_bwtimer(nullb);
2018: }
2019:
2020: nullb->q->queuedata = nullb;
2021:
2022: rv = ida_alloc(&nullb_indexes, GFP_KERNEL);
2023: if (rv < 0)
2024: goto out_cleanup_disk;
2025:
2026: nullb->index = rv;
2027: dev->index = rv;
2028:
2029: if (config_item_name(&dev->group.cg_item)) {
2030: /* Use configfs dir name as the device name */
2031: snprintf(nullb->disk_name, sizeof(nullb->disk_name),
2032: "%s", config_item_name(&dev->group.cg_item));
2033: } else {
2034: sprintf(nullb->disk_name, "nullb%d", nullb->index);
2035: }
2036:
2037: set_capacity(nullb->disk,
2038: ((sector_t)nullb->dev->size * SZ_1M) >> SECTOR_SHIFT);
2039: nullb->disk->major = null_major;
2040: nullb->disk->first_minor = nullb->index;
2041: nullb->disk->minors = 1;
2042: nullb->disk->fops = &null_ops;
2043: nullb->disk->private_data = nullb;
2044: strscpy(nullb->disk->disk_name, nullb->disk_name);
2045:
2046: if (nullb->dev->zoned) {
2047: rv = null_register_zoned_dev(nullb);
2048: if (rv)
2049: goto out_ida_free;
2050: }
2051:
2052: rv = add_disk(nullb->disk);
2053: if (rv)
2054: goto out_ida_free;
2055:
2056: list_add_tail(&nullb->list, &nullb_list);
2057:
2058: pr_info("disk %s created\n", nullb->disk_name);
2059:
2060: return 0;
2061:
2062: out_ida_free:
2063: ida_free(&nullb_indexes, nullb->index);
2064: out_cleanup_disk:
2065: put_disk(nullb->disk);
2066: out_cleanup_zone:
2067: null_free_zoned_dev(dev);
2068: out_cleanup_tags:
2069: if (nullb->tag_set == &nullb->__tag_set)
2070: blk_mq_free_tag_set(nullb->tag_set);
2071: out_cleanup_queues:
2072: kfree(nullb->queues);
2073: out_free_nullb:
2074: kfree(nullb);
2075: dev->nullb = NULL;
2076: out:
2077: return rv;
2078: }
SourceFile:drivers/block/null_blk/main.c]
|
| 11/2 |
2026/08/13 22:05 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 13352
output: 41
thoughts: 12
Thoughts: **My Thought Process on `null_setup_tagset`**
Alright, first things first. My immediate impulse is to dive into the `null_setup_tagset` function. It's not just a random check; it's a critical starting point for understanding how the system initializes and sets up its tagging mechanism. I need to get a clear picture of what assumptions this function makes, what dependencies it has, and what its expected output is. Is it populating global state? Is it returning configuration? Or is it performing some kind of validation before proceeding? Understanding its core purpose and how it integrates into the broader workflow is paramount. I'm looking for any potential edge cases it might not be handling, or any implicit requirements that could lead to downstream issues. This function, in essence, feels like the bedrock upon which the rest of the tagging logic is built, and I want to be absolutely sure that foundation is sound.
|
| 12/2 |
2026/08/13 22:05 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/null_blk/main.c Name:null_setup_tagset]
Results: map[SourceCode:1864: static int null_setup_tagset(struct nullb *nullb)
1865: {
1866: if (nullb->dev->shared_tags) {
1867: nullb->tag_set = &tag_set;
1868: return null_init_global_tag_set();
1869: }
1870:
1871: nullb->tag_set = &nullb->__tag_set;
1872: nullb->tag_set->driver_data = nullb;
1873: nullb->tag_set->nr_hw_queues = nullb->dev->submit_queues;
1874: nullb->tag_set->queue_depth = nullb->dev->hw_queue_depth;
1875: nullb->tag_set->numa_node = nullb->dev->home_node;
1876: if (nullb->dev->no_sched)
1877: nullb->tag_set->flags |= BLK_MQ_F_NO_SCHED_BY_DEFAULT;
1878: if (nullb->dev->shared_tag_bitmap)
1879: nullb->tag_set->flags |= BLK_MQ_F_TAG_HCTX_SHARED;
1880: if (nullb->dev->blocking)
1881: nullb->tag_set->flags |= BLK_MQ_F_BLOCKING;
1882: return null_init_tag_set(nullb->tag_set, nullb->dev->poll_queues);
1883: }
SourceFile:drivers/block/null_blk/main.c]
|
| 13/2 |
2026/08/13 22:05 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 13835
output: 38
thoughts: 145
Thoughts: **The Blocking Queue Conundrum**
My initial thought process, as I delved into this code, was one of logical deduction. I observed a direct correlation: if `nullb->tag_set->flags` had the `BLK_MQ_F_BLOCKING` bit set, it was because `nullb->dev->blocking` was true. This was the first piece of the puzzle.
Then, I traced the origin of `dev->blocking`'s truthiness. It dawned on me that `null_validate_conf` was responsible for setting `dev->blocking = true` specifically when `dev->memory_backed` was true. This established a crucial link: `dev->memory_backed` being true ultimately led to the queue being marked as blocking.
This revelation immediately sparked a question in my mind. If a queue is indeed marked as blocking, how does that impact the execution flow within `blk_mq_submit_bio`? Specifically, I wondered if it was appropriate for `blk_mq_submit_bio` to directly invoke `queue_rq` under the protection of an RCU read lock when the queue was in this blocking state. This felt like a potential point of contention or an edge case that warranted further investigation. My immediate next step, therefore, was to navigate to `block/blk-mq.c` and examine the implementation of `blk_mq_submit_bio` to confirm or refute this suspicion.
|
| 14/2 |
2026/08/13 22:05 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:block/blk-mq.c Name:blk_mq_submit_bio]
Results: map[SourceCode:3080: /**
3081: * blk_mq_submit_bio - Create and send a request to block device.
3082: * @bio: Bio pointer.
3083: *
3084: * Builds up a request structure from @q and @bio and send to the device. The
3085: * request may not be queued directly to hardware if:
3086: * * This request can be merged with another one
3087: * * We want to place request at plug queue for possible future merging
3088: * * There is an IO scheduler active at this queue
3089: *
3090: * It will not queue the request if there is an error with the bio, or at the
3091: * request creation.
3092: */
3093: void blk_mq_submit_bio(struct bio *bio)
3094: {
3095: struct request_queue *q = bdev_get_queue(bio->bi_bdev);
3096: struct blk_plug *plug = current->plug;
3097: const int is_sync = op_is_sync(bio->bi_opf);
3098: unsigned int integrity_action;
3099: struct blk_mq_hw_ctx *hctx;
3100: unsigned int nr_segs;
3101: struct request *rq;
3102: blk_status_t ret;
3103:
3104: /*
3105: * If the plug has a cached request for this queue, try to use it.
3106: */
3107: rq = blk_mq_get_cached_request(plug, q, bio->bi_opf);
3108:
3109: /*
3110: * A BIO that was released from a zone write plug has already been
3111: * through the preparation in this function, already holds a reference
3112: * on the queue usage counter, and is the only write BIO in-flight for
3113: * the target zone. Go straight to preparing a request for it.
3114: */
3115: if (bio_zone_write_plugging(bio)) {
3116: nr_segs = bio->__bi_nr_segments;
3117: if (rq)
3118: blk_queue_exit(q);
3119: goto new_request;
3120: }
3121:
3122: /*
3123: * The cached request already holds a q_usage_counter reference and we
3124: * don't have to acquire a new one if we use it.
3125: */
3126: if (!rq) {
3127: if (unlikely(bio_queue_enter(bio)))
3128: return;
3129: }
3130:
3131: /*
3132: * Device reconfiguration may change logical block size or reduce the
3133: * number of poll queues, so the checks for alignment and poll support
3134: * have to be done with queue usage counter held.
3135: */
3136: if (unlikely(bio_unaligned(bio, q))) {
3137: bio_io_error(bio);
3138: goto queue_exit;
3139: }
3140:
3141: if ((bio->bi_opf & REQ_POLLED) && !blk_mq_can_poll(q)) {
3142: bio_endio_status(bio, BLK_STS_NOTSUPP);
3143: goto queue_exit;
3144: }
3145:
3146: bio = __bio_split_to_limits(bio, &q->limits, &nr_segs);
3147: if (!bio)
3148: goto queue_exit;
3149:
3150: integrity_action = bio_integrity_action(bio);
3151: if (integrity_action)
3152: bio_integrity_prep(bio, integrity_action);
3153:
3154: blk_mq_bio_issue_init(q, bio);
3155: if (blk_mq_attempt_bio_merge(q, bio, nr_segs))
3156: goto queue_exit;
3157:
3158: if (bio_needs_zone_write_plugging(bio)) {
3159: if (blk_zone_plug_bio(bio, nr_segs))
3160: goto queue_exit;
3161: }
3162:
3163: new_request:
3164: if (rq) {
3165: rq_qos_throttle(rq->q, bio);
3166: blk_mq_rq_time_init(rq, blk_time_get_ns());
3167: rq->cmd_flags = bio->bi_opf;
3168: INIT_LIST_HEAD(&rq->queuelist);
3169: } else {
3170: rq = blk_mq_get_new_requests(q, plug, bio);
3171: if (unlikely(!rq)) {
3172: if (bio->bi_opf & REQ_NOWAIT)
3173: bio_wouldblock_error(bio);
3174: goto queue_exit;
3175: }
3176: }
3177:
3178: trace_block_getrq(bio);
3179:
3180: rq_qos_track(q, rq, bio);
3181:
3182: blk_mq_bio_to_request(rq, bio, nr_segs);
3183:
3184: ret = blk_crypto_rq_get_keyslot(rq);
3185: if (ret != BLK_STS_OK) {
3186: bio_endio_status(bio, ret);
3187: blk_mq_free_request(rq);
3188: return;
3189: }
3190:
3191: if (bio_zone_write_plugging(bio))
3192: blk_zone_write_plug_init_request(rq);
3193:
3194: if (op_is_flush(bio->bi_opf) && blk_insert_flush(rq))
3195: return;
3196:
3197: if (plug) {
3198: blk_add_rq_to_plug(plug, rq);
3199: return;
3200: }
3201:
3202: hctx = rq->mq_hctx;
3203: if ((rq->rq_flags & RQF_USE_SCHED) ||
3204: (hctx->dispatch_busy && (q->nr_hw_queues == 1 || !is_sync))) {
3205: blk_mq_insert_request(rq, 0);
3206: blk_mq_run_hw_queue(hctx, true);
3207: } else {
3208: blk_mq_run_dispatch_ops(q, blk_mq_try_issue_directly(hctx, rq));
3209: }
3210: return;
3211:
3212: queue_exit:
3213: if (!rq)
3214: blk_queue_exit(q);
3215: else
3216: rq_list_add_head(&plug->cached_rqs, rq);
3217: }
SourceFile:block/blk-mq.c]
|
| 15/2 |
2026/08/13 22:05 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 16120
output: 40
thoughts: 19
Thoughts: **The Crucial Realization About `blk_mq_run_dispatch_ops`**
My immediate thought upon reviewing this code is a jolt of realization: "Wait, `blk_mq_run_dispatch_ops` does RCU read lock!" This isn't just a casual observation; it's a critical piece of understanding about the operation of the block layer's multi-queue dispatching mechanism. Knowing that this function, which is clearly central to how I'll be managing I/O requests and their associated operations, acquires an RCU read lock fundamentally changes how I need to approach its usage and any concurrent operations I might be considering around it.
This implies that any data structures or state that `blk_mq_run_dispatch_ops` accesses are protected by RCU read-side protections. This means I can safely read from them within this function without needing explicit spinlocks, *provided* I adhere to RCU's rules. Conversely, it also means that any modifications to that same shared state must be done with RCU write-side protections, and importantly, that any code *calling* `blk_mq_run_dispatch_ops` needs to be mindful of this. If I'm attempting to, for example, tear down a data structure that `blk_mq_run_dispatch_ops` might be reading from, I need to ensure that the tear-down process properly synchronizes with the RCU read lock held by `blk_mq_run_dispatch_ops`. This might involve grace periods, or ensuring that no dispatch operations are active before proceeding with deallocation.
This single detail – the RCU read lock – dictates a significant portion of my subsequent design and implementation strategy. It’s a foundational assumption that will guide how I think about synchronization, potential race conditions, and the overall safety of my interactions with the block layer's dispatching logic. I can't just assume I can freely modify shared data if `blk_mq_run_dispatch_ops` is touching it; I need to be aware of the RCU implications. This is a prime example of how a seemingly small detail can have cascading effects on the entire system's design.
|
| 16/2 |
2026/08/13 22:05 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:block/blk-mq.c Name:blk_mq_run_dispatch_ops]
Results: map[SourceCode: SourceFile:]
|
| 17/2 |
2026/08/13 22:05 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 16184
output: 33
thoughts: 14
Thoughts: **My Thought Process:**
Right, so the first thing that hits me when I look at this is, "Okay, this is a macro." That's my immediate classification. My next logical step, driven by that identification, is to figure out *where* this macro actually resides. I need to locate it.
|
| 18/2 |
2026/08/13 22:05 |
tool |
grepper |
0m
Args: map[Expression:define blk_mq_run_dispatch_ops PathPrefix:block/]
Results: map[Output:block/blk-mq.h=440=do { \
--
block/blk-mq.h-455-
block/blk-mq.h:456:#define blk_mq_run_dispatch_ops(q, dispatch_ops) \
block/blk-mq.h-457- __blk_mq_run_dispatch_ops(q, true, dispatch_ops) \
]
|
| 19/2 |
2026/08/13 22:05 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 16327
output: 41
thoughts: 16
Thoughts: **My Thought Process Regarding `__blk_mq_run_dispatch_ops`**
Alright, my primary focus right now is understanding the inner workings of `__blk_mq_run_dispatch_ops`. I want to get a clear picture of what this function *does*, how it fits into the broader block layer, and what its core responsibilities are within the blk-mq framework.
Essentially, I'm digging into the dispatching mechanism. I need to ascertain how it takes requests that have been prepared and processed by the earlier stages of the block layer and *actually* sends them off to the relevant hardware queue or I/O scheduler. This involves tracing the flow of a request from the moment it's ready for dispatch to its actual submission.
A key aspect I'm looking for is how `__blk_mq_run_dispatch_ops` handles the queuing and prioritization of these requests. Does it directly interact with hardware queues? Does it delegate that responsibility to something else? How does it ensure that the most important or time-sensitive requests are handled first? I'm interested in the logic that determines which request gets dispatched next.
Furthermore, I need to understand the role of "dispatch ops" themselves. What exactly are these operations, and what information do they encapsulate? Are they specific to the hardware device, or are they more generic operations that blk-mq utilizes? How are these ops populated and managed?
I'm also considering the context in which `__blk_mq_run_dispatch_ops` is invoked. Is it called as part of a workqueue, an interrupt handler, or perhaps from a more direct request path? Understanding the calling context is crucial for comprehending the performance implications and potential bottlenecks.
Finally, I want to understand the exit conditions and return values of this function. What does it signify when `__blk_mq_run_dispatch_ops` completes its work? Does it signal that all pending dispatches are done, or is it an ongoing process? This will help me understand the overall lifecycle of a dispatched I/O request.
|
| 20/2 |
2026/08/13 22:05 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:block/blk-mq.h Name:__blk_mq_run_dispatch_ops]
Results: map[SourceCode: SourceFile:]
|
| 21/2 |
2026/08/13 22:05 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 16389
output: 39
thoughts: 20
Thoughts: **My Thought Process Regarding `block/blk-mq.h` Line 440**
Alright, I'm diving into the kernel's block layer, specifically the multi-queue block layer (blk-mq) in `block/blk-mq.h`, and I've landed around line 440. My initial thought is to get a grip on the immediate context of this line. What is happening *right here*? Is it a struct definition, a function pointer, a macro, a simple variable declaration, or perhaps the start of a control flow block? My focus will be on understanding the syntax and keywords present at that specific location to get a preliminary sense of its purpose.
Once I've grasped the immediate syntactic meaning, I need to step back and understand the *role* of this line within the larger structure of the file. Is this line part of a larger data structure, a crucial part of a function's signature, or a key element in how blk-mq manages its queues and requests? I'll be looking for related definitions and usages nearby to see how this specific line contributes to the overall operation of the block layer. For instance, if it's a field within a `struct`, I'll want to know what that struct represents and what other fields it contains. If it's a function pointer, I'll be interested in the type of function it points to and where that function is defined or used.
My next step is to consider the *implications* of what I'm seeing. If this line is setting up some form of callback or dispatch mechanism, I'll be thinking about the performance implications. Is this a critical path operation? Does it involve locking or synchronization that could become a bottleneck? If it's related to request handling, I'll be considering how it impacts the latency and throughput of I/O operations. The fact that it's within the blk-mq subsystem immediately signals that this is likely a high-performance, highly parallelized component, so understanding any potential contention or overhead introduced by this line is paramount.
Finally, I'll be trying to connect this specific line to the broader goals of blk-mq. Why was this particular piece of code designed this way? What problem does it solve in terms of scaling I/O to modern multi-core CPUs and high-performance storage devices? I'll be thinking about the abstraction layers being employed and how this line fits into the overall design philosophy of blk-mq, aiming for efficiency and scalability. My expertise tells me that subtle details in these low-level kernel structures can have significant downstream effects, so I'm looking for the elegance (or perhaps the necessary complexity) of the solution presented around line 440.
|
| 22/2 |
2026/08/13 22:05 |
tool |
read-file |
0m
Error:
Args: map[File:block/blk-mq.h FirstLine:430 LineCount:40]
|
| 23/2 |
2026/08/13 22:05 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 16455
output: 35
thoughts: 9
Thoughts: **My Thought Process**
Okay, so, looking at this, my immediate internal reaction is that the variable or parameter labeled "FirstLine" absolutely has to be an integer. There's no other logical data type that would make sense for it in this context. It's not a string of characters, it's not a floating-point number with decimal precision, nor is it a boolean. It signifies a position, a count, a specific row number, and those are inherently discrete, whole numbers. That's the fundamental characteristic that jumps out at me.
|
| 24/2 |
2026/08/13 22:05 |
tool |
read-file |
0m
Args: map[File:block/blk-mq.h FirstLine:430 LineCount:40]
Results: map[Contents: 430:
431: /*
432: * Allow at least some tags
433: */
434: depth = max((bt->sb.depth + users - 1) / users, 4U);
435: return __blk_mq_active_requests(hctx) < depth;
436: }
437:
438: /* run the code block in @dispatch_ops with rcu/srcu read lock held */
439: #define __blk_mq_run_dispatch_ops(q, check_sleep, dispatch_ops) \
440: do { \
441: if ((q)->tag_set->flags & BLK_MQ_F_BLOCKING) { \
442: struct blk_mq_tag_set *__tag_set = (q)->tag_set; \
443: int srcu_idx; \
444: \
445: might_sleep_if(check_sleep); \
446: srcu_idx = srcu_read_lock(__tag_set->srcu); \
447: (dispatch_ops); \
448: srcu_read_unlock(__tag_set->srcu, srcu_idx); \
449: } else { \
450: rcu_read_lock(); \
451: (dispatch_ops); \
452: rcu_read_unlock(); \
453: } \
454: } while (0)
455:
456: #define blk_mq_run_dispatch_ops(q, dispatch_ops) \
457: __blk_mq_run_dispatch_ops(q, true, dispatch_ops) \
458:
459: static inline bool blk_mq_can_poll(struct request_queue *q)
460: {
461: return (q->limits.features & BLK_FEAT_POLL) &&
462: q->tag_set->map[HCTX_TYPE_POLL].nr_queues;
463: }
464:
465: #endif
]
|
| 25/2 |
2026/08/13 22:05 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 17102
output: 41
thoughts: 156
Thoughts: **My Thought Process Unpacked**
My initial focus landed on the `__blk_mq_run_dispatch_ops` function. I immediately noticed its conditional logic based on the `BLK_MQ_F_BLOCKING` flag within the `tag_set`. Specifically, if this flag is present, the execution path diverges: it opts for `srcu_read_lock` and then calls `might_sleep_if(check_sleep)`. Conversely, if `BLK_MQ_F_BLOCKING` is *not* set, the function defaults to using `rcu_read_lock`.
This distinction struck me as significant, so my next step was to trace how `BLK_MQ_F_BLOCKING` gets set. My attention then turned to `null_setup_tagset`. I observed that this function *does* indeed set `BLK_MQ_F_BLOCKING` under a particular circumstance: when the `dev->memory_backed` flag for the device is true.
However, I then dug deeper into the `null_setup_tagset` logic and realized there's a further crucial condition attached. The `BLK_MQ_F_BLOCKING` flag is *only* set if `nullb->dev->shared_tags` is false. This specific nuance is critical. It means that even if `dev->memory_backed` is true, the blocking behavior isn't guaranteed. The presence or absence of shared tags acts as a gatekeeper for this flag.
To ensure I had a complete understanding, I felt it necessary to revisit the `null_setup_tagset` function, going through its logic once more to fully confirm the interplay of these flags and conditions. This detailed examination is what leads me to the current understanding of the execution flow.
|
| 26/2 |
2026/08/13 22:05 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/null_blk/main.c Name:null_setup_tagset]
Results: map[SourceCode:1864: static int null_setup_tagset(struct nullb *nullb)
1865: {
1866: if (nullb->dev->shared_tags) {
1867: nullb->tag_set = &tag_set;
1868: return null_init_global_tag_set();
1869: }
1870:
1871: nullb->tag_set = &nullb->__tag_set;
1872: nullb->tag_set->driver_data = nullb;
1873: nullb->tag_set->nr_hw_queues = nullb->dev->submit_queues;
1874: nullb->tag_set->queue_depth = nullb->dev->hw_queue_depth;
1875: nullb->tag_set->numa_node = nullb->dev->home_node;
1876: if (nullb->dev->no_sched)
1877: nullb->tag_set->flags |= BLK_MQ_F_NO_SCHED_BY_DEFAULT;
1878: if (nullb->dev->shared_tag_bitmap)
1879: nullb->tag_set->flags |= BLK_MQ_F_TAG_HCTX_SHARED;
1880: if (nullb->dev->blocking)
1881: nullb->tag_set->flags |= BLK_MQ_F_BLOCKING;
1882: return null_init_tag_set(nullb->tag_set, nullb->dev->poll_queues);
1883: }
SourceFile:drivers/block/null_blk/main.c]
|
| 27/2 |
2026/08/13 22:05 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 17729
output: 44
thoughts: 56
Thoughts: **My Thought Process for Handling Shared Tags in the Null Driver**
Ah, yes, I see it now! My initial reaction is one of affirmation, a "Yes!" moment. My analysis has led me to a crucial branching point: if the `shared_tags` flag within the `nullb->dev` structure is set to true, it signals that we're to utilize the globally defined `tag_set`. This, in turn, triggers the invocation of the `null_init_global_tag_set()` function. My next logical step, therefore, is to meticulously examine the implementation and behavior of `null_init_global_tag_set()` to fully grasp its role in this process. This detailed understanding will be key to ensuring correct global tag set initialization when the shared tags feature is enabled.
|
| 28/2 |
2026/08/13 22:05 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/null_blk/main.c Name:null_init_global_tag_set]
Results: map[SourceCode:1841: static int null_init_global_tag_set(void)
1842: {
1843: int error;
1844:
1845: if (tag_set.ops)
1846: return 0;
1847:
1848: tag_set.nr_hw_queues = g_submit_queues;
1849: tag_set.queue_depth = g_hw_queue_depth;
1850: tag_set.numa_node = g_home_node;
1851: if (g_no_sched)
1852: tag_set.flags |= BLK_MQ_F_NO_SCHED_BY_DEFAULT;
1853: if (g_shared_tag_bitmap)
1854: tag_set.flags |= BLK_MQ_F_TAG_HCTX_SHARED;
1855: if (g_blocking)
1856: tag_set.flags |= BLK_MQ_F_BLOCKING;
1857:
1858: error = null_init_tag_set(&tag_set, g_poll_queues);
1859: if (error)
1860: tag_set.ops = NULL;
1861: return error;
1862: }
SourceFile:drivers/block/null_blk/main.c]
|
| 29/2 |
2026/08/13 22:05 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 18195
output: 43
thoughts: 164
Thoughts: **My Thought Process Regarding `null_init_global_tag_set` and Blocking Behavior**
It seems I've stumbled upon a potential discrepancy within the `null_init_global_tag_set` function, and I'm tracing its implications for how blocking behavior is handled in this context. My initial observation is that `null_init_global_tag_set` directly relies on `g_blocking`.
Now, the critical point here is that `g_blocking` is a module parameter. And as I recall, module parameters, by default, are `false`. This is a fundamental point that could lead to unexpected outcomes.
Let me trace a specific scenario: Imagine a device being created through configfs. If this device is configured with `shared_tags=1` and `memory_backed=1`, then `null_validate_conf` will explicitly set `dev->blocking = true`. This indicates a clear intention for this specific device's tag set to operate in a blocking manner.
However, the crux of the issue appears to be in the subsequent call to `null_setup_tagset`. This function, it seems, will utilize the *global* `tag_set`. And, as established, this global `tag_set` was initialized using `g_blocking`, which, by default, is `false`.
This leads to a potentially problematic situation: even if `dev->blocking` is set to `true` for a specific device configuration, the underlying global tag set being used might still have blocking disabled because it was initialized with a `false` module parameter. The consequence I'm anticipating is that the queue, when ultimately set up, will *not* have the `BLK_MQ_F_BLOCKING` flag set, despite the device configuration suggesting otherwise.
This raises a crucial question in my mind: is `shared_tags` set to `true` by default in the configfs creation process? I need to verify this. To do so, I plan to examine the `nullb_group_make_item` function, as this is where the configfs item for the device is created, and it's the most logical place to find the default settings for parameters like `shared_tags`. Understanding the default value of `shared_tags` will be key to determining if this potential blocking behavior issue is a common occurrence or dependent on explicit user configuration.
|
| 30/2 |
2026/08/13 22:06 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:drivers/block/null_blk/main.c Name:nullb_group_make_item]
Results: map[SourceCode: SourceFile:]
|
| 31/2 |
2026/08/13 22:06 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 18407
output: 31
thoughts: 24
Thoughts: **My Thought Process on Analyzing `make_item` in `drivers/block/null_blk/main.c`**
Alright, so my first instinct when encountering a new or unfamiliar piece of code, especially within the kernel, is to immediately dive into the specifics. The prompt points me towards `drivers/block/null_blk/main.c` and a particular function, `make_item`. This tells me the problem space is the null block device driver, a rather fundamental component for testing and simulation. My immediate goal here is to understand what `make_item` does, how it fits into the broader context of the null block driver's operation, and what its implications are.
My immediate mental model is to think: "What's the *purpose* of this function?" Is it for initialization? Resource allocation? Data processing? Given the name `make_item`, I'm strongly suspecting it's involved in the creation or instantiation of something. In the context of a block driver, "item" could refer to a request queue, a blk_mq_ctx, a partition, or even the device itself. I need to confirm this.
So, my first action would be to virtually "open" the `drivers/block/null_blk/main.c` file in my mind's eye and locate the definition of `make_item`. I'm anticipating it will have parameters that give clues to its role. What arguments does it take? What does it return? These will be critical in understanding its function signature and therefore its high-level purpose.
Once I've found the function, I'll start tracing its execution path. I'll be looking for:
* **Initialization of structures:** Is it allocating memory for data structures? Is it setting default values? This is where I'd expect to see `kzalloc`, `kmalloc`, or similar memory allocation calls.
* **Configuration:** Does it configure any internal state for the null block device? This might involve setting up queues, defining device properties, or registering something with the kernel's block layer.
* **Dependencies:** Does `make_item` call other functions? If so, what are they? Understanding these dependencies will help me map out the flow of control and the relationships between different parts of the driver.
* **Error handling:** How does `make_item` handle failures? Does it return error codes? Does it perform cleanup? Robustness is key in the kernel, so I'd be scrutinizing this.
* **Integration with the block layer:** Since it's a block driver, I'm expecting to see interactions with the Linux kernel's block layer (e.g., `blk_alloc_queue`, `blk_register_queue`, `blk_mq_init_map`, etc.). `make_item` likely plays a role in setting up these interfaces.
Specifically for `make_item` in a null block driver, my hypothesis is that it's likely involved in setting up the core data structure for a *single instance* of a null block device. This could mean:
1. **Creating and initializing the `struct gendisk`:** This is the primary structure representing a block device.
2. **Setting up the request queue:** This is crucial for handling I/O requests. Given it's a null driver, this queue might be minimal or specially configured.
3. **Possibly dealing with multi-queue (blk-mq) setup:** Modern block drivers heavily rely on blk-mq, so I'd be looking for related structures and initialization functions.
4. **Associating the device with its operations:** The driver needs to tell the kernel what functions to call for read, write, and other I/O operations.
In essence, my thought process is a systematic deconstruction. I'm not just reading the code; I'm actively trying to *understand the intent* behind it. I'm building a mental model of how this function contributes to the overall functionality of the null block driver, and more broadly, how it interacts with the kernel's block subsystem. The search for `make_item` is the starting point of this deeper investigation.
|
| 32/2 |
2026/08/13 22:06 |
tool |
grepper |
0m
Error:
Args: map[Expression:make_item PathPrefix:drivers/block/null_blk/]
Results:
|
| 33/2 |
2026/08/13 22:06 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 18460
output: 33
thoughts: 23
Thoughts: **My Thought Process on `configfs` in `null_blk`**
Alright, so my initial impulse, when presented with the `null_blk` driver and the mention of `configfs`, is to dive right into the code. My first thought is to locate where `configfs` is actually being utilized within the `drivers/block/null_blk/main.c` file. I want to see the direct implementation, the hooks, the structures, and the functions that `configfs` is interacting with. This isn't about theoretical understanding at this point; it's about observing the concrete manifestation of the interface within this specific block driver. I'm looking for declarations, registrations, and any callbacks that signal `configfs`'s presence and role in how `null_blk` is configured or managed dynamically.
|
| 34/2 |
2026/08/13 22:06 |
tool |
grepper |
0m
Args: map[Expression:config_item_type PathPrefix:drivers/block/null_blk/]
Results: map[Output:drivers/block/null_blk/main.c=645=static const struct configfs_item_operations nullb_device_ops = {
--
drivers/block/null_blk/main.c-648-
drivers/block/null_blk/main.c:649:static const struct config_item_type nullb_device_type = {
drivers/block/null_blk/main.c-650- .ct_item_ops = &nullb_device_ops,
--
drivers/block/null_blk/main.c=752=static const struct configfs_group_operations nullb_group_ops = {
--
drivers/block/null_blk/main.c-756-
drivers/block/null_blk/main.c:757:static const struct config_item_type nullb_group_type = {
drivers/block/null_blk/main.c-758- .ct_group_ops = &nullb_group_ops,
]
|
| 35/2 |
2026/08/13 22:06 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 18754
output: 41
thoughts: 12
Thoughts: **My Thought Process on `nullb_group_ops`**
Ah, yes. My initial instinct here, upon encountering `nullb_group_ops`, is to dive straight into understanding its functionality. I'm immediately curious about what "group ops" actually entails in this context, especially given the "nullb" prefix. My mind immediately starts to dissect these components.
"Nullb" – what does that signify? Is it a specific type of operation, perhaps indicating a nullification or a default behavior? Or does it relate to a particular data structure or state where operations are intentionally bypassed or rendered ineffective? I'm trying to recall if I've seen this prefix before, or if it's a new convention within this codebase or the broader system I'm working with. The ambiguity is the first hurdle.
Then there's "group_ops." This suggests a collection or a set of operations that are to be performed collectively. My immediate thoughts turn to how these operations are grouped: are they batched, sequenced, or perhaps executed in parallel? What is the scope of this grouping? Does it apply to a set of data, a logical unit of work, or a specific component's interactions?
So, my primary investigative path is to understand the *purpose* and *mechanism* of `nullb_group_ops`. I'm looking for answers to:
* **What is the core function?** What is it designed to achieve?
* **What are the constituent operations?** What specific actions are being grouped?
* **Under what conditions does it operate?** When is `nullb_group_ops` invoked, and what are the prerequisites?
* **What are the implications of the "nullb" aspect?** Does it signify an absence of action, a placeholder, or a specific form of no-op? How does this differentiate it from other potential "group_ops" implementations?
* **What is the intended outcome or side effect?** What state changes or results should I expect?
* **How does it interact with the rest of the system?** Where does it fit into the larger architectural flow?
Essentially, I'm trying to build a mental model of this `nullb_group_ops` construct, starting from its name and branching out to its detailed behavior and contextual relevance. It's about peeling back the layers to reveal its underlying logic and purpose.
|
| 36/2 |
2026/08/13 22:06 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/null_blk/main.c Name:nullb_group_ops]
Results: map[SourceCode: 752: static const struct configfs_group_operations nullb_group_ops = {
753: .make_group = nullb_group_make_group,
754: .drop_item = nullb_group_drop_item,
755: };
SourceFile:drivers/block/null_blk/main.c]
|
| 37/2 |
2026/08/13 22:06 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 18897
output: 43
thoughts: 14
Thoughts: **My Thought Process on `nullb_group_make_group`**
Alright, so my current mental focus is zeroing in on this particular function: `nullb_group_make_group`. I'm not just casually looking at it; I'm actively dissecting its potential role and implications within the larger system. The name itself, `nullb_group_make_group`, immediately triggers a few lines of inquiry.
First, the `group_make_group` part suggests an operation that creates a group, and likely a new group is being instantiated. This is pretty standard, but the context of *where* this group is being made is crucial. Is it a top-level group, a subgroup, or something else entirely? The naming doesn't immediately clarify the hierarchy, so that's a point of interest.
Then there's the `nullb_` prefix. This is the really intriguing bit for me. What does `nullb_` signify? It could mean a few things, and I'm running through the possibilities:
* **Null Bound:** Perhaps it's related to the bounds or limits of the group being created. Maybe it's about setting default, "null" boundaries, or initializing bounds that are currently undefined. This could be relevant for dynamic group creation where bounds are established later.
* **Null Boolean:** It could be a flag, a boolean value that is being initialized to null or a false-like state. This might indicate a certain type of group or a status associated with its creation.
* **Null Byte/Bit:** Less likely in a high-level context, but if this is a very low-level operation, it could refer to initializing memory with null bytes or bits.
* **A Specific Namespace or Type Identifier:** `nullb_` could be a distinct identifier for a particular *kind* of group being made. Perhaps there are other `group_make_group` functions with different prefixes, each signifying a different category or behavior of groups. This would imply a classification system at play.
* **A Placeholder or Uninitialized State:** It might simply be a convention to denote that this group is being created in a preliminary or uninitialized state, awaiting further configuration or data population.
Given my expertise, I'm not just pondering these possibilities in isolation. I'm actively cross-referencing them with my existing knowledge of the system's architecture, its data structures, and common patterns for group management. I'm thinking about how this function would interact with other components: what parameters would it likely take? What would it return? Does it involve memory allocation? Does it interact with a database or a configuration store?
The "thoughts" themselves are not static; they're a dynamic process of hypothesis generation and testing (mentally, at least). I'm not just *reading* the name; I'm *interrogating* it, trying to anticipate its behavior, its purpose, and its potential pitfalls. The `nullb_` prefix is the key enigma here, and unraveling its meaning is central to understanding the function's role. I'm essentially trying to reverse-engineer its intended functionality from its name, looking for clues that would allow me to predict its output and its impact on the system's state.
|
| 38/2 |
2026/08/13 22:06 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/null_blk/main.c Name:nullb_group_make_group]
Results: map[SourceCode: 686: static struct
687: config_group *nullb_group_make_group(struct config_group *group, const char *name)
688: {
689: struct nullb_device *dev;
690:
691: if (null_find_dev_by_name(name))
692: return ERR_PTR(-EEXIST);
693:
694: dev = null_alloc_dev();
695: if (!dev)
696: return ERR_PTR(-ENOMEM);
697:
698: config_group_init_type_name(&dev->group, name, &nullb_device_type);
699: nullb_add_fault_config(dev);
700:
701: return &dev->group;
702: }
SourceFile:drivers/block/null_blk/main.c]
|
| 39/2 |
2026/08/13 22:06 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 19208
output: 40
thoughts: 11
Thoughts: **My Deep Dive into `null_alloc_dev`**
Alright, so my first instinct is to really get a grip on this `null_alloc_dev`. I need to understand exactly what it is, what its purpose is, and how it functions within the broader system. My mind immediately goes to its core responsibilities – it's clearly related to memory allocation, but the "null" part suggests a very specific, perhaps even critical, role. I'm thinking about the edge cases, the scenarios where standard allocation mechanisms might fail or be undesirable, and how `null_alloc_dev` steps in. Is it a fallback? A placeholder? Does it represent an inability to allocate, or a deliberate choice *not* to? I'm picturing the internal mechanics: how does it interact with the kernel's memory management subsystem? What are the implications of using it – performance, safety, resource consumption? I'll be looking for its API, its typical call sites, and the expected behavior when it's invoked. Essentially, I'm trying to build a comprehensive mental model of `null_alloc_dev`'s place and function, from the most abstract conceptual level down to its concrete implementation details, so I can fully appreciate its significance and any potential ramifications of its existence.
|
| 40/2 |
2026/08/13 22:06 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/null_blk/main.c Name:null_alloc_dev]
Results: map[SourceCode: 777: static struct nullb_device *null_alloc_dev(void)
778: {
779: struct nullb_device *dev;
780:
781: dev = kzalloc_obj(*dev);
782: if (!dev)
783: return NULL;
784:
785: #ifdef CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION
786: dev->timeout_config.attr = null_timeout_attr;
787: dev->requeue_config.attr = null_requeue_attr;
788: dev->init_hctx_fault_config.attr = null_init_hctx_attr;
789: #endif
790:
791: INIT_RADIX_TREE(&dev->data, GFP_ATOMIC);
792: INIT_RADIX_TREE(&dev->cache, GFP_ATOMIC);
793: if (badblocks_init(&dev->badblocks, 0)) {
794: kfree(dev);
795: return NULL;
796: }
797:
798: dev->size = g_gb * 1024;
799: dev->completion_nsec = g_completion_nsec;
800: dev->submit_queues = g_submit_queues;
801: dev->prev_submit_queues = g_submit_queues;
802: dev->poll_queues = g_poll_queues;
803: dev->prev_poll_queues = g_poll_queues;
804: dev->home_node = g_home_node;
805: dev->queue_mode = g_queue_mode;
806: dev->blocksize = g_bs;
807: dev->max_sectors = g_max_sectors;
808: dev->irqmode = g_irqmode;
809: dev->hw_queue_depth = g_hw_queue_depth;
810: dev->blocking = g_blocking;
811: dev->memory_backed = g_memory_backed;
812: dev->discard = g_discard;
813: dev->cache_size = g_cache_size;
814: dev->mbps = g_mbps;
815: dev->use_per_node_hctx = g_use_per_node_hctx;
816: dev->zoned = g_zoned;
817: dev->zone_size = g_zone_size;
818: dev->zone_capacity = g_zone_capacity;
819: dev->zone_nr_conv = g_zone_nr_conv;
820: dev->zone_max_open = g_zone_max_open;
821: dev->zone_max_active = g_zone_max_active;
822: dev->zone_append_max_sectors = g_zone_append_max_sectors;
823: dev->zone_full = g_zone_full;
824: dev->virt_boundary = g_virt_boundary;
825: dev->no_sched = g_no_sched;
826: dev->shared_tags = g_shared_tags;
827: dev->shared_tag_bitmap = g_shared_tag_bitmap;
828: dev->fua = g_fua;
829: dev->rotational = g_rotational;
830:
831: return dev;
832: }
SourceFile:drivers/block/null_blk/main.c]
|
| 41/2 |
2026/08/13 22:06 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 20251
output: 33
thoughts: 29
Thoughts: **My Thought Process:**
My initial line of inquiry is to understand the genesis of `dev->shared_tags`. I note that it's explicitly initialized with the value of `g_shared_tags`. This immediately raises a follow-up question in my mind: what precisely *is* `g_shared_tags`? I need to delve into its definition and purpose to fully grasp the implications of this assignment.
|
| 42/2 |
2026/08/13 22:06 |
tool |
grepper |
0m
Args: map[Expression:g_shared_tags PathPrefix:drivers/block/null_blk/]
Results: map[Output:drivers/block/null_blk/main.c=178=MODULE_PARM_DESC(blocking, "Register as a blocking blk-mq driver device");
drivers/block/null_blk/main.c-179-
drivers/block/null_blk/main.c:180:static bool g_shared_tags;
drivers/block/null_blk/main.c:181:module_param_named(shared_tags, g_shared_tags, bool, 0444);
drivers/block/null_blk/main.c-182-MODULE_PARM_DESC(shared_tags, "Share tag set between devices for blk-mq");
--
drivers/block/null_blk/main.c=777=static struct nullb_device *null_alloc_dev(void)
--
drivers/block/null_blk/main.c-825- dev->no_sched = g_no_sched;
drivers/block/null_blk/main.c:826: dev->shared_tags = g_shared_tags;
drivers/block/null_blk/main.c-827- dev->shared_tag_bitmap = g_shared_tag_bitmap;
]
|
| 43/2 |
2026/08/13 22:06 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 20600
output: 40
thoughts: 174
Thoughts: **My Thought Process Regarding `dev->shared_tags` and Tag Set Flags**
Okay, so my initial observation is that `dev->shared_tags` defaults to `false`. This immediately tells me that if this remains `false`, the `null_setup_tagset` function will utilize `nullb->__tag_set` and not the global tag set.
Now, I'm digging a bit deeper into what happens when `null_setup_tagset` uses `nullb->__tag_set`. I see this block of code:
```c
if (nullb->dev->blocking)
nullb->tag_set->flags |= BLK_MQ_F_BLOCKING;
```
This is a crucial point. It means that if `nullb->dev->blocking` is true, the `BLK_MQ_F_BLOCKING` flag *should* be set on the tag set. And that brings me to the next step in my reasoning: when *is* `nullb->dev->blocking` set to true?
I'm recalling (or checking) that `nullb->dev->blocking` is indeed set to `true` within the `null_validate_conf` function, specifically when `dev->memory_backed` is true.
Therefore, based on this chain of logic, if `dev->memory_backed` is true, then `nullb->dev->blocking` will become true, which in turn *should* lead to `BLK_MQ_F_BLOCKING` being set on the tag set, even if `dev->shared_tags` is false.
I need to re-verify `null_validate_conf` to ensure my understanding of that specific condition is accurate and that this flow is indeed what's happening.
|
| 44/2 |
2026/08/13 22:06 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/null_blk/main.c Name:null_validate_conf]
Results: map[SourceCode:1885: static int null_validate_conf(struct nullb_device *dev)
1886: {
1887: if (dev->queue_mode == NULL_Q_RQ) {
1888: pr_err("legacy IO path is no longer available\n");
1889: return -EINVAL;
1890: }
1891: if (dev->queue_mode == NULL_Q_BIO) {
1892: pr_err("BIO-based IO path is no longer available, using blk-mq instead.\n");
1893: dev->queue_mode = NULL_Q_MQ;
1894: }
1895:
1896: if (dev->use_per_node_hctx) {
1897: if (dev->submit_queues != nr_online_nodes)
1898: dev->submit_queues = nr_online_nodes;
1899: } else if (dev->submit_queues > nr_cpu_ids)
1900: dev->submit_queues = nr_cpu_ids;
1901: else if (dev->submit_queues == 0)
1902: dev->submit_queues = 1;
1903: dev->prev_submit_queues = dev->submit_queues;
1904:
1905: if (dev->poll_queues > g_poll_queues)
1906: dev->poll_queues = g_poll_queues;
1907: dev->prev_poll_queues = dev->poll_queues;
1908: dev->irqmode = min_t(unsigned int, dev->irqmode, NULL_IRQ_TIMER);
1909:
1910: /* Do memory allocation, so set blocking */
1911: if (dev->memory_backed)
1912: dev->blocking = true;
1913: else /* cache is meaningless */
1914: dev->cache_size = 0;
1915: dev->cache_size = min_t(unsigned long, ULONG_MAX / 1024 / 1024,
1916: dev->cache_size);
1917: dev->mbps = min_t(unsigned int, 1024 * 40, dev->mbps);
1918:
1919: if (dev->zoned &&
1920: (!dev->zone_size || !is_power_of_2(dev->zone_size))) {
1921: pr_err("zone_size must be power-of-two\n");
1922: return -EINVAL;
1923: }
1924:
1925: return 0;
1926: }
SourceFile:drivers/block/null_blk/main.c]
|
| 45/2 |
2026/08/13 22:06 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 21566
output: 38
thoughts: 386
Thoughts: **The Curious Case of Blocking Calls in RCU Contexts**
My thought process began with a moment of dissonance. I was reviewing the `BLK_MQ_F_BLOCKING` flag and its implication within `__blk_mq_run_dispatch_ops`. My understanding was that `srcu_read_lock` was employed there, and it was qualified by `might_sleep_if(check_sleep)`. This suggests a potential for sleeping, but under specific, controlled conditions.
However, this intuition was immediately challenged by a bug report I was examining. The report clearly stated: "BUG: sleeping function called from invalid context at kernel/locking/mutex.c:623". The context details were quite specific: `in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 19399, name: syz.6.4428`, `preempt_count: 0, expected: 0`, and crucially, `RCU nest depth: 1, expected: 0`. The list of locks held further cemented this suspicion, showing a held `rcu_read_lock` at `blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208`.
This raised a flag. If `__blk_mq_run_dispatch_ops` *uses* `srcu_read_lock` and might sleep, and the bug report points to a sleeping call within an invalid RCU context at `blk_mq_submit_bio`, then something isn't quite adding up. The crucial insight then struck me: the bug report explicitly mentions `rcu_read_lock` being taken *directly* at `blk_mq_submit_bio` around line 3208. This suggests that the issue might not be within the `__blk_mq_run_dispatch_ops` function itself, but rather in how `blk_mq_submit_bio` is interacting with RCU locks and potentially making sleeping calls under circumstances where it shouldn't be. My next step, therefore, was to dive back into the `blk_mq_submit_bio` code, focusing precisely on that section around line 3208, to understand the exact sequence of operations and the conditions under which this problematic RCU lock acquisition occurs.
|
| 46/2 |
2026/08/13 22:06 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:block/blk-mq.c Name:blk_mq_submit_bio]
Results: map[SourceCode:3080: /**
3081: * blk_mq_submit_bio - Create and send a request to block device.
3082: * @bio: Bio pointer.
3083: *
3084: * Builds up a request structure from @q and @bio and send to the device. The
3085: * request may not be queued directly to hardware if:
3086: * * This request can be merged with another one
3087: * * We want to place request at plug queue for possible future merging
3088: * * There is an IO scheduler active at this queue
3089: *
3090: * It will not queue the request if there is an error with the bio, or at the
3091: * request creation.
3092: */
3093: void blk_mq_submit_bio(struct bio *bio)
3094: {
3095: struct request_queue *q = bdev_get_queue(bio->bi_bdev);
3096: struct blk_plug *plug = current->plug;
3097: const int is_sync = op_is_sync(bio->bi_opf);
3098: unsigned int integrity_action;
3099: struct blk_mq_hw_ctx *hctx;
3100: unsigned int nr_segs;
3101: struct request *rq;
3102: blk_status_t ret;
3103:
3104: /*
3105: * If the plug has a cached request for this queue, try to use it.
3106: */
3107: rq = blk_mq_get_cached_request(plug, q, bio->bi_opf);
3108:
3109: /*
3110: * A BIO that was released from a zone write plug has already been
3111: * through the preparation in this function, already holds a reference
3112: * on the queue usage counter, and is the only write BIO in-flight for
3113: * the target zone. Go straight to preparing a request for it.
3114: */
3115: if (bio_zone_write_plugging(bio)) {
3116: nr_segs = bio->__bi_nr_segments;
3117: if (rq)
3118: blk_queue_exit(q);
3119: goto new_request;
3120: }
3121:
3122: /*
3123: * The cached request already holds a q_usage_counter reference and we
3124: * don't have to acquire a new one if we use it.
3125: */
3126: if (!rq) {
3127: if (unlikely(bio_queue_enter(bio)))
3128: return;
3129: }
3130:
3131: /*
3132: * Device reconfiguration may change logical block size or reduce the
3133: * number of poll queues, so the checks for alignment and poll support
3134: * have to be done with queue usage counter held.
3135: */
3136: if (unlikely(bio_unaligned(bio, q))) {
3137: bio_io_error(bio);
3138: goto queue_exit;
3139: }
3140:
3141: if ((bio->bi_opf & REQ_POLLED) && !blk_mq_can_poll(q)) {
3142: bio_endio_status(bio, BLK_STS_NOTSUPP);
3143: goto queue_exit;
3144: }
3145:
3146: bio = __bio_split_to_limits(bio, &q->limits, &nr_segs);
3147: if (!bio)
3148: goto queue_exit;
3149:
3150: integrity_action = bio_integrity_action(bio);
3151: if (integrity_action)
3152: bio_integrity_prep(bio, integrity_action);
3153:
3154: blk_mq_bio_issue_init(q, bio);
3155: if (blk_mq_attempt_bio_merge(q, bio, nr_segs))
3156: goto queue_exit;
3157:
3158: if (bio_needs_zone_write_plugging(bio)) {
3159: if (blk_zone_plug_bio(bio, nr_segs))
3160: goto queue_exit;
3161: }
3162:
3163: new_request:
3164: if (rq) {
3165: rq_qos_throttle(rq->q, bio);
3166: blk_mq_rq_time_init(rq, blk_time_get_ns());
3167: rq->cmd_flags = bio->bi_opf;
3168: INIT_LIST_HEAD(&rq->queuelist);
3169: } else {
3170: rq = blk_mq_get_new_requests(q, plug, bio);
3171: if (unlikely(!rq)) {
3172: if (bio->bi_opf & REQ_NOWAIT)
3173: bio_wouldblock_error(bio);
3174: goto queue_exit;
3175: }
3176: }
3177:
3178: trace_block_getrq(bio);
3179:
3180: rq_qos_track(q, rq, bio);
3181:
3182: blk_mq_bio_to_request(rq, bio, nr_segs);
3183:
3184: ret = blk_crypto_rq_get_keyslot(rq);
3185: if (ret != BLK_STS_OK) {
3186: bio_endio_status(bio, ret);
3187: blk_mq_free_request(rq);
3188: return;
3189: }
3190:
3191: if (bio_zone_write_plugging(bio))
3192: blk_zone_write_plug_init_request(rq);
3193:
3194: if (op_is_flush(bio->bi_opf) && blk_insert_flush(rq))
3195: return;
3196:
3197: if (plug) {
3198: blk_add_rq_to_plug(plug, rq);
3199: return;
3200: }
3201:
3202: hctx = rq->mq_hctx;
3203: if ((rq->rq_flags & RQF_USE_SCHED) ||
3204: (hctx->dispatch_busy && (q->nr_hw_queues == 1 || !is_sync))) {
3205: blk_mq_insert_request(rq, 0);
3206: blk_mq_run_hw_queue(hctx, true);
3207: } else {
3208: blk_mq_run_dispatch_ops(q, blk_mq_try_issue_directly(hctx, rq));
3209: }
3210: return;
3211:
3212: queue_exit:
3213: if (!rq)
3214: blk_queue_exit(q);
3215: else
3216: rq_list_add_head(&plug->cached_rqs, rq);
3217: }
SourceFile:block/blk-mq.c]
|
| 47/2 |
2026/08/13 22:06 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 24092
output: 41
thoughts: 201
Thoughts: **My Thought Process Unpacking the `blk_mq_run_dispatch_ops` Call**
Right, so I'm staring at this critical line: `blk_mq_run_dispatch_ops(q, blk_mq_try_issue_directly(hctx, rq));`. My immediate focus is on how this dispatch operation will behave, specifically its synchronization characteristics. The documentation, or my prior understanding, tells me that if the `BLK_MQ_F_BLOCKING` flag is *not* set on the tag set associated with the queue `q`, then `blk_mq_run_dispatch_ops` will acquire an `rcu_read_lock()`. This implies a non-blocking, read-side critical section for the dispatch.
Now, I need to determine if `BLK_MQ_F_BLOCKING` is actually set. My initial reasoning was based on the fact that `dev->shared_tags` is false. This led me to believe we're using `nullb->__tag_set`. Looking at the logic within `null_setup_tagset`, it explicitly sets `nullb->tag_set->flags |= BLK_MQ_F_BLOCKING;` *if* `nullb->dev->blocking` is true.
This is where I have to pause and backtrack. My initial assumption that `BLK_MQ_F_BLOCKING` would *not* be set, based on `dev->shared_tags` being false, seems to have been too simplistic. The actual condition for setting `BLK_MQ_F_BLOCKING` is `nullb->dev->blocking`.
So, my corrected thought process is: if `nullb->dev->blocking` is true, then `BLK_MQ_F_BLOCKING` *will* be set. This, in turn, means that `blk_mq_run_dispatch_ops` will *not* be using `rcu_read_lock()`, and therefore will not be executing within that specific read-side critical section. The behavior will be different, and I need to re-evaluate the implications of that. I must go back and carefully re-examine the `null_setup_tagset` function to ensure I'm not missing any other nuances that might influence this flag.
|
| 48/2 |
2026/08/13 22:06 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/null_blk/main.c Name:null_setup_tagset]
Results: map[SourceCode:1864: static int null_setup_tagset(struct nullb *nullb)
1865: {
1866: if (nullb->dev->shared_tags) {
1867: nullb->tag_set = &tag_set;
1868: return null_init_global_tag_set();
1869: }
1870:
1871: nullb->tag_set = &nullb->__tag_set;
1872: nullb->tag_set->driver_data = nullb;
1873: nullb->tag_set->nr_hw_queues = nullb->dev->submit_queues;
1874: nullb->tag_set->queue_depth = nullb->dev->hw_queue_depth;
1875: nullb->tag_set->numa_node = nullb->dev->home_node;
1876: if (nullb->dev->no_sched)
1877: nullb->tag_set->flags |= BLK_MQ_F_NO_SCHED_BY_DEFAULT;
1878: if (nullb->dev->shared_tag_bitmap)
1879: nullb->tag_set->flags |= BLK_MQ_F_TAG_HCTX_SHARED;
1880: if (nullb->dev->blocking)
1881: nullb->tag_set->flags |= BLK_MQ_F_BLOCKING;
1882: return null_init_tag_set(nullb->tag_set, nullb->dev->poll_queues);
1883: }
SourceFile:drivers/block/null_blk/main.c]
|
| 49/2 |
2026/08/13 22:06 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 24764
output: 41
thoughts: 346
Thoughts: **The RCU/SRCU Mismatch in Bio Submission**
My train of thought here is focused on a discrepancy I'm observing in the locking mechanism used during bio submission, specifically within the block layer's multi-queue (blk-mq) infrastructure.
Initially, I'm analyzing the logic based on the `shared_tags` flag. If `shared_tags` is `false`, I've established that the code will utilize `nullb->__tag_set`. Following this, it appears that the `BLK_MQ_F_BLOCKING` flag should be set if the underlying device, `nullb->dev`, is marked as `blocking`. My understanding is further reinforced by the `null_validate_conf` function, which explicitly sets `dev->blocking = true` when `dev->memory_backed` is true. Therefore, the logical conclusion is that `BLK_MQ_F_BLOCKING` *ought* to be set in this scenario.
However, this is where the divergence occurs and my debugging process kicks in. If `BLK_MQ_F_BLOCKING` *is* indeed set, my expectation is that the `__blk_mq_run_dispatch_ops` function will employ `srcu_read_lock` for its read-side synchronization. This is based on my knowledge of the block layer's locking conventions for blocking requests.
The critical point of confusion arises when I examine the provided stack trace. It clearly shows `rcu_read_lock` being invoked at the point where I expect `srcu_read_lock` to be used (specifically within `blk_mq_submit_bio`). This is a significant deviation from the expected behavior.
My immediate next step is to revisit the `__blk_mq_run_dispatch_ops` function in detail. I need to scrutinize its implementation to understand why, under the conditions I've deduced that should lead to `BLK_MQ_F_BLOCKING` being set, it's opting for `rcu_read_lock` instead of the anticipated `srcu_read_lock`. There must be a subtle condition or a different path within that function that's being triggered, leading to this unexpected locking choice.
|
| 50/2 |
2026/08/13 22:06 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:block/blk-mq.h Name:__blk_mq_run_dispatch_ops]
Results: map[SourceCode: SourceFile:]
|
| 51/2 |
2026/08/13 22:06 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 25156
output: 35
thoughts: 21
Thoughts: **My Thought Process for Navigating the `blk-mq.h` File**
I need to re-examine the code in `blk/blk-mq.h`, specifically around line 440. My current line of thinking is that there's something within that particular section that warrants a closer look. I'm not entirely sure what I'm looking for just yet, but I have a strong intuition that the functionality or logic residing there is crucial to the problem I'm trying to solve. Perhaps it's a data structure definition, a critical function pointer, or a complex conditional block that I might have overlooked or misunderstood previously. This isn't a random browse; it's a targeted investigation driven by a specific, albeit not fully articulated, hypothesis that something important is happening at that precise location in the code. I expect to find some key piece of information that will either confirm or refute my current understanding, and hopefully, point me towards a solution or a deeper insight into the block layer's multi-queue handling.
|
| 52/2 |
2026/08/13 22:06 |
tool |
read-file |
0m
Args: map[File:block/blk-mq.h FirstLine:430 LineCount:40]
Results: map[Contents: 430:
431: /*
432: * Allow at least some tags
433: */
434: depth = max((bt->sb.depth + users - 1) / users, 4U);
435: return __blk_mq_active_requests(hctx) < depth;
436: }
437:
438: /* run the code block in @dispatch_ops with rcu/srcu read lock held */
439: #define __blk_mq_run_dispatch_ops(q, check_sleep, dispatch_ops) \
440: do { \
441: if ((q)->tag_set->flags & BLK_MQ_F_BLOCKING) { \
442: struct blk_mq_tag_set *__tag_set = (q)->tag_set; \
443: int srcu_idx; \
444: \
445: might_sleep_if(check_sleep); \
446: srcu_idx = srcu_read_lock(__tag_set->srcu); \
447: (dispatch_ops); \
448: srcu_read_unlock(__tag_set->srcu, srcu_idx); \
449: } else { \
450: rcu_read_lock(); \
451: (dispatch_ops); \
452: rcu_read_unlock(); \
453: } \
454: } while (0)
455:
456: #define blk_mq_run_dispatch_ops(q, dispatch_ops) \
457: __blk_mq_run_dispatch_ops(q, true, dispatch_ops) \
458:
459: static inline bool blk_mq_can_poll(struct request_queue *q)
460: {
461: return (q->limits.features & BLK_FEAT_POLL) &&
462: q->tag_set->map[HCTX_TYPE_POLL].nr_queues;
463: }
464:
465: #endif
]
|
| 53/2 |
2026/08/13 22:06 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 25815
output: 31
thoughts: 206
Thoughts: **My Thought Process Regarding Block MQ Tag Allocation**
So, I've been digging into this block multi-queue (MQ) tag allocation logic. My immediate observation is that if the `BLK_MQ_F_BLOCKING` flag isn't set on the `tag_set`, the code opts for an `rcu_read_lock()`. This tells me that `BLK_MQ_F_BLOCKING` *must* be false in this specific scenario.
Now, the burning question is *why* is it false? My next step is to investigate the `shared_tags` setting. I recall that if `shared_tags` is true, the system defaults to using the global `tag_set`. Then, I remember that `null_init_global_tag_set` is responsible for initializing this global set, and it uses a variable called `g_blocking` for its configuration. If `g_blocking` happens to be false, it logically follows that the `BLK_MQ_F_BLOCKING` flag won't be set on this global `tag_set`.
However, there's a crucial detail I need to keep in mind: by default, `dev->shared_tags` is derived from `g_shared_tags`, which itself defaults to `false`. This brings me to a potentially significant point: could syzkaller be interfering here? Is it possible that syzkaller is explicitly setting `shared_tags=1` through its configuration, perhaps via configfs? This leads me to my final line of inquiry: I need to verify whether `shared_tags` is even exposed and controllable through the configfs interface. If it is, then syzkaller could indeed be manipulating it, leading to the observed behavior.
|
| 54/2 |
2026/08/13 22:06 |
tool |
grepper |
0m
Args: map[Expression:shared_tags PathPrefix:drivers/block/null_blk/]
Results: map[Output:drivers/block/null_blk/main.c=178=MODULE_PARM_DESC(blocking, "Register as a blocking blk-mq driver device");
drivers/block/null_blk/main.c-179-
drivers/block/null_blk/main.c:180:static bool g_shared_tags;
drivers/block/null_blk/main.c:181:module_param_named(shared_tags, g_shared_tags, bool, 0444);
drivers/block/null_blk/main.c:182:MODULE_PARM_DESC(shared_tags, "Share tag set between devices for blk-mq");
drivers/block/null_blk/main.c-183-
--
drivers/block/null_blk/main.c=471=NULLB_DEVICE_ATTR(no_sched, bool, NULL);
drivers/block/null_blk/main.c:472:NULLB_DEVICE_ATTR(shared_tags, bool, NULL);
drivers/block/null_blk/main.c-473-NULLB_DEVICE_ATTR(shared_tag_bitmap, bool, NULL);
--
drivers/block/null_blk/main.c=596=static struct configfs_attribute *nullb_device_attrs[] = {
--
drivers/block/null_blk/main.c-618- &nullb_device_attr_shared_tag_bitmap,
drivers/block/null_blk/main.c:619: &nullb_device_attr_shared_tags,
drivers/block/null_blk/main.c-620- &nullb_device_attr_size,
--
drivers/block/null_blk/main.c=777=static struct nullb_device *null_alloc_dev(void)
--
drivers/block/null_blk/main.c-825- dev->no_sched = g_no_sched;
drivers/block/null_blk/main.c:826: dev->shared_tags = g_shared_tags;
drivers/block/null_blk/main.c-827- dev->shared_tag_bitmap = g_shared_tag_bitmap;
--
drivers/block/null_blk/main.c=1864=static int null_setup_tagset(struct nullb *nullb)
drivers/block/null_blk/main.c-1865-{
drivers/block/null_blk/main.c:1866: if (nullb->dev->shared_tags) {
drivers/block/null_blk/main.c-1867- nullb->tag_set = &tag_set;
--
drivers/block/null_blk/null_blk.h=53=struct nullb_device {
--
drivers/block/null_blk/null_blk.h-108- bool no_sched; /* no IO scheduler for the device */
drivers/block/null_blk/null_blk.h:109: bool shared_tags; /* share tag set between devices for blk-mq */
drivers/block/null_blk/null_blk.h-110- bool shared_tag_bitmap; /* use hostwide shared tags */
]
|
| 55/2 |
2026/08/13 22:06 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 26831
output: 40
thoughts: 227
Thoughts: **My Thought Process Unraveling a Configuration Nuance**
Ah, excellent! It appears the `shared_tags` parameter is indeed exposed through configfs. This is a crucial piece of information that leads me to a particular scenario.
So, imagine `syzkaller` comes along and crafts a device. It configures this device with both `memory_backed=1` and, importantly, `shared_tags=1`. Under these specific conditions, my understanding is that `dev->blocking` will be set to `true`. However, the `null_setup_tagset` function, when operating in this context, relies on the global `tag_set`. The hitch here is that this global `tag_set` *does not* have the `BLK_MQ_F_BLOCKING` flag set. Why? Because the global `g_blocking` variable is currently `false`. This seems like a potential inconsistency or at least something worth noting.
But then a thought strikes me: is this the *only* way this behavior can manifest? I need to explore other possibilities. What if `shared_tags` is actually set to `false`?
Let's trace that path. If `shared_tags` is `false`, then `null_setup_tagset` will instead use the `nullb->__tag_set`. Now, within that function, there's this conditional logic:
```c
if (nullb->dev->blocking)
nullb->tag_set->flags |= BLK_MQ_F_BLOCKING;
```
This is interesting! In this case, if `nullb->dev->blocking` is true, then `BLK_MQ_F_BLOCKING` *will* be set on the `nullb->tag_set`. This seems to offer a different outcome regarding the flag.
However, a critical timing question arises immediately: is `null_setup_tagset` being invoked *before* `null_validate_conf`? The order of these operations is paramount. I need to go back and examine the `null_add_dev` function to confirm the precise execution flow and dependencies. This will be key to understanding the overall behavior and any potential race conditions or configuration dependencies.
|
| 56/2 |
2026/08/13 22:07 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/null_blk/main.c Name:null_add_dev]
Results: map[SourceCode:1955: static int null_add_dev(struct nullb_device *dev)
1956: {
1957: struct queue_limits lim = {
1958: .logical_block_size = dev->blocksize,
1959: .physical_block_size = dev->blocksize,
1960: .max_hw_sectors = dev->max_sectors,
1961: .dma_alignment = 1,
1962: };
1963:
1964: struct nullb *nullb;
1965: int rv;
1966:
1967: rv = null_validate_conf(dev);
1968: if (rv)
1969: return rv;
1970:
1971: nullb = kzalloc_node(sizeof(*nullb), GFP_KERNEL, dev->home_node);
1972: if (!nullb) {
1973: rv = -ENOMEM;
1974: goto out;
1975: }
1976: nullb->dev = dev;
1977: dev->nullb = nullb;
1978:
1979: spin_lock_init(&nullb->lock);
1980:
1981: rv = setup_queues(nullb);
1982: if (rv)
1983: goto out_free_nullb;
1984:
1985: rv = null_setup_tagset(nullb);
1986: if (rv)
1987: goto out_cleanup_queues;
1988:
1989: if (dev->virt_boundary)
1990: lim.virt_boundary_mask = PAGE_SIZE - 1;
1991: null_config_discard(nullb, &lim);
1992: if (dev->zoned) {
1993: rv = null_init_zoned_dev(dev, &lim);
1994: if (rv)
1995: goto out_cleanup_tags;
1996: }
1997:
1998: if (dev->cache_size > 0) {
1999: set_bit(NULLB_DEV_FL_CACHE, &nullb->dev->flags);
2000: lim.features |= BLK_FEAT_WRITE_CACHE;
2001: if (dev->fua)
2002: lim.features |= BLK_FEAT_FUA;
2003: }
2004:
2005: if (dev->rotational)
2006: lim.features |= BLK_FEAT_ROTATIONAL;
2007:
2008: nullb->disk = blk_mq_alloc_disk(nullb->tag_set, &lim, nullb);
2009: if (IS_ERR(nullb->disk)) {
2010: rv = PTR_ERR(nullb->disk);
2011: goto out_cleanup_zone;
2012: }
2013: nullb->q = nullb->disk->queue;
2014:
2015: if (dev->mbps) {
2016: set_bit(NULLB_DEV_FL_THROTTLED, &dev->flags);
2017: nullb_setup_bwtimer(nullb);
2018: }
2019:
2020: nullb->q->queuedata = nullb;
2021:
2022: rv = ida_alloc(&nullb_indexes, GFP_KERNEL);
2023: if (rv < 0)
2024: goto out_cleanup_disk;
2025:
2026: nullb->index = rv;
2027: dev->index = rv;
2028:
2029: if (config_item_name(&dev->group.cg_item)) {
2030: /* Use configfs dir name as the device name */
2031: snprintf(nullb->disk_name, sizeof(nullb->disk_name),
2032: "%s", config_item_name(&dev->group.cg_item));
2033: } else {
2034: sprintf(nullb->disk_name, "nullb%d", nullb->index);
2035: }
2036:
2037: set_capacity(nullb->disk,
2038: ((sector_t)nullb->dev->size * SZ_1M) >> SECTOR_SHIFT);
2039: nullb->disk->major = null_major;
2040: nullb->disk->first_minor = nullb->index;
2041: nullb->disk->minors = 1;
2042: nullb->disk->fops = &null_ops;
2043: nullb->disk->private_data = nullb;
2044: strscpy(nullb->disk->disk_name, nullb->disk_name);
2045:
2046: if (nullb->dev->zoned) {
2047: rv = null_register_zoned_dev(nullb);
2048: if (rv)
2049: goto out_ida_free;
2050: }
2051:
2052: rv = add_disk(nullb->disk);
2053: if (rv)
2054: goto out_ida_free;
2055:
2056: list_add_tail(&nullb->list, &nullb_list);
2057:
2058: pr_info("disk %s created\n", nullb->disk_name);
2059:
2060: return 0;
2061:
2062: out_ida_free:
2063: ida_free(&nullb_indexes, nullb->index);
2064: out_cleanup_disk:
2065: put_disk(nullb->disk);
2066: out_cleanup_zone:
2067: null_free_zoned_dev(dev);
2068: out_cleanup_tags:
2069: if (nullb->tag_set == &nullb->__tag_set)
2070: blk_mq_free_tag_set(nullb->tag_set);
2071: out_cleanup_queues:
2072: kfree(nullb->queues);
2073: out_free_nullb:
2074: kfree(nullb);
2075: dev->nullb = NULL;
2076: out:
2077: return rv;
2078: }
SourceFile:drivers/block/null_blk/main.c]
|
| 57/2 |
2026/08/13 22:07 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 28946
output: 42
thoughts: 2328
Thoughts: **A Deep Dive into a Sleeping Function Bug in the Null Block Device Driver**
I've been tracing an interesting bug that manifests as a "sleeping function called from invalid context" warning within the null block device driver. The core of the issue seems to lie in the interaction between how tag sets are initialized and the context in which I'm submitting requests.
My investigation started by observing the order of operations: `null_validate_conf` is called before `null_setup_tagset`. This means that if I'm creating a `memory_backed` device, `dev->blocking` is set to `true` early on.
Then, `null_setup_tagset` is invoked. Its behavior diverges based on the `dev->shared_tags` flag.
* If `dev->shared_tags` is `false`, it directly sets the `BLK_MQ_F_BLOCKING` flag on the device's tag set. This seems straightforward and would allow sleeping operations.
* However, if `dev->shared_tags` is `true`, it calls `null_init_global_tag_set()`. This function, in turn, relies on the module parameter `g_blocking`. Crucially, `g_blocking` defaults to `false`. Therefore, if I create a device with both `memory_backed=1` and `shared_tags=1`, the `BLK_MQ_F_BLOCKING` flag is *not* set on the global tag set.
This absence of `BLK_MQ_F_BLOCKING` is the linchpin. When `__blk_mq_run_dispatch_ops` is called in this scenario, it falls into the `else` branch. This branch uses `rcu_read_lock()` before calling `null_queue_rq`.
The problem arises because `null_queue_rq` eventually leads to `null_handle_cmd` -> `null_process_zoned_cmd` -> `null_lock_zone`. And because `dev->memory_backed` is `true`, `null_lock_zone` attempts to acquire a `mutex_lock`. Sleeping inside an RCU read lock section (which is what `rcu_read_lock()` implies for `might_sleep()`) is precisely what triggers the "sleeping function called from invalid context" BUG.
I've double-checked the logic for `null_setup_tagset` and `null_init_global_tag_set()`. The former correctly delegates to the latter when `shared_tags` is true, and `null_init_global_tag_set()` unequivocally uses `g_blocking` to set the `BLK_MQ_F_BLOCKING` flag. Since `g_blocking` defaults to false, this path often leads to the flag being unset.
I also considered other scenarios. If `shared_tags` were `false`, then `null_setup_tagset` would directly set `BLK_MQ_F_BLOCKING` due to `dev->blocking` being true (because `memory_backed=1`). So, the bug *specifically* occurs when `shared_tags=1`, `memory_backed=1`, and `zoned=1` (which leads to `null_process_zoned_cmd`).
The critical insight is that `BLK_MQ_F_BLOCKING` dictates the locking mechanism: if set, it uses SRCU (which allows sleeping); if not set, it falls back to RCU read locks (which do not). My bug happens precisely when the fallback to RCU read locks occurs, leading to the conflict with `mutex_lock`.
Therefore, the exact reproduction path I've identified is: creating a null_blk device via configfs, setting `zoned=1`, `memory_backed=1`, `shared_tags=1`, and `power=1`. This sequence ensures that `BLK_MQ_F_BLOCKING` is not set, forcing the RCU read lock path, which then conflicts with the mutex acquisition in `null_lock_zone`. It's interesting to note that this could also happen if the module was loaded with these parameters without using configfs, but configfs provides a cleaner, reproducible method. The potential for syzkaller to trigger this is also high, as it frequently manipulates configfs attributes, including `shared_tags`.
|
| 58/2 |
2026/08/13 22:07 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/null_blk/zoned.c Name:null_process_zoned_cmd]
Results: map[SourceCode: 708: blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd, enum req_op op,
709: sector_t sector, sector_t nr_sectors)
710: {
711: struct nullb_device *dev;
712: struct nullb_zone *zone;
713: blk_status_t sts;
714:
715: switch (op) {
716: case REQ_OP_WRITE:
717: return null_zone_write(cmd, sector, nr_sectors, false);
718: case REQ_OP_ZONE_APPEND:
719: return null_zone_write(cmd, sector, nr_sectors, true);
720: case REQ_OP_ZONE_RESET:
721: case REQ_OP_ZONE_RESET_ALL:
722: case REQ_OP_ZONE_OPEN:
723: case REQ_OP_ZONE_CLOSE:
724: case REQ_OP_ZONE_FINISH:
725: return null_zone_mgmt(cmd, op, sector);
726: default:
727: dev = cmd->nq->dev;
728: zone = &dev->zones[null_zone_no(dev, sector)];
729: if (zone->cond == BLK_ZONE_COND_OFFLINE)
730: return BLK_STS_IOERR;
731:
732: null_lock_zone(dev, zone);
733: sts = null_process_cmd(cmd, op, sector, nr_sectors);
734: null_unlock_zone(dev, zone);
735: return sts;
736: }
737: }
SourceFile:drivers/block/null_blk/zoned.c]
|
| 59/2 |
2026/08/13 22:07 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 31822
output: 40
thoughts: 393
Thoughts: **My Thought Process Regarding the `REQ_OP_READ` Locking Behavior**
Okay, so I'm digging into this `REQ_OP_READ` scenario, which is the default, and I see it directly invokes `null_lock_zone(dev, zone)`. My understanding is that `null_lock_zone` then proceeds to call `mutex_lock`, but *only* if `dev->memory_backed` is true. This is a critical dependency I'm keeping in mind.
Now, a crucial question pops into my head: what happens if `g_blocking` is true in this context? If `g_blocking` is indeed set to true, it influences the global tag set by enabling `BLK_MQ_F_BLOCKING`. This flag, in turn, allows for sleeping operations via `srcu_read_lock`. However, I know that `g_blocking` defaults to false, which means this sleep-allowing behavior isn't the typical path.
This brings me to what I believe is the core of the bug. The `dev->blocking` flag is being set to true by `null_validate_conf` because `memory_backed` is true. That part is expected. The problem arises in `null_setup_tagset`. This function appears to *ignore* the per-device `dev->blocking` setting if `dev->shared_tags` is true. Instead, it relies on the global `g_blocking`, which, as I noted, is usually false. This is a clear and problematic disconnect between the expected per-device blocking behavior and the actual global setting when `shared_tags` is enabled.
I'm trying to see if there are any other ways `BLK_MQ_F_BLOCKING` might be missed. What if `shared_tags` is false, but `dev->blocking` is explicitly set to false? If `dev->blocking` is false, `BLK_MQ_F_BLOCKING` wouldn't be set. However, my earlier check on `null_validate_conf` shows that it *forces* `dev->blocking` to be true if `dev->memory_backed` is true. So, if `shared_tags` is false, `dev->blocking` will be true, and `BLK_MQ_F_BLOCKING` *will* be set on `nullb->__tag_set`. Therefore, this specific bug scenario, where `BLK_MQ_F_BLOCKING` is missed, *only* seems to manifest when `shared_tags=1`.
I'm going back to re-verify `null_validate_conf` one more time to ensure I haven't missed any nuances there.
|
| 60/2 |
2026/08/13 22:07 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/null_blk/main.c Name:null_validate_conf]
Results: map[SourceCode:1885: static int null_validate_conf(struct nullb_device *dev)
1886: {
1887: if (dev->queue_mode == NULL_Q_RQ) {
1888: pr_err("legacy IO path is no longer available\n");
1889: return -EINVAL;
1890: }
1891: if (dev->queue_mode == NULL_Q_BIO) {
1892: pr_err("BIO-based IO path is no longer available, using blk-mq instead.\n");
1893: dev->queue_mode = NULL_Q_MQ;
1894: }
1895:
1896: if (dev->use_per_node_hctx) {
1897: if (dev->submit_queues != nr_online_nodes)
1898: dev->submit_queues = nr_online_nodes;
1899: } else if (dev->submit_queues > nr_cpu_ids)
1900: dev->submit_queues = nr_cpu_ids;
1901: else if (dev->submit_queues == 0)
1902: dev->submit_queues = 1;
1903: dev->prev_submit_queues = dev->submit_queues;
1904:
1905: if (dev->poll_queues > g_poll_queues)
1906: dev->poll_queues = g_poll_queues;
1907: dev->prev_poll_queues = dev->poll_queues;
1908: dev->irqmode = min_t(unsigned int, dev->irqmode, NULL_IRQ_TIMER);
1909:
1910: /* Do memory allocation, so set blocking */
1911: if (dev->memory_backed)
1912: dev->blocking = true;
1913: else /* cache is meaningless */
1914: dev->cache_size = 0;
1915: dev->cache_size = min_t(unsigned long, ULONG_MAX / 1024 / 1024,
1916: dev->cache_size);
1917: dev->mbps = min_t(unsigned int, 1024 * 40, dev->mbps);
1918:
1919: if (dev->zoned &&
1920: (!dev->zone_size || !is_power_of_2(dev->zone_size))) {
1921: pr_err("zone_size must be power-of-two\n");
1922: return -EINVAL;
1923: }
1924:
1925: return 0;
1926: }
SourceFile:drivers/block/null_blk/main.c]
|
| 61/2 |
2026/08/13 22:07 |
llm |
initial-researcher |
1m
Model:
Tokens:
input: 33007
output: 42
thoughts: 3339
Thoughts: **My Thought Process in Reproducing the `null_blk` Bug**
Alright, let's break down how I arrived at this conclusion about the `null_blk` bug. It's all about tracing the execution flow and understanding the dependencies between different configuration options.
First, I see the crucial line: `if (dev->memory_backed) dev->blocking = true;`. This immediately tells me that `memory_backed` being set has a direct impact on whether the device is forced into a blocking mode. This is a key piece of information.
Then, I laid out the steps to reproduce the bug, based on typical configfs interactions for devices like this. It's a standard pattern: mount configfs, create the device directory, and then write specific values to the device's attributes. I listed these as:
1. Mount configfs (if not already).
2. Create the device directory: `/sys/kernel/config/nullb/mydev`.
3. Set `zoned` to "1".
4. Set `memory_backed` to "1".
5. Set `shared_tags` to "1".
6. Set `power` to "1".
My next step was to check for any hidden dependencies or prerequisites. I wondered if `zoned` required `zone_size` to be set. I found that `dev->zone_size` defaults to `g_zone_size`, which is 256 MB. Since 256 is a power of two, `is_power_of_2(256)` is true, so it should pass `null_validate_conf` without issues. Good, no extra configuration needed there.
I also confirmed that `shared_tags` is indeed writable via configfs, as `NULLB_DEVICE_ATTR(shared_tags, bool, NULL)` is defined.
This led me to draft the C code that would perform these steps. It's straightforward: create the directory and then use a helper function `write_file` to write the necessary values to the attributes.
A quick thought popped up: "Is configfs mounted by default in syzkaller?" My knowledge base tells me yes, syzkaller typically mounts configfs at `/sys/kernel/config`. However, to be absolutely sure and to align with the bug report itself, which showed configfs paths, I double-checked the provided stack trace. Seeing those configfs paths confirmed that the issue is indeed triggered via configfs.
Now, the core of the problem lies in the interaction between `shared_tags` and the underlying locking mechanisms. I specifically looked at how `shared_tags=1` affects the tag set initialization. The code snippet `if (nullb->dev->shared_tags) { nullb->tag_set = &tag_set; return null_init_global_tag_set(); }` clearly shows that when `shared_tags` is enabled, the device uses the global `tag_set` and calls `null_init_global_tag_set()`.
Then, I examined `null_init_global_tag_set()`: `if (g_blocking) tag_set.flags |= BLK_MQ_F_BLOCKING;`. Here's the critical point: `g_blocking` is a module parameter that defaults to `false`. Therefore, `BLK_MQ_F_BLOCKING` is *not* set on the global `tag_set` by default.
What's the consequence of `BLK_MQ_F_BLOCKING` not being set? It means that `blk_mq_submit_bio` will use `rcu_read_lock` instead of `srcu_read_lock` when submitting I/O. This is where the race condition happens.
When `null_queue_rq` is called under this `rcu_read_lock`, and it subsequently calls `null_process_zoned_cmd`, which then calls `null_lock_zone`. Since `memory_backed=1` was set, `null_lock_zone` attempts to acquire a `mutex_lock`. Attempting to acquire a mutex while holding an RCU read lock is what triggers the BUG: `BUG: sleeping function called from invalid context`.
I also confirmed that the problem isn't related to other fields like `zone_size` being set to a non-power-of-two value, as the default 256MB is fine. I also verified that `shared_tags` is indeed a bool attribute configurable via configfs.
Finally, I reviewed the provided stack trace one last time to ensure my analysis perfectly matched the observed call chain. The trace showed `null_lock_zone` being called within the context of partition scanning, which submits a bio, leading to `blk_mq_submit_bio` and then `null_queue_rq` under an RCU read lock, all the way down to `null_lock_zone` attempting a `mutex_lock`. It was a perfect match.
This detailed analysis led me to confidently conclude that the specific combination of `memory_backed=1` and `shared_tags=1`, when triggered by an event like `power=1` (which initiates partition scanning), creates the race condition. The fix would likely involve ensuring proper blocking behavior for the tag set when devices demand it, or perhaps restricting the combination of features. My immediate goal, however, was to provide a reliable reproducer, which I had now constructed.
|
| 62/2 |
2026/08/13 22:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/block/null_blk/zoned.c Name:null_init_zoned_dev]
Results: map[SourceCode: 51: int null_init_zoned_dev(struct nullb_device *dev,
52: struct queue_limits *lim)
53: {
54: sector_t dev_capacity_sects, zone_capacity_sects;
55: struct nullb_zone *zone;
56: sector_t sector = 0;
57: unsigned int i;
58:
59: if (!is_power_of_2(dev->zone_size)) {
60: pr_err("zone_size must be power-of-two\n");
61: return -EINVAL;
62: }
63: if (dev->zone_size > dev->size) {
64: pr_err("Zone size larger than device capacity\n");
65: return -EINVAL;
66: }
67:
68: if (!dev->zone_capacity)
69: dev->zone_capacity = dev->zone_size;
70:
71: if (dev->zone_capacity > dev->zone_size) {
72: pr_err("zone capacity (%lu MB) larger than zone size (%lu MB)\n",
73: dev->zone_capacity, dev->zone_size);
74: return -EINVAL;
75: }
76:
77: /*
78: * If a smaller zone capacity was requested, do not allow a smaller last
79: * zone at the same time as such zone configuration does not correspond
80: * to any real zoned device.
81: */
82: if (dev->zone_capacity != dev->zone_size &&
83: dev->size & (dev->zone_size - 1)) {
84: pr_err("A smaller last zone is not allowed with zone capacity smaller than zone size.\n");
85: return -EINVAL;
86: }
87:
88: zone_capacity_sects = mb_to_sects(dev->zone_capacity);
89: dev_capacity_sects = mb_to_sects(dev->size);
90: dev->zone_size_sects = mb_to_sects(dev->zone_size);
91: dev->nr_zones = round_up(dev_capacity_sects, dev->zone_size_sects)
92: >> ilog2(dev->zone_size_sects);
93:
94: dev->zones = kvmalloc_objs(struct nullb_zone, dev->nr_zones,
95: GFP_KERNEL | __GFP_ZERO);
96: if (!dev->zones)
97: return -ENOMEM;
98:
99: spin_lock_init(&dev->zone_res_lock);
100:
101: if (dev->zone_nr_conv >= dev->nr_zones) {
102: dev->zone_nr_conv = dev->nr_zones - 1;
103: pr_info("changed the number of conventional zones to %u",
104: dev->zone_nr_conv);
105: }
106:
107: dev->zone_append_max_sectors =
108: min(ALIGN_DOWN(dev->zone_append_max_sectors,
109: dev->blocksize >> SECTOR_SHIFT),
110: zone_capacity_sects);
111:
112: /* Max active zones has to be < nbr of seq zones in order to be enforceable */
113: if (dev->zone_max_active >= dev->nr_zones - dev->zone_nr_conv) {
114: dev->zone_max_active = 0;
115: pr_info("zone_max_active limit disabled, limit >= zone count\n");
116: }
117:
118: /* Max open zones has to be <= max active zones */
119: if (dev->zone_max_active && dev->zone_max_open > dev->zone_max_active) {
120: dev->zone_max_open = dev->zone_max_active;
121: pr_info("changed the maximum number of open zones to %u\n",
122: dev->zone_max_open);
123: } else if (dev->zone_max_open >= dev->nr_zones - dev->zone_nr_conv) {
124: dev->zone_max_open = 0;
125: pr_info("zone_max_open limit disabled, limit >= zone count\n");
126: }
127: dev->need_zone_res_mgmt = dev->zone_max_active || dev->zone_max_open;
128: dev->imp_close_zone_no = dev->zone_nr_conv;
129:
130: for (i = 0; i < dev->zone_nr_conv; i++) {
131: zone = &dev->zones[i];
132:
133: null_init_zone_lock(dev, zone);
134: zone->start = sector;
135: zone->len = dev->zone_size_sects;
136: zone->capacity = zone->len;
137: zone->wp = zone->start + zone->len;
138: zone->type = BLK_ZONE_TYPE_CONVENTIONAL;
139: zone->cond = BLK_ZONE_COND_NOT_WP;
140:
141: sector += dev->zone_size_sects;
142: }
143:
144: for (i = dev->zone_nr_conv; i < dev->nr_zones; i++) {
145: zone = &dev->zones[i];
146:
147: null_init_zone_lock(dev, zone);
148: zone->start = sector;
149: if (zone->start + dev->zone_size_sects > dev_capacity_sects)
150: zone->len = dev_capacity_sects - zone->start;
151: else
152: zone->len = dev->zone_size_sects;
153: zone->capacity =
154: min_t(sector_t, zone->len, zone_capacity_sects);
155: zone->type = BLK_ZONE_TYPE_SEQWRITE_REQ;
156: if (dev->zone_full) {
157: zone->cond = BLK_ZONE_COND_FULL;
158: zone->wp = zone->start + zone->capacity;
159: } else{
160: zone->cond = BLK_ZONE_COND_EMPTY;
161: zone->wp = zone->start;
162: }
163:
164: sector += dev->zone_size_sects;
165: }
166:
167: lim->features |= BLK_FEAT_ZONED;
168: lim->chunk_sectors = dev->zone_size_sects;
169: lim->max_hw_zone_append_sectors = dev->zone_append_max_sectors;
170: lim->max_open_zones = dev->zone_max_open;
171: lim->max_active_zones = dev->zone_max_active;
172: return 0;
173: }
SourceFile:drivers/block/null_blk/zoned.c]
|
| 63/2 |
2026/08/13 22:08 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 38433
output: 31
thoughts: 105
Thoughts: **My Thought Process Regarding Device Zone Size Validation**
Alright, so my current line of inquiry is focused on this specific conditional check: `if (dev->zone_size > dev->size)`. My immediate reaction is to understand the implications of this comparison, particularly the return of `-EINVAL`, which signifies an invalid argument. This suggests a fundamental constraint is being violated.
My next step is to investigate the default value for `dev->size`. I recall that `g_gb`, a likely candidate for setting this parameter, defaults to 250. However, I need to be precise. Is it 250 megabytes, or 250 gigabytes? This distinction is critical for understanding the scale of `dev->size`. If `g_gb` is indeed 250 GB, then `dev->size` would translate to 256,000 MB (250 * 1024 MB). The magnitude difference is substantial and directly impacts the validity of the `dev->zone_size > dev->size` check.
Therefore, to fully grasp the context and the reasoning behind this validation, my immediate priority is to confirm the actual definitions and default values for both `g_gb` and `g_zone_size`. This will allow me to accurately assess the range of valid `zone_size` values relative to the device's total `size`.
|
| 64/2 |
2026/08/13 22:09 |
tool |
grepper |
0m
Args: map[Expression:g_gb PathPrefix:drivers/block/null_blk/]
Results: map[Output:drivers/block/null_blk/main.c=158=MODULE_PARM_DESC(queue_mode, "Block interface to use (0=bio,1=rq,2=multiqueue)");
drivers/block/null_blk/main.c-159-
drivers/block/null_blk/main.c:160:static int g_gb = 250;
drivers/block/null_blk/main.c:161:module_param_named(gb, g_gb, int, 0444);
drivers/block/null_blk/main.c-162-MODULE_PARM_DESC(gb, "Size in GB");
--
drivers/block/null_blk/main.c=777=static struct nullb_device *null_alloc_dev(void)
--
drivers/block/null_blk/main.c-797-
drivers/block/null_blk/main.c:798: dev->size = g_gb * 1024;
drivers/block/null_blk/main.c-799- dev->completion_nsec = g_completion_nsec;
]
|
| 65/2 |
2026/08/13 22:09 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 38841
output: 1166
thoughts: 3019
Thoughts: **My Thought Process on Reproducing the `null_blk` Sleeping Function Bug**
I've been investigating a specific bug in the `null_blk` driver where a sleeping function is called from an invalid context. My goal is to precisely understand the conditions that trigger this and to develop a minimal, reliable reproducer.
Initially, I reviewed the provided information, specifically focusing on the device size and zone size. I confirmed that `g_gb` (250 GB) translates to a `dev->size` of 256000 MB, which is significantly larger than `g_zone_size` (256 MB). This comparison indicated that the basic device configuration checks would pass, so I moved on.
My next step was to examine the C code snippet provided for creating the `null_blk` device. It seemed straightforward: create a directory, then write "1" to the `zoned`, `memory_backed`, `shared_tags`, and `power` files. This sequence of operations is central to my reproducer.
A crucial point of concern was whether `g_blocking` might be true on the syzkaller instance. If it were, the bug wouldn't trigger, as syzkaller typically doesn't pass module parameters unless explicitly defined in its description. Since `null_blk` is usually loaded without parameters, I deduced that `g_blocking` would likely be false by default. This assumption is critical to my understanding of the bug.
I then meticulously reviewed the bug report, paying close attention to the call trace and the locks held. The trace immediately confirmed my hypothesis: the `power` store operation, which I suspected was the trigger, leads to `add_disk`. This, in turn, initiates partition scanning. During this scan, a bio is submitted. The key observation is that `blk_mq_submit_bio()` is called under `rcu_read_lock()`. This is problematic because the `BLK_MQ_F_BLOCKING` flag is *not* set on the queue.
The reason `BLK_MQ_F_BLOCKING` is absent is directly tied to `shared_tags` being true. When `shared_tags` is enabled, the device uses the global tag set. This global tag set's `BLK_MQ_F_BLOCKING` status is determined by the `g_blocking` module parameter, which, as I assumed, defaults to false. However, the device is configured as `memory_backed`. This means that within `null_lock_zone` (called by `null_process_zoned_cmd`), `mutex_lock` is invoked. A `mutex_lock` is a sleeping function, and attempting to call it while holding an RCU read lock is the direct cause of the "sleeping function called from invalid context" bug.
This alignment between the trace, the code, and my understanding of the configuration options gave me high confidence in my reproducer.
I then considered potential robustness issues for my reproducer. I realized that if `null_blk` wasn't loaded, the `mkdir` operation would fail. To address this, I decided to add a `system("modprobe null_blk");` call, as it's a safe operation and ensures the module is available. Furthermore, I thought about `configfs` potentially not being mounted. Therefore, I included `mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);` to ensure that `configfs` is mounted before attempting to create the device.
Finally, I re-examined the relevant functions, `null_lock_zone` and `null_process_zoned_cmd`, and the partition scanning logic (which reads sector 0). This re-verification reinforced my conclusion that the chain of events was precisely as I had outlined: `power` -> `add_disk` -> partition scan -> bio submission under RCU lock -> `null_process_zoned_cmd` -> `null_lock_zone` (which uses `mutex_lock` due to `memory_backed`) -> BUG.
Everything aligns perfectly. The bug is fundamentally a configuration mismatch: the device's requirement for a blocking queue (due to `memory_backed`) conflicts with the global tag set's non-blocking nature (because `g_blocking` is false and `shared_tags` is true). My refined C code now accounts for these potential setup issues, making it a robust reproducer for this specific `null_blk` bug.
|
| 66/1 |
2026/08/13 22:10 |
loop |
|
5m
|
| 67/2 |
2026/08/13 22:10 |
iteration |
0 |
3m
|
| 68/3 |
2026/08/13 22:10 |
action |
If |
0m
Args:
|
| 69/3 |
2026/08/13 22:10 |
action |
merge-strategy |
0m
Results: map[CurrentReproStrategy:An analysis of the bug report and kernel source code reveals the root cause of the issue:
1. **The Bug Mechanism**:
The stack trace shows a "sleeping function called from invalid context" warning triggered by `mutex_lock()` in `null_lock_zone()`. This happens while handling a bio submission (`blk_mq_submit_bio()`) under an `rcu_read_lock()`.
2. **Why `mutex_lock()` is called**:
In `drivers/block/null_blk/zoned.c`, `null_lock_zone()` uses a `spinlock` by default, but switches to a `mutex` if the device is configured as `memory_backed` (`dev->memory_backed == true`).
3. **Why it executes under `rcu_read_lock()`**:
When a bio is submitted, `blk_mq_submit_bio()` checks if the request queue's tag set has the `BLK_MQ_F_BLOCKING` flag. If it does, it uses `srcu_read_lock()` (which allows sleeping). If it doesn't, it falls back to `rcu_read_lock()` (which disables preemption and forbids sleeping).
4. **The Configuration Mismatch**:
When a `null_blk` device is created via configfs with `memory_backed=1`, `null_validate_conf()` correctly sets `dev->blocking = true` to indicate that the queue needs to allow blocking/sleeping.
However, if the device is also configured with `shared_tags=1`, `null_setup_tagset()` ignores the per-device `dev->blocking` flag and instead uses the global `tag_set`. The global `tag_set` is initialized based on the module parameter `g_blocking`, which defaults to `false`.
As a result, the `BLK_MQ_F_BLOCKING` flag is **not** set on the queue, causing `blk_mq_submit_bio()` to issue requests under `rcu_read_lock()`.
5. **Triggering the Bug**:
Powering on the device (`power=1`) triggers `add_disk()`, which initiates a partition scan. The partition scan submits a read bio for sector 0. This read request is dispatched under `rcu_read_lock()` and reaches `null_process_zoned_cmd()`, which calls `null_lock_zone()`. Because `memory_backed=1`, it attempts to acquire a mutex, triggering the BUG.
### Minimal Reproducer
The following standalone C program reproduces the bug by creating a `null_blk` device via configfs with the exact conflicting attributes (`zoned=1`, `memory_backed=1`, `shared_tags=1`) and then powering it on.
```c
// save as repro.c and compile with: gcc repro.c -o repro
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
void write_file(const char *path, const char *val) {
int fd = open(path, O_WRONLY);
if (fd >= 0) {
write(fd, val, strlen(val));
close(fd);
}
}
int main() {
// Ensure configfs is mounted (usually mounted at /sys/kernel/config by default)
mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
// Create a new null_blk device via configfs
mkdir("/sys/kernel/config/nullb/mydev", 0755);
// Enable zoned mode
write_file("/sys/kernel/config/nullb/mydev/zoned", "1");
// Enable memory backed mode. This forces the device to require a blocking queue
// because memory allocation and zone locking can sleep.
write_file("/sys/kernel/config/nullb/mydev/memory_backed", "1");
// Enable shared tags. This causes the device to use the global tag set.
// The global tag set is initialized based on module parameters (g_blocking),
// which defaults to false. Thus, the queue will NOT have BLK_MQ_F_BLOCKING set,
// despite the device requiring a blocking queue.
write_file("/sys/kernel/config/nullb/mydev/shared_tags", "1");
// Power on the device. This triggers add_disk(), which scans partitions.
// Partition scanning submits a read bio. Since BLK_MQ_F_BLOCKING is missing,
// blk_mq_submit_bio() issues the request under rcu_read_lock().
// The request reaches null_process_zoned_cmd() -> null_lock_zone(), which
// calls mutex_lock() (because memory_backed=1), triggering the BUG.
write_file("/sys/kernel/config/nullb/mydev/power", "1");
return 0;
}
```]
|
| 70/3 |
2026/08/13 22:10 |
agent |
repro-generator |
0m
Model:
Results: map[IsProbe:true RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
#include <errno.h>
int main() {
int res;
res = mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
if (res < 0 && errno != EBUSY) {
printf("[-] Failed to mount configfs: %s\n", strerror(errno));
} else {
printf("[+] configfs mounted or already mounted.\n");
}
struct stat st;
res = stat("/sys/kernel/config/nullb", &st);
if (res < 0) {
printf("[-] /sys/kernel/config/nullb does not exist: %s\n", strerror(errno));
exit(1);
}
printf("[+] /sys/kernel/config/nullb exists.\n");
res = mkdir("/sys/kernel/config/nullb/probe_dev", 0755);
if (res < 0) {
printf("[-] Failed to create probe_dev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Created probe_dev successfully.\n");
res = rmdir("/sys/kernel/config/nullb/probe_dev");
if (res < 0) {
printf("[-] Failed to remove probe_dev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Removed probe_dev successfully.\n");
return 0;
}
]
Instruction: You are a security researcher with deep Linux kernel background.
Your goal is to generate a minimal, standalone C program for the strictly defensive
purpose of verifying a bugfix in an isolated environment.
To ensure that we can diagnose why a program might fail to run on the test environment,
you MUST include detailed logging and error checking in the generated C program:
1. Use 'printf(...)' for all progress messages and error logs.
2. Every system call (e.g., socket, bind, listen, connect, ioctl, send) must check for a failure return value.
3. If a call fails, it must print a specific error message including the function name
and the error string (use strerror(errno)), and then exit with a non-zero status.
4. The program must print a message after every successful major step.
5. Generate code that follows this pattern for all operations:
int res = do_something();
if (res < 0) {
printf("[-] Failed to do_something: %s\n", strerror(errno));
exit(1);
}
printf("[+] do_something successful.\n");
6. The compilation and development environment (including compilers, build
systems, makefiles, and kernel build/header directories) is NOT available
on the target test VM guest. Do NOT check for, build, or reference any
compilation tools, build files, or kernel development directories.
7. Do NOT execute shell commands or run external binaries (e.g. by using
functions like 'system()', 'popen()', or the 'exec' family such as
'execve()'). All environment checks, capability probings, and reproduction
steps must be performed directly using standard Linux system calls (such
as 'open', 'socket', 'ioctl', 'stat', etc.).
8. When reproducing asynchronous kernel timeouts or warnings, always
include a sufficient delay (using sleep or similar) after deleting
or unregistering the device to allow the kernel's asynchronous
timeout to trigger before program exit.
=== PHASE 1: CAPABILITY PROBING (GENERATION) ===
You MUST start by generating a simple 'probe' program first. This is a strict, non-negotiable requirement
to verify that the test environment has the necessary kernel capabilities and privileges.
This program's sole purpose is to verify subsystem availability and privileges by probing specific
device files, subsystems, or syscalls (for example: opening /dev/vhci to check if the virtual
Bluetooth controller is accessible, loading a minimal dummy BPF program, or making a specific
socket/ioctl call).
Print clear messages indicating success or failure of these probes, and exit with 0 only if
all checks pass.
Do NOT attempt complex logic, and do NOT try to trigger the actual bug/crash in this first version,
regardless of how simple the reproducer seems. You must wait until a successful probe run has been
confirmed in the environment (i.e., when CapabilitiesVerified becomes true).
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: Bug Description: BUG: sleeping function called from invalid context in null_process_zoned_cmd
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:623
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 19399, name: syz.6.4428
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
7 locks held by syz.6.4428/19399:
#0: ffff888030e500f0 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x246/0x320 fs/file.c:1259
#1: ffff88801d756450 (sb_writers#12){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#1: ffff88801d756450 (sb_writers#12){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#2: ffff888029822280 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#3: ffff888057f6c870 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#3: ffff888057f6c870 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#4: ffffffff9aaec560 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#5: ffff888051072350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
CPU: 0 UID: 0 PID: 19399 Comm: syz.6.4428 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x378/0x4d0 kernel/sched/core.c:9197
__mutex_lock_common kernel/locking/mutex.c:623 [inline]
__mutex_lock+0x118/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f95ef39e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f95f019b028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f95ef625fa0 RCX: 00007f95ef39e0d9
RDX: 0000000000000002 RSI: 0000200000000700 RDI: 0000000000000005
RBP: 00007f95ef435024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f95ef626038 R14: 00007f95ef625fa0 R15: 00007ffe19f02fb8
</TASK>
------------[ cut here ]------------
DEBUG_LOCKS_WARN_ON(lock->magic != lock)
WARNING: kernel/locking/mutex.c:625 at __mutex_lock_common kernel/locking/mutex.c:625 [inline], CPU#0: syz.6.4428/19399
WARNING: kernel/locking/mutex.c:625 at __mutex_lock+0x12d8/0x1550 kernel/locking/mutex.c:821, CPU#0: syz.6.4428/19399
Modules linked in:
CPU: 0 UID: 0 PID: 19399 Comm: syz.6.4428 Tainted: G W L syzkaller #0 PREEMPT(full)
Tainted: [W]=WARN, [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
RIP: 0010:__mutex_lock_common kernel/locking/mutex.c:625 [inline]
RIP: 0010:__mutex_lock+0x12df/0x1550 kernel/locking/mutex.c:821
Code: 7a 57 90 48 c1 e8 03 0f b6 04 18 84 c0 0f 85 47 02 00 00 83 3d 45 38 85 04 00 75 13 48 8d 3d c8 87 88 04 48 c7 c6 40 f7 ec 8b <67> 48 0f b9 3a 90 e9 75 ee ff ff 90 0f 0b 90 e9 48 f2 ff ff 90 0f
RSP: 0018:ffffc9001182ed40 EFLAGS: 00010246
RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000080000
RDX: ffffc90012289000 RSI: ffffffff8becf740 RDI: ffffffff905ac9d0
RBP: ffffc9001182eed0 R08: ffffffff90577a43 R09: 1ffffffff20aef48
R10: dffffc0000000000 R11: fffffbfff20aef49 R12: ffff88804b9c0000
R13: 0000000000000000 R14: 1ffff92002305dbc R15: 0000000000000000
FS: 00007f95f019b6c0(0000) GS:ffff888124f55000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2f81bff8 CR3: 000000007cb27000 CR4: 0000000000350ef0
Call Trace:
<TASK>
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f95ef39e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f95f019b028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f95ef625fa0 RCX: 00007f95ef39e0d9
RDX: 0000000000000002 RSI: 0000200000000700 RDI: 0000000000000005
RBP: 00007f95ef435024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f95ef626038 R14: 00007f95ef625fa0 R15: 00007ffe19f02fb8
</TASK>
----------------
Code disassembly (best guess):
0: 7a 57 jp 0x59
2: 90 nop
3: 48 c1 e8 03 shr $0x3,%rax
7: 0f b6 04 18 movzbl (%rax,%rbx,1),%eax
b: 84 c0 test %al,%al
d: 0f 85 47 02 00 00 jne 0x25a
13: 83 3d 45 38 85 04 00 cmpl $0x0,0x4853845(%rip) # 0x485385f
1a: 75 13 jne 0x2f
1c: 48 8d 3d c8 87 88 04 lea 0x48887c8(%rip),%rdi # 0x48887eb
23: 48 c7 c6 40 f7 ec 8b mov $0xffffffff8becf740,%rsi
* 2a: 67 48 0f b9 3a ud1 (%edx),%rdi <-- trapping instruction
2f: 90 nop
30: e9 75 ee ff ff jmp 0xffffeeaa
35: 90 nop
36: 0f 0b ud2
38: 90 nop
39: e9 48 f2 ff ff jmp 0xfffff286
3e: 90 nop
3f: 0f .byte 0xf
Strategy: An analysis of the bug report and kernel source code reveals the root cause of the issue:
1. **The Bug Mechanism**:
The stack trace shows a "sleeping function called from invalid context" warning triggered by `mutex_lock()` in `null_lock_zone()`. This happens while handling a bio submission (`blk_mq_submit_bio()`) under an `rcu_read_lock()`.
2. **Why `mutex_lock()` is called**:
In `drivers/block/null_blk/zoned.c`, `null_lock_zone()` uses a `spinlock` by default, but switches to a `mutex` if the device is configured as `memory_backed` (`dev->memory_backed == true`).
3. **Why it executes under `rcu_read_lock()`**:
When a bio is submitted, `blk_mq_submit_bio()` checks if the request queue's tag set has the `BLK_MQ_F_BLOCKING` flag. If it does, it uses `srcu_read_lock()` (which allows sleeping). If it doesn't, it falls back to `rcu_read_lock()` (which disables preemption and forbids sleeping).
4. **The Configuration Mismatch**:
When a `null_blk` device is created via configfs with `memory_backed=1`, `null_validate_conf()` correctly sets `dev->blocking = true` to indicate that the queue needs to allow blocking/sleeping.
However, if the device is also configured with `shared_tags=1`, `null_setup_tagset()` ignores the per-device `dev->blocking` flag and instead uses the global `tag_set`. The global `tag_set` is initialized based on the module parameter `g_blocking`, which defaults to `false`.
As a result, the `BLK_MQ_F_BLOCKING` flag is **not** set on the queue, causing `blk_mq_submit_bio()` to issue requests under `rcu_read_lock()`.
5. **Triggering the Bug**:
Powering on the device (`power=1`) triggers `add_disk()`, which initiates a partition scan. The partition scan submits a read bio for sector 0. This read request is dispatched under `rcu_read_lock()` and reaches `null_process_zoned_cmd()`, which calls `null_lock_zone()`. Because `memory_backed=1`, it attempts to acquire a mutex, triggering the BUG.
### Minimal Reproducer
The following standalone C program reproduces the bug by creating a `null_blk` device via configfs with the exact conflicting attributes (`zoned=1`, `memory_backed=1`, `shared_tags=1`) and then powering it on.
```c
// save as repro.c and compile with: gcc repro.c -o repro
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
void write_file(const char *path, const char *val) {
int fd = open(path, O_WRONLY);
if (fd >= 0) {
write(fd, val, strlen(val));
close(fd);
}
}
int main() {
// Ensure configfs is mounted (usually mounted at /sys/kernel/config by default)
mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
// Create a new null_blk device via configfs
mkdir("/sys/kernel/config/nullb/mydev", 0755);
// Enable zoned mode
write_file("/sys/kernel/config/nullb/mydev/zoned", "1");
// Enable memory backed mode. This forces the device to require a blocking queue
// because memory allocation and zone locking can sleep.
write_file("/sys/kernel/config/nullb/mydev/memory_backed", "1");
// Enable shared tags. This causes the device to use the global tag set.
// The global tag set is initialized based on module parameters (g_blocking),
// which defaults to false. Thus, the queue will NOT have BLK_MQ_F_BLOCKING set,
// despite the device requiring a blocking queue.
write_file("/sys/kernel/config/nullb/mydev/shared_tags", "1");
// Power on the device. This triggers add_disk(), which scans partitions.
// Partition scanning submits a read bio. Since BLK_MQ_F_BLOCKING is missing,
// blk_mq_submit_bio() issues the request under rcu_read_lock().
// The request reaches null_process_zoned_cmd() -> null_lock_zone(), which
// calls mutex_lock() (because memory_backed=1), triggering the BUG.
write_file("/sys/kernel/config/nullb/mydev/power", "1");
return 0;
}
```
|
| 71/4 |
2026/08/13 22:10 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 9622
output: 435
thoughts: 1529
Thoughts: **My Thought Process for Generating the Bugfix Verification Probe**
Okay, my primary objective here is to construct a minimal, standalone C program, a "probe," to confirm that the environment is correctly set up for verifying a specific bugfix. The bug itself is described as "sleeping function called from invalid context in null_process_zoned_cmd." The user has helpfully provided a strategy and a minimal reproducer for this bug.
The reproducer leverages `configfs` to set up a `null_blk` device with a very specific configuration: `zoned=1`, `memory_backed=1`, `shared_tags=1`, and `power=1`. This setup is crucial for triggering the bug.
Now, the strict requirement is that I *must* start with a "probe" program. This probe has a singular purpose: to verify that the test environment possesses the necessary kernel capabilities and privileges. It's *not* meant to trigger the actual bug or crash. It needs to be simple and focused on subsystem availability and privileges.
Thinking about the bug and the reproducer, the key components involved are `configfs` and the `null_blk` module. Therefore, my probe needs to check for the presence and accessibility of these.
Specifically, I need to:
1. **Verify `configfs` availability:** This means checking if `/sys/kernel/config` exists and, ideally, if it can be mounted with the `configfs` filesystem type. If it's already mounted, that's fine; I just need to confirm it's accessible.
2. **Verify `null_blk` subsystem presence:** The `null_blk` module registers itself under `/sys/kernel/config/nullb`. So, I need to check if this directory exists.
The instructions also state: "If it doesn't exist, we might need to load the module, but we can't use `system("modprobe null_blk")`." This is important. I'm not supposed to actively load modules. However, for fuzzing environments like `syzkaller`, it's generally assumed that necessary modules are either built-in or auto-loaded. So, my approach should be to check for the *existence* of `/sys/kernel/config/nullb`. If it's not there, it implies `null_blk` isn't ready, and my probe should fail.
Let's refine the probe's logic:
* **Mount `configfs`:** I'll attempt to mount `configfs` on `/sys/kernel/config`. If it fails, I'll check if the error is `EBUSY` (meaning it's already mounted), which is an acceptable scenario. Any other error might indicate privilege issues or a problem with the filesystem itself, but I should report it.
* **Check for `/sys/kernel/config/nullb`:** I'll use `stat()` to check if the `/sys/kernel/config/nullb` directory exists. If `stat()` fails, my probe should exit with an error, indicating that the `null_blk` subsystem isn't available in the expected location.
* **Test directory creation/removal:** To further confirm write privileges and the integrity of the `nullb` directory, I'll try to create a temporary directory (e.g., `probe_dev`) within `/sys/kernel/config/nullb` and then immediately remove it. This is a simple smoke test for write operations.
Based on this refined logic, I've constructed a C program. It includes necessary headers for file operations, system calls, and error handling.
The program's flow is:
1. Attempt to mount `configfs`.
2. Check for the existence of `/sys/kernel/config/nullb`.
3. Create a test directory `probe_dev` inside `/sys/kernel/config/nullb`.
4. Remove the test directory `probe_dev`.
If any of these steps fail (except `configfs` being `EBUSY`), the program will print an error message and exit. Success will be indicated by messages confirming each step.
The final output will be a JSON object with the C code for this probe program, marked as `IsProbe: true`. This fulfills the user's requirement to start with a probe that verifies subsystem availability and privileges.
|
| 72/4 |
2026/08/13 22:10 |
tool |
set-results |
0m
Args: map[IsProbe:true RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
#include <errno.h>
int main() {
int res;
res = mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
if (res < 0 && errno != EBUSY) {
printf("[-] Failed to mount configfs: %s\n", strerror(errno));
} else {
printf("[+] configfs mounted or already mounted.\n");
}
struct stat st;
res = stat("/sys/kernel/config/nullb", &st);
if (res < 0) {
printf("[-] /sys/kernel/config/nullb does not exist: %s\n", strerror(errno));
exit(1);
}
printf("[+] /sys/kernel/config/nullb exists.\n");
res = mkdir("/sys/kernel/config/nullb/probe_dev", 0755);
if (res < 0) {
printf("[-] Failed to create probe_dev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Created probe_dev successfully.\n");
res = rmdir("/sys/kernel/config/nullb/probe_dev");
if (res < 0) {
printf("[-] Failed to remove probe_dev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Removed probe_dev successfully.\n");
return 0;
}
]
Results: map[IsProbe:true RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
#include <errno.h>
int main() {
int res;
res = mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
if (res < 0 && errno != EBUSY) {
printf("[-] Failed to mount configfs: %s\n", strerror(errno));
} else {
printf("[+] configfs mounted or already mounted.\n");
}
struct stat st;
res = stat("/sys/kernel/config/nullb", &st);
if (res < 0) {
printf("[-] /sys/kernel/config/nullb does not exist: %s\n", strerror(errno));
exit(1);
}
printf("[+] /sys/kernel/config/nullb exists.\n");
res = mkdir("/sys/kernel/config/nullb/probe_dev", 0755);
if (res < 0) {
printf("[-] Failed to create probe_dev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Created probe_dev successfully.\n");
res = rmdir("/sys/kernel/config/nullb/probe_dev");
if (res < 0) {
printf("[-] Failed to remove probe_dev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Removed probe_dev successfully.\n");
return 0;
}
]
|
| 73/3 |
2026/08/13 22:10 |
loop |
|
0m
|
| 74/4 |
2026/08/13 22:10 |
iteration |
0 |
0m
|
| 75/5 |
2026/08/13 22:10 |
action |
merge-repro-c |
0m
Results: map[CurrentCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
#include <errno.h>
int main() {
int res;
res = mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
if (res < 0 && errno != EBUSY) {
printf("[-] Failed to mount configfs: %s\n", strerror(errno));
} else {
printf("[+] configfs mounted or already mounted.\n");
}
struct stat st;
res = stat("/sys/kernel/config/nullb", &st);
if (res < 0) {
printf("[-] /sys/kernel/config/nullb does not exist: %s\n", strerror(errno));
exit(1);
}
printf("[+] /sys/kernel/config/nullb exists.\n");
res = mkdir("/sys/kernel/config/nullb/probe_dev", 0755);
if (res < 0) {
printf("[-] Failed to create probe_dev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Created probe_dev successfully.\n");
res = rmdir("/sys/kernel/config/nullb/probe_dev");
if (res < 0) {
printf("[-] Failed to remove probe_dev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Removed probe_dev successfully.\n");
return 0;
}
]
|
| 76/5 |
2026/08/13 22:10 |
action |
compile-c-prog |
0m
Results: map[CompilerError: FormattedReproC:#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
#include <errno.h>
int main() {
int res;
res = mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
if (res < 0 && errno != EBUSY) {
printf("[-] Failed to mount configfs: %s\n", strerror(errno));
} else {
printf("[+] configfs mounted or already mounted.\n");
}
struct stat st;
res = stat("/sys/kernel/config/nullb", &st);
if (res < 0) {
printf("[-] /sys/kernel/config/nullb does not exist: %s\n", strerror(errno));
exit(1);
}
printf("[+] /sys/kernel/config/nullb exists.\n");
res = mkdir("/sys/kernel/config/nullb/probe_dev", 0755);
if (res < 0) {
printf("[-] Failed to create probe_dev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Created probe_dev successfully.\n");
res = rmdir("/sys/kernel/config/nullb/probe_dev");
if (res < 0) {
printf("[-] Failed to remove probe_dev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Removed probe_dev successfully.\n");
return 0;
}
]
|
| 77/5 |
2026/08/13 22:10 |
action |
If |
0m
Args:
|
| 78/3 |
2026/08/13 22:10 |
action |
run-c-repro |
2m
Results: map[CandidateBugTitle: CandidateCrashReport: CandidateReproduced:false ConsoleOutput:[ 68.658711][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 68.658722][ T33] audit: type=1400 audit(1786659097.481:201): avc: denied { transition } for pid=5827 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 68.677725][ T33] audit: type=1400 audit(1786659097.491:202): avc: denied { noatsecure } for pid=5827 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 68.683818][ T33] audit: type=1400 audit(1786659097.491:203): avc: denied { rlimitinh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 68.689751][ T33] audit: type=1400 audit(1786659097.491:204): avc: denied { siginh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 70.675308][ T33] audit: type=1400 audit(1786659099.491:205): avc: denied { write } for pid=5833 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 70.722102][ T33] audit: type=1400 audit(1786659099.541:206): avc: denied { write } for pid=5836 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Warning: Permanently added '[localhost]:7904' (ED25519) to the list of known hosts.
[ 71.206120][ T33] audit: type=1400 audit(1786659100.021:207): avc: denied { mounton } for pid=5846 comm="syz-executor849" path="/sys/kernel/config" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[ 71.217650][ T33] audit: type=1400 audit(1786659100.031:208): avc: denied { mount } for pid=5846 comm="syz-executor849" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=filesystem permissive=1
[ 71.224862][ T33] audit: type=1400 audit(1786659100.031:209): avc: denied { search } for pid=5846 comm="syz-executor849" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[+] configfs mounted or already mounted.
[+] /sys/kernel/config/nullb exists.
[+] Created probe_dev successfully.
[+] Removed probe_dev successfully.
[ 71.232489][ T33] audit: type=1400 audit(1786659100.031:210): avc: denied { search } for pid=5846 comm="syz-executor849" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[ 71.880487][ T1373] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.883119][ T1373] ieee802154 phy1 wpan1: encryption failed: -22
[ 74.692757][ T33] kauditd_printk_skb: 21 callbacks suppressed
[ 74.692784][ T33] audit: type=1400 audit(1786659103.511:232): avc: denied { write } for pid=5883 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.729177][ T33] audit: type=1400 audit(1786659103.551:233): avc: denied { write } for pid=5886 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
OtherCrashReports:<nil> StraceOutput:/strace -e \!wait4,clock_nanosleep,nanosleep -s 100 -x -f /syz-executor2458969260
<...>
[ 69.696266][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 69.696277][ T33] audit: type=1400 audit(1786659184.821:202): avc: denied { transition } for pid=5823 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 69.707138][ T33] audit: type=1400 audit(1786659184.831:203): avc: denied { noatsecure } for pid=5823 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 69.713342][ T33] audit: type=1400 audit(1786659184.831:204): avc: denied { rlimitinh } for pid=5823 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 69.720636][ T33] audit: type=1400 audit(1786659184.831:205): avc: denied { siginh } for pid=5823 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 71.829740][ T1375] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.833880][ T1375] ieee802154 phy1 wpan1: encryption failed: -22
[ 73.654263][ T33] audit: type=1400 audit(1786659188.781:206): avc: denied { write } for pid=5836 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 73.691844][ T33] audit: type=1400 audit(1786659188.821:207): avc: denied { write } for pid=5839 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 73.767443][ T33] audit: type=1400 audit(1786659188.891:208): avc: denied { write } for pid=5842 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 73.805852][ T33] audit: type=1400 audit(1786659188.931:209): avc: denied { write } for pid=5845 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.597198][ T33] audit: type=1400 audit(1786659189.721:210): avc: denied { write } for pid=5852 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.656701][ T33] audit: type=1400 audit(1786659189.781:211): avc: denied { write } for pid=5855 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.767050][ T33] audit: type=1400 audit(1786659189.891:212): avc: denied { write } for pid=5859 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Warning: Permanently added '[localhost]:50747' (ED25519) to the list of known hosts.
[ 74.813666][ T33] audit: type=1400 audit(1786659189.941:213): avc: denied { write } for pid=5862 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.897950][ T33] audit: type=1400 audit(1786659190.021:214): avc: denied { write } for pid=5866 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.953948][ T33] audit: type=1400 audit(1786659190.081:215): avc: denied { write } for pid=5871 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
execve("/syz-executor2458969260", ["/syz-executor2458969260"], 0x7ffdd33523f0 /* 11 vars */) = 0
brk(NULL) = 0x555568558000
brk(0x555568558d80) = 0x555568558d80
arch_prctl(ARCH_SET_FS, 0x555568558400) = 0
set_tid_address(0x5555685586d0) = 5875
set_robust_list(0x5555685586e0, 24) = 0
rseq({cpu_id_start=0, cpu_id=RSEQ_CPU_ID_UNINITIALIZED, rseq_cs=NULL, flags=0, node_id=0, mm_cid=0, slice_ctrl={request=0, granted=0, __reserved=0}, __reserved=0}, 33, 0, 0x53053053) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
readlinkat(AT_FDCWD, "/proc/self/exe", "/syz-executor2458969260", 4096) = 23
getrandom("\x11\xe5\xaf\x54\x89\xf3\x10\x0c", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x555568558d80
brk(0x555568579d80) = 0x555568579d80
brk(0x55556857a000) = 0x55556857a000
mprotect(0x7f593c75d000, 20480, PROT_READ) = 0
[ 75.033655][ T33] audit: type=1400 audit(1786659190.161:216): avc: denied { write } for pid=5876 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
mount("configfs", "/sys/kernel/config", "configfs", 0, NULL) = -1 EBUSY (Device or resource busy)
[ 75.042403][ T33] audit: type=1400 audit(1786659190.171:217): avc: denied { mounton } for pid=5875 comm="syz-executor245" path="/sys/kernel/config" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
newfstatat(AT_FDCWD, "/sys/kernel/config/nullb", {st_mode=S_IFDIR|0755, st_size=0, ...}, 0) = 0
[ 75.056589][ T33] audit: type=1400 audit(1786659190.171:218): avc: denied { mount } for pid=5875 comm="syz-executor245" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=filesystem permissive=1
[ 75.063778][ T33] audit: type=1400 audit(1786659190.181:219): avc: denied { search } for pid=5875 comm="syz-executor245" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
mkdir("/sys/kernel/config/nullb/probe_dev", 0755) = 0
[ 75.075906][ T33] audit: type=1400 audit(1786659190.181:220): avc: denied { search } for pid=5875 comm="syz-executor245" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[ 75.082910][ T33] audit: type=1400 audit(1786659190.181:221): avc: denied { search } for pid=5875 comm="syz-executor245" name="nullb" dev="configfs" ino=736 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
rmdir("/sys/kernel/config/nullb/probe_dev") = 0
write(1, "[+] configfs mounted or already mounted.\n[+] /sys/kernel/config/nullb exists.\n[+] Created probe_dev "..., 150) = 150
[+] configfs mounted or already mounted.
[+] /sys/kernel/config/nullb exists.
[+] Created probe_dev successfully.
[+] Removed probe_dev successfully.
exit_group(0) = ?
+++ exited with 0 +++
[ 82.071225][ T24] cfg80211: failed to load regulatory.db
TestError:]
|
| 79/3 |
2026/08/13 22:13 |
action |
truncate-log |
0m
Results: map[TruncatedConsoleOutput:[ 68.658711][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 68.658722][ T33] audit: type=1400 audit(1786659097.481:201): avc: denied { transition } for pid=5827 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 68.677725][ T33] audit: type=1400 audit(1786659097.491:202): avc: denied { noatsecure } for pid=5827 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 68.683818][ T33] audit: type=1400 audit(1786659097.491:203): avc: denied { rlimitinh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 68.689751][ T33] audit: type=1400 audit(1786659097.491:204): avc: denied { siginh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 70.675308][ T33] audit: type=1400 audit(1786659099.491:205): avc: denied { write } for pid=5833 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 70.722102][ T33] audit: type=1400 audit(1786659099.541:206): avc: denied { write } for pid=5836 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Warning: Permanently added '[localhost]:7904' (ED25519) to the list of known hosts.
[ 71.206120][ T33] audit: type=1400 audit(1786659100.021:207): avc: denied { mounton } for pid=5846 comm="syz-executor849" path="/sys/kernel/config" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[ 71.217650][ T33] audit: type=1400 audit(1786659100.031:208): avc: denied { mount } for pid=5846 comm="syz-executor849" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=filesystem permissive=1
[ 71.224862][ T33] audit: type=1400 audit(1786659100.031:209): avc: denied { search } for pid=5846 comm="syz-executor849" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[+] configfs mounted or already mounted.
[+] /sys/kernel/config/nullb exists.
[+] Created probe_dev successfully.
[+] Removed probe_dev successfully.
[ 71.232489][ T33] audit: type=1400 audit(1786659100.031:210): avc: denied { search } for pid=5846 comm="syz-executor849" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[ 71.880487][ T1373] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.883119][ T1373] ieee802154 phy1 wpan1: encryption failed: -22
[ 74.692757][ T33] kauditd_printk_skb: 21 callbacks suppressed
[ 74.692784][ T33] audit: type=1400 audit(1786659103.511:232): avc: denied { write } for pid=5883 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.729177][ T33] audit: type=1400 audit(1786659103.551:233): avc: denied { write } for pid=5886 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
TruncatedCrashReport: TruncatedStraceOutput:/strace -e \!wait4,clock_nanosleep,nanosleep -s 100 -x -f /syz-executor2458969260
<...>
[ 69.696266][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 69.696277][ T33] audit: type=1400 audit(1786659184.821:202): avc: denied { transition } for pid=5823 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 69.707138][ T33] audit: type=1400 audit(1786659184.831:203): avc: denied { noatsecure } for pid=5823 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 69.713342][ T33] audit: type=1400 audit(1786659184.831:204): avc: denied { rlimitinh } for pid=5823 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 69.720636][ T33] audit: type=1400 audit(1786659184.831:205): avc: denied { siginh } for pid=5823 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 71.829740][ T1375] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.833880][ T1375] ieee802154 phy1 wpan1: encryption failed: -22
[ 73.654263][ T33] audit: type=1400 audit(1786659188.781:206): avc: denied { write } for pid=5836 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 73.691844][ T33] audit: type=1400 audit(1786659188.821:207): avc: denied { write } for pid=5839 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 73.767443][ T33] audit: type=1400 audit(1786659188.891:208): avc: denied { write } for pid=5842 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 73.805852][ T33] audit: type=1400 audit(1786659188.931:209): avc: denied { write } for pid=5845 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.597198][ T33] audit: type=1400 audit(1786659189.721:210): avc: denied { write } for pid=5852 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.656701][ T33] audit: type=1400 audit(1786659189.781:211): avc: denied { write } for pid=5855 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.767050][ T33] audit: type=1400 audit(1786659189.891:212): avc: denied { write } for pid=5859 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Warning: Permanently added '[localhost]:50747' (ED25519) to the list of known hosts.
[ 74.813666][ T33] audit: type=1400 audit(1786659189.941:213): avc: denied { write } for pid=5862 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.897950][ T33] audit: type=1400 audit(1786659190.021:214): avc: denied { write } for pid=5866 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.953948][ T33] audit: type=1400 audit(1786659190.081:215): avc: denied { write } for pid=5871 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
execve("/syz-executor2458969260", ["/syz-executor2458969260"], 0x7ffdd33523f0 /* 11 vars */) = 0
brk(NULL) = 0x555568558000
brk(0x555568558d80) = 0x555568558d80
arch_prctl(ARCH_SET_FS, 0x555568558400) = 0
set_tid_address(0x5555685586d0) = 5875
set_robust_list(0x5555685586e0, 24) = 0
rseq({cpu_id_start=0, cpu_id=RSEQ_CPU_ID_UNINITIALIZED, rseq_cs=NULL, flags=0, node_id=0, mm_cid=0, slice_ctrl={request=0, granted=0, __reserved=0}, __reserved=0}, 33, 0, 0x53053053) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
readlinkat(AT_FDCWD, "/proc/self/exe", "/syz-executor2458969260", 4096) = 23
getrandom("\x11\xe5\xaf\x54\x89\xf3\x10\x0c", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x555568558d80
brk(0x555568579d80) = 0x555568579d80
brk(0x55556857a000) = 0x55556857a000
mprotect(0x7f593c75d000, 20480, PROT_READ) = 0
[ 75.033655][ T33] audit: type=1400 audit(1786659190.161:216): avc: denied { write } for pid=5876 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
mount("configfs", "/sys/kernel/config", "configfs", 0, NULL) = -1 EBUSY (Device or resource busy)
[ 75.042403][ T33] audit: type=1400 audit(1786659190.171:217): avc: denied { mounton } for pid=5875 comm="syz-executor245" path="/sys/kernel/config" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
newfstatat(AT_FDCWD, "/sys/kernel/config/nullb", {st_mode=S_IFDIR|0755, st_size=0, ...}, 0) = 0
[ 75.056589][ T33] audit: type=1400 audit(1786659190.171:218): avc: denied { mount } for pid=5875 comm="syz-executor245" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=filesystem permissive=1
[ 75.063778][ T33] audit: type=1400 audit(1786659190.181:219): avc: denied { search } for pid=5875 comm="syz-executor245" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
mkdir("/sys/kernel/config/nullb/probe_dev", 0755) = 0
[ 75.075906][ T33] audit: type=1400 audit(1786659190.181:220): avc: denied { search } for pid=5875 comm="syz-executor245" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[ 75.082910][ T33] audit: type=1400 audit(1786659190.181:221): avc: denied { search } for pid=5875 comm="syz-executor245" name="nullb" dev="configfs" ino=736 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
rmdir("/sys/kernel/config/nullb/probe_dev") = 0
write(1, "[+] configfs mounted or already mounted.\n[+] /sys/kernel/config/nullb exists.\n[+] Created probe_dev "..., 150) = 150
[+] configfs mounted or already mounted.
[+] /sys/kernel/config/nullb exists.
[+] Created probe_dev successfully.
[+] Removed probe_dev successfully.
exit_group(0) = ?
+++ exited with 0 +++
[ 82.071225][ T24] cfg80211: failed to load regulatory.db
]
|
| 80/3 |
2026/08/13 22:13 |
agent |
repro-oracle |
0m
Model:
Results: map[Feedback:The capability probe executed successfully. The configfs is mounted, the nullb subsystem is available, and we can create and remove nullb devices. The environment is ready. Please proceed to generate the full reproducer in the next iteration. ProbePassed:true TerminalError: TitleMatches:false]
Instruction: You are a security researcher with deep Linux kernel background.
Analyze the results of running the generated program.
=== CRITICAL ENVIRONMENT & TARGET CLASSIFICATION ===
Set 'TerminalError' to a descriptive error message ONLY if:
1. The execution failed due to missing hardware device nodes, subsystems, kernel modules, or privilege limits
that cannot be loaded, created, or bypassed by user-space C code edits in the VM guest.
2. The target source files or functions described in the bug description do not exist in the checked-out codebase,
meaning the codebase version is mismatched and the target code is absent.
=== CRITICAL PROHIBITIONS ===
- Do NOT classify a run as a terminal failure or assume a bug is fixed based on git log entries, commit titles,
or commit messages. Reproducibility can ONLY be determined by executing reproducer candidates in the VM.
- Do NOT suggest C code strategies, repairs, or namespace bypasses when setting 'TerminalError'.
=== PHASE 1: CAPABILITY PROBING (EVALUATION) ===
The executed program was a simple environment probe.
Use this to guide your classification and feedback:
1. If the execution was successful (all environment/subsystem probes passed and program exited with 0),
set the field 'ProbePassed' to true and provide feedback explicitly indicating that the environment
is ready and the agent should now proceed to generate the full reproducer in the next iteration.
2. If the probe failed (e.g., missing permissions, missing devices, or sandbox restrictions),
set the field 'ProbePassed' to false, and explain what failed in the 'Feedback'
field so the generator can adjust its setups.
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: Bug Description: BUG: sleeping function called from invalid context in null_process_zoned_cmd
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:623
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 19399, name: syz.6.4428
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
7 locks held by syz.6.4428/19399:
#0: ffff888030e500f0 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x246/0x320 fs/file.c:1259
#1: ffff88801d756450 (sb_writers#12){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#1: ffff88801d756450 (sb_writers#12){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#2: ffff888029822280 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#3: ffff888057f6c870 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#3: ffff888057f6c870 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#4: ffffffff9aaec560 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#5: ffff888051072350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
CPU: 0 UID: 0 PID: 19399 Comm: syz.6.4428 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x378/0x4d0 kernel/sched/core.c:9197
__mutex_lock_common kernel/locking/mutex.c:623 [inline]
__mutex_lock+0x118/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f95ef39e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f95f019b028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f95ef625fa0 RCX: 00007f95ef39e0d9
RDX: 0000000000000002 RSI: 0000200000000700 RDI: 0000000000000005
RBP: 00007f95ef435024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f95ef626038 R14: 00007f95ef625fa0 R15: 00007ffe19f02fb8
</TASK>
------------[ cut here ]------------
DEBUG_LOCKS_WARN_ON(lock->magic != lock)
WARNING: kernel/locking/mutex.c:625 at __mutex_lock_common kernel/locking/mutex.c:625 [inline], CPU#0: syz.6.4428/19399
WARNING: kernel/locking/mutex.c:625 at __mutex_lock+0x12d8/0x1550 kernel/locking/mutex.c:821, CPU#0: syz.6.4428/19399
Modules linked in:
CPU: 0 UID: 0 PID: 19399 Comm: syz.6.4428 Tainted: G W L syzkaller #0 PREEMPT(full)
Tainted: [W]=WARN, [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
RIP: 0010:__mutex_lock_common kernel/locking/mutex.c:625 [inline]
RIP: 0010:__mutex_lock+0x12df/0x1550 kernel/locking/mutex.c:821
Code: 7a 57 90 48 c1 e8 03 0f b6 04 18 84 c0 0f 85 47 02 00 00 83 3d 45 38 85 04 00 75 13 48 8d 3d c8 87 88 04 48 c7 c6 40 f7 ec 8b <67> 48 0f b9 3a 90 e9 75 ee ff ff 90 0f 0b 90 e9 48 f2 ff ff 90 0f
RSP: 0018:ffffc9001182ed40 EFLAGS: 00010246
RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000080000
RDX: ffffc90012289000 RSI: ffffffff8becf740 RDI: ffffffff905ac9d0
RBP: ffffc9001182eed0 R08: ffffffff90577a43 R09: 1ffffffff20aef48
R10: dffffc0000000000 R11: fffffbfff20aef49 R12: ffff88804b9c0000
R13: 0000000000000000 R14: 1ffff92002305dbc R15: 0000000000000000
FS: 00007f95f019b6c0(0000) GS:ffff888124f55000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2f81bff8 CR3: 000000007cb27000 CR4: 0000000000350ef0
Call Trace:
<TASK>
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f95ef39e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f95f019b028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f95ef625fa0 RCX: 00007f95ef39e0d9
RDX: 0000000000000002 RSI: 0000200000000700 RDI: 0000000000000005
RBP: 00007f95ef435024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f95ef626038 R14: 00007f95ef625fa0 R15: 00007ffe19f02fb8
</TASK>
----------------
Code disassembly (best guess):
0: 7a 57 jp 0x59
2: 90 nop
3: 48 c1 e8 03 shr $0x3,%rax
7: 0f b6 04 18 movzbl (%rax,%rbx,1),%eax
b: 84 c0 test %al,%al
d: 0f 85 47 02 00 00 jne 0x25a
13: 83 3d 45 38 85 04 00 cmpl $0x0,0x4853845(%rip) # 0x485385f
1a: 75 13 jne 0x2f
1c: 48 8d 3d c8 87 88 04 lea 0x48887c8(%rip),%rdi # 0x48887eb
23: 48 c7 c6 40 f7 ec 8b mov $0xffffffff8becf740,%rsi
* 2a: 67 48 0f b9 3a ud1 (%edx),%rdi <-- trapping instruction
2f: 90 nop
30: e9 75 ee ff ff jmp 0xffffeeaa
35: 90 nop
36: 0f 0b ud2
38: 90 nop
39: e9 48 f2 ff ff jmp 0xfffff286
3e: 90 nop
3f: 0f .byte 0xf
IsProbe: true
Reproduced: false
Console Output: [ 68.658711][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 68.658722][ T33] audit: type=1400 audit(1786659097.481:201): avc: denied { transition } for pid=5827 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 68.677725][ T33] audit: type=1400 audit(1786659097.491:202): avc: denied { noatsecure } for pid=5827 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 68.683818][ T33] audit: type=1400 audit(1786659097.491:203): avc: denied { rlimitinh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 68.689751][ T33] audit: type=1400 audit(1786659097.491:204): avc: denied { siginh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 70.675308][ T33] audit: type=1400 audit(1786659099.491:205): avc: denied { write } for pid=5833 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 70.722102][ T33] audit: type=1400 audit(1786659099.541:206): avc: denied { write } for pid=5836 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Warning: Permanently added '[localhost]:7904' (ED25519) to the list of known hosts.
[ 71.206120][ T33] audit: type=1400 audit(1786659100.021:207): avc: denied { mounton } for pid=5846 comm="syz-executor849" path="/sys/kernel/config" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[ 71.217650][ T33] audit: type=1400 audit(1786659100.031:208): avc: denied { mount } for pid=5846 comm="syz-executor849" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=filesystem permissive=1
[ 71.224862][ T33] audit: type=1400 audit(1786659100.031:209): avc: denied { search } for pid=5846 comm="syz-executor849" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[+] configfs mounted or already mounted.
[+] /sys/kernel/config/nullb exists.
[+] Created probe_dev successfully.
[+] Removed probe_dev successfully.
[ 71.232489][ T33] audit: type=1400 audit(1786659100.031:210): avc: denied { search } for pid=5846 comm="syz-executor849" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[ 71.880487][ T1373] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.883119][ T1373] ieee802154 phy1 wpan1: encryption failed: -22
[ 74.692757][ T33] kauditd_printk_skb: 21 callbacks suppressed
[ 74.692784][ T33] audit: type=1400 audit(1786659103.511:232): avc: denied { write } for pid=5883 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.729177][ T33] audit: type=1400 audit(1786659103.551:233): avc: denied { write } for pid=5886 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Strace Output: /strace -e \!wait4,clock_nanosleep,nanosleep -s 100 -x -f /syz-executor2458969260
<...>
[ 69.696266][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 69.696277][ T33] audit: type=1400 audit(1786659184.821:202): avc: denied { transition } for pid=5823 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 69.707138][ T33] audit: type=1400 audit(1786659184.831:203): avc: denied { noatsecure } for pid=5823 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 69.713342][ T33] audit: type=1400 audit(1786659184.831:204): avc: denied { rlimitinh } for pid=5823 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 69.720636][ T33] audit: type=1400 audit(1786659184.831:205): avc: denied { siginh } for pid=5823 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 71.829740][ T1375] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.833880][ T1375] ieee802154 phy1 wpan1: encryption failed: -22
[ 73.654263][ T33] audit: type=1400 audit(1786659188.781:206): avc: denied { write } for pid=5836 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 73.691844][ T33] audit: type=1400 audit(1786659188.821:207): avc: denied { write } for pid=5839 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 73.767443][ T33] audit: type=1400 audit(1786659188.891:208): avc: denied { write } for pid=5842 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 73.805852][ T33] audit: type=1400 audit(1786659188.931:209): avc: denied { write } for pid=5845 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.597198][ T33] audit: type=1400 audit(1786659189.721:210): avc: denied { write } for pid=5852 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.656701][ T33] audit: type=1400 audit(1786659189.781:211): avc: denied { write } for pid=5855 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.767050][ T33] audit: type=1400 audit(1786659189.891:212): avc: denied { write } for pid=5859 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Warning: Permanently added '[localhost]:50747' (ED25519) to the list of known hosts.
[ 74.813666][ T33] audit: type=1400 audit(1786659189.941:213): avc: denied { write } for pid=5862 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.897950][ T33] audit: type=1400 audit(1786659190.021:214): avc: denied { write } for pid=5866 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.953948][ T33] audit: type=1400 audit(1786659190.081:215): avc: denied { write } for pid=5871 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
execve("/syz-executor2458969260", ["/syz-executor2458969260"], 0x7ffdd33523f0 /* 11 vars */) = 0
brk(NULL) = 0x555568558000
brk(0x555568558d80) = 0x555568558d80
arch_prctl(ARCH_SET_FS, 0x555568558400) = 0
set_tid_address(0x5555685586d0) = 5875
set_robust_list(0x5555685586e0, 24) = 0
rseq({cpu_id_start=0, cpu_id=RSEQ_CPU_ID_UNINITIALIZED, rseq_cs=NULL, flags=0, node_id=0, mm_cid=0, slice_ctrl={request=0, granted=0, __reserved=0}, __reserved=0}, 33, 0, 0x53053053) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
readlinkat(AT_FDCWD, "/proc/self/exe", "/syz-executor2458969260", 4096) = 23
getrandom("\x11\xe5\xaf\x54\x89\xf3\x10\x0c", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x555568558d80
brk(0x555568579d80) = 0x555568579d80
brk(0x55556857a000) = 0x55556857a000
mprotect(0x7f593c75d000, 20480, PROT_READ) = 0
[ 75.033655][ T33] audit: type=1400 audit(1786659190.161:216): avc: denied { write } for pid=5876 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
mount("configfs", "/sys/kernel/config", "configfs", 0, NULL) = -1 EBUSY (Device or resource busy)
[ 75.042403][ T33] audit: type=1400 audit(1786659190.171:217): avc: denied { mounton } for pid=5875 comm="syz-executor245" path="/sys/kernel/config" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
newfstatat(AT_FDCWD, "/sys/kernel/config/nullb", {st_mode=S_IFDIR|0755, st_size=0, ...}, 0) = 0
[ 75.056589][ T33] audit: type=1400 audit(1786659190.171:218): avc: denied { mount } for pid=5875 comm="syz-executor245" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=filesystem permissive=1
[ 75.063778][ T33] audit: type=1400 audit(1786659190.181:219): avc: denied { search } for pid=5875 comm="syz-executor245" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
mkdir("/sys/kernel/config/nullb/probe_dev", 0755) = 0
[ 75.075906][ T33] audit: type=1400 audit(1786659190.181:220): avc: denied { search } for pid=5875 comm="syz-executor245" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[ 75.082910][ T33] audit: type=1400 audit(1786659190.181:221): avc: denied { search } for pid=5875 comm="syz-executor245" name="nullb" dev="configfs" ino=736 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
rmdir("/sys/kernel/config/nullb/probe_dev") = 0
write(1, "[+] configfs mounted or already mounted.\n[+] /sys/kernel/config/nullb exists.\n[+] Created probe_dev "..., 150) = 150
[+] configfs mounted or already mounted.
[+] /sys/kernel/config/nullb exists.
[+] Created probe_dev successfully.
[+] Removed probe_dev successfully.
exit_group(0) = ?
+++ exited with 0 +++
[ 82.071225][ T24] cfg80211: failed to load regulatory.db
Crash Report:
|
| 81/4 |
2026/08/13 22:13 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 13581
output: 78
thoughts: 162
Thoughts: **Capability Probe Analysis and Next Steps**
My analysis of the capability probe results indicates a successful execution. The probe program exited with a status code of 0, signifying no errors during its operation.
The output logs provide further confirmation of this success:
* The message "[+] configfs mounted or already mounted" tells me that the configuration filesystem, essential for device management, is accessible.
* The presence of "[+] /sys/kernel/config/nullb exists" confirms that the necessary directory structure for null block devices is in place.
* Crucially, the lines "[+] Created probe_dev successfully" and "[+] Removed probe_dev successfully" demonstrate that the probe was able to instantiate and then clean up a null block device using the configfs interface. This is a direct validation of the core functionality I was testing for.
* The final "exit_group(0)" and "+++ exited with 0 +++" reiterate the clean termination of the probe process.
Considering the bug description, which involves `null_process_zoned_cmd` and `nullb_device_power_store`, the successful creation and removal of a nullb device via configfs strongly suggests that the underlying environment is prepared for these operations. The probe has confirmed the basic capability required for the bug to manifest.
Therefore, I will confidently set the `ProbePassed` flag to `true`. My next step will be to proceed with generating the full reproducer, as the environment has met the necessary prerequisites. I will also provide this positive feedback to the relevant parties.
|
| 82/4 |
2026/08/13 22:13 |
tool |
set-results |
0m
Args: map[Feedback:The capability probe executed successfully. The configfs is mounted, the nullb subsystem is available, and we can create and remove nullb devices. The environment is ready. Please proceed to generate the full reproducer in the next iteration. ProbePassed:true TerminalError: TitleMatches:false]
Results: map[Feedback:The capability probe executed successfully. The configfs is mounted, the nullb subsystem is available, and we can create and remove nullb devices. The environment is ready. Please proceed to generate the full reproducer in the next iteration. ProbePassed:true TerminalError: TitleMatches:false]
|
| 83/3 |
2026/08/13 22:13 |
action |
loop-controller |
0m
Results: map[CapabilitiesVerified:true ContinueSignal:continue EquivalenceAnalysis: OracleFeedback:The capability probe executed successfully. The configfs is mounted, the nullb subsystem is available, and we can create and remove nullb devices. The environment is ready. Please proceed to generate the full reproducer in the next iteration. ReproC: Reproduced:false ReproducedBugTitle: ReproducedCrashReport:]
|
| 84/2 |
2026/08/13 22:13 |
iteration |
1 |
2m
|
| 85/3 |
2026/08/13 22:13 |
action |
If |
0m
Args: map[OracleFeedback:The capability probe executed successfully. The configfs is mounted, the nullb subsystem is available, and we can create and remove nullb devices. The environment is ready. Please proceed to generate the full reproducer in the next iteration.]
|
| 86/4 |
2026/08/13 22:13 |
agent |
strategy-refiner |
0m
Model:
Instruction: You are an expert in Linux kernel debugging.
Refine the reproduction strategy based on feedback from previous attempts.
Analyze the technical diagnosis provided in the oracle feedback and translate it into concrete,
step-by-step instructions for the repro-generator on how to modify the code structure, alignments,
offsets, or parameters of the candidate program.
=== TOOL SELECTION GUIDELINES ===
- Prefer codesearch-definition-source and codesearch-struct-layout first for symbol lookups.
- Fall back to read-file or grepper for macros, headers, or if symbol lookup fails.
=== CRITICAL PROHIBITIONS ===
- Do NOT repeat searches for the same symbols or files. Use information you have already gathered.
- Do NOT write long explanations. Keep your reasoning short and focused on actionable changes.
- Do NOT assume a bug is fixed based on git commit history.
- If you are stuck, try a different approach or proceed to generate a candidate reproducer.
Prefer calling several tools at the same time to save round-trips.
Prompt: Bug Description: BUG: sleeping function called from invalid context in null_process_zoned_cmd
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:623
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 19399, name: syz.6.4428
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
7 locks held by syz.6.4428/19399:
#0: ffff888030e500f0 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x246/0x320 fs/file.c:1259
#1: ffff88801d756450 (sb_writers#12){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#1: ffff88801d756450 (sb_writers#12){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#2: ffff888029822280 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#3: ffff888057f6c870 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#3: ffff888057f6c870 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#4: ffffffff9aaec560 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#5: ffff888051072350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
CPU: 0 UID: 0 PID: 19399 Comm: syz.6.4428 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x378/0x4d0 kernel/sched/core.c:9197
__mutex_lock_common kernel/locking/mutex.c:623 [inline]
__mutex_lock+0x118/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f95ef39e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f95f019b028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f95ef625fa0 RCX: 00007f95ef39e0d9
RDX: 0000000000000002 RSI: 0000200000000700 RDI: 0000000000000005
RBP: 00007f95ef435024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f95ef626038 R14: 00007f95ef625fa0 R15: 00007ffe19f02fb8
</TASK>
------------[ cut here ]------------
DEBUG_LOCKS_WARN_ON(lock->magic != lock)
WARNING: kernel/locking/mutex.c:625 at __mutex_lock_common kernel/locking/mutex.c:625 [inline], CPU#0: syz.6.4428/19399
WARNING: kernel/locking/mutex.c:625 at __mutex_lock+0x12d8/0x1550 kernel/locking/mutex.c:821, CPU#0: syz.6.4428/19399
Modules linked in:
CPU: 0 UID: 0 PID: 19399 Comm: syz.6.4428 Tainted: G W L syzkaller #0 PREEMPT(full)
Tainted: [W]=WARN, [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
RIP: 0010:__mutex_lock_common kernel/locking/mutex.c:625 [inline]
RIP: 0010:__mutex_lock+0x12df/0x1550 kernel/locking/mutex.c:821
Code: 7a 57 90 48 c1 e8 03 0f b6 04 18 84 c0 0f 85 47 02 00 00 83 3d 45 38 85 04 00 75 13 48 8d 3d c8 87 88 04 48 c7 c6 40 f7 ec 8b <67> 48 0f b9 3a 90 e9 75 ee ff ff 90 0f 0b 90 e9 48 f2 ff ff 90 0f
RSP: 0018:ffffc9001182ed40 EFLAGS: 00010246
RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000080000
RDX: ffffc90012289000 RSI: ffffffff8becf740 RDI: ffffffff905ac9d0
RBP: ffffc9001182eed0 R08: ffffffff90577a43 R09: 1ffffffff20aef48
R10: dffffc0000000000 R11: fffffbfff20aef49 R12: ffff88804b9c0000
R13: 0000000000000000 R14: 1ffff92002305dbc R15: 0000000000000000
FS: 00007f95f019b6c0(0000) GS:ffff888124f55000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2f81bff8 CR3: 000000007cb27000 CR4: 0000000000350ef0
Call Trace:
<TASK>
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f95ef39e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f95f019b028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f95ef625fa0 RCX: 00007f95ef39e0d9
RDX: 0000000000000002 RSI: 0000200000000700 RDI: 0000000000000005
RBP: 00007f95ef435024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f95ef626038 R14: 00007f95ef625fa0 R15: 00007ffe19f02fb8
</TASK>
----------------
Code disassembly (best guess):
0: 7a 57 jp 0x59
2: 90 nop
3: 48 c1 e8 03 shr $0x3,%rax
7: 0f b6 04 18 movzbl (%rax,%rbx,1),%eax
b: 84 c0 test %al,%al
d: 0f 85 47 02 00 00 jne 0x25a
13: 83 3d 45 38 85 04 00 cmpl $0x0,0x4853845(%rip) # 0x485385f
1a: 75 13 jne 0x2f
1c: 48 8d 3d c8 87 88 04 lea 0x48887c8(%rip),%rdi # 0x48887eb
23: 48 c7 c6 40 f7 ec 8b mov $0xffffffff8becf740,%rsi
* 2a: 67 48 0f b9 3a ud1 (%edx),%rdi <-- trapping instruction
2f: 90 nop
30: e9 75 ee ff ff jmp 0xffffeeaa
35: 90 nop
36: 0f 0b ud2
38: 90 nop
39: e9 48 f2 ff ff jmp 0xfffff286
3e: 90 nop
3f: 0f .byte 0xf
Current Strategy: An analysis of the bug report and kernel source code reveals the root cause of the issue:
1. **The Bug Mechanism**:
The stack trace shows a "sleeping function called from invalid context" warning triggered by `mutex_lock()` in `null_lock_zone()`. This happens while handling a bio submission (`blk_mq_submit_bio()`) under an `rcu_read_lock()`.
2. **Why `mutex_lock()` is called**:
In `drivers/block/null_blk/zoned.c`, `null_lock_zone()` uses a `spinlock` by default, but switches to a `mutex` if the device is configured as `memory_backed` (`dev->memory_backed == true`).
3. **Why it executes under `rcu_read_lock()`**:
When a bio is submitted, `blk_mq_submit_bio()` checks if the request queue's tag set has the `BLK_MQ_F_BLOCKING` flag. If it does, it uses `srcu_read_lock()` (which allows sleeping). If it doesn't, it falls back to `rcu_read_lock()` (which disables preemption and forbids sleeping).
4. **The Configuration Mismatch**:
When a `null_blk` device is created via configfs with `memory_backed=1`, `null_validate_conf()` correctly sets `dev->blocking = true` to indicate that the queue needs to allow blocking/sleeping.
However, if the device is also configured with `shared_tags=1`, `null_setup_tagset()` ignores the per-device `dev->blocking` flag and instead uses the global `tag_set`. The global `tag_set` is initialized based on the module parameter `g_blocking`, which defaults to `false`.
As a result, the `BLK_MQ_F_BLOCKING` flag is **not** set on the queue, causing `blk_mq_submit_bio()` to issue requests under `rcu_read_lock()`.
5. **Triggering the Bug**:
Powering on the device (`power=1`) triggers `add_disk()`, which initiates a partition scan. The partition scan submits a read bio for sector 0. This read request is dispatched under `rcu_read_lock()` and reaches `null_process_zoned_cmd()`, which calls `null_lock_zone()`. Because `memory_backed=1`, it attempts to acquire a mutex, triggering the BUG.
### Minimal Reproducer
The following standalone C program reproduces the bug by creating a `null_blk` device via configfs with the exact conflicting attributes (`zoned=1`, `memory_backed=1`, `shared_tags=1`) and then powering it on.
```c
// save as repro.c and compile with: gcc repro.c -o repro
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
void write_file(const char *path, const char *val) {
int fd = open(path, O_WRONLY);
if (fd >= 0) {
write(fd, val, strlen(val));
close(fd);
}
}
int main() {
// Ensure configfs is mounted (usually mounted at /sys/kernel/config by default)
mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
// Create a new null_blk device via configfs
mkdir("/sys/kernel/config/nullb/mydev", 0755);
// Enable zoned mode
write_file("/sys/kernel/config/nullb/mydev/zoned", "1");
// Enable memory backed mode. This forces the device to require a blocking queue
// because memory allocation and zone locking can sleep.
write_file("/sys/kernel/config/nullb/mydev/memory_backed", "1");
// Enable shared tags. This causes the device to use the global tag set.
// The global tag set is initialized based on module parameters (g_blocking),
// which defaults to false. Thus, the queue will NOT have BLK_MQ_F_BLOCKING set,
// despite the device requiring a blocking queue.
write_file("/sys/kernel/config/nullb/mydev/shared_tags", "1");
// Power on the device. This triggers add_disk(), which scans partitions.
// Partition scanning submits a read bio. Since BLK_MQ_F_BLOCKING is missing,
// blk_mq_submit_bio() issues the request under rcu_read_lock().
// The request reaches null_process_zoned_cmd() -> null_lock_zone(), which
// calls mutex_lock() (because memory_backed=1), triggering the BUG.
write_file("/sys/kernel/config/nullb/mydev/power", "1");
return 0;
}
```
Feedback: The capability probe executed successfully. The configfs is mounted, the nullb subsystem is available, and we can create and remove nullb devices. The environment is ready. Please proceed to generate the full reproducer in the next iteration.
Reply: Based on the successful capability probe, the environment is fully prepared to reproduce the bug. The configfs is mounted, and the `nullb` subsystem is available for device creation.
The root cause of the bug is a configuration mismatch in the `null_blk` driver. When a device is configured with `memory_backed=1`, it requires a blocking request queue because zone locking uses a `mutex` (which can sleep). However, if `shared_tags=1` is also set, the driver ignores the device's blocking requirement and uses the global tag set, which defaults to non-blocking. Consequently, the request queue lacks the `BLK_MQ_F_BLOCKING` flag. When the device is powered on, partition scanning submits a read bio under `rcu_read_lock()` (atomic context), leading to a "sleeping function called from invalid context" BUG when `null_lock_zone()` attempts to acquire the mutex.
Here are the concrete instructions for the repro-generator to build the final C reproducer:
1. **Setup Environment**:
- Mount `configfs` at `/sys/kernel/config` to ensure the configuration interface is available.
2. **Cleanup Previous State**:
- Attempt to write `"0"` to `/sys/kernel/config/nullb/mydev/power` and call `rmdir("/sys/kernel/config/nullb/mydev")` to clean up any leftover state from previous runs.
3. **Trigger the Bug**:
- Create a new `null_blk` device directory: `mkdir("/sys/kernel/config/nullb/mydev", 0755)`.
- Write `"1"` to `.../mydev/zoned` to enable zoned mode.
- Write `"1"` to `.../mydev/memory_backed` to force the use of a mutex for zone locking.
- Write `"1"` to `.../mydev/shared_tags` to force the use of the global (non-blocking) tag set.
- Write `"1"` to `.../mydev/power` to power on the device. This will trigger `add_disk()`, initiate partition scanning, and submit a bio that hits the sleeping lock in atomic context, reproducing the bug.
4. **Code Structure**:
- Use a simple helper function `write_file(const char *path, const char *val)` that opens the file `O_WRONLY`, writes the string, and closes it.
- Execute the steps sequentially in `main()`. No threading or complex synchronization is required.
|
| 87/5 |
2026/08/13 22:13 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 9109
output: 555
thoughts: 1637
Thoughts: **My Thought Process on Reproducing the `null_process_zoned_cmd` Bug**
Alright, let's break down my thinking process for tackling this bug report. The core issue is a "sleeping function called from invalid context" within `null_process_zoned_cmd`, and the user has provided a crucial C code snippet that *should* reproduce it, along with feedback from a previous attempt.
My immediate goal is to refine the reproduction strategy and translate it into actionable instructions for a hypothetical "repro-generator." I'm operating under the assumption that I'm an expert in kernel debugging, so I need to analyze the situation critically and ensure the generated reproducer is as robust and effective as possible.
First, I'm looking at the user's feedback: "The capability probe executed successfully. The configfs is mounted, the nullb subsystem is available, and we can create and remove nullb devices. The environment is ready." This is excellent news. It means the foundational setup – configfs being mounted and the `nullb` module or subsystem being functional – is already in place. I don't need to worry about adding steps to load modules or mount filesystems; the environment is prepped.
Then, I re-examine the user's prompt carefully. It's not just asking me to *use* the provided C code, but to *refine the reproduction strategy based on feedback* and *translate it into concrete, step-by-step instructions* for modifying code structure, alignments, offsets, or parameters.
This is where a key realization hits me: the C program provided in the "Current Strategy" is *already* a complete, minimal reproducer. I've reviewed it, and it directly performs the actions that the bug description implies trigger the error. The sequence of `mkdir`, `write_file` calls to configure the `nullb` device – especially setting `zoned=1`, `memory_backed=1`, and `shared_tags=1` – and then triggering `power=1` is precisely what leads to the problematic `mutex_lock` call within an invalid context.
So, my initial thought of "refining the code structure, alignments, offsets, or parameters" is a bit of a red herring in this specific context. The provided code *is* the refined structure. There are no obvious offsets or complex alignments to adjust. The "parameters" are the values written to the sysfs files, and those are already set correctly to trigger the bug.
Therefore, the most effective "refinement" I can do is to ensure the provided reproducer is robust and to clearly instruct the repro-generator to use *that exact code*.
However, as an expert, I always consider edge cases and potential improvements for robustness. What if the `/sys/kernel/config/nullb/mydev` directory already exists from a previous, failed run? This could cause the `mkdir` to fail, and while the `write_file` calls might still succeed if the device configuration is partial, it's better to have a clean slate.
This leads me to consider adding a cleanup step. Before creating the device, I should attempt to remove it or at least gracefully handle its existence. The simplest way to do this is to try `rmdir` and perhaps even try to power down the device first (`write_file(..., "0")`) if it exists. I also briefly considered using a unique device name, but `mydev` is common in these minimal reproducer scenarios and sufficient for the task.
So, my refined C code incorporates this robustness:
```c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
void write_file(const char *path, const char *val) {
int fd = open(path, O_WRONLY);
if (fd >= 0) {
write(fd, val, strlen(val));
close(fd);
}
}
int main() {
// Ensure configfs is mounted
mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
// Clean up in case it already exists
// Attempt to power down the device first, then remove the directory.
// We ignore errors here because it might not exist.
write_file("/sys/kernel/config/nullb/mydev/power", "0");
rmdir("/sys/kernel/config/nullb/mydev");
// Create a new null_blk device via configfs
// We check for errors, but still proceed if mkdir fails, as the device might already exist
// in a valid state that we can then configure.
if (mkdir("/sys/kernel/config/nullb/mydev", 0755) < 0) {
perror("mkdir");
// The user feedback indicates nullb is available, so we can likely proceed.
}
// Configure the null_blk device to trigger the bug.
// Setting memory_backed=1 and shared_tags=1 without BLK_MQ_F_BLOCKING
// on the queue is the key to the race condition/invalid context.
write_file("/sys/kernel/config/nullb/mydev/zoned", "1");
write_file("/sys/kernel/config/nullb/mydev/memory_backed", "1");
write_file("/sys/kernel/config/nullb/mydev/shared_tags", "1");
// Powering on the device initiates disk scan, which submits a bio,
// leading to the sleep function called from an invalid context.
write_file("/sys/kernel/config/nullb/mydev/power", "1");
return 0;
}
```
My final step is to translate this into instructions for the "repro-generator." Since the core of the problem is solved by the C code itself, and the environment is confirmed ready, my instructions will be straightforward: "Generate the following C program." I don't need to instruct on any complex code modifications, parameter tuning beyond what's in the C code, or additional tool invocations. The provided C code, with the minor robustness addition, *is* the concrete output.
The fact that syzkaller is the process name and the bug is triggered during the `power="1"` write reinforces that the setup is correct and the issue is deep within the kernel's block layer interaction with `nullb`.
In summary, my thought process evolved from understanding the bug and feedback, to critically evaluating the provided reproducer, to making minor robustness improvements, and finally to formulating clear instructions to generate the *exact* refined code. The "refine strategy" instruction, in this case, meant ensuring the provided strategy (the C code) was as solid as possible and then instructing its generation.
|
| 88/3 |
2026/08/13 22:13 |
action |
merge-strategy |
0m
Results: map[CurrentReproStrategy:Based on the successful capability probe, the environment is fully prepared to reproduce the bug. The configfs is mounted, and the `nullb` subsystem is available for device creation.
The root cause of the bug is a configuration mismatch in the `null_blk` driver. When a device is configured with `memory_backed=1`, it requires a blocking request queue because zone locking uses a `mutex` (which can sleep). However, if `shared_tags=1` is also set, the driver ignores the device's blocking requirement and uses the global tag set, which defaults to non-blocking. Consequently, the request queue lacks the `BLK_MQ_F_BLOCKING` flag. When the device is powered on, partition scanning submits a read bio under `rcu_read_lock()` (atomic context), leading to a "sleeping function called from invalid context" BUG when `null_lock_zone()` attempts to acquire the mutex.
Here are the concrete instructions for the repro-generator to build the final C reproducer:
1. **Setup Environment**:
- Mount `configfs` at `/sys/kernel/config` to ensure the configuration interface is available.
2. **Cleanup Previous State**:
- Attempt to write `"0"` to `/sys/kernel/config/nullb/mydev/power` and call `rmdir("/sys/kernel/config/nullb/mydev")` to clean up any leftover state from previous runs.
3. **Trigger the Bug**:
- Create a new `null_blk` device directory: `mkdir("/sys/kernel/config/nullb/mydev", 0755)`.
- Write `"1"` to `.../mydev/zoned` to enable zoned mode.
- Write `"1"` to `.../mydev/memory_backed` to force the use of a mutex for zone locking.
- Write `"1"` to `.../mydev/shared_tags` to force the use of the global (non-blocking) tag set.
- Write `"1"` to `.../mydev/power` to power on the device. This will trigger `add_disk()`, initiate partition scanning, and submit a bio that hits the sleeping lock in atomic context, reproducing the bug.
4. **Code Structure**:
- Use a simple helper function `write_file(const char *path, const char *val)` that opens the file `O_WRONLY`, writes the string, and closes it.
- Execute the steps sequentially in `main()`. No threading or complex synchronization is required.]
|
| 89/3 |
2026/08/13 22:13 |
agent |
repro-generator |
0m
Model:
Results: map[IsProbe:false RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
#include <errno.h>
void write_file(const char *path, const char *val) {
int fd = open(path, O_WRONLY);
if (fd < 0) {
printf("[-] Failed to open %s: %s\n", path, strerror(errno));
exit(1);
}
if (write(fd, val, strlen(val)) < 0) {
printf("[-] Failed to write to %s: %s\n", path, strerror(errno));
close(fd);
exit(1);
}
close(fd);
printf("[+] Wrote '%s' to %s\n", val, path);
}
int main() {
int res;
res = mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
if (res < 0 && errno != EBUSY) {
printf("[-] Failed to mount configfs: %s\n", strerror(errno));
} else {
printf("[+] configfs mounted or already mounted.\n");
}
// Cleanup previous state if any
int fd = open("/sys/kernel/config/nullb/mydev/power", O_WRONLY);
if (fd >= 0) {
if (write(fd, "0\n", 2) < 0) {}
close(fd);
}
rmdir("/sys/kernel/config/nullb/mydev");
res = mkdir("/sys/kernel/config/nullb/mydev", 0755);
if (res < 0) {
printf("[-] Failed to create mydev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Created mydev successfully.\n");
write_file("/sys/kernel/config/nullb/mydev/zoned", "1\n");
write_file("/sys/kernel/config/nullb/mydev/memory_backed", "1\n");
write_file("/sys/kernel/config/nullb/mydev/shared_tags", "1\n");
// This should trigger the bug
write_file("/sys/kernel/config/nullb/mydev/power", "1\n");
// Sleep to allow asynchronous tasks to finish if needed
sleep(2);
return 0;
}
]
Instruction: You are a security researcher with deep Linux kernel background.
Your goal is to generate a minimal, standalone C program for the strictly defensive
purpose of verifying a bugfix in an isolated environment.
To ensure that we can diagnose why a program might fail to run on the test environment,
you MUST include detailed logging and error checking in the generated C program:
1. Use 'printf(...)' for all progress messages and error logs.
2. Every system call (e.g., socket, bind, listen, connect, ioctl, send) must check for a failure return value.
3. If a call fails, it must print a specific error message including the function name
and the error string (use strerror(errno)), and then exit with a non-zero status.
4. The program must print a message after every successful major step.
5. Generate code that follows this pattern for all operations:
int res = do_something();
if (res < 0) {
printf("[-] Failed to do_something: %s\n", strerror(errno));
exit(1);
}
printf("[+] do_something successful.\n");
6. The compilation and development environment (including compilers, build
systems, makefiles, and kernel build/header directories) is NOT available
on the target test VM guest. Do NOT check for, build, or reference any
compilation tools, build files, or kernel development directories.
7. Do NOT execute shell commands or run external binaries (e.g. by using
functions like 'system()', 'popen()', or the 'exec' family such as
'execve()'). All environment checks, capability probings, and reproduction
steps must be performed directly using standard Linux system calls (such
as 'open', 'socket', 'ioctl', 'stat', etc.).
8. When reproducing asynchronous kernel timeouts or warnings, always
include a sufficient delay (using sleep or similar) after deleting
or unregistering the device to allow the kernel's asynchronous
timeout to trigger before program exit.
=== PHASE 2: BUG REPRODUCTION (GENERATION) ===
You must now generate a full reproducer candidate attempting to trigger the target bug/crash.
Do NOT generate a probe program. Focus directly on triggering the bug/crash described in the description.
You can assume that all necessary kernel capabilities and privileges (e.g., access to /dev/vhci,
ability to load BPF programs, etc.) have already been verified and are available in the environment.
Do not spend too much time analyzing or trying to generate a perfect one-shot reproducer.
Instead, follow an iterative approach: generate a simple candidate, execute it, analyze the results,
and improve it. Keep your reasoning steps short and focused on the next logical experiment.
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: Bug Description: BUG: sleeping function called from invalid context in null_process_zoned_cmd
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:623
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 19399, name: syz.6.4428
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
7 locks held by syz.6.4428/19399:
#0: ffff888030e500f0 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x246/0x320 fs/file.c:1259
#1: ffff88801d756450 (sb_writers#12){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#1: ffff88801d756450 (sb_writers#12){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#2: ffff888029822280 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#3: ffff888057f6c870 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#3: ffff888057f6c870 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#4: ffffffff9aaec560 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#5: ffff888051072350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
CPU: 0 UID: 0 PID: 19399 Comm: syz.6.4428 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x378/0x4d0 kernel/sched/core.c:9197
__mutex_lock_common kernel/locking/mutex.c:623 [inline]
__mutex_lock+0x118/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f95ef39e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f95f019b028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f95ef625fa0 RCX: 00007f95ef39e0d9
RDX: 0000000000000002 RSI: 0000200000000700 RDI: 0000000000000005
RBP: 00007f95ef435024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f95ef626038 R14: 00007f95ef625fa0 R15: 00007ffe19f02fb8
</TASK>
------------[ cut here ]------------
DEBUG_LOCKS_WARN_ON(lock->magic != lock)
WARNING: kernel/locking/mutex.c:625 at __mutex_lock_common kernel/locking/mutex.c:625 [inline], CPU#0: syz.6.4428/19399
WARNING: kernel/locking/mutex.c:625 at __mutex_lock+0x12d8/0x1550 kernel/locking/mutex.c:821, CPU#0: syz.6.4428/19399
Modules linked in:
CPU: 0 UID: 0 PID: 19399 Comm: syz.6.4428 Tainted: G W L syzkaller #0 PREEMPT(full)
Tainted: [W]=WARN, [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
RIP: 0010:__mutex_lock_common kernel/locking/mutex.c:625 [inline]
RIP: 0010:__mutex_lock+0x12df/0x1550 kernel/locking/mutex.c:821
Code: 7a 57 90 48 c1 e8 03 0f b6 04 18 84 c0 0f 85 47 02 00 00 83 3d 45 38 85 04 00 75 13 48 8d 3d c8 87 88 04 48 c7 c6 40 f7 ec 8b <67> 48 0f b9 3a 90 e9 75 ee ff ff 90 0f 0b 90 e9 48 f2 ff ff 90 0f
RSP: 0018:ffffc9001182ed40 EFLAGS: 00010246
RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000080000
RDX: ffffc90012289000 RSI: ffffffff8becf740 RDI: ffffffff905ac9d0
RBP: ffffc9001182eed0 R08: ffffffff90577a43 R09: 1ffffffff20aef48
R10: dffffc0000000000 R11: fffffbfff20aef49 R12: ffff88804b9c0000
R13: 0000000000000000 R14: 1ffff92002305dbc R15: 0000000000000000
FS: 00007f95f019b6c0(0000) GS:ffff888124f55000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2f81bff8 CR3: 000000007cb27000 CR4: 0000000000350ef0
Call Trace:
<TASK>
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f95ef39e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f95f019b028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f95ef625fa0 RCX: 00007f95ef39e0d9
RDX: 0000000000000002 RSI: 0000200000000700 RDI: 0000000000000005
RBP: 00007f95ef435024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f95ef626038 R14: 00007f95ef625fa0 R15: 00007ffe19f02fb8
</TASK>
----------------
Code disassembly (best guess):
0: 7a 57 jp 0x59
2: 90 nop
3: 48 c1 e8 03 shr $0x3,%rax
7: 0f b6 04 18 movzbl (%rax,%rbx,1),%eax
b: 84 c0 test %al,%al
d: 0f 85 47 02 00 00 jne 0x25a
13: 83 3d 45 38 85 04 00 cmpl $0x0,0x4853845(%rip) # 0x485385f
1a: 75 13 jne 0x2f
1c: 48 8d 3d c8 87 88 04 lea 0x48887c8(%rip),%rdi # 0x48887eb
23: 48 c7 c6 40 f7 ec 8b mov $0xffffffff8becf740,%rsi
* 2a: 67 48 0f b9 3a ud1 (%edx),%rdi <-- trapping instruction
2f: 90 nop
30: e9 75 ee ff ff jmp 0xffffeeaa
35: 90 nop
36: 0f 0b ud2
38: 90 nop
39: e9 48 f2 ff ff jmp 0xfffff286
3e: 90 nop
3f: 0f .byte 0xf
Strategy: Based on the successful capability probe, the environment is fully prepared to reproduce the bug. The configfs is mounted, and the `nullb` subsystem is available for device creation.
The root cause of the bug is a configuration mismatch in the `null_blk` driver. When a device is configured with `memory_backed=1`, it requires a blocking request queue because zone locking uses a `mutex` (which can sleep). However, if `shared_tags=1` is also set, the driver ignores the device's blocking requirement and uses the global tag set, which defaults to non-blocking. Consequently, the request queue lacks the `BLK_MQ_F_BLOCKING` flag. When the device is powered on, partition scanning submits a read bio under `rcu_read_lock()` (atomic context), leading to a "sleeping function called from invalid context" BUG when `null_lock_zone()` attempts to acquire the mutex.
Here are the concrete instructions for the repro-generator to build the final C reproducer:
1. **Setup Environment**:
- Mount `configfs` at `/sys/kernel/config` to ensure the configuration interface is available.
2. **Cleanup Previous State**:
- Attempt to write `"0"` to `/sys/kernel/config/nullb/mydev/power` and call `rmdir("/sys/kernel/config/nullb/mydev")` to clean up any leftover state from previous runs.
3. **Trigger the Bug**:
- Create a new `null_blk` device directory: `mkdir("/sys/kernel/config/nullb/mydev", 0755)`.
- Write `"1"` to `.../mydev/zoned` to enable zoned mode.
- Write `"1"` to `.../mydev/memory_backed` to force the use of a mutex for zone locking.
- Write `"1"` to `.../mydev/shared_tags` to force the use of the global (non-blocking) tag set.
- Write `"1"` to `.../mydev/power` to power on the device. This will trigger `add_disk()`, initiate partition scanning, and submit a bio that hits the sleeping lock in atomic context, reproducing the bug.
4. **Code Structure**:
- Use a simple helper function `write_file(const char *path, const char *val)` that opens the file `O_WRONLY`, writes the string, and closes it.
- Execute the steps sequentially in `main()`. No threading or complex synchronization is required.
Previous Reproducer Attempt:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
#include <errno.h>
int main() {
int res;
res = mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
if (res < 0 && errno != EBUSY) {
printf("[-] Failed to mount configfs: %s\n", strerror(errno));
} else {
printf("[+] configfs mounted or already mounted.\n");
}
struct stat st;
res = stat("/sys/kernel/config/nullb", &st);
if (res < 0) {
printf("[-] /sys/kernel/config/nullb does not exist: %s\n", strerror(errno));
exit(1);
}
printf("[+] /sys/kernel/config/nullb exists.\n");
res = mkdir("/sys/kernel/config/nullb/probe_dev", 0755);
if (res < 0) {
printf("[-] Failed to create probe_dev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Created probe_dev successfully.\n");
res = rmdir("/sys/kernel/config/nullb/probe_dev");
if (res < 0) {
printf("[-] Failed to remove probe_dev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Removed probe_dev successfully.\n");
return 0;
}
Execution Results & Debugging Feedback:
The capability probe executed successfully. The configfs is mounted, the nullb subsystem is available, and we can create and remove nullb devices. The environment is ready. Please proceed to generate the full reproducer in the next iteration.
|
| 90/4 |
2026/08/13 22:13 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 9438
output: 650
thoughts: 2169
Thoughts: **My Thought Process for Generating the `null_blk` Bug Reproducer**
Okay, so the core task at hand is to create a C reproducer for a specific kernel bug: "BUG: sleeping function called from invalid context in null_process_zoned_cmd". My goal is to craft a minimal, reliable C program that triggers this exact issue.
The bug report and its associated stack trace are my primary guides. I see a clear path outlined:
1. **Mount `configfs`**: This is the fundamental requirement for interacting with `configfs`-based kernel modules like `null_blk`. Without it, none of the subsequent steps will work.
2. **Cleanup Previous State**: It's good practice to ensure a clean slate. This involves removing any existing `nullb` device configuration, specifically `/sys/kernel/config/nullb/mydev`.
3. **Create the Device Directory**: I need to create the specific directory structure under `configfs` for our `nullb` device, which is `/sys/kernel/config/nullb/mydev`.
4. **Configure Device Properties**: The bug report implies specific settings trigger the problem. I need to write values to particular files within the newly created device directory:
* `zoned`: Set to "1". This is a key parameter for zoned block devices.
* `memory_backed`: Set to "1". This is another crucial setting that, in conjunction with others, seems to lead to the problematic mutex acquisition.
* `shared_tags`: Set to "1". This setting influences how I/O requests are handled by the block layer's multi-queue (`blk-mq`) subsystem.
* `power`: Set to "1". This is the action that directly triggers the bug, according to the stack trace, as it initiates a write operation that eventually leads to the sleeping function call in an invalid context.
My initial C code draft reflects these steps. I've included necessary headers, a helper function `write_file` for cleaner file operations, and the `main` function to orchestrate the sequence.
```c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
#include <errno.h>
void write_file(const char *path, const char *val) {
int fd = open(path, O_WRONLY);
if (fd < 0) {
printf("[-] Failed to open %s: %s\n", path, strerror(errno));
exit(1);
}
if (write(fd, val, strlen(val)) < 0) {
printf("[-] Failed to write to %s: %s\n", path, strerror(errno));
close(fd);
exit(1);
}
close(fd);
printf("[+] Wrote '%s' to %s\n", val, path);
}
int main() {
int res;
res = mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
if (res < 0 && errno != EBUSY) {
printf("[-] Failed to mount configfs: %s\n", strerror(errno));
} else {
printf("[+] configfs mounted or already mounted.\n");
}
// Cleanup previous state if any
int fd = open("/sys/kernel/config/nullb/mydev/power", O_WRONLY);
if (fd >= 0) {
write(fd, "0\n", 2);
close(fd);
}
rmdir("/sys/kernel/config/nullb/mydev");
res = mkdir("/sys/kernel/config/nullb/mydev", 0755);
if (res < 0) {
printf("[-] Failed to create mydev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Created mydev successfully.\n");
write_file("/sys/kernel/config/nullb/mydev/zoned", "1\n");
write_file("/sys/kernel/config/nullb/mydev/memory_backed", "1\n");
write_file("/sys/kernel/config/nullb/mydev/shared_tags", "1\n");
// This should trigger the bug
write_file("/sys/kernel/config/nullb/mydev/power", "1\n");
// Sleep to allow asynchronous tasks to finish if needed
sleep(2);
return 0;
}
```
Now, I reread the bug details more carefully. The crucial part is the stack trace, which is more detailed than just the top-level function. It reveals:
`BUG: sleeping function called from invalid context in null_process_zoned_cmd`
...
` nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501`
` flush_write_buffer fs/configfs/file.c:207 [inline]`
` configfs_write_iter+0x337/0x430 fs/configfs/file.c:229`
This confirms that the bug is triggered directly by writing to the `power` attribute. The subsequent deeper stack trace, which I then investigate, paints a much clearer picture:
`null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]`
`null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732`
... (and many more kernel functions like `__mutex_lock`)
The core problem emerges from understanding the interplay of flags:
* `shared_tags` being set enables `blk_mq_submit_bio` to potentially issue I/O directly under an `rcu_read_lock`. This is an atomic context.
* `memory_backed` (and `zoned`) causes `null_lock_zone` to attempt to acquire a mutex.
* The violation occurs because `blk_mq_submit_bio`, believing it's safe to issue directly due to `shared_tags`, ends up calling into `null_queue_rq`, which then calls `null_process_zoned_cmd`. This path eventually leads to `null_lock_zone` trying to take a mutex (`__mutex_lock`) *while still holding the `rcu_read_lock`*. This is the "sleeping function called from invalid context" scenario.
So, the initial strategy and the generated code align perfectly with the bug's trigger mechanism. The specific sequence of writes (`zoned`, `memory_backed`, `shared_tags`, and finally `power`) is precisely what's needed to set up the conflicting conditions within the kernel's block layer and `null_blk` driver.
A quick check regarding the `null_blk` module loading: the fact that `/sys/kernel/config/nullb` exists, as implied by the problem setup and my initial probing, suggests that the module is already loaded or built-in. Syzkaller typically doesn't explicitly load modules unless it's part of its fuzzing strategy; if the path exists, we can assume the module is active.
Therefore, no further refinement to the reproducer's logic itself is needed. The C code accurately reflects the described exploit path. The next step is to package this reproducer and report it.
|
| 91/4 |
2026/08/13 22:14 |
tool |
set-results |
0m
Args: map[IsProbe:false RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
#include <errno.h>
void write_file(const char *path, const char *val) {
int fd = open(path, O_WRONLY);
if (fd < 0) {
printf("[-] Failed to open %s: %s\n", path, strerror(errno));
exit(1);
}
if (write(fd, val, strlen(val)) < 0) {
printf("[-] Failed to write to %s: %s\n", path, strerror(errno));
close(fd);
exit(1);
}
close(fd);
printf("[+] Wrote '%s' to %s\n", val, path);
}
int main() {
int res;
res = mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
if (res < 0 && errno != EBUSY) {
printf("[-] Failed to mount configfs: %s\n", strerror(errno));
} else {
printf("[+] configfs mounted or already mounted.\n");
}
// Cleanup previous state if any
int fd = open("/sys/kernel/config/nullb/mydev/power", O_WRONLY);
if (fd >= 0) {
if (write(fd, "0\n", 2) < 0) {}
close(fd);
}
rmdir("/sys/kernel/config/nullb/mydev");
res = mkdir("/sys/kernel/config/nullb/mydev", 0755);
if (res < 0) {
printf("[-] Failed to create mydev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Created mydev successfully.\n");
write_file("/sys/kernel/config/nullb/mydev/zoned", "1\n");
write_file("/sys/kernel/config/nullb/mydev/memory_backed", "1\n");
write_file("/sys/kernel/config/nullb/mydev/shared_tags", "1\n");
// This should trigger the bug
write_file("/sys/kernel/config/nullb/mydev/power", "1\n");
// Sleep to allow asynchronous tasks to finish if needed
sleep(2);
return 0;
}
]
Results: map[IsProbe:false RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
#include <errno.h>
void write_file(const char *path, const char *val) {
int fd = open(path, O_WRONLY);
if (fd < 0) {
printf("[-] Failed to open %s: %s\n", path, strerror(errno));
exit(1);
}
if (write(fd, val, strlen(val)) < 0) {
printf("[-] Failed to write to %s: %s\n", path, strerror(errno));
close(fd);
exit(1);
}
close(fd);
printf("[+] Wrote '%s' to %s\n", val, path);
}
int main() {
int res;
res = mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
if (res < 0 && errno != EBUSY) {
printf("[-] Failed to mount configfs: %s\n", strerror(errno));
} else {
printf("[+] configfs mounted or already mounted.\n");
}
// Cleanup previous state if any
int fd = open("/sys/kernel/config/nullb/mydev/power", O_WRONLY);
if (fd >= 0) {
if (write(fd, "0\n", 2) < 0) {}
close(fd);
}
rmdir("/sys/kernel/config/nullb/mydev");
res = mkdir("/sys/kernel/config/nullb/mydev", 0755);
if (res < 0) {
printf("[-] Failed to create mydev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Created mydev successfully.\n");
write_file("/sys/kernel/config/nullb/mydev/zoned", "1\n");
write_file("/sys/kernel/config/nullb/mydev/memory_backed", "1\n");
write_file("/sys/kernel/config/nullb/mydev/shared_tags", "1\n");
// This should trigger the bug
write_file("/sys/kernel/config/nullb/mydev/power", "1\n");
// Sleep to allow asynchronous tasks to finish if needed
sleep(2);
return 0;
}
]
|
| 92/3 |
2026/08/13 22:14 |
loop |
|
0m
|
| 93/4 |
2026/08/13 22:14 |
iteration |
0 |
0m
|
| 94/5 |
2026/08/13 22:14 |
action |
merge-repro-c |
0m
Results: map[CurrentCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
#include <errno.h>
void write_file(const char *path, const char *val) {
int fd = open(path, O_WRONLY);
if (fd < 0) {
printf("[-] Failed to open %s: %s\n", path, strerror(errno));
exit(1);
}
if (write(fd, val, strlen(val)) < 0) {
printf("[-] Failed to write to %s: %s\n", path, strerror(errno));
close(fd);
exit(1);
}
close(fd);
printf("[+] Wrote '%s' to %s\n", val, path);
}
int main() {
int res;
res = mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
if (res < 0 && errno != EBUSY) {
printf("[-] Failed to mount configfs: %s\n", strerror(errno));
} else {
printf("[+] configfs mounted or already mounted.\n");
}
// Cleanup previous state if any
int fd = open("/sys/kernel/config/nullb/mydev/power", O_WRONLY);
if (fd >= 0) {
if (write(fd, "0\n", 2) < 0) {}
close(fd);
}
rmdir("/sys/kernel/config/nullb/mydev");
res = mkdir("/sys/kernel/config/nullb/mydev", 0755);
if (res < 0) {
printf("[-] Failed to create mydev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Created mydev successfully.\n");
write_file("/sys/kernel/config/nullb/mydev/zoned", "1\n");
write_file("/sys/kernel/config/nullb/mydev/memory_backed", "1\n");
write_file("/sys/kernel/config/nullb/mydev/shared_tags", "1\n");
// This should trigger the bug
write_file("/sys/kernel/config/nullb/mydev/power", "1\n");
// Sleep to allow asynchronous tasks to finish if needed
sleep(2);
return 0;
}
]
|
| 95/5 |
2026/08/13 22:14 |
action |
compile-c-prog |
0m
Results: map[CompilerError: FormattedReproC:#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
#include <errno.h>
void write_file(const char *path, const char *val) {
int fd = open(path, O_WRONLY);
if (fd < 0) {
printf("[-] Failed to open %s: %s\n", path, strerror(errno));
exit(1);
}
if (write(fd, val, strlen(val)) < 0) {
printf("[-] Failed to write to %s: %s\n", path, strerror(errno));
close(fd);
exit(1);
}
close(fd);
printf("[+] Wrote '%s' to %s\n", val, path);
}
int main() {
int res;
res = mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
if (res < 0 && errno != EBUSY) {
printf("[-] Failed to mount configfs: %s\n", strerror(errno));
} else {
printf("[+] configfs mounted or already mounted.\n");
}
// Cleanup previous state if any
int fd = open("/sys/kernel/config/nullb/mydev/power", O_WRONLY);
if (fd >= 0) {
if (write(fd, "0\n", 2) < 0) {}
close(fd);
}
rmdir("/sys/kernel/config/nullb/mydev");
res = mkdir("/sys/kernel/config/nullb/mydev", 0755);
if (res < 0) {
printf("[-] Failed to create mydev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Created mydev successfully.\n");
write_file("/sys/kernel/config/nullb/mydev/zoned", "1\n");
write_file("/sys/kernel/config/nullb/mydev/memory_backed", "1\n");
write_file("/sys/kernel/config/nullb/mydev/shared_tags", "1\n");
// This should trigger the bug
write_file("/sys/kernel/config/nullb/mydev/power", "1\n");
// Sleep to allow asynchronous tasks to finish if needed
sleep(2);
return 0;
}
]
|
| 96/5 |
2026/08/13 22:14 |
action |
If |
0m
Args:
|
| 97/3 |
2026/08/13 22:14 |
action |
run-c-repro |
1m
Results: map[CandidateBugTitle:BUG: sleeping function called from invalid context in null_process_zoned_cmd CandidateCrashReport:BUG: sleeping function called from invalid context at kernel/locking/mutex.c:623
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5838, name: syz-executor260
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
6 locks held by syz-executor260/5838:
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#1: ffff88810728f080 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#3: ffffffff9ab67760 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#4: ffff8881145e8350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
CPU: 0 UID: 0 PID: 5838 Comm: syz-executor260 Not tainted syzkaller #1 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x378/0x4d0 kernel/sched/core.c:9197
__mutex_lock_common kernel/locking/mutex.c:623 [inline]
__mutex_lock+0x118/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc940d6d2f7
Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
</TASK>
=============================
[ BUG: Invalid wait context ]
syzkaller #1 Tainted: G W
-----------------------------
syz-executor260/5838 is trying to lock:
ffff888122ac0060 (&zone->mutex){+.+.}-{4:4}, at: null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
ffff888122ac0060 (&zone->mutex){+.+.}-{4:4}, at: null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
other info that might help us debug this:
context-{5:5}
6 locks held by syz-executor260/5838:
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#1: ffff88810728f080 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#3: ffffffff9ab67760 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#4: ffff8881145e8350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
stack backtrace:
CPU: 0 UID: 0 PID: 5838 Comm: syz-executor260 Tainted: G W syzkaller #1 PREEMPT(full)
Tainted: [W]=WARN
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
print_lock_invalid_wait_context kernel/locking/lockdep.c:4830 [inline]
check_wait_context kernel/locking/lockdep.c:4902 [inline]
__lock_acquire+0xe39/0x2cf0 kernel/locking/lockdep.c:5187
lock_acquire+0x106/0x350 kernel/locking/lockdep.c:5868
__mutex_lock_common kernel/locking/mutex.c:646 [inline]
__mutex_lock+0x19d/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc940d6d2f7
Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
</TASK>
null_blk: disk mydev created
CandidateReproduced:true ConsoleOutput:[ 68.869913][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 68.869924][ T33] audit: type=1400 audit(1786659325.505:201): avc: denied { transition } for pid=5822 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 68.887530][ T33] audit: type=1400 audit(1786659325.515:202): avc: denied { noatsecure } for pid=5822 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 68.893677][ T33] audit: type=1400 audit(1786659325.515:203): avc: denied { rlimitinh } for pid=5822 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 68.900040][ T33] audit: type=1400 audit(1786659325.515:204): avc: denied { siginh } for pid=5822 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:5318' (ED25519) to the list of known hosts.
[ 71.165814][ T33] audit: type=1400 audit(1786659327.795:205): avc: denied { mounton } for pid=5838 comm="syz-executor260" path="/sys/kernel/config" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[ 71.173450][ T33] audit: type=1400 audit(1786659327.795:206): avc: denied { mount } for pid=5838 comm="syz-executor260" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=filesystem permissive=1
[ 71.180739][ T33] audit: type=1400 audit(1786659327.795:207): avc: denied { search } for pid=5838 comm="syz-executor260" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[ 71.186440][ T5838] null_blk: mydev: using native zone append
[ 71.188302][ T33] audit: type=1400 audit(1786659327.795:208): avc: denied { search } for pid=5838 comm="syz-executor260" name="nullb" dev="configfs" ino=3536 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[ 71.196895][ T33] audit: type=1400 audit(1786659327.795:209): avc: denied { search } for pid=5838 comm="syz-executor260" name="/" dev="configfs" ino=68 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[ 71.208272][ T33] audit: type=1400 audit(1786659327.795:210): avc: denied { search } for pid=5838 comm="syz-executor260" name="nullb" dev="configfs" ino=3536 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
[ 71.226923][ T5838] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:623
[ 71.230278][ T5838] in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5838, name: syz-executor260
[ 71.233486][ T5838] preempt_count: 0, expected: 0
[ 71.235033][ T5838] RCU nest depth: 1, expected: 0
[ 71.236583][ T5838] 6 locks held by syz-executor260/5838:
[ 71.238452][ T5838] #0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0
[ 71.241293][ T5838] #1: ffff88810728f080 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430
[ 71.244316][ T5838] #2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430
[ 71.247341][ T5838] #3: ffffffff9ab67760 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380
[ 71.250316][ T5838] #4: ffff8881145e8350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70
[ 71.253176][ T5838] #5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40
[ 71.256213][ T5838] CPU: 0 UID: 0 PID: 5838 Comm: syz-executor260 Not tainted syzkaller #1 PREEMPT(full)
[ 71.256222][ T5838] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 71.256228][ T5838] Call Trace:
[ 71.256233][ T5838] <TASK>
[ 71.256237][ T5838] dump_stack_lvl+0xe8/0x150
[ 71.256251][ T5838] __might_resched+0x378/0x4d0
[ 71.256267][ T5838] __mutex_lock+0x118/0x1550
[ 71.256282][ T5838] ? do_raw_spin_unlock+0xf5/0x210
[ 71.256301][ T5838] ? null_process_zoned_cmd+0x6f6/0xf80
[ 71.256312][ T5838] ? __pfx___mutex_lock+0x10/0x10
[ 71.256325][ T5838] ? _raw_spin_unlock_irqrestore+0x4c/0x80
[ 71.256335][ T5838] ? __mod_timer+0xb53/0xed0
[ 71.256350][ T5838] null_process_zoned_cmd+0x6f6/0xf80
[ 71.256362][ T5838] ? blk_mq_start_request+0x4bf/0x870
[ 71.256375][ T5838] null_queue_rq+0x8bc/0xe70
[ 71.256389][ T5838] blk_mq_try_issue_directly+0x3f4/0x880
[ 71.256399][ T5838] ? __pfx_blk_mq_try_issue_directly+0x10/0x10
[ 71.256407][ T5838] ? ktime_get+0x1f5/0x220
[ 71.256419][ T5838] ? blk_account_io_start+0x578/0x8c0
[ 71.256432][ T5838] blk_mq_submit_bio+0x20c0/0x2a40
[ 71.256442][ T5838] ? blk_mq_submit_bio+0x306/0x2a40
[ 71.256453][ T5838] ? __pfx_blk_mq_submit_bio+0x10/0x10
[ 71.256460][ T5838] ? blk_cgroup_bio_start+0x5d4/0x670
[ 71.256472][ T5838] ? __pfx_blk_cgroup_bio_start+0x10/0x10
[ 71.256483][ T5838] ? __submit_bio+0x7e/0x340
[ 71.256492][ T5838] submit_bio_noacct_nocheck+0x2f4/0xa40
[ 71.256508][ T5838] ? __pfx_submit_bio_noacct_nocheck+0x10/0x10
[ 71.256521][ T5838] ? submit_bio_noacct+0xf7b/0x1b20
[ 71.256530][ T5838] ? blkcg_set_ioprio+0x16b/0x2a0
[ 71.256544][ T5838] block_read_full_folio+0x7a6/0x810
[ 71.256555][ T5838] ? __pfx_blkdev_get_block+0x10/0x10
[ 71.256565][ T5838] filemap_read_folio+0x12c/0x3a0
[ 71.256576][ T5838] ? __pfx_blkdev_read_folio+0x10/0x10
[ 71.256585][ T5838] ? __pfx_filemap_read_folio+0x10/0x10
[ 71.256595][ T5838] ? filemap_add_folio+0x350/0x530
[ 71.256605][ T5838] do_read_cache_folio+0x354/0x590
[ 71.256615][ T5838] ? __pfx_blkdev_read_folio+0x10/0x10
[ 71.256626][ T5838] read_part_sector+0xb6/0x2b0
[ 71.256635][ T5838] adfspart_check_ICS+0xb1/0x960
[ 71.256644][ T5838] ? seq_buf_printf+0x212/0x2d0
[ 71.256658][ T5838] ? __pfx_adfspart_check_ICS+0x10/0x10
[ 71.256668][ T5838] ? bdev_disk_changed+0x56c/0x17a0
[ 71.256674][ T5838] ? bdev_disk_changed+0x56c/0x17a0
[ 71.256685][ T5838] bdev_disk_changed+0x851/0x17a0
[ 71.256702][ T5838] ? __pfx_bdev_disk_changed+0x10/0x10
[ 71.256713][ T5838] ? file_init_path+0x42e/0x5a0
[ 71.256730][ T5838] blkdev_get_whole+0x372/0x510
[ 71.256741][ T5838] bdev_open+0x324/0xd70
[ 71.256753][ T5838] bdev_file_open_by_dev+0x1be/0x240
[ 71.256763][ T5838] disk_scan_partitions+0x1bb/0x2c0
[ 71.256775][ T5838] add_disk_fwnode+0x24b/0x3a0
[ 71.256786][ T5838] null_add_dev+0x130b/0x1d70
[ 71.256797][ T5838] ? __pfx_null_add_dev+0x10/0x10
[ 71.256815][ T5838] ? configfs_write_iter+0x238/0x430
[ 71.256829][ T5838] nullb_device_power_store+0x240/0x380
[ 71.256838][ T5838] ? __pfx_nullb_device_power_store+0x10/0x10
[ 71.256847][ T5838] ? down_read+0x2be/0x330
[ 71.256857][ T5838] ? __pfx_nullb_device_power_store+0x10/0x10
[ 71.256866][ T5838] configfs_write_iter+0x337/0x430
[ 71.256878][ T5838] vfs_write+0x612/0xba0
[ 71.256892][ T5838] ? __pfx_vfs_write+0x10/0x10
[ 71.256903][ T5838] ? do_sys_openat2+0x14e/0x200
[ 71.256910][ T5838] ? kmem_cache_free+0x182/0x650
[ 71.256921][ T5838] ? fd_install+0x94/0x3d0
[ 71.256935][ T5838] ksys_write+0x150/0x270
[ 71.256946][ T5838] ? __pfx_ksys_write+0x10/0x10
[ 71.256959][ T5838] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 71.256968][ T5838] do_syscall_64+0x174/0x580
[ 71.256978][ T5838] ? trace_irq_disable+0x3b/0x140
[ 71.256987][ T5838] ? clear_bhb_loop+0x70/0xc0
[ 71.257018][ T5838] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 71.257026][ T5838] RIP: 0033:0x7fc940d6d2f7
[ 71.257036][ T5838] Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
[ 71.257042][ T5838] RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
[ 71.257051][ T5838] RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
[ 71.257056][ T5838] RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
[ 71.257061][ T5838] RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
[ 71.257065][ T5838] R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
[ 71.257070][ T5838] R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
[ 71.257083][ T5838] </TASK>
[ 71.257086][ T5838]
[ 71.395837][ T5838] =============================
[ 71.397405][ T5838] [ BUG: Invalid wait context ]
[ 71.398939][ T5838] syzkaller #1 Tainted: G W
[ 71.400802][ T5838] -----------------------------
[ 71.402324][ T5838] syz-executor260/5838 is trying to lock:
[ 71.404091][ T5838] ffff888122ac0060 (&zone->mutex){+.+.}-{4:4}, at: null_process_zoned_cmd+0x6f6/0xf80
[ 71.407042][ T5838] other info that might help us debug this:
[ 71.408866][ T5838] context-{5:5}
[ 71.409961][ T5838] 6 locks held by syz-executor260/5838:
[ 71.411676][ T5838] #0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0
[ 71.414472][ T5838] #1: ffff88810728f080 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430
[ 71.417520][ T5838] #2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430
[ 71.420525][ T5838] #3: ffffffff9ab67760 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380
[ 71.423455][ T5838] #4: ffff8881145e8350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70
[ 71.426306][ T5838] #5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40
[ 71.429350][ T5838] stack backtrace:
[ 71.430530][ T5838] CPU: 0 UID: 0 PID: 5838 Comm: syz-executor260 Tainted: G W syzkaller #1 PREEMPT(full)
[ 71.430541][ T5838] Tainted: [W]=WARN
[ 71.430543][ T5838] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 71.430548][ T5838] Call Trace:
[ 71.430553][ T5838] <TASK>
[ 71.430557][ T5838] dump_stack_lvl+0xe8/0x150
[ 71.430569][ T5838] __lock_acquire+0xe39/0x2cf0
[ 71.430578][ T5838] ? __show_trace_log_lvl+0x478/0x550
[ 71.430590][ T5838] ? null_process_zoned_cmd+0x6f6/0xf80
[ 71.430600][ T5838] lock_acquire+0x106/0x350
[ 71.430607][ T5838] ? null_process_zoned_cmd+0x6f6/0xf80
[ 71.430616][ T5838] ? dump_stack_lvl+0x135/0x150
[ 71.430625][ T5838] ? __might_resched+0x378/0x4d0
[ 71.430637][ T5838] __mutex_lock+0x19d/0x1550
[ 71.430647][ T5838] ? null_process_zoned_cmd+0x6f6/0xf80
[ 71.430656][ T5838] ? do_raw_spin_unlock+0xf5/0x210
[ 71.430666][ T5838] ? null_process_zoned_cmd+0x6f6/0xf80
[ 71.430675][ T5838] ? __pfx___mutex_lock+0x10/0x10
[ 71.430685][ T5838] ? _raw_spin_unlock_irqrestore+0x4c/0x80
[ 71.430693][ T5838] ? __mod_timer+0xb53/0xed0
[ 71.430705][ T5838] null_process_zoned_cmd+0x6f6/0xf80
[ 71.430714][ T5838] ? blk_mq_start_request+0x4bf/0x870
[ 71.430725][ T5838] null_queue_rq+0x8bc/0xe70
[ 71.430734][ T5838] blk_mq_try_issue_directly+0x3f4/0x880
[ 71.430743][ T5838] ? __pfx_blk_mq_try_issue_directly+0x10/0x10
[ 71.430751][ T5838] ? ktime_get+0x1f5/0x220
[ 71.430761][ T5838] ? blk_account_io_start+0x578/0x8c0
[ 71.430772][ T5838] blk_mq_submit_bio+0x20c0/0x2a40
[ 71.430780][ T5838] ? blk_mq_submit_bio+0x306/0x2a40
[ 71.430789][ T5838] ? __pfx_blk_mq_submit_bio+0x10/0x10
[ 71.430795][ T5838] ? blk_cgroup_bio_start+0x5d4/0x670
[ 71.430805][ T5838] ? __pfx_blk_cgroup_bio_start+0x10/0x10
[ 71.430813][ T5838] ? __submit_bio+0x7e/0x340
[ 71.430821][ T5838] submit_bio_noacct_nocheck+0x2f4/0xa40
[ 71.430834][ T5838] ? __pfx_submit_bio_noacct_nocheck+0x10/0x10
[ 71.430845][ T5838] ? submit_bio_noacct+0xf7b/0x1b20
[ 71.430852][ T5838] ? blkcg_set_ioprio+0x16b/0x2a0
[ 71.430863][ T5838] block_read_full_folio+0x7a6/0x810
[ 71.430871][ T5838] ? __pfx_blkdev_get_block+0x10/0x10
[ 71.430880][ T5838] filemap_read_folio+0x12c/0x3a0
[ 71.430890][ T5838] ? __pfx_blkdev_read_folio+0x10/0x10
[ 71.430897][ T5838] ? __pfx_filemap_read_folio+0x10/0x10
[ 71.430906][ T5838] ? filemap_add_folio+0x350/0x530
[ 71.430914][ T5838] do_read_cache_folio+0x354/0x590
[ 71.430923][ T5838] ? __pfx_blkdev_read_folio+0x10/0x10
[ 71.430932][ T5838] read_part_sector+0xb6/0x2b0
[ 71.430939][ T5838] adfspart_check_ICS+0xb1/0x960
[ 71.430947][ T5838] ? seq_buf_printf+0x212/0x2d0
[ 71.430957][ T5838] ? __pfx_adfspart_check_ICS+0x10/0x10
[ 71.430965][ T5838] ? bdev_disk_changed+0x56c/0x17a0
[ 71.430971][ T5838] ? bdev_disk_changed+0x56c/0x17a0
[ 71.430997][ T5838] bdev_disk_changed+0x851/0x17a0
[ 71.431008][ T5838] ? __pfx_bdev_disk_changed+0x10/0x10
[ 71.431016][ T5838] ? file_init_path+0x42e/0x5a0
[ 71.431023][ T5838] blkdev_get_whole+0x372/0x510
[ 71.431031][ T5838] bdev_open+0x324/0xd70
[ 71.431040][ T5838] bdev_file_open_by_dev+0x1be/0x240
[ 71.431048][ T5838] disk_scan_partitions+0x1bb/0x2c0
[ 71.431057][ T5838] add_disk_fwnode+0x24b/0x3a0
[ 71.431067][ T5838] null_add_dev+0x130b/0x1d70
[ 71.431075][ T5838] ? __pfx_null_add_dev+0x10/0x10
[ 71.431084][ T5838] ? configfs_write_iter+0x238/0x430
[ 71.431095][ T5838] nullb_device_power_store+0x240/0x380
[ 71.431103][ T5838] ? __pfx_nullb_device_power_store+0x10/0x10
[ 71.431115][ T5838] ? down_read+0x2be/0x330
[ 71.431124][ T5838] ? __pfx_nullb_device_power_store+0x10/0x10
[ 71.431131][ T5838] configfs_write_iter+0x337/0x430
[ 71.431141][ T5838] vfs_write+0x612/0xba0
[ 71.431152][ T5838] ? __pfx_vfs_write+0x10/0x10
[ 71.431161][ T5838] ? do_sys_openat2+0x14e/0x200
[ 71.431167][ T5838] ? kmem_cache_free+0x182/0x650
[ 71.431178][ T5838] ? fd_install+0x94/0x3d0
[ 71.431187][ T5838] ksys_write+0x150/0x270
[ 71.431196][ T5838] ? __pfx_ksys_write+0x10/0x10
[ 71.431206][ T5838] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 71.431214][ T5838] do_syscall_64+0x174/0x580
[ 71.431223][ T5838] ? trace_irq_disable+0x3b/0x140
[ 71.431231][ T5838] ? clear_bhb_loop+0x70/0xc0
[ 71.431239][ T5838] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 71.431246][ T5838] RIP: 0033:0x7fc940d6d2f7
[ 71.431256][ T5838] Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
[ 71.431262][ T5838] RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
[ 71.431270][ T5838] RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
[ 71.431276][ T5838] RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
[ 71.431280][ T5838] RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
[ 71.431285][ T5838] R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
[ 71.431289][ T5838] R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
[ 71.431296][ T5838] </TASK>
[ 71.583324][ T5838] null_blk: disk mydev created
[ 71.858278][ T1374] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.860509][ T1374] ieee802154 phy1 wpan1: encryption failed: -22
[+] configfs mounted or already mounted.
[+] Created mydev successfully.
[+] Wrote '1
' to /sys/kernel/config/nullb/mydev/zoned
[+] Wrote '1
' to /sys/kernel/config/nullb/mydev/memory_backed
[+] Wrote '1
' to /sys/kernel/config/nullb/mydev/shared_tags
[+] Wrote '1
' to /sys/kernel/config/nullb/mydev/power
[ 73.908126][ T33] kauditd_printk_skb: 29 callbacks suppressed
[ 73.908138][ T33] audit: type=1400 audit(1786659330.545:240): avc: denied { write } for pid=5872 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 73.931908][ T33] audit: type=1400 audit(1786659330.565:241): avc: denied { write } for pid=5875 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.267196][ T33] audit: type=1400 audit(1786659330.895:242): avc: denied { write } for pid=5878 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.291483][ T33] audit: type=1400 audit(1786659330.925:243): avc: denied { write } for pid=5881 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.904623][ T33] audit: type=1400 audit(1786659331.535:244): avc: denied { write } for pid=5884 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.928930][ T33] audit: type=1400 audit(1786659331.565:245): avc: denied { write } for pid=5887 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
OtherCrashReports:<nil> StraceOutput: TestError:]
|
| 98/3 |
2026/08/13 22:15 |
action |
truncate-log |
0m
Results: map[TruncatedConsoleOutput:[ 71.256267][ T5838] __mutex_lock+0x118/0x1550
[ 71.256282][ T5838] ? do_raw_spin_unlock+0xf5/0x210
[ 71.256301][ T5838] ? null_process_zoned_cmd+0x6f6/0xf80
[ 71.256312][ T5838] ? __pfx___mutex_lock+0x10/0x10
[ 71.256325][ T5838] ? _raw_spin_unlock_irqrestore+0x4c/0x80
[ 71.256335][ T5838] ? __mod_timer+0xb53/0xed0
[ 71.256350][ T5838] null_process_zoned_cmd+0x6f6/0xf80
[ 71.256362][ T5838] ? blk_mq_start_request+0x4bf/0x870
[ 71.256375][ T5838] null_queue_rq+0x8bc/0xe70
[ 71.256389][ T5838] blk_mq_try_issue_directly+0x3f4/0x880
[ 71.256399][ T5838] ? __pfx_blk_mq_try_issue_directly+0x10/0x10
[ 71.256407][ T5838] ? ktime_get+0x1f5/0x220
[ 71.256419][ T5838] ? blk_account_io_start+0x578/0x8c0
[ 71.256432][ T5838] blk_mq_submit_bio+0x20c0/0x2a40
[ 71.256442][ T5838] ? blk_mq_submit_bio+0x306/0x2a40
[ 71.256453][ T5838] ? __pfx_blk_mq_submit_bio+0x10/0x10
[ 71.256460][ T5838] ? blk_cgroup_bio_start+0x5d4/0x670
[ 71.256472][ T5838] ? __pfx_blk_cgroup_bio_start+0x10/0x10
[ 71.256483][ T5838] ? __submit_bio+0x7e/0x340
[ 71.256492][ T5838] submit_bio_noacct_nocheck+0x2f4/0xa40
[ 71.256508][ T5838] ? __pfx_submit_bio_noacct_nocheck+0x10/0x10
[ 71.256521][ T5838] ? submit_bio_noacct+0xf7b/0x1b20
[ 71.256530][ T5838] ? blkcg_set_ioprio+0x16b/0x2a0
[ 71.256544][ T5838] block_read_full_folio+0x7a6/0x810
[ 71.256555][ T5838] ? __pfx_blkdev_get_block+0x10/0x10
[ 71.256565][ T5838] filemap_read_folio+0x12c/0x3a0
[ 71.256576][ T5838] ? __pfx_blkdev_read_folio+0x10/0x10
[ 71.256585][ T5838] ? __pfx_filemap_read_folio+0x10/0x10
[ 71.256595][ T5838] ? filemap_add_folio+0x350/0x530
[ 71.256605][ T5838] do_read_cache_folio+0x354/0x590
[ 71.256615][ T5838] ? __pfx_blkdev_read_folio+0x10/0x10
[ 71.256626][ T5838] read_part_sector+0xb6/0x2b0
[ 71.256635][ T5838] adfspart_check_ICS+0xb1/0x960
[ 71.256644][ T5838] ? seq_buf_printf+0x212/0x2d0
[ 71.256658][ T5838] ? __pfx_adfspart_check_ICS+0x10/0x10
[ 71.256668][ T5838] ? bdev_disk_changed+0x56c/0x17a0
[ 71.256674][ T5838] ? bdev_disk_changed+0x56c/0x17a0
[ 71.256685][ T5838] bdev_disk_changed+0x851/0x17a0
[ 71.256702][ T5838] ? __pfx_bdev_disk_changed+0x10/0x10
[ 71.256713][ T5838] ? file_init_path+0x42e/0x5a0
[ 71.256730][ T5838] blkdev_get_whole+0x372/0x510
[ 71.256741][ T5838] bdev_open+0x324/0xd70
[ 71.256753][ T5838] bdev_file_open_by_dev+0x1be/0x240
[ 71.256763][ T5838] disk_scan_partitions+0x1bb/0x2c0
[ 71.256775][ T5838] add_disk_fwnode+0x24b/0x3a0
[ 71.256786][ T5838] null_add_dev+0x130b/0x1d70
[ 71.256797][ T5838] ? __pfx_null_add_dev+0x10/0x10
[ 71.256815][ T5838] ? configfs_write_iter+0x238/0x430
[ 71.256829][ T5838] nullb_device_power_store+0x240/0x380
[ 71.256838][ T5838] ? __pfx_nullb_device_power_store+0x10/0x10
[ 71.256847][ T5838] ? down_read+0x2be/0x330
[ 71.256857][ T5838] ? __pfx_nullb_device_power_store+0x10/0x10
[ 71.256866][ T5838] configfs_write_iter+0x337/0x430
[ 71.256878][ T5838] vfs_write+0x612/0xba0
[ 71.256892][ T5838] ? __pfx_vfs_write+0x10/0x10
[ 71.256903][ T5838] ? do_sys_openat2+0x14e/0x200
[ 71.256910][ T5838] ? kmem_cache_free+0x182/0x650
[ 71.256921][ T5838] ? fd_install+0x94/0x3d0
[ 71.256935][ T5838] ksys_write+0x150/0x270
[ 71.256946][ T5838] ? __pfx_ksys_write+0x10/0x10
[ 71.256959][ T5838] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 71.256968][ T5838] do_syscall_64+0x174/0x580
[ 71.256978][ T5838] ? trace_irq_disable+0x3b/0x140
[ 71.256987][ T5838] ? clear_bhb_loop+0x70/0xc0
[ 71.257018][ T5838] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 71.257026][ T5838] RIP: 0033:0x7fc940d6d2f7
[ 71.257036][ T5838] Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
[ 71.257042][ T5838] RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
[ 71.257051][ T5838] RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
[ 71.257056][ T5838] RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
[ 71.257061][ T5838] RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
[ 71.257065][ T5838] R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
[ 71.257070][ T5838] R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
[ 71.257083][ T5838] </TASK>
[ 71.257086][ T5838]
[ 71.395837][ T5838] =============================
[ 71.397405][ T5838] [ BUG: Invalid wait context ]
[ 71.398939][ T5838] syzkaller #1 Tainted: G W
[ 71.400802][ T5838] -----------------------------
[ 71.402324][ T5838] syz-executor260/5838 is trying to lock:
[ 71.404091][ T5838] ffff888122ac0060 (&zone->mutex){+.+.}-{4:4}, at: null_process_zoned_cmd+0x6f6/0xf80
[ 71.407042][ T5838] other info that might help us debug this:
[ 71.408866][ T5838] context-{5:5}
[ 71.409961][ T5838] 6 locks held by syz-executor260/5838:
[ 71.411676][ T5838] #0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0
[ 71.414472][ T5838] #1: ffff88810728f080 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430
[ 71.417520][ T5838] #2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430
[ 71.420525][ T5838] #3: ffffffff9ab67760 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380
[ 71.423455][ T5838] #4: ffff8881145e8350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70
[ 71.426306][ T5838] #5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40
[ 71.429350][ T5838] stack backtrace:
[ 71.430530][ T5838] CPU: 0 UID: 0 PID: 5838 Comm: syz-executor260 Tainted: G W syzkaller #1 PREEMPT(full)
[ 71.430541][ T5838] Tainted: [W]=WARN
[ 71.430543][ T5838] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 71.430548][ T5838] Call Trace:
[ 71.430553][ T5838] <TASK>
[ 71.430557][ T5838] dump_stack_lvl+0xe8/0x150
[ 71.430569][ T5838] __lock_acquire+0xe39/0x2cf0
[ 71.430578][ T5838] ? __show_trace_log_lvl+0x478/0x550
[ 71.430590][ T5838] ? null_process_zoned_cmd+0x6f6/0xf80
[ 71.430600][ T5838] lock_acquire+0x106/0x350
[ 71.430607][ T5838] ? null_process_zoned_cmd+0x6f6/0xf80
[ 71.430616][ T5838] ? dump_stack_lvl+0x135/0x150
[ 71.430625][ T5838] ? __might_resched+0x378/0x4d0
[ 71.430637][ T5838] __mutex_lock+0x19d/0x1550
[ 71.430647][ T5838] ? null_process_zoned_cmd+0x6f6/0xf80
[ 71.430656][ T5838] ? do_raw_spin_unlock+0xf5/0x210
[ 71.430666][ T5838] ? null_process_zoned_cmd+0x6f6/0xf80
[ 71.430675][ T5838] ? __pfx___mutex_lock+0x10/0x10
[ 71.430685][ T5838] ? _raw_spin_unlock_irqrestore+0x4c/0x80
[ 71.430693][ T5838] ? __mod_timer+0xb53/0xed0
[ 71.430705][ T5838] null_process_zoned_cmd+0x6f6/0xf80
[ 71.430714][ T5838] ? blk_mq_start_request+0x4bf/0x870
[ 71.430725][ T5838] null_queue_rq+0x8bc/0xe70
[ 71.430734][ T5838] blk_mq_try_issue_directly+0x3f4/0x880
[ 71.430743][ T5838] ? __pfx_blk_mq_try_issue_directly+0x10/0x10
[ 71.430751][ T5838] ? ktime_get+0x1f5/0x220
[ 71.430761][ T5838] ? blk_account_io_start+0x578/0x8c0
[ 71.430772][ T5838] blk_mq_submit_bio+0x20c0/0x2a40
[ 71.430780][ T5838] ? blk_mq_submit_bio+0x306/0x2a40
[ 71.430789][ T5838] ? __pfx_blk_mq_submit_bio+0x10/0x10
[ 71.430795][ T5838] ? blk_cgroup_bio_start+0x5d4/0x670
[ 71.430805][ T5838] ? __pfx_blk_cgroup_bio_start+0x10/0x10
[ 71.430813][ T5838] ? __submit_bio+0x7e/0x340
[ 71.430821][ T5838] submit_bio_noacct_nocheck+0x2f4/0xa40
[ 71.430834][ T5838] ? __pfx_submit_bio_noacct_nocheck+0x10/0x10
[ 71.430845][ T5838] ? submit_bio_noacct+0xf7b/0x1b20
[ 71.430852][ T5838] ? blkcg_set_ioprio+0x16b/0x2a0
[ 71.430863][ T5838] block_read_full_folio+0x7a6/0x810
[ 71.430871][ T5838] ? __pfx_blkdev_get_block+0x10/0x10
[ 71.430880][ T5838] filemap_read_folio+0x12c/0x3a0
[ 71.430890][ T5838] ? __pfx_blkdev_read_folio+0x10/0x10
[ 71.430897][ T5838] ? __pfx_filemap_read_folio+0x10/0x10
[ 71.430906][ T5838] ? filemap_add_folio+0x350/0x530
[ 71.430914][ T5838] do_read_cache_folio+0x354/0x590
[ 71.430923][ T5838] ? __pfx_blkdev_read_folio+0x10/0x10
[ 71.430932][ T5838] read_part_sector+0xb6/0x2b0
[ 71.430939][ T5838] adfspart_check_ICS+0xb1/0x960
[ 71.430947][ T5838] ? seq_buf_printf+0x212/0x2d0
[ 71.430957][ T5838] ? __pfx_adfspart_check_ICS+0x10/0x10
[ 71.430965][ T5838] ? bdev_disk_changed+0x56c/0x17a0
[ 71.430971][ T5838] ? bdev_disk_changed+0x56c/0x17a0
[ 71.430997][ T5838] bdev_disk_changed+0x851/0x17a0
[ 71.431008][ T5838] ? __pfx_bdev_disk_changed+0x10/0x10
[ 71.431016][ T5838] ? file_init_path+0x42e/0x5a0
[ 71.431023][ T5838] blkdev_get_whole+0x372/0x510
[ 71.431031][ T5838] bdev_open+0x324/0xd70
[ 71.431040][ T5838] bdev_file_open_by_dev+0x1be/0x240
[ 71.431048][ T5838] disk_scan_partitions+0x1bb/0x2c0
[ 71.431057][ T5838] add_disk_fwnode+0x24b/0x3a0
[ 71.431067][ T5838] null_add_dev+0x130b/0x1d70
[ 71.431075][ T5838] ? __pfx_null_add_dev+0x10/0x10
[ 71.431084][ T5838] ? configfs_write_iter+0x238/0x430
[ 71.431095][ T5838] nullb_device_power_store+0x240/0x380
[ 71.431103][ T5838] ? __pfx_nullb_device_power_store+0x10/0x10
[ 71.431115][ T5838] ? down_read+0x2be/0x330
[ 71.431124][ T5838] ? __pfx_nullb_device_power_store+0x10/0x10
[ 71.431131][ T5838] configfs_write_iter+0x337/0x430
[ 71.431141][ T5838] vfs_write+0x612/0xba0
[ 71.431152][ T5838] ? __pfx_vfs_write+0x10/0x10
[ 71.431161][ T5838] ? do_sys_openat2+0x14e/0x200
[ 71.431167][ T5838] ? kmem_cache_free+0x182/0x650
[ 71.431178][ T5838] ? fd_install+0x94/0x3d0
[ 71.431187][ T5838] ksys_write+0x150/0x270
[ 71.431196][ T5838] ? __pfx_ksys_write+0x10/0x10
[ 71.431206][ T5838] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 71.431214][ T5838] do_syscall_64+0x174/0x580
[ 71.431223][ T5838] ? trace_irq_disable+0x3b/0x140
[ 71.431231][ T5838] ? clear_bhb_loop+0x70/0xc0
[ 71.431239][ T5838] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 71.431246][ T5838] RIP: 0033:0x7fc940d6d2f7
[ 71.431256][ T5838] Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
[ 71.431262][ T5838] RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
[ 71.431270][ T5838] RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
[ 71.431276][ T5838] RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
[ 71.431280][ T5838] RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
[ 71.431285][ T5838] R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
[ 71.431289][ T5838] R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
[ 71.431296][ T5838] </TASK>
[ 71.583324][ T5838] null_blk: disk mydev created
[ 71.858278][ T1374] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.860509][ T1374] ieee802154 phy1 wpan1: encryption failed: -22
[+] configfs mounted or already mounted.
[+] Created mydev successfully.
[+] Wrote '1
' to /sys/kernel/config/nullb/mydev/zoned
[+] Wrote '1
' to /sys/kernel/config/nullb/mydev/memory_backed
[+] Wrote '1
' to /sys/kernel/config/nullb/mydev/shared_tags
[+] Wrote '1
' to /sys/kernel/config/nullb/mydev/power
[ 73.908126][ T33] kauditd_printk_skb: 29 callbacks suppressed
[ 73.908138][ T33] audit: type=1400 audit(1786659330.545:240): avc: denied { write } for pid=5872 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 73.931908][ T33] audit: type=1400 audit(1786659330.565:241): avc: denied { write } for pid=5875 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.267196][ T33] audit: type=1400 audit(1786659330.895:242): avc: denied { write } for pid=5878 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.291483][ T33] audit: type=1400 audit(1786659330.925:243): avc: denied { write } for pid=5881 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.904623][ T33] audit: type=1400 audit(1786659331.535:244): avc: denied { write } for pid=5884 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.928930][ T33] audit: type=1400 audit(1786659331.565:245): avc: denied { write } for pid=5887 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
TruncatedCrashReport:BUG: sleeping function called from invalid context at kernel/locking/mutex.c:623
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5838, name: syz-executor260
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
6 locks held by syz-executor260/5838:
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#1: ffff88810728f080 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#3: ffffffff9ab67760 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#4: ffff8881145e8350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
CPU: 0 UID: 0 PID: 5838 Comm: syz-executor260 Not tainted syzkaller #1 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x378/0x4d0 kernel/sched/core.c:9197
__mutex_lock_common kernel/locking/mutex.c:623 [inline]
__mutex_lock+0x118/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc940d6d2f7
Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
</TASK>
=============================
[ BUG: Invalid wait context ]
syzkaller #1 Tainted: G W
-----------------------------
syz-executor260/5838 is trying to lock:
ffff888122ac0060 (&zone->mutex){+.+.}-{4:4}, at: null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
ffff888122ac0060 (&zone->mutex){+.+.}-{4:4}, at: null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
other info that might help us debug this:
context-{5:5}
6 locks held by syz-executor260/5838:
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#1: ffff88810728f080 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#3: ffffffff9ab67760 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#4: ffff8881145e8350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
stack backtrace:
CPU: 0 UID: 0 PID: 5838 Comm: syz-executor260 Tainted: G W syzkaller #1 PREEMPT(full)
Tainted: [W]=WARN
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
print_lock_invalid_wait_context kernel/locking/lockdep.c:4830 [inline]
check_wait_context kernel/locking/lockdep.c:4902 [inline]
__lock_acquire+0xe39/0x2cf0 kernel/locking/lockdep.c:5187
lock_acquire+0x106/0x350 kernel/locking/lockdep.c:5868
__mutex_lock_common kernel/locking/mutex.c:646 [inline]
__mutex_lock+0x19d/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc940d6d2f7
Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
</TASK>
null_blk: disk mydev created
TruncatedStraceOutput:]
|
| 99/3 |
2026/08/13 22:15 |
agent |
repro-oracle |
0m
Model:
Results: map[Feedback:The reproducer successfully triggered the expected crash. The crash signature and call trace match the original bug description exactly: a sleeping function (`__mutex_lock`) is called from an invalid context (inside `rcu_read_lock` held by `blk_mq_submit_bio`) via `null_process_zoned_cmd` -> `null_lock_zone`. ProbePassed:false TerminalError: TitleMatches:true]
Instruction: You are a security researcher with deep Linux kernel background.
Analyze the results of running the generated program.
=== CRITICAL ENVIRONMENT & TARGET CLASSIFICATION ===
Set 'TerminalError' to a descriptive error message ONLY if:
1. The execution failed due to missing hardware device nodes, subsystems, kernel modules, or privilege limits
that cannot be loaded, created, or bypassed by user-space C code edits in the VM guest.
2. The target source files or functions described in the bug description do not exist in the checked-out codebase,
meaning the codebase version is mismatched and the target code is absent.
=== CRITICAL PROHIBITIONS ===
- Do NOT classify a run as a terminal failure or assume a bug is fixed based on git log entries, commit titles,
or commit messages. Reproducibility can ONLY be determined by executing reproducer candidates in the VM.
- Do NOT suggest C code strategies, repairs, or namespace bypasses when setting 'TerminalError'.
=== PHASE 2: BUG REPRODUCTION (EVALUATION) ===
The executed program was a full reproducer candidate attempting to trigger the target bug/crash.
Use this to guide your classification and feedback:
1. If a crash was triggered (Reproduced is true):
- Determine if the triggered crash matches the expected bug.
- If you conclude they represent the same underlying bug (the same root cause)
despite different titles, crash signatures, or call traces, set TitleMatches
to true and provide a detailed, technical, and verbose explanation of the
equivalence in the 'Feedback' field.
- If they do not represent the same bug (a completely unrelated crash/collision),
set TitleMatches to false and explain the collision in 'Feedback'.
- If they match exactly, set TitleMatches to true and provide a brief confirmation in 'Feedback'.
2. If the execution was successful (exit 0) WITHOUT a crash (Reproduced is false):
- The reproduction attempt failed to trigger the bug. Analyze the console/strace output
to understand why the bug did not trigger (e.g., timing, input arguments, environment setup)
and provide feedback on how to improve the reproducer logic to trigger the crash.
Critical Diagnostic Rule for Reproduction Failures:
If the reproduction attempt fails (e.g., a system call returns an error, or a
warning/error message appears in the console log), you MUST:
1. Identify the failing system call from the execution trace or strace output.
2. Identify any corresponding warning or error messages in the console log.
3. Immediately search the kernel source tree for the warning message strings or
the code of the failing system call/subsystem to locate the validation logic.
4. Trace the kernel's validation logic to diagnose the exact constraint violation
or input mismatch in the generated program.
5. Provide a technical diagnosis in the feedback explaining the exact kernel constraint that was violated and why.
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: Bug Description: BUG: sleeping function called from invalid context in null_process_zoned_cmd
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:623
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 19399, name: syz.6.4428
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
7 locks held by syz.6.4428/19399:
#0: ffff888030e500f0 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x246/0x320 fs/file.c:1259
#1: ffff88801d756450 (sb_writers#12){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#1: ffff88801d756450 (sb_writers#12){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#2: ffff888029822280 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#3: ffff888057f6c870 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#3: ffff888057f6c870 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#4: ffffffff9aaec560 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#5: ffff888051072350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#6: ffffffff8eb59c60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
CPU: 0 UID: 0 PID: 19399 Comm: syz.6.4428 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x378/0x4d0 kernel/sched/core.c:9197
__mutex_lock_common kernel/locking/mutex.c:623 [inline]
__mutex_lock+0x118/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f95ef39e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f95f019b028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f95ef625fa0 RCX: 00007f95ef39e0d9
RDX: 0000000000000002 RSI: 0000200000000700 RDI: 0000000000000005
RBP: 00007f95ef435024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f95ef626038 R14: 00007f95ef625fa0 R15: 00007ffe19f02fb8
</TASK>
------------[ cut here ]------------
DEBUG_LOCKS_WARN_ON(lock->magic != lock)
WARNING: kernel/locking/mutex.c:625 at __mutex_lock_common kernel/locking/mutex.c:625 [inline], CPU#0: syz.6.4428/19399
WARNING: kernel/locking/mutex.c:625 at __mutex_lock+0x12d8/0x1550 kernel/locking/mutex.c:821, CPU#0: syz.6.4428/19399
Modules linked in:
CPU: 0 UID: 0 PID: 19399 Comm: syz.6.4428 Tainted: G W L syzkaller #0 PREEMPT(full)
Tainted: [W]=WARN, [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
RIP: 0010:__mutex_lock_common kernel/locking/mutex.c:625 [inline]
RIP: 0010:__mutex_lock+0x12df/0x1550 kernel/locking/mutex.c:821
Code: 7a 57 90 48 c1 e8 03 0f b6 04 18 84 c0 0f 85 47 02 00 00 83 3d 45 38 85 04 00 75 13 48 8d 3d c8 87 88 04 48 c7 c6 40 f7 ec 8b <67> 48 0f b9 3a 90 e9 75 ee ff ff 90 0f 0b 90 e9 48 f2 ff ff 90 0f
RSP: 0018:ffffc9001182ed40 EFLAGS: 00010246
RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000080000
RDX: ffffc90012289000 RSI: ffffffff8becf740 RDI: ffffffff905ac9d0
RBP: ffffc9001182eed0 R08: ffffffff90577a43 R09: 1ffffffff20aef48
R10: dffffc0000000000 R11: fffffbfff20aef49 R12: ffff88804b9c0000
R13: 0000000000000000 R14: 1ffff92002305dbc R15: 0000000000000000
FS: 00007f95f019b6c0(0000) GS:ffff888124f55000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2f81bff8 CR3: 000000007cb27000 CR4: 0000000000350ef0
Call Trace:
<TASK>
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f95ef39e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f95f019b028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f95ef625fa0 RCX: 00007f95ef39e0d9
RDX: 0000000000000002 RSI: 0000200000000700 RDI: 0000000000000005
RBP: 00007f95ef435024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f95ef626038 R14: 00007f95ef625fa0 R15: 00007ffe19f02fb8
</TASK>
----------------
Code disassembly (best guess):
0: 7a 57 jp 0x59
2: 90 nop
3: 48 c1 e8 03 shr $0x3,%rax
7: 0f b6 04 18 movzbl (%rax,%rbx,1),%eax
b: 84 c0 test %al,%al
d: 0f 85 47 02 00 00 jne 0x25a
13: 83 3d 45 38 85 04 00 cmpl $0x0,0x4853845(%rip) # 0x485385f
1a: 75 13 jne 0x2f
1c: 48 8d 3d c8 87 88 04 lea 0x48887c8(%rip),%rdi # 0x48887eb
23: 48 c7 c6 40 f7 ec 8b mov $0xffffffff8becf740,%rsi
* 2a: 67 48 0f b9 3a ud1 (%edx),%rdi <-- trapping instruction
2f: 90 nop
30: e9 75 ee ff ff jmp 0xffffeeaa
35: 90 nop
36: 0f 0b ud2
38: 90 nop
39: e9 48 f2 ff ff jmp 0xfffff286
3e: 90 nop
3f: 0f .byte 0xf
IsProbe: false
Reproduced: true
Console Output: [ 71.256267][ T5838] __mutex_lock+0x118/0x1550
[ 71.256282][ T5838] ? do_raw_spin_unlock+0xf5/0x210
[ 71.256301][ T5838] ? null_process_zoned_cmd+0x6f6/0xf80
[ 71.256312][ T5838] ? __pfx___mutex_lock+0x10/0x10
[ 71.256325][ T5838] ? _raw_spin_unlock_irqrestore+0x4c/0x80
[ 71.256335][ T5838] ? __mod_timer+0xb53/0xed0
[ 71.256350][ T5838] null_process_zoned_cmd+0x6f6/0xf80
[ 71.256362][ T5838] ? blk_mq_start_request+0x4bf/0x870
[ 71.256375][ T5838] null_queue_rq+0x8bc/0xe70
[ 71.256389][ T5838] blk_mq_try_issue_directly+0x3f4/0x880
[ 71.256399][ T5838] ? __pfx_blk_mq_try_issue_directly+0x10/0x10
[ 71.256407][ T5838] ? ktime_get+0x1f5/0x220
[ 71.256419][ T5838] ? blk_account_io_start+0x578/0x8c0
[ 71.256432][ T5838] blk_mq_submit_bio+0x20c0/0x2a40
[ 71.256442][ T5838] ? blk_mq_submit_bio+0x306/0x2a40
[ 71.256453][ T5838] ? __pfx_blk_mq_submit_bio+0x10/0x10
[ 71.256460][ T5838] ? blk_cgroup_bio_start+0x5d4/0x670
[ 71.256472][ T5838] ? __pfx_blk_cgroup_bio_start+0x10/0x10
[ 71.256483][ T5838] ? __submit_bio+0x7e/0x340
[ 71.256492][ T5838] submit_bio_noacct_nocheck+0x2f4/0xa40
[ 71.256508][ T5838] ? __pfx_submit_bio_noacct_nocheck+0x10/0x10
[ 71.256521][ T5838] ? submit_bio_noacct+0xf7b/0x1b20
[ 71.256530][ T5838] ? blkcg_set_ioprio+0x16b/0x2a0
[ 71.256544][ T5838] block_read_full_folio+0x7a6/0x810
[ 71.256555][ T5838] ? __pfx_blkdev_get_block+0x10/0x10
[ 71.256565][ T5838] filemap_read_folio+0x12c/0x3a0
[ 71.256576][ T5838] ? __pfx_blkdev_read_folio+0x10/0x10
[ 71.256585][ T5838] ? __pfx_filemap_read_folio+0x10/0x10
[ 71.256595][ T5838] ? filemap_add_folio+0x350/0x530
[ 71.256605][ T5838] do_read_cache_folio+0x354/0x590
[ 71.256615][ T5838] ? __pfx_blkdev_read_folio+0x10/0x10
[ 71.256626][ T5838] read_part_sector+0xb6/0x2b0
[ 71.256635][ T5838] adfspart_check_ICS+0xb1/0x960
[ 71.256644][ T5838] ? seq_buf_printf+0x212/0x2d0
[ 71.256658][ T5838] ? __pfx_adfspart_check_ICS+0x10/0x10
[ 71.256668][ T5838] ? bdev_disk_changed+0x56c/0x17a0
[ 71.256674][ T5838] ? bdev_disk_changed+0x56c/0x17a0
[ 71.256685][ T5838] bdev_disk_changed+0x851/0x17a0
[ 71.256702][ T5838] ? __pfx_bdev_disk_changed+0x10/0x10
[ 71.256713][ T5838] ? file_init_path+0x42e/0x5a0
[ 71.256730][ T5838] blkdev_get_whole+0x372/0x510
[ 71.256741][ T5838] bdev_open+0x324/0xd70
[ 71.256753][ T5838] bdev_file_open_by_dev+0x1be/0x240
[ 71.256763][ T5838] disk_scan_partitions+0x1bb/0x2c0
[ 71.256775][ T5838] add_disk_fwnode+0x24b/0x3a0
[ 71.256786][ T5838] null_add_dev+0x130b/0x1d70
[ 71.256797][ T5838] ? __pfx_null_add_dev+0x10/0x10
[ 71.256815][ T5838] ? configfs_write_iter+0x238/0x430
[ 71.256829][ T5838] nullb_device_power_store+0x240/0x380
[ 71.256838][ T5838] ? __pfx_nullb_device_power_store+0x10/0x10
[ 71.256847][ T5838] ? down_read+0x2be/0x330
[ 71.256857][ T5838] ? __pfx_nullb_device_power_store+0x10/0x10
[ 71.256866][ T5838] configfs_write_iter+0x337/0x430
[ 71.256878][ T5838] vfs_write+0x612/0xba0
[ 71.256892][ T5838] ? __pfx_vfs_write+0x10/0x10
[ 71.256903][ T5838] ? do_sys_openat2+0x14e/0x200
[ 71.256910][ T5838] ? kmem_cache_free+0x182/0x650
[ 71.256921][ T5838] ? fd_install+0x94/0x3d0
[ 71.256935][ T5838] ksys_write+0x150/0x270
[ 71.256946][ T5838] ? __pfx_ksys_write+0x10/0x10
[ 71.256959][ T5838] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 71.256968][ T5838] do_syscall_64+0x174/0x580
[ 71.256978][ T5838] ? trace_irq_disable+0x3b/0x140
[ 71.256987][ T5838] ? clear_bhb_loop+0x70/0xc0
[ 71.257018][ T5838] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 71.257026][ T5838] RIP: 0033:0x7fc940d6d2f7
[ 71.257036][ T5838] Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
[ 71.257042][ T5838] RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
[ 71.257051][ T5838] RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
[ 71.257056][ T5838] RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
[ 71.257061][ T5838] RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
[ 71.257065][ T5838] R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
[ 71.257070][ T5838] R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
[ 71.257083][ T5838] </TASK>
[ 71.257086][ T5838]
[ 71.395837][ T5838] =============================
[ 71.397405][ T5838] [ BUG: Invalid wait context ]
[ 71.398939][ T5838] syzkaller #1 Tainted: G W
[ 71.400802][ T5838] -----------------------------
[ 71.402324][ T5838] syz-executor260/5838 is trying to lock:
[ 71.404091][ T5838] ffff888122ac0060 (&zone->mutex){+.+.}-{4:4}, at: null_process_zoned_cmd+0x6f6/0xf80
[ 71.407042][ T5838] other info that might help us debug this:
[ 71.408866][ T5838] context-{5:5}
[ 71.409961][ T5838] 6 locks held by syz-executor260/5838:
[ 71.411676][ T5838] #0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0
[ 71.414472][ T5838] #1: ffff88810728f080 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430
[ 71.417520][ T5838] #2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430
[ 71.420525][ T5838] #3: ffffffff9ab67760 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380
[ 71.423455][ T5838] #4: ffff8881145e8350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70
[ 71.426306][ T5838] #5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40
[ 71.429350][ T5838] stack backtrace:
[ 71.430530][ T5838] CPU: 0 UID: 0 PID: 5838 Comm: syz-executor260 Tainted: G W syzkaller #1 PREEMPT(full)
[ 71.430541][ T5838] Tainted: [W]=WARN
[ 71.430543][ T5838] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 71.430548][ T5838] Call Trace:
[ 71.430553][ T5838] <TASK>
[ 71.430557][ T5838] dump_stack_lvl+0xe8/0x150
[ 71.430569][ T5838] __lock_acquire+0xe39/0x2cf0
[ 71.430578][ T5838] ? __show_trace_log_lvl+0x478/0x550
[ 71.430590][ T5838] ? null_process_zoned_cmd+0x6f6/0xf80
[ 71.430600][ T5838] lock_acquire+0x106/0x350
[ 71.430607][ T5838] ? null_process_zoned_cmd+0x6f6/0xf80
[ 71.430616][ T5838] ? dump_stack_lvl+0x135/0x150
[ 71.430625][ T5838] ? __might_resched+0x378/0x4d0
[ 71.430637][ T5838] __mutex_lock+0x19d/0x1550
[ 71.430647][ T5838] ? null_process_zoned_cmd+0x6f6/0xf80
[ 71.430656][ T5838] ? do_raw_spin_unlock+0xf5/0x210
[ 71.430666][ T5838] ? null_process_zoned_cmd+0x6f6/0xf80
[ 71.430675][ T5838] ? __pfx___mutex_lock+0x10/0x10
[ 71.430685][ T5838] ? _raw_spin_unlock_irqrestore+0x4c/0x80
[ 71.430693][ T5838] ? __mod_timer+0xb53/0xed0
[ 71.430705][ T5838] null_process_zoned_cmd+0x6f6/0xf80
[ 71.430714][ T5838] ? blk_mq_start_request+0x4bf/0x870
[ 71.430725][ T5838] null_queue_rq+0x8bc/0xe70
[ 71.430734][ T5838] blk_mq_try_issue_directly+0x3f4/0x880
[ 71.430743][ T5838] ? __pfx_blk_mq_try_issue_directly+0x10/0x10
[ 71.430751][ T5838] ? ktime_get+0x1f5/0x220
[ 71.430761][ T5838] ? blk_account_io_start+0x578/0x8c0
[ 71.430772][ T5838] blk_mq_submit_bio+0x20c0/0x2a40
[ 71.430780][ T5838] ? blk_mq_submit_bio+0x306/0x2a40
[ 71.430789][ T5838] ? __pfx_blk_mq_submit_bio+0x10/0x10
[ 71.430795][ T5838] ? blk_cgroup_bio_start+0x5d4/0x670
[ 71.430805][ T5838] ? __pfx_blk_cgroup_bio_start+0x10/0x10
[ 71.430813][ T5838] ? __submit_bio+0x7e/0x340
[ 71.430821][ T5838] submit_bio_noacct_nocheck+0x2f4/0xa40
[ 71.430834][ T5838] ? __pfx_submit_bio_noacct_nocheck+0x10/0x10
[ 71.430845][ T5838] ? submit_bio_noacct+0xf7b/0x1b20
[ 71.430852][ T5838] ? blkcg_set_ioprio+0x16b/0x2a0
[ 71.430863][ T5838] block_read_full_folio+0x7a6/0x810
[ 71.430871][ T5838] ? __pfx_blkdev_get_block+0x10/0x10
[ 71.430880][ T5838] filemap_read_folio+0x12c/0x3a0
[ 71.430890][ T5838] ? __pfx_blkdev_read_folio+0x10/0x10
[ 71.430897][ T5838] ? __pfx_filemap_read_folio+0x10/0x10
[ 71.430906][ T5838] ? filemap_add_folio+0x350/0x530
[ 71.430914][ T5838] do_read_cache_folio+0x354/0x590
[ 71.430923][ T5838] ? __pfx_blkdev_read_folio+0x10/0x10
[ 71.430932][ T5838] read_part_sector+0xb6/0x2b0
[ 71.430939][ T5838] adfspart_check_ICS+0xb1/0x960
[ 71.430947][ T5838] ? seq_buf_printf+0x212/0x2d0
[ 71.430957][ T5838] ? __pfx_adfspart_check_ICS+0x10/0x10
[ 71.430965][ T5838] ? bdev_disk_changed+0x56c/0x17a0
[ 71.430971][ T5838] ? bdev_disk_changed+0x56c/0x17a0
[ 71.430997][ T5838] bdev_disk_changed+0x851/0x17a0
[ 71.431008][ T5838] ? __pfx_bdev_disk_changed+0x10/0x10
[ 71.431016][ T5838] ? file_init_path+0x42e/0x5a0
[ 71.431023][ T5838] blkdev_get_whole+0x372/0x510
[ 71.431031][ T5838] bdev_open+0x324/0xd70
[ 71.431040][ T5838] bdev_file_open_by_dev+0x1be/0x240
[ 71.431048][ T5838] disk_scan_partitions+0x1bb/0x2c0
[ 71.431057][ T5838] add_disk_fwnode+0x24b/0x3a0
[ 71.431067][ T5838] null_add_dev+0x130b/0x1d70
[ 71.431075][ T5838] ? __pfx_null_add_dev+0x10/0x10
[ 71.431084][ T5838] ? configfs_write_iter+0x238/0x430
[ 71.431095][ T5838] nullb_device_power_store+0x240/0x380
[ 71.431103][ T5838] ? __pfx_nullb_device_power_store+0x10/0x10
[ 71.431115][ T5838] ? down_read+0x2be/0x330
[ 71.431124][ T5838] ? __pfx_nullb_device_power_store+0x10/0x10
[ 71.431131][ T5838] configfs_write_iter+0x337/0x430
[ 71.431141][ T5838] vfs_write+0x612/0xba0
[ 71.431152][ T5838] ? __pfx_vfs_write+0x10/0x10
[ 71.431161][ T5838] ? do_sys_openat2+0x14e/0x200
[ 71.431167][ T5838] ? kmem_cache_free+0x182/0x650
[ 71.431178][ T5838] ? fd_install+0x94/0x3d0
[ 71.431187][ T5838] ksys_write+0x150/0x270
[ 71.431196][ T5838] ? __pfx_ksys_write+0x10/0x10
[ 71.431206][ T5838] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 71.431214][ T5838] do_syscall_64+0x174/0x580
[ 71.431223][ T5838] ? trace_irq_disable+0x3b/0x140
[ 71.431231][ T5838] ? clear_bhb_loop+0x70/0xc0
[ 71.431239][ T5838] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 71.431246][ T5838] RIP: 0033:0x7fc940d6d2f7
[ 71.431256][ T5838] Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
[ 71.431262][ T5838] RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
[ 71.431270][ T5838] RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
[ 71.431276][ T5838] RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
[ 71.431280][ T5838] RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
[ 71.431285][ T5838] R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
[ 71.431289][ T5838] R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
[ 71.431296][ T5838] </TASK>
[ 71.583324][ T5838] null_blk: disk mydev created
[ 71.858278][ T1374] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.860509][ T1374] ieee802154 phy1 wpan1: encryption failed: -22
[+] configfs mounted or already mounted.
[+] Created mydev successfully.
[+] Wrote '1
' to /sys/kernel/config/nullb/mydev/zoned
[+] Wrote '1
' to /sys/kernel/config/nullb/mydev/memory_backed
[+] Wrote '1
' to /sys/kernel/config/nullb/mydev/shared_tags
[+] Wrote '1
' to /sys/kernel/config/nullb/mydev/power
[ 73.908126][ T33] kauditd_printk_skb: 29 callbacks suppressed
[ 73.908138][ T33] audit: type=1400 audit(1786659330.545:240): avc: denied { write } for pid=5872 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 73.931908][ T33] audit: type=1400 audit(1786659330.565:241): avc: denied { write } for pid=5875 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.267196][ T33] audit: type=1400 audit(1786659330.895:242): avc: denied { write } for pid=5878 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.291483][ T33] audit: type=1400 audit(1786659330.925:243): avc: denied { write } for pid=5881 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.904623][ T33] audit: type=1400 audit(1786659331.535:244): avc: denied { write } for pid=5884 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 74.928930][ T33] audit: type=1400 audit(1786659331.565:245): avc: denied { write } for pid=5887 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Strace Output:
Crash Report: BUG: sleeping function called from invalid context at kernel/locking/mutex.c:623
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5838, name: syz-executor260
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
6 locks held by syz-executor260/5838:
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#1: ffff88810728f080 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#3: ffffffff9ab67760 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#4: ffff8881145e8350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
CPU: 0 UID: 0 PID: 5838 Comm: syz-executor260 Not tainted syzkaller #1 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x378/0x4d0 kernel/sched/core.c:9197
__mutex_lock_common kernel/locking/mutex.c:623 [inline]
__mutex_lock+0x118/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc940d6d2f7
Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
</TASK>
=============================
[ BUG: Invalid wait context ]
syzkaller #1 Tainted: G W
-----------------------------
syz-executor260/5838 is trying to lock:
ffff888122ac0060 (&zone->mutex){+.+.}-{4:4}, at: null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
ffff888122ac0060 (&zone->mutex){+.+.}-{4:4}, at: null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
other info that might help us debug this:
context-{5:5}
6 locks held by syz-executor260/5838:
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#1: ffff88810728f080 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#3: ffffffff9ab67760 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#4: ffff8881145e8350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
stack backtrace:
CPU: 0 UID: 0 PID: 5838 Comm: syz-executor260 Tainted: G W syzkaller #1 PREEMPT(full)
Tainted: [W]=WARN
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
print_lock_invalid_wait_context kernel/locking/lockdep.c:4830 [inline]
check_wait_context kernel/locking/lockdep.c:4902 [inline]
__lock_acquire+0xe39/0x2cf0 kernel/locking/lockdep.c:5187
lock_acquire+0x106/0x350 kernel/locking/lockdep.c:5868
__mutex_lock_common kernel/locking/mutex.c:646 [inline]
__mutex_lock+0x19d/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc940d6d2f7
Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
</TASK>
null_blk: disk mydev created
|
| 100/4 |
2026/08/13 22:15 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 22558
output: 107
thoughts: 629
Thoughts: **My Thought Process Regarding the Null Block Zoned Command Crash**
Okay, I've just reviewed this crash report, and it's quite clear what's happening here. I'm dealing with a bug in the `null_blk` driver, specifically when it's handling zoned block device commands. The core of the issue, as indicated by the "BUG: sleeping function called from invalid context" message, is that a function that *might* sleep (in this case, `__mutex_lock_common` which eventually calls `mutex_lock`) is being invoked in a context where sleeping is not allowed.
Looking at the stack trace, it traces the execution path directly to the problem. It starts with `__mutex_lock_common` at `kernel/locking/mutex.c:623`, which is the low-level mutex locking mechanism. This is called by `__mutex_lock` at line 821. Then, the trace shows `null_lock_zone` at `drivers/block/null_blk/zoned.c:39` (which is marked as `[inline]`, meaning it's part of the `null_process_zoned_cmd` function's logic), and this is directly within `null_process_zoned_cmd` at `drivers/block/null_blk/zoned.c:732`.
This `null_process_zoned_cmd` function is then called by `null_handle_cmd` at `drivers/block/null_blk/main.c:1455`, which is part of the request queueing logic (`null_queue_rq` at `drivers/block/null_blk/main.c:1703`). The request ultimately originates from the block multi-queue (`blk_mq`) subsystem, specifically through `__blk_mq_issue_directly` and `blk_mq_submit_bio`.
The crash report provides crucial additional information. It explicitly states: "syz-executor260/5838 is trying to lock: ffff888122ac0060 (&zone->mutex){+.+.}-{4:4}". This confirms that the mutex being acquired is indeed the one associated with the zoned zone structure, and the context is the `null_lock_zone` function. The "other info that might help us debug this: context-{5:5}" and "6 locks held by syz-executor260/5838" are also important clues. Specifically, the presence of locks like `rcu_read_lock` held by the same process indicates that we're likely within a code path that's supposed to be atomic or non-blocking with respect to certain operations, and attempting to acquire a sleeping lock there is a violation.
The fact that the bug is reproduced successfully is excellent. The title also accurately reflects the problem. Therefore, my immediate next steps are to mark `TitleMatches` as true. Since this isn't a probe-related issue that I'm testing with `syz-executor`, `ProbePassed` should be set to false. `TerminalError` can be left empty as there's no specific terminal error to report beyond the general invalid context bug. I'll then provide this feedback. The core of the problem is clear: a kernel component is attempting to acquire a lock that can sleep in an interrupt context or a context where sleeping is explicitly forbidden, leading to the crash.
|
| 101/4 |
2026/08/13 22:15 |
tool |
set-results |
0m
Args: map[Feedback:The reproducer successfully triggered the expected crash. The crash signature and call trace match the original bug description exactly: a sleeping function (`__mutex_lock`) is called from an invalid context (inside `rcu_read_lock` held by `blk_mq_submit_bio`) via `null_process_zoned_cmd` -> `null_lock_zone`. ProbePassed:false TerminalError: TitleMatches:true]
Results: map[Feedback:The reproducer successfully triggered the expected crash. The crash signature and call trace match the original bug description exactly: a sleeping function (`__mutex_lock`) is called from an invalid context (inside `rcu_read_lock` held by `blk_mq_submit_bio`) via `null_process_zoned_cmd` -> `null_lock_zone`. ProbePassed:false TerminalError: TitleMatches:true]
|
| 102/3 |
2026/08/13 22:15 |
action |
loop-controller |
0m
Results: map[CapabilitiesVerified:true ContinueSignal: EquivalenceAnalysis:The reproducer successfully triggered the expected crash. The crash signature and call trace match the original bug description exactly: a sleeping function (`__mutex_lock`) is called from an invalid context (inside `rcu_read_lock` held by `blk_mq_submit_bio`) via `null_process_zoned_cmd` -> `null_lock_zone`. OracleFeedback:The reproducer successfully triggered the expected crash. The crash signature and call trace match the original bug description exactly: a sleeping function (`__mutex_lock`) is called from an invalid context (inside `rcu_read_lock` held by `blk_mq_submit_bio`) via `null_process_zoned_cmd` -> `null_lock_zone`. ReproC:#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <string.h>
#include <errno.h>
void write_file(const char *path, const char *val) {
int fd = open(path, O_WRONLY);
if (fd < 0) {
printf("[-] Failed to open %s: %s\n", path, strerror(errno));
exit(1);
}
if (write(fd, val, strlen(val)) < 0) {
printf("[-] Failed to write to %s: %s\n", path, strerror(errno));
close(fd);
exit(1);
}
close(fd);
printf("[+] Wrote '%s' to %s\n", val, path);
}
int main() {
int res;
res = mount("configfs", "/sys/kernel/config", "configfs", 0, NULL);
if (res < 0 && errno != EBUSY) {
printf("[-] Failed to mount configfs: %s\n", strerror(errno));
} else {
printf("[+] configfs mounted or already mounted.\n");
}
// Cleanup previous state if any
int fd = open("/sys/kernel/config/nullb/mydev/power", O_WRONLY);
if (fd >= 0) {
if (write(fd, "0\n", 2) < 0) {}
close(fd);
}
rmdir("/sys/kernel/config/nullb/mydev");
res = mkdir("/sys/kernel/config/nullb/mydev", 0755);
if (res < 0) {
printf("[-] Failed to create mydev: %s\n", strerror(errno));
exit(1);
}
printf("[+] Created mydev successfully.\n");
write_file("/sys/kernel/config/nullb/mydev/zoned", "1\n");
write_file("/sys/kernel/config/nullb/mydev/memory_backed", "1\n");
write_file("/sys/kernel/config/nullb/mydev/shared_tags", "1\n");
// This should trigger the bug
write_file("/sys/kernel/config/nullb/mydev/power", "1\n");
// Sleep to allow asynchronous tasks to finish if needed
sleep(2);
return 0;
}
Reproduced:true ReproducedBugTitle:BUG: sleeping function called from invalid context in null_process_zoned_cmd ReproducedCrashReport:BUG: sleeping function called from invalid context at kernel/locking/mutex.c:623
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5838, name: syz-executor260
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
6 locks held by syz-executor260/5838:
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#1: ffff88810728f080 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#3: ffffffff9ab67760 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#4: ffff8881145e8350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
CPU: 0 UID: 0 PID: 5838 Comm: syz-executor260 Not tainted syzkaller #1 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x378/0x4d0 kernel/sched/core.c:9197
__mutex_lock_common kernel/locking/mutex.c:623 [inline]
__mutex_lock+0x118/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc940d6d2f7
Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
</TASK>
=============================
[ BUG: Invalid wait context ]
syzkaller #1 Tainted: G W
-----------------------------
syz-executor260/5838 is trying to lock:
ffff888122ac0060 (&zone->mutex){+.+.}-{4:4}, at: null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
ffff888122ac0060 (&zone->mutex){+.+.}-{4:4}, at: null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
other info that might help us debug this:
context-{5:5}
6 locks held by syz-executor260/5838:
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2733 [inline]
#0: ffff888101f0c450 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683
#1: ffff88810728f080 (&buffer->mutex){+.+.}-{4:4}, at: configfs_write_iter+0x7e/0x430 fs/configfs/file.c:226
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
#2: ffff888109f89d70 (&p->frag_sem){.+.+}-{4:4}, at: configfs_write_iter+0x238/0x430 fs/configfs/file.c:229
#3: ffffffff9ab67760 (&lock){+.+.}-{4:4}, at: nullb_device_power_store+0xdb/0x380 drivers/block/null_blk/main.c:496
#4: ffff8881145e8350 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0xde/0xd70 block/bdev.c:948
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:300 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:840 [inline]
#5: ffffffff8eb63e60 (rcu_read_lock){....}-{1:3}, at: blk_mq_submit_bio+0x1c8a/0x2a40 block/blk-mq.c:3208
stack backtrace:
CPU: 0 UID: 0 PID: 5838 Comm: syz-executor260 Tainted: G W syzkaller #1 PREEMPT(full)
Tainted: [W]=WARN
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
print_lock_invalid_wait_context kernel/locking/lockdep.c:4830 [inline]
check_wait_context kernel/locking/lockdep.c:4902 [inline]
__lock_acquire+0xe39/0x2cf0 kernel/locking/lockdep.c:5187
lock_acquire+0x106/0x350 kernel/locking/lockdep.c:5868
__mutex_lock_common kernel/locking/mutex.c:646 [inline]
__mutex_lock+0x19d/0x1550 kernel/locking/mutex.c:821
null_lock_zone drivers/block/null_blk/zoned.c:39 [inline]
null_process_zoned_cmd+0x6f6/0xf80 drivers/block/null_blk/zoned.c:732
null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
__blk_mq_issue_directly block/blk-mq.c:2694 [inline]
blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
__submit_bio_noacct_mq block/blk-core.c:756 [inline]
submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
bh_submit fs/buffer.c:1239 [inline]
block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2516
do_read_cache_folio+0x354/0x590 mm/filemap.c:4146
read_mapping_folio include/linux/pagemap.h:1015 [inline]
read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
check_partition block/partitions/core.c:143 [inline]
blk_add_partitions block/partitions/core.c:591 [inline]
bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
blkdev_get_whole+0x372/0x510 block/bdev.c:751
bdev_open+0x324/0xd70 block/bdev.c:960
bdev_file_open_by_dev+0x1be/0x240 block/bdev.c:1062
disk_scan_partitions+0x1bb/0x2c0 block/genhd.c:387
add_disk_final block/genhd.c:412 [inline]
add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
add_disk include/linux/blkdev.h:800 [inline]
null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
flush_write_buffer fs/configfs/file.c:207 [inline]
configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc940d6d2f7
Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fff5db0a200 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00005555703a5400 RCX: 00007fc940d6d2f7
RDX: 0000000000000002 RSI: 00007fc940da6060 RDI: 0000000000000003
RBP: 00007fc940da6060 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00007fc940da8238
R13: 0000000000000002 R14: 00007fc940dd0cc0 R15: 0000000000000002
</TASK>
null_blk: disk mydev created
]
|
| 103/1 |
2026/08/13 22:15 |
action |
save-repro-c |
0m
Results:
|