| 0/0 |
2026/09/07 14:41 |
flow |
repro-c |
50m
Results: map[EquivalenceAnalysis:The reproduced crash `BUG: sleeping function called from invalid context at kernel/workqueue.c:4561` is the exact same underlying bug as the original `WARNING: suspicious RCU usage in wakeup_source_unregister`.
In both cases, the bug is caused by `mmc_free_host()` being called from an atomic context (the timer callback `vub300_inactivity_timer_expired`).
The call chain is:
`call_timer_fn` -> `vub300_inactivity_timer_expired` -> `kref_put` -> `vub300_delete` -> `mmc_free_host`.
(Note: `vub300_inactivity_timer_expired` and `vub300_delete` are missing from the stack traces due to tail-call optimization).
`mmc_free_host()` performs operations that can sleep:
1. `cancel_delayed_work_sync(&host->detect);`
2. `put_device(&host->class_dev);` (which eventually calls `wakeup_source_unregister` and `synchronize_srcu`).
The original crash was triggered during the second step (`put_device` -> ... -> `wakeup_source_unregister`), while the reproduced crash was triggered during the first step (`cancel_delayed_work_sync` -> `__cancel_work_sync` -> `might_sleep()`). The difference in the crash signature is simply because `cancel_delayed_work_sync` is called before `put_device` in `mmc_free_host()`, so the `might_sleep()` check in the workqueue code catches the invalid context first in the current kernel version.
Both crashes represent the same root cause: freeing the MMC host from a timer callback. OtherCrashReports:<nil> ReproC:#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
#define USB_RAW_IOCTL_RUN _IO('U', 1)
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
struct usb_raw_event {
uint32_t type;
uint32_t length;
uint8_t data[0];
};
struct usb_raw_ep_io {
uint16_t ep;
uint16_t flags;
uint32_t length;
uint8_t data[0];
};
struct usb_ctrlrequest {
uint8_t bRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} __attribute__((packed));
int main() {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
printf("[+] open /dev/raw-gadget successful.\n");
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
if (ioctl(fd, USB_RAW_IOCTL_INIT, &init) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_INIT successful.\n");
if (ioctl(fd, USB_RAW_IOCTL_RUN, 0) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_RUN: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_RUN successful.\n");
int done = 0;
while (!done) {
struct usb_raw_event *event = malloc(sizeof(*event) + 1024);
event->type = 0;
event->length = 1024;
if (ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_EVENT_FETCH: %s\n", strerror(errno));
free(event);
break;
}
if (event->type == 2) { // USB_RAW_EVENT_CONTROL
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)event->data;
struct usb_raw_ep_io *io = malloc(sizeof(*io) + 1024);
io->ep = 0;
io->flags = 0;
io->length = 0;
int handled = 0;
if (req->bRequestType == 0x80 && req->bRequest == 6) { // GET_DESCRIPTOR
if ((req->wValue >> 8) == 1) { // DEVICE
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
} else if ((req->wValue >> 8) == 2) { // CONFIG
uint8_t desc[] = {
9, 2, 46, 0, 1, 1, 0, 0x80, 50,
9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0,
7, 5, 0x81, 2, 0, 2, 0,
7, 5, 0x02, 2, 0, 2, 0,
7, 5, 0x83, 2, 0, 2, 0,
7, 5, 0x04, 2, 0, 2, 0,
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
}
} else if (req->bRequestType == 0xC0) { // VENDOR IN
if (req->bRequest == 1) { // GET_HC_INF0
uint8_t data[4] = {4, 0, 0, 1};
io->length = req->wLength < 4 ? req->wLength : 4;
memcpy(io->data, data, io->length);
handled = 1;
} else if (req->bRequest == 0) { // GET_SYSTEM_PORT_STATUS
// port_flags = 0 (card_present = 0) to avoid mmc_add_host probing
uint8_t data[15] = {15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
io->length = req->wLength < 15 ? req->wLength : 15;
memcpy(io->data, data, io->length);
handled = 1;
done = 1; // Last request in vub300_probe
}
} else if (req->bRequestType == 0x40) { // VENDOR OUT
if (req->bRequest == 16) { // SET_ROM_WAIT_STATES
io->length = 0;
handled = 1;
}
} else if (req->bRequestType == 0x00 && req->bRequest == 9) { // SET_CONFIGURATION
io->length = 0;
handled = 1;
} else {
// ACK other standard requests (e.g. SET_ADDRESS)
io->length = 0;
handled = 1;
}
if (handled) {
if (req->bRequestType & 0x80) {
ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
free(io);
}
free(event);
}
printf("[+] USB enumeration completed.\n");
// Give vub300_probe a moment to finish mmc_add_host
usleep(200000);
// Close fd to simulate USB disconnect
close(fd);
printf("[+] Gadget closed, simulating disconnect.\n");
// Wait for the inactivity_timer to expire (it is set to jiffies + HZ)
sleep(2);
printf("[+] Done.\n");
return 0;
}
Reproduced:true ReproducedBugTitle:BUG: sleeping function called from invalid context in mmc_free_host ReproducedCrashReport:BUG: sleeping function called from invalid context at kernel/workqueue.c:4561
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 0, name: swapper/1
preempt_count: 101, expected: 0
RCU nest depth: 0, expected: 0
locks held by swapper/1/0: 1, last CPU#1:
#0: ffffc90000a18cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 1 UID: 0 PID: 0 Comm: swapper/1 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:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x36a/0x4c0 kernel/sched/core.c:9234
__cancel_work_sync+0x6d/0x110 kernel/workqueue.c:4561
mmc_free_host+0x19/0x30 drivers/mmc/core/host.c:700
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:64
Code: 9c a2 02 c3 cc cc cc cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 66 90 0f 00 2d b3 37 24 00 fb f4 <e9> cc 03 03 00 cc cc cc cc cc cc cc cc cc cc cc cc 90 90 90 90 90
RSP: 0018:ffffc900001a7e40 EFLAGS: 00000246
RAX: 000000000003e04d RBX: ffffffff819a5f6c RCX: 8000000000000001
RDX: 0000000000000001 RSI: ffffffff8e3b7134 RDI: ffffffff8c540080
RBP: ffffc900001a7f10 R08: ffff88827be33a1b R09: 1ffff1104f7c6743
R10: dffffc0000000000 R11: ffffed104f7c6744 R12: 0000000000000000
R13: 1ffff1103008f000 R14: 1ffff92000034fd0 R15: dffffc0000000000
arch_safe_halt arch/x86/kernel/process.c:767 [inline]
default_idle+0x9/0x20 arch/x86/kernel/process.c:768
default_idle_call+0x72/0xb0 kernel/sched/idle.c:122
cpuidle_idle_call kernel/sched/idle.c:199 [inline]
do_idle+0x1cc/0x540 kernel/sched/idle.c:355
cpu_startup_entry+0x43/0x60 kernel/sched/idle.c:454
start_secondary+0x101/0x110 arch/x86/kernel/smpboot.c:312
common_startup_64+0x13e/0x157
</TASK>
ODEBUG: object ffffc90000a18a80 is NOT on stack ffffc900001a0000, but annotated.
------------[ cut here ]------------
1
WARNING: lib/debugobjects.c:672 at debug_object_is_on_stack lib/debugobjects.c:672 [inline], CPU#1: swapper/1/0
WARNING: lib/debugobjects.c:672 at lookup_object_or_alloc lib/debugobjects.c:705 [inline], CPU#1: swapper/1/0
WARNING: lib/debugobjects.c:672 at __debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798, CPU#1: swapper/1/0
Modules linked in:
CPU: 1 UID: 0 PID: 0 Comm: swapper/1 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
RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:672 [inline]
RIP: 0010:lookup_object_or_alloc lib/debugobjects.c:705 [inline]
RIP: 0010:__debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798
Code: cc cc cc 41 ff c7 44 89 3d c9 79 f7 15 48 c7 c1 80 0a 54 8c 48 c7 c7 e0 0a 54 8c 84 c0 48 0f 45 f9 48 89 de e8 8d 95 45 fc 90 <0f> 0b 90 e9 c0 fe ff ff e8 4f 1c 00 00 8b 05 a1 f7 79 0a 3b 05 9f
RSP: 0018:ffffc90000a189b8 EFLAGS: 00010046
RAX: 0000000000000050 RBX: ffffc90000a18a80 RCX: 14c412d005b96700
RDX: 0000000000000100 RSI: 0000000000000100 RDI: 0000000000000000
RBP: ffff888180478020 R08: 0000000000000100 R09: 1ffff920001430e4
R10: dffffc0000000000 R11: fffff520001430e5 R12: ffff88810f22d478
R13: ffff88810d414a80 R14: dffffc0000000000 R15: 0000000000000001
FS: 0000000000000000(0000) GS:ffff8882e8473000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f414538af5e CR3: 00000001f8ede000 CR4: 0000000000352ef0
Call Trace:
<IRQ>
__synchronize_srcu+0x1d5/0x2f0 kernel/rcu/srcutree.c:1475
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:64
Code: 9c a2 02 c3 cc cc cc cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 66 90 0f 00 2d b3 37 24 00 fb f4 <e9> cc 03 03 00 cc cc cc cc cc cc cc cc cc cc cc cc 90 90 90 90 90
RSP: 0018:ffffc900001a7e40 EFLAGS: 00000246
RAX: 000000000003e04d RBX: ffffffff819a5f6c RCX: 8000000000000001
RDX: 0000000000000001 RSI: ffffffff8e3b7134 RDI: ffffffff8c540080
RBP: ffffc900001a7f10 R08: ffff88827be33a1b R09: 1ffff1104f7c6743
R10: dffffc0000000000 R11: ffffed104f7c6744 R12: 0000000000000000
R13: 1ffff1103008f000 R14: 1ffff92000034fd0 R15: dffffc0000000000
arch_safe_halt arch/x86/kernel/process.c:767 [inline]
default_idle+0x9/0x20 arch/x86/kernel/process.c:768
default_idle_call+0x72/0xb0 kernel/sched/idle.c:122
cpuidle_idle_call kernel/sched/idle.c:199 [inline]
do_idle+0x1cc/0x540 kernel/sched/idle.c:355
cpu_startup_entry+0x43/0x60 kernel/sched/idle.c:454
start_secondary+0x101/0x110 arch/x86/kernel/smpboot.c:312
common_startup_64+0x13e/0x157
</TASK>
----------------
Code disassembly (best guess):
0: 9c pushf
1: a2 02 c3 cc cc cc cc movabs %al,0xccccccccccccc302
8: cc cc
a: cc int3
b: 90 nop
c: 90 nop
d: 90 nop
e: 90 nop
f: 90 nop
10: 90 nop
11: 90 nop
12: 90 nop
13: 90 nop
14: 90 nop
15: 90 nop
16: 90 nop
17: 90 nop
18: 90 nop
19: 90 nop
1a: 90 nop
1b: f3 0f 1e fa endbr64
1f: 66 90 xchg %ax,%ax
21: 0f 00 2d b3 37 24 00 verw 0x2437b3(%rip) # 0x2437db
28: fb sti
29: f4 hlt
* 2a: e9 cc 03 03 00 jmp 0x303fb <-- trapping instruction
2f: cc int3
30: cc int3
31: cc int3
32: cc int3
33: cc int3
34: cc int3
35: cc int3
36: cc int3
37: cc int3
38: cc int3
39: cc int3
3a: cc int3
3b: 90 nop
3c: 90 nop
3d: 90 nop
3e: 90 nop
3f: 90 nop
]
|
| 1/1 |
2026/09/07 14:41 |
action |
kernel-checkouter |
0m
Results: map[KernelSrc:/app/workdir/cache/src/aa98a73d3de081d3fc16043e1ff9e100d090b407]
|
| 2/1 |
2026/09/07 14:41 |
action |
kernel-builder |
17m
Results: map[KernelObj:/app/workdir/cache/build/86e7e8a6858ad9f8b76e95f932208696c32300f7]
|
| 3/1 |
2026/09/07 14:58 |
action |
codesearch-prepare |
11m
Results: map[Index:codesearch-index]
|
| 4/1 |
2026/09/07 15:10 |
agent |
initial-researcher |
9m
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: WARNING: suspicious RCU usage in wakeup_source_unregister
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
=============================
WARNING: suspicious RCU usage
syzkaller #0 Tainted: G W L
-----------------------------
kernel/rcu/srcutree.c:1468 Illegal synchronize_srcu() in same-type SRCU (or in RCU) read-side critical section!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
locks held by syz-executor/5675: 5, last CPU#0:
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1542 [inline]
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm+0x10f/0x480 kernel/fork.c:1595
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:562 [inline]
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: dup_mmap+0x195/0x1dc0 mm/mmap.c:1716
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: mmap_write_lock_nested include/linux/mmap_lock.h:552 [inline]
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: dup_mmap+0x221/0x1dc0 mm/mmap.c:1723
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: __pte_offset_map+0x29/0x240 mm/pgtable-generic.c:290
#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
stack backtrace:
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
Call Trace:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
lockdep_rcu_suspicious+0x140/0x1d0 kernel/locking/lockdep.c:6938
__synchronize_srcu+0x157/0x2f0 kernel/rcu/srcutree.c:1464
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
BUG: sleeping function called from invalid context at kernel/rcu/srcutree.c:1472
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 5675, name: syz-executor
preempt_count: 101, expected: 0
RCU nest depth: 1, expected: 0
locks held by syz-executor/5675: 5, last CPU#0:
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1542 [inline]
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm+0x10f/0x480 kernel/fork.c:1595
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:562 [inline]
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: dup_mmap+0x195/0x1dc0 mm/mmap.c:1716
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: mmap_write_lock_nested include/linux/mmap_lock.h:552 [inline]
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: dup_mmap+0x221/0x1dc0 mm/mmap.c:1723
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: __pte_offset_map+0x29/0x240 mm/pgtable-generic.c:290
#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
Preemption disabled at:
[<ffffffff81336576>] preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
Call Trace:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x36a/0x4c0 kernel/sched/core.c:9234
__synchronize_srcu+0x1a1/0x2f0 kernel/rcu/srcutree.c:1472
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
ODEBUG: object ffffc90000007a80 is NOT on stack ffffc90004320000, but annotated.
------------[ cut here ]------------
1
WARNING: lib/debugobjects.c:672 at debug_object_is_on_stack lib/debugobjects.c:672 [inline], CPU#0: syz-executor/5675
WARNING: lib/debugobjects.c:672 at lookup_object_or_alloc lib/debugobjects.c:705 [inline], CPU#0: syz-executor/5675
WARNING: lib/debugobjects.c:672 at __debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798, CPU#0: syz-executor/5675
Modules linked in:
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:672 [inline]
RIP: 0010:lookup_object_or_alloc lib/debugobjects.c:705 [inline]
RIP: 0010:__debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798
Code: cc cc cc 41 ff c7 44 89 3d c9 75 e8 15 48 c7 c1 80 9d 6d 8c 48 c7 c7 e0 9d 6d 8c 84 c0 48 0f 45 f9 48 89 de e8 4d fa 3d fc 90 <0f> 0b 90 e9 c0 fe ff ff e8 4f 1c 00 00 8b 05 a1 cd 6e 0a 3b 05 9f
RSP: 0018:ffffc900000079b8 EFLAGS: 00010046
RAX: 0000000000000050 RBX: ffffc90000007a80 RCX: 0978036a12caea00
RDX: 0000000000000100 RSI: 0000000000000100 RDI: 0000000000000000
RBP: ffff88803588dde0 R08: 0000000000000100 R09: 0000000000080000
R10: 0000000000008000 R11: ffffffff8ec362b8 R12: 1ffff92000000f4c
R13: ffff888021b995e8 R14: dffffc0000000000 R15: 0000000000000001
FS: 000055558fe74500(0000) GS:ffff888124cd9000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fdafb3556c8 CR3: 00000000640ca000 CR4: 00000000003526f0
Call Trace:
<IRQ>
__synchronize_srcu+0x1d5/0x2f0 kernel/rcu/srcutree.c:1475
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
----------------
Code disassembly (best guess), 1 bytes skipped:
0: 00 00 add %al,(%rax)
2: 41 c7 84 24 20 0e 00 movl $0x0,0xe20(%r12)
9: 00 00 00 00 00
e: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
13: 49 83 c4 48 add $0x48,%r12
17: 4c 89 e7 mov %r12,%rdi
1a: e8 f7 ed 50 0a call 0xa50ee16
1f: e8 d2 00 3a 00 call 0x3a00f6
24: fb sti
25: 4c 8b 65 c8 mov -0x38(%rbp),%r12
* 29: 49 8d bc 24 10 17 00 lea 0x1710(%r12),%rdi <-- trapping instruction
30: 00
31: 48 89 f8 mov %rdi,%rax
34: 48 c1 e8 03 shr $0x3,%rax
38: 42 0f b6 04 30 movzbl (%rax,%r14,1),%eax
3d: 84 c0 test %al,%al
Reply: An analysis of the bug report and kernel source reveals the following root cause and reproduction strategy.
### Root Cause Analysis
The bug is a classic case of freeing an object and calling sleeping functions from an atomic context (timer callback).
During initialization (`vub300_probe`), the `vub300` MMC host driver arms an `inactivity_timer` and holds a reference to the `vub300` object for it.
When the USB device is disconnected, `vub300_disconnect` is invoked. It sets `vub300->interface = NULL` and drops its reference to the object, but **crucially fails to delete the pending `inactivity_timer`** (e.g., via `del_timer_sync`).
When the timer eventually expires, its callback `vub300_inactivity_timer_expired` runs in softirq (atomic) context. It sees that the interface is disconnected (`!vub300->interface`) and drops the timer's reference to the object. Since this is the last reference, `vub300_delete` is executed directly from the timer callback.
`vub300_delete` calls `mmc_free_host()`, which drops the device reference and triggers `mmc_host_classdev_release()`. This function unregisters the wakeup source, which calls `synchronize_srcu()`. Because `synchronize_srcu()` can sleep, calling it from a softirq context is illegal and triggers the observed `WARNING: suspicious RCU usage` and `BUG: sleeping function called from invalid context`.
### Reproduction Strategy
To reproduce this bug, we need to trick the kernel into probing the `vub300` driver and then immediately disconnect the device. We can achieve this from userspace using the `raw-gadget` subsystem to emulate a USB device that matches the `vub300` driver's expected Vendor/Product IDs (`0x0424:0x012C`).
1. Open `/dev/raw-gadget` and initialize a dummy USB device.
2. Respond to standard USB enumeration requests (`GET_DESCRIPTOR` for Device and Configuration). The configuration must expose 4 bulk endpoints (2 IN, 2 OUT) as expected by the driver.
3. Respond to the three specific vendor control requests sent by `vub300_probe` (`GET_HC_INF0`, `SET_ROM_WAIT_STATES`, and `GET_SYSTEM_PORT_STATUS`).
4. Once `vub300_probe` completes successfully, close the `raw-gadget` file descriptor to simulate a physical USB disconnect.
5. Sleep for a couple of seconds to allow the `inactivity_timer` (armed to `jiffies + HZ`) to expire and trigger the bug.
### Minimal C Reproducer
```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
#define USB_RAW_IOCTL_RUN _IO('U', 1)
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
struct usb_raw_event {
uint32_t type;
uint32_t length;
uint8_t data[0];
};
struct usb_raw_ep_io {
uint16_t ep;
uint16_t flags;
uint32_t length;
uint8_t data[0];
};
struct usb_ctrlrequest {
uint8_t bRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} __attribute__((packed));
int main() {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
perror("open /dev/raw-gadget");
return 1;
}
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
if (ioctl(fd, USB_RAW_IOCTL_INIT, &init) < 0) {
perror("USB_RAW_IOCTL_INIT");
return 1;
}
if (ioctl(fd, USB_RAW_IOCTL_RUN, 0) < 0) {
perror("USB_RAW_IOCTL_RUN");
return 1;
}
int done = 0;
while (!done) {
struct usb_raw_event *event = malloc(sizeof(*event) + 1024);
event->type = 0;
event->length = 1024;
if (ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event) < 0) {
free(event);
break;
}
if (event->type == 2) { // USB_RAW_EVENT_CONTROL
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)event->data;
struct usb_raw_ep_io *io = malloc(sizeof(*io) + 1024);
io->ep = 0;
io->flags = 0;
io->length = 0;
int handled = 0;
if (req->bRequestType == 0x80 && req->bRequest == 6) { // GET_DESCRIPTOR
if ((req->wValue >> 8) == 1) { // DEVICE
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
} else if ((req->wValue >> 8) == 2) { // CONFIG
uint8_t desc[] = {
9, 2, 46, 0, 1, 1, 0, 0x80, 50,
9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0,
7, 5, 0x81, 2, 0, 2, 0,
7, 5, 0x02, 2, 0, 2, 0,
7, 5, 0x83, 2, 0, 2, 0,
7, 5, 0x04, 2, 0, 2, 0,
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
}
} else if (req->bRequestType == 0xC0) { // VENDOR IN
if (req->bRequest == 1) { // GET_HC_INF0
uint8_t data[4] = {4, 0, 0, 1};
io->length = req->wLength < 4 ? req->wLength : 4;
memcpy(io->data, data, io->length);
handled = 1;
} else if (req->bRequest == 0) { // GET_SYSTEM_PORT_STATUS
uint8_t data[15] = {15, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
io->length = req->wLength < 15 ? req->wLength : 15;
memcpy(io->data, data, io->length);
handled = 1;
done = 1; // Last request in vub300_probe
}
} else if (req->bRequestType == 0x40) { // VENDOR OUT
if (req->bRequest == 16) { // SET_ROM_WAIT_STATES
io->length = 0;
handled = 1;
}
} else if (req->bRequestType == 0x00 && req->bRequest == 9) { // SET_CONFIGURATION
io->length = 0;
handled = 1;
} else {
// ACK other standard requests (e.g. SET_ADDRESS)
io->length = 0;
handled = 1;
}
if (handled) {
if (req->bRequestType & 0x80) {
ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
free(io);
}
free(event);
}
// Give vub300_probe a moment to finish mmc_add_host
usleep(200000);
// Close fd to simulate USB disconnect
close(fd);
// Wait for the inactivity_timer to expire (it is set to jiffies + HZ)
sleep(2);
return 0;
}
```
|
| 5/2 |
2026/09/07 15:10 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 12645
output: 19
thoughts: 846
Thoughts: **My Thought Process on the RCU and Debug Object Warnings**
Okay, I've received a bug report with some rather concerning warnings, and my immediate thought is to dissect them one by one to understand the underlying issue.
The first warning, `WARNING: suspicious RCU usage in wakeup_source_unregister`, immediately grabs my attention. The accompanying message, `kernel/rcu/srcutree.c:1468 Illegal synchronize_srcu() in same-type SRCU (or in RCU) read-side critical section!`, is a dead giveaway. This tells me that somewhere within the `wakeup_source_unregister` function, an attempt is being made to call `synchronize_srcu()` while already inside an RCU read-side critical section. This is fundamentally a violation of RCU's rules – `synchronize_srcu()` is designed to *wait* for RCU read-side sections to complete, and you absolutely cannot call a blocking operation from within a context that must remain non-blocking.
This naturally leads to the second warning: `BUG: sleeping function called from invalid context at kernel/rcu/srcutree.c:1472`. This bug report is directly corroborating the first warning. The fact that a "sleeping function" (which `synchronize_srcu()` is, as it needs to block until quiescent states are reached) is called from an "invalid context" confirms the violation. The context must be invalid precisely *because* it's an RCU read-side critical section, where sleeping is prohibited.
Then I see the third warning: `ODEBUG: object ffffc90000007a80 is NOT on stack ffffc90004320000, but annotated.` This points to an issue with the `debugobjects` subsystem. It suggests that an object, identified by `ffffc90000007a80`, is being tracked or annotated by `debugobjects`, but its current location (indicated by the stack address `ffffc90004320000`) doesn't match where `debugobjects` expects it to be. This often happens when an object is allocated or freed incorrectly, or when there's some corruption in how objects are managed, and it's a strong indicator that memory corruption or an invalid object lifecycle is at play.
Now, I need to trace the execution path that led to these warnings. The provided stack trace for the first warning is crucial here. I'll examine it function by function:
* `lockdep_rcu_suspicious` and `__synchronize_srcu`: These confirm the RCU violation, as expected.
* `wakeup_source_remove` and `wakeup_source_unregister`: These are the functions directly involved in the RCU misuse.
* `mmc_host_classdev_release`: This function seems to be the entry point into releasing an MMC host class device.
* `device_release` and `kobject_cleanup`/`kobject_release`/`kref_put`: This sequence indicates the standard mechanism for releasing a `kobject` is being invoked. When an object's reference count drops to zero, it's released, and this often involves cleanup routines like `mmc_host_classdev_release`.
* `call_timer_fn`, `expire_timers`, `__run_timers`, `__run_timer_base`, `run_timer_base`, `run_timer_softirq`: This entire chain reveals a critical piece of information: the release process is being triggered by a timer expiration. Specifically, it's coming from a `softirq` context.
This "softirq context" is the key insight. Softirqs are executed in an atomic context. This means interrupts are disabled, and crucially, *sleeping is forbidden*. Furthermore, RCU read-side critical sections are often implicitly entered or managed within atomic contexts where softirqs are disabled. Therefore, calling `synchronize_srcu()`, which *must* sleep to ensure a quiescent state, from within this timer callback (which is operating in a softirq context) is the direct cause of the `BUG: sleeping function called from invalid context`.
The sequence is clear: a timer fires, its callback is executed in a softirq context. This callback eventually leads to the release of an MMC host class device. During this release, `wakeup_source_unregister` is called. Inside `wakeup_source_unregister`, `synchronize_srcu()` is invoked, attempting to sleep while already in an atomic/softirq context, thus triggering the RCU warning and the sleeping function bug. The debug object warning might be a consequence of this improper object lifecycle management, possibly related to the state of the `mmc_host_classdev` object or associated structures when it's being released.
To pinpoint the exact timer, I look at the "locks held" section of the bug report. It explicitly states: `#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745`. This tells me the problematic timer is `vub300->inactivity_timer`. My next logical step would be to search the codebase for `vub300` to understand its role and how this timer is being set up and what actions it's intended to perform. This will help me understand *why* `wakeup_source_unregister` is being called from this timer callback in the first place.
|
| 6/2 |
2026/09/07 15:10 |
tool |
grepper |
0m
Args:
Results: map[Output:
Full output is too long, showing 500 out of 1644 lines.
Use more precise expression if possible.
MAINTAINERS=29293=S: Orphan
MAINTAINERS:29294:F: drivers/mmc/host/vub300.c
MAINTAINERS-29295-
--
drivers/mmc/host/Kconfig=920=config MMC_VUB300
--
drivers/mmc/host/Kconfig-944- To compile this mmc host controller driver as a module,
drivers/mmc/host/Kconfig:945: choose M here: the module will be called vub300.
drivers/mmc/host/Kconfig-946-
--
drivers/mmc/host/Makefile=62=obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
drivers/mmc/host/Makefile:63:obj-$(CONFIG_MMC_VUB300) += vub300.o
drivers/mmc/host/Makefile-64-obj-$(CONFIG_MMC_USHC) += ushc.o
--
drivers/mmc/host/vub300.c=260=MODULE_PARM_DESC(firmware_rom_wait_states,
--
drivers/mmc/host/vub300.c-265-#define VUB300_PRODUCT_ID 0x012C
drivers/mmc/host/vub300.c:266:static const struct usb_device_id vub300_table[] = {
drivers/mmc/host/vub300.c-267- {USB_DEVICE(ELAN_VENDOR_ID, VUB300_PRODUCT_ID)},
--
drivers/mmc/host/vub300.c-270-};
drivers/mmc/host/vub300.c:271:MODULE_DEVICE_TABLE(usb, vub300_table);
drivers/mmc/host/vub300.c-272-
--
drivers/mmc/host/vub300.c=286=struct sdio_register {
--
drivers/mmc/host/vub300.c-295-
drivers/mmc/host/vub300.c:296:struct vub300_mmc_host {
drivers/mmc/host/vub300.c-297- struct usb_device *udev;
--
drivers/mmc/host/vub300.c-354-
drivers/mmc/host/vub300.c:355:#define kref_to_vub300_mmc_host(d) container_of(d, struct vub300_mmc_host, kref)
drivers/mmc/host/vub300.c-356-#define SET_TRANSFER_PSEUDOCODE 21
--
drivers/mmc/host/vub300.c-368-
drivers/mmc/host/vub300.c:369:static void vub300_delete(struct kref *kref)
drivers/mmc/host/vub300.c-370-{ /* kref callback - softirq */
drivers/mmc/host/vub300.c:371: struct vub300_mmc_host *vub300 = kref_to_vub300_mmc_host(kref);
drivers/mmc/host/vub300.c:372: struct mmc_host *mmc = vub300->mmc;
drivers/mmc/host/vub300.c-373-
drivers/mmc/host/vub300.c:374: usb_free_urb(vub300->command_out_urb);
drivers/mmc/host/vub300.c:375: vub300->command_out_urb = NULL;
drivers/mmc/host/vub300.c:376: usb_free_urb(vub300->command_res_urb);
drivers/mmc/host/vub300.c:377: vub300->command_res_urb = NULL;
drivers/mmc/host/vub300.c:378: usb_put_dev(vub300->udev);
drivers/mmc/host/vub300.c-379- mmc_free_host(mmc);
drivers/mmc/host/vub300.c-380- /*
drivers/mmc/host/vub300.c:381: * and hence also frees vub300
drivers/mmc/host/vub300.c-382- * which is contained at the end of struct mmc
--
drivers/mmc/host/vub300.c-385-
drivers/mmc/host/vub300.c:386:static void vub300_queue_cmnd_work(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-387-{
drivers/mmc/host/vub300.c:388: kref_get(&vub300->kref);
drivers/mmc/host/vub300.c:389: if (queue_work(cmndworkqueue, &vub300->cmndwork)) {
drivers/mmc/host/vub300.c-390- /*
--
drivers/mmc/host/vub300.c-401- */
drivers/mmc/host/vub300.c:402: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-403- }
--
drivers/mmc/host/vub300.c-405-
drivers/mmc/host/vub300.c:406:static void vub300_queue_poll_work(struct vub300_mmc_host *vub300, int delay)
drivers/mmc/host/vub300.c-407-{
drivers/mmc/host/vub300.c:408: kref_get(&vub300->kref);
drivers/mmc/host/vub300.c:409: if (queue_delayed_work(pollworkqueue, &vub300->pollwork, delay)) {
drivers/mmc/host/vub300.c-410- /*
--
drivers/mmc/host/vub300.c-421- */
drivers/mmc/host/vub300.c:422: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-423- }
--
drivers/mmc/host/vub300.c-425-
drivers/mmc/host/vub300.c:426:static void vub300_queue_dead_work(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-427-{
drivers/mmc/host/vub300.c:428: kref_get(&vub300->kref);
drivers/mmc/host/vub300.c:429: if (queue_work(deadworkqueue, &vub300->deadwork)) {
drivers/mmc/host/vub300.c-430- /*
--
drivers/mmc/host/vub300.c-441- */
drivers/mmc/host/vub300.c:442: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-443- }
--
drivers/mmc/host/vub300.c=446=static void irqpoll_res_completed(struct urb *urb)
drivers/mmc/host/vub300.c-447-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:448: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-449- if (urb->status)
drivers/mmc/host/vub300.c:450: vub300->usb_transport_fail = urb->status;
drivers/mmc/host/vub300.c:451: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-452-}
--
drivers/mmc/host/vub300.c=454=static void irqpoll_out_completed(struct urb *urb)
drivers/mmc/host/vub300.c-455-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:456: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-457- if (urb->status) {
drivers/mmc/host/vub300.c:458: vub300->usb_transport_fail = urb->status;
drivers/mmc/host/vub300.c:459: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-460- return;
--
drivers/mmc/host/vub300.c-463- unsigned int pipe =
drivers/mmc/host/vub300.c:464: usb_rcvbulkpipe(vub300->udev, vub300->cmnd_res_ep);
drivers/mmc/host/vub300.c:465: usb_fill_bulk_urb(vub300->command_res_urb, vub300->udev, pipe,
drivers/mmc/host/vub300.c:466: &vub300->resp, sizeof(vub300->resp),
drivers/mmc/host/vub300.c:467: irqpoll_res_completed, vub300);
drivers/mmc/host/vub300.c:468: vub300->command_res_urb->actual_length = 0;
drivers/mmc/host/vub300.c:469: ret = usb_submit_urb(vub300->command_res_urb, GFP_ATOMIC);
drivers/mmc/host/vub300.c-470- if (ret) {
drivers/mmc/host/vub300.c:471: vub300->usb_transport_fail = ret;
drivers/mmc/host/vub300.c:472: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-473- }
--
drivers/mmc/host/vub300.c-477-
drivers/mmc/host/vub300.c:478:static void send_irqpoll(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-479-{
drivers/mmc/host/vub300.c:480: /* cmd_mutex is held by vub300_pollwork_thread */
drivers/mmc/host/vub300.c-481- int retval;
drivers/mmc/host/vub300.c-482- int timeout = 0xFFFF & (0x0001FFFF - firmware_irqpoll_timeout);
drivers/mmc/host/vub300.c:483: vub300->cmnd.poll.header_size = 22;
drivers/mmc/host/vub300.c:484: vub300->cmnd.poll.header_type = 1;
drivers/mmc/host/vub300.c:485: vub300->cmnd.poll.port_number = 0;
drivers/mmc/host/vub300.c:486: vub300->cmnd.poll.command_type = 2;
drivers/mmc/host/vub300.c:487: vub300->cmnd.poll.poll_timeout_lsb = 0xFF & (unsigned)timeout;
drivers/mmc/host/vub300.c:488: vub300->cmnd.poll.poll_timeout_msb = 0xFF & (unsigned)(timeout >> 8);
drivers/mmc/host/vub300.c:489: usb_fill_bulk_urb(vub300->command_out_urb, vub300->udev,
drivers/mmc/host/vub300.c:490: usb_sndbulkpipe(vub300->udev, vub300->cmnd_out_ep)
drivers/mmc/host/vub300.c:491: , &vub300->cmnd, sizeof(vub300->cmnd)
drivers/mmc/host/vub300.c:492: , irqpoll_out_completed, vub300);
drivers/mmc/host/vub300.c:493: retval = usb_submit_urb(vub300->command_out_urb, GFP_KERNEL);
drivers/mmc/host/vub300.c-494- if (0 > retval) {
drivers/mmc/host/vub300.c:495: vub300->usb_transport_fail = retval;
drivers/mmc/host/vub300.c:496: vub300_queue_poll_work(vub300, 1);
drivers/mmc/host/vub300.c:497: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-498- return;
--
drivers/mmc/host/vub300.c-503-
drivers/mmc/host/vub300.c:504:static void new_system_port_status(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-505-{
drivers/mmc/host/vub300.c:506: int old_card_present = vub300->card_present;
drivers/mmc/host/vub300.c-507- int new_card_present =
drivers/mmc/host/vub300.c:508: (0x0001 & vub300->system_port_status.port_flags) ? 1 : 0;
drivers/mmc/host/vub300.c:509: vub300->read_only =
drivers/mmc/host/vub300.c:510: (0x0010 & vub300->system_port_status.port_flags) ? 1 : 0;
drivers/mmc/host/vub300.c-511- if (new_card_present && !old_card_present) {
drivers/mmc/host/vub300.c:512: dev_info(&vub300->udev->dev, "card just inserted\n");
drivers/mmc/host/vub300.c:513: vub300->card_present = 1;
drivers/mmc/host/vub300.c:514: vub300->bus_width = 0;
drivers/mmc/host/vub300.c-515- if (disable_offload_processing)
drivers/mmc/host/vub300.c:516: strscpy(vub300->vub_name, "EMPTY Processing Disabled",
drivers/mmc/host/vub300.c:517: sizeof(vub300->vub_name));
drivers/mmc/host/vub300.c-518- else
drivers/mmc/host/vub300.c:519: vub300->vub_name[0] = 0;
drivers/mmc/host/vub300.c:520: mmc_detect_change(vub300->mmc, 1);
drivers/mmc/host/vub300.c-521- } else if (!new_card_present && old_card_present) {
drivers/mmc/host/vub300.c:522: dev_info(&vub300->udev->dev, "card just ejected\n");
drivers/mmc/host/vub300.c:523: vub300->card_present = 0;
drivers/mmc/host/vub300.c:524: mmc_detect_change(vub300->mmc, 0);
drivers/mmc/host/vub300.c-525- } else {
--
drivers/mmc/host/vub300.c-529-
drivers/mmc/host/vub300.c:530:static void __add_offloaded_reg_to_fifo(struct vub300_mmc_host *vub300,
drivers/mmc/host/vub300.c-531- struct offload_registers_access
--
drivers/mmc/host/vub300.c-533-{
drivers/mmc/host/vub300.c:534: u8 r = vub300->fn[func].offload_point + vub300->fn[func].offload_count;
drivers/mmc/host/vub300.c:535: memcpy(&vub300->fn[func].reg[MAXREGMASK & r], register_access,
drivers/mmc/host/vub300.c-536- sizeof(struct offload_registers_access));
drivers/mmc/host/vub300.c:537: vub300->fn[func].offload_count += 1;
drivers/mmc/host/vub300.c:538: vub300->total_offload_count += 1;
drivers/mmc/host/vub300.c-539-}
drivers/mmc/host/vub300.c-540-
drivers/mmc/host/vub300.c:541:static void add_offloaded_reg(struct vub300_mmc_host *vub300,
drivers/mmc/host/vub300.c-542- struct offload_registers_access *register_access)
--
drivers/mmc/host/vub300.c-547- u8 func = ((0x70 & register_access->command_byte[0]) >> 4);
drivers/mmc/host/vub300.c:548: u8 regs = vub300->dynamic_register_count;
drivers/mmc/host/vub300.c-549- u8 i = 0;
drivers/mmc/host/vub300.c:550: while (0 < regs-- && 1 == vub300->sdio_register[i].activate) {
drivers/mmc/host/vub300.c:551: if (vub300->sdio_register[i].func_num == func &&
drivers/mmc/host/vub300.c:552: vub300->sdio_register[i].sdio_reg == Register) {
drivers/mmc/host/vub300.c:553: if (vub300->sdio_register[i].prepared == 0)
drivers/mmc/host/vub300.c:554: vub300->sdio_register[i].prepared = 1;
drivers/mmc/host/vub300.c:555: vub300->sdio_register[i].response =
drivers/mmc/host/vub300.c-556- register_access->Respond_Byte[2];
drivers/mmc/host/vub300.c:557: vub300->sdio_register[i].regvalue =
drivers/mmc/host/vub300.c-558- register_access->Respond_Byte[3];
--
drivers/mmc/host/vub300.c-564- }
drivers/mmc/host/vub300.c:565: __add_offloaded_reg_to_fifo(vub300, register_access, func);
drivers/mmc/host/vub300.c-566-}
drivers/mmc/host/vub300.c-567-
drivers/mmc/host/vub300.c:568:static void check_vub300_port_status(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-569-{
drivers/mmc/host/vub300.c-570- /*
drivers/mmc/host/vub300.c:571: * cmd_mutex is held by vub300_pollwork_thread,
drivers/mmc/host/vub300.c:572: * vub300_deadwork_thread or vub300_cmndwork_thread
drivers/mmc/host/vub300.c-573- */
--
drivers/mmc/host/vub300.c-575- retval =
drivers/mmc/host/vub300.c:576: usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
drivers/mmc/host/vub300.c-577- GET_SYSTEM_PORT_STATUS,
drivers/mmc/host/vub300.c-578- USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
drivers/mmc/host/vub300.c:579: 0x0000, 0x0000, &vub300->system_port_status,
drivers/mmc/host/vub300.c:580: sizeof(vub300->system_port_status), 1000);
drivers/mmc/host/vub300.c:581: if (sizeof(vub300->system_port_status) == retval)
drivers/mmc/host/vub300.c:582: new_system_port_status(vub300);
drivers/mmc/host/vub300.c-583-}
drivers/mmc/host/vub300.c-584-
drivers/mmc/host/vub300.c:585:static void __vub300_irqpoll_response(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-586-{
drivers/mmc/host/vub300.c:587: /* cmd_mutex is held by vub300_pollwork_thread */
drivers/mmc/host/vub300.c:588: if (vub300->command_res_urb->actual_length == 0)
drivers/mmc/host/vub300.c-589- return;
drivers/mmc/host/vub300.c-590-
drivers/mmc/host/vub300.c:591: switch (vub300->resp.common.header_type) {
drivers/mmc/host/vub300.c-592- case RESPONSE_INTERRUPT:
drivers/mmc/host/vub300.c:593: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:594: if (vub300->irq_enabled)
drivers/mmc/host/vub300.c:595: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c-596- else
drivers/mmc/host/vub300.c:597: vub300->irqs_queued += 1;
drivers/mmc/host/vub300.c:598: vub300->irq_disabled = 1;
drivers/mmc/host/vub300.c:599: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c-600- break;
drivers/mmc/host/vub300.c-601- case RESPONSE_ERROR:
drivers/mmc/host/vub300.c:602: if (vub300->resp.error.error_code == SD_ERROR_NO_DEVICE)
drivers/mmc/host/vub300.c:603: check_vub300_port_status(vub300);
drivers/mmc/host/vub300.c-604- break;
drivers/mmc/host/vub300.c-605- case RESPONSE_STATUS:
drivers/mmc/host/vub300.c:606: vub300->system_port_status = vub300->resp.status;
drivers/mmc/host/vub300.c:607: new_system_port_status(vub300);
drivers/mmc/host/vub300.c:608: if (!vub300->card_present)
drivers/mmc/host/vub300.c:609: vub300_queue_poll_work(vub300, HZ / 5);
drivers/mmc/host/vub300.c-610- break;
--
drivers/mmc/host/vub300.c-612- {
drivers/mmc/host/vub300.c:613: int offloaded_data_length = vub300->resp.common.header_size - 3;
drivers/mmc/host/vub300.c-614- int register_count = offloaded_data_length >> 3;
--
drivers/mmc/host/vub300.c-616- while (register_count--) {
drivers/mmc/host/vub300.c:617: add_offloaded_reg(vub300, &vub300->resp.irq.reg[ri]);
drivers/mmc/host/vub300.c-618- ri += 1;
drivers/mmc/host/vub300.c-619- }
drivers/mmc/host/vub300.c:620: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:621: if (vub300->irq_enabled)
drivers/mmc/host/vub300.c:622: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c-623- else
drivers/mmc/host/vub300.c:624: vub300->irqs_queued += 1;
drivers/mmc/host/vub300.c:625: vub300->irq_disabled = 1;
drivers/mmc/host/vub300.c:626: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c-627- break;
--
drivers/mmc/host/vub300.c-630- {
drivers/mmc/host/vub300.c:631: int offloaded_data_length = vub300->resp.common.header_size - 3;
drivers/mmc/host/vub300.c-632- int register_count = offloaded_data_length >> 3;
--
drivers/mmc/host/vub300.c-634- while (register_count--) {
drivers/mmc/host/vub300.c:635: add_offloaded_reg(vub300, &vub300->resp.irq.reg[ri]);
drivers/mmc/host/vub300.c-636- ri += 1;
drivers/mmc/host/vub300.c-637- }
drivers/mmc/host/vub300.c:638: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:639: if (vub300->irq_enabled)
drivers/mmc/host/vub300.c:640: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c-641- else
drivers/mmc/host/vub300.c:642: vub300->irqs_queued += 1;
drivers/mmc/host/vub300.c:643: vub300->irq_disabled = 0;
drivers/mmc/host/vub300.c:644: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c-645- break;
--
drivers/mmc/host/vub300.c-647- case RESPONSE_NO_INTERRUPT:
drivers/mmc/host/vub300.c:648: vub300_queue_poll_work(vub300, 1);
drivers/mmc/host/vub300.c-649- break;
--
drivers/mmc/host/vub300.c-654-
drivers/mmc/host/vub300.c:655:static void __do_poll(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-656-{
drivers/mmc/host/vub300.c:657: /* cmd_mutex is held by vub300_pollwork_thread */
drivers/mmc/host/vub300.c-658- unsigned long commretval;
drivers/mmc/host/vub300.c:659: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c:660: init_completion(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c:661: send_irqpoll(vub300);
drivers/mmc/host/vub300.c:662: commretval = wait_for_completion_timeout(&vub300->irqpoll_complete,
drivers/mmc/host/vub300.c-663- msecs_to_jiffies(500));
drivers/mmc/host/vub300.c:664: if (vub300->usb_transport_fail) {
drivers/mmc/host/vub300.c-665- /* no need to do anything */
drivers/mmc/host/vub300.c-666- } else if (commretval == 0) {
drivers/mmc/host/vub300.c:667: vub300->usb_timed_out = 1;
drivers/mmc/host/vub300.c:668: usb_kill_urb(vub300->command_out_urb);
drivers/mmc/host/vub300.c:669: usb_kill_urb(vub300->command_res_urb);
drivers/mmc/host/vub300.c-670- } else { /* commretval > 0 */
drivers/mmc/host/vub300.c:671: __vub300_irqpoll_response(vub300);
drivers/mmc/host/vub300.c-672- }
--
drivers/mmc/host/vub300.c-677- */
drivers/mmc/host/vub300.c:678:static void vub300_pollwork_thread(struct work_struct *work)
drivers/mmc/host/vub300.c-679-{ /* NOT irq */
drivers/mmc/host/vub300.c:680: struct vub300_mmc_host *vub300 = container_of(work,
drivers/mmc/host/vub300.c:681: struct vub300_mmc_host, pollwork.work);
drivers/mmc/host/vub300.c:682: if (!vub300->interface) {
drivers/mmc/host/vub300.c:683: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-684- return;
drivers/mmc/host/vub300.c-685- }
drivers/mmc/host/vub300.c:686: mutex_lock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:687: if (vub300->cmd) {
drivers/mmc/host/vub300.c:688: vub300_queue_poll_work(vub300, 1);
drivers/mmc/host/vub300.c:689: } else if (!vub300->card_present) {
drivers/mmc/host/vub300.c-690- /* no need to do anything */
drivers/mmc/host/vub300.c:691: } else { /* vub300->card_present */
drivers/mmc/host/vub300.c:692: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:693: if (!vub300->irq_enabled) {
drivers/mmc/host/vub300.c:694: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:695: } else if (vub300->irqs_queued) {
drivers/mmc/host/vub300.c:696: vub300->irqs_queued -= 1;
drivers/mmc/host/vub300.c:697: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c:698: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c:699: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:700: } else { /* NOT vub300->irqs_queued */
drivers/mmc/host/vub300.c:701: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:702: __do_poll(vub300);
drivers/mmc/host/vub300.c-703- }
drivers/mmc/host/vub300.c-704- }
drivers/mmc/host/vub300.c:705: mutex_unlock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:706: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-707-}
drivers/mmc/host/vub300.c-708-
drivers/mmc/host/vub300.c:709:static void vub300_deadwork_thread(struct work_struct *work)
drivers/mmc/host/vub300.c-710-{ /* NOT irq */
drivers/mmc/host/vub300.c:711: struct vub300_mmc_host *vub300 =
drivers/mmc/host/vub300.c:712: container_of(work, struct vub300_mmc_host, deadwork);
drivers/mmc/host/vub300.c:713: if (!vub300->interface) {
drivers/mmc/host/vub300.c:714: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-715- return;
drivers/mmc/host/vub300.c-716- }
drivers/mmc/host/vub300.c:717: mutex_lock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:718: if (vub300->cmd) {
drivers/mmc/host/vub300.c-719- /*
--
drivers/mmc/host/vub300.c-724- */
drivers/mmc/host/vub300.c:725: } else if (vub300->card_present) {
drivers/mmc/host/vub300.c:726: check_vub300_port_status(vub300);
drivers/mmc/host/vub300.c:727: } else if (vub300->mmc && vub300->mmc->card) {
drivers/mmc/host/vub300.c-728- /*
--
drivers/mmc/host/vub300.c-734- } else {
drivers/mmc/host/vub300.c:735: check_vub300_port_status(vub300);
drivers/mmc/host/vub300.c-736- }
drivers/mmc/host/vub300.c:737: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c:738: mutex_unlock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:739: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-740-}
drivers/mmc/host/vub300.c-741-
drivers/mmc/host/vub300.c:742:static void vub300_inactivity_timer_expired(struct timer_list *t)
drivers/mmc/host/vub300.c-743-{ /* softirq */
drivers/mmc/host/vub300.c:744: struct vub300_mmc_host *vub300 = timer_container_of(vub300, t,
drivers/mmc/host/vub300.c-745- inactivity_timer);
drivers/mmc/host/vub300.c:746: if (!vub300->interface) {
drivers/mmc/host/vub300.c:747: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c:748: } else if (vub300->cmd) {
drivers/mmc/host/vub300.c:749: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-750- } else {
drivers/mmc/host/vub300.c:751: vub300_queue_dead_work(vub300);
drivers/mmc/host/vub300.c:752: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-753- }
--
drivers/mmc/host/vub300.c-755-
drivers/mmc/host/vub300.c:756:static int vub300_response_error(u8 error_code)
drivers/mmc/host/vub300.c-757-{
--
drivers/mmc/host/vub300.c=792=static void command_res_completed(struct urb *urb)
drivers/mmc/host/vub300.c-793-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:794: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-795- if (urb->status) {
drivers/mmc/host/vub300.c-796- /* we have to let the initiator handle the error */
drivers/mmc/host/vub300.c:797: } else if (vub300->command_res_urb->actual_length == 0) {
drivers/mmc/host/vub300.c-798- /*
--
drivers/mmc/host/vub300.c-801- */
drivers/mmc/host/vub300.c:802: } else if (!vub300->data) {
drivers/mmc/host/vub300.c-803- /* this means that the command (typically CMD52) succeeded */
drivers/mmc/host/vub300.c:804: } else if (vub300->resp.common.header_type != 0x02) {
drivers/mmc/host/vub300.c-805- /*
--
drivers/mmc/host/vub300.c-808- */
drivers/mmc/host/vub300.c:809: } else if (vub300->urb) {
drivers/mmc/host/vub300.c:810: vub300->cmd->error =
drivers/mmc/host/vub300.c:811: vub300_response_error(vub300->resp.error.error_code);
drivers/mmc/host/vub300.c:812: usb_unlink_urb(vub300->urb);
drivers/mmc/host/vub300.c-813- } else {
drivers/mmc/host/vub300.c:814: vub300->cmd->error =
drivers/mmc/host/vub300.c:815: vub300_response_error(vub300->resp.error.error_code);
drivers/mmc/host/vub300.c:816: usb_sg_cancel(&vub300->sg_request);
drivers/mmc/host/vub300.c-817- }
drivers/mmc/host/vub300.c:818: complete(&vub300->command_complete); /* got_response_in */
drivers/mmc/host/vub300.c-819-}
--
drivers/mmc/host/vub300.c=821=static void command_out_completed(struct urb *urb)
drivers/mmc/host/vub300.c-822-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:823: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-824- if (urb->status) {
drivers/mmc/host/vub300.c:825: complete(&vub300->command_complete);
drivers/mmc/host/vub300.c-826- } else {
--
drivers/mmc/host/vub300.c-828- unsigned int pipe =
drivers/mmc/host/vub300.c:829: usb_rcvbulkpipe(vub300->udev, vub300->cmnd_res_ep);
drivers/mmc/host/vub300.c:830: usb_fill_bulk_urb(vub300->command_res_urb, vub300->udev, pipe,
drivers/mmc/host/vub300.c:831: &vub300->resp, sizeof(vub300->resp),
drivers/mmc/host/vub300.c:832: command_res_completed, vub300);
drivers/mmc/host/vub300.c:833: vub300->command_res_urb->actual_length = 0;
drivers/mmc/host/vub300.c:834: ret = usb_submit_urb(vub300->command_res_urb, GFP_ATOMIC);
drivers/mmc/host/vub300.c-835- if (ret == 0) {
--
drivers/mmc/host/vub300.c-844- */
drivers/mmc/host/vub300.c:845: complete(&vub300->command_complete);
drivers/mmc/host/vub300.c-846- }
--
drivers/mmc/host/vub300.c-852- */
drivers/mmc/host/vub300.c:853:static void snoop_block_size_and_bus_width(struct vub300_mmc_host *vub300,
drivers/mmc/host/vub300.c-854- u32 cmd_arg)
--
drivers/mmc/host/vub300.c-856- if ((0xFBFFFE00 & cmd_arg) == 0x80022200)
drivers/mmc/host/vub300.c:857: vub300->fbs[1] = (cmd_arg << 8) | (0x00FF & vub300->fbs[1]);
drivers/mmc/host/vub300.c-858- else if ((0xFBFFFE00 & cmd_arg) == 0x80022000)
drivers/mmc/host/vub300.c:859: vub300->fbs[1] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[1]);
drivers/mmc/host/vub300.c-860- else if ((0xFBFFFE00 & cmd_arg) == 0x80042200)
drivers/mmc/host/vub300.c:861: vub300->fbs[2] = (cmd_arg << 8) | (0x00FF & vub300->fbs[2]);
drivers/mmc/host/vub300.c-862- else if ((0xFBFFFE00 & cmd_arg) == 0x80042000)
drivers/mmc/host/vub300.c:863: vub300->fbs[2] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[2]);
drivers/mmc/host/vub300.c-864- else if ((0xFBFFFE00 & cmd_arg) == 0x80062200)
drivers/mmc/host/vub300.c:865: vub300->fbs[3] = (cmd_arg << 8) | (0x00FF & vub300->fbs[3]);
drivers/mmc/host/vub300.c-866- else if ((0xFBFFFE00 & cmd_arg) == 0x80062000)
drivers/mmc/host/vub300.c:867: vub300->fbs[3] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[3]);
drivers/mmc/host/vub300.c-868- else if ((0xFBFFFE00 & cmd_arg) == 0x80082200)
drivers/mmc/host/vub300.c:869: vub300->fbs[4] = (cmd_arg << 8) | (0x00FF & vub300->fbs[4]);
drivers/mmc/host/vub300.c-870- else if ((0xFBFFFE00 & cmd_arg) == 0x80082000)
drivers/mmc/host/vub300.c:871: vub300->fbs[4] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[4]);
drivers/mmc/host/vub300.c-872- else if ((0xFBFFFE00 & cmd_arg) == 0x800A2200)
drivers/mmc/host/vub300.c:873: vub300->fbs[5] = (cmd_arg << 8) | (0x00FF & vub300->fbs[5]);
drivers/mmc/host/vub300.c-874- else if ((0xFBFFFE00 & cmd_arg) == 0x800A2000)
drivers/mmc/host/vub300.c:875: vub300->fbs[5] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[5]);
drivers/mmc/host/vub300.c-876- else if ((0xFBFFFE00 & cmd_arg) == 0x800C2200)
drivers/mmc/host/vub300.c:877: vub300->fbs[6] = (cmd_arg << 8) | (0x00FF & vub300->fbs[6]);
drivers/mmc/host/vub300.c-878- else if ((0xFBFFFE00 & cmd_arg) == 0x800C2000)
drivers/mmc/host/vub300.c:879: vub300->fbs[6] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[6]);
drivers/mmc/host/vub300.c-880- else if ((0xFBFFFE00 & cmd_arg) == 0x800E2200)
drivers/mmc/host/vub300.c:881: vub300->fbs[7] = (cmd_arg << 8) | (0x00FF & vub300->fbs[7]);
drivers/mmc/host/vub300.c-882- else if ((0xFBFFFE00 & cmd_arg) == 0x800E2000)
drivers/mmc/host/vub300.c:883: vub300->fbs[7] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[7]);
drivers/mmc/host/vub300.c-884- else if ((0xFBFFFE03 & cmd_arg) == 0x80000E00)
drivers/mmc/host/vub300.c:885: vub300->bus_width = 1;
drivers/mmc/host/vub300.c-886- else if ((0xFBFFFE03 & cmd_arg) == 0x80000E02)
drivers/mmc/host/vub300.c:887: vub300->bus_width = 4;
drivers/mmc/host/vub300.c-888-}
drivers/mmc/host/vub300.c-889-
drivers/mmc/host/vub300.c:890:static void send_command(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-891-{
drivers/mmc/host/vub300.c:892: /* cmd_mutex is held by vub300_cmndwork_thread */
drivers/mmc/host/vub300.c:893: struct mmc_command *cmd = vub300->cmd;
drivers/mmc/host/vub300.c:894: struct mmc_data *data = vub300->data;
drivers/mmc/host/vub300.c-895- int retval;
--
drivers/mmc/host/vub300.c-897- u8 response_type;
drivers/mmc/host/vub300.c:898: if (vub300->app_spec) {
drivers/mmc/host/vub300.c-899- switch (cmd->opcode) {
--
drivers/mmc/host/vub300.c-901- response_type = SDRT_1;
drivers/mmc/host/vub300.c:902: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-903- if (0x00000000 == (0x00000003 & cmd->arg))
drivers/mmc/host/vub300.c:904: vub300->bus_width = 1;
drivers/mmc/host/vub300.c-905- else if (0x00000002 == (0x00000003 & cmd->arg))
drivers/mmc/host/vub300.c:906: vub300->bus_width = 4;
drivers/mmc/host/vub300.c-907- else
drivers/mmc/host/vub300.c:908: dev_err(&vub300->udev->dev,
drivers/mmc/host/vub300.c-909- "unexpected ACMD6 bus_width=%d\n",
--
drivers/mmc/host/vub300.c-913- response_type = SDRT_1;
drivers/mmc/host/vub300.c:914: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-915- break;
--
drivers/mmc/host/vub300.c-917- response_type = SDRT_1;
drivers/mmc/host/vub300.c:918: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-919- break;
--
drivers/mmc/host/vub300.c-921- response_type = SDRT_1;
drivers/mmc/host/vub300.c:922: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-923- break;
--
drivers/mmc/host/vub300.c-925- response_type = SDRT_3;
drivers/mmc/host/vub300.c:926: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-927- break;
--
drivers/mmc/host/vub300.c-929- response_type = SDRT_1;
drivers/mmc/host/vub300.c:930: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-931- break;
--
drivers/mmc/host/vub300.c-933- response_type = SDRT_1;
drivers/mmc/host/vub300.c:934: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-935- break;
--
drivers/mmc/host/vub300.c-937- response_type = SDRT_1;
drivers/mmc/host/vub300.c:938: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-939- break;
]
|
| 7/2 |
2026/09/07 15:11 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 29174
output: 45
thoughts: 56
Thoughts: **My Debugging Journey: Tracing the `vub300_delete` Bug**
Alright, so the root of this problem, as far as I can tell, is that the bug is originating within the `vub300_delete` function. I've pinpointed this by observing that it's being invoked via `kref_put(&vub300->kref, vub300_delete);`. This means that whenever the reference count on `vub300` drops to zero, this `vub300_delete` function is supposed to be executed to handle the cleanup. My next logical step, therefore, is to dive deep into the `vub300_delete` function itself and meticulously examine its internal workings to uncover what's going wrong.
|
| 8/2 |
2026/09/07 15:11 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_delete]
Results: map[SourceCode: 369: static void vub300_delete(struct kref *kref)
370: { /* kref callback - softirq */
371: struct vub300_mmc_host *vub300 = kref_to_vub300_mmc_host(kref);
372: struct mmc_host *mmc = vub300->mmc;
373:
374: usb_free_urb(vub300->command_out_urb);
375: vub300->command_out_urb = NULL;
376: usb_free_urb(vub300->command_res_urb);
377: vub300->command_res_urb = NULL;
378: usb_put_dev(vub300->udev);
379: mmc_free_host(mmc);
380: /*
381: * and hence also frees vub300
382: * which is contained at the end of struct mmc
383: */
384: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 9/2 |
2026/09/07 15:11 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 29599
output: 50
thoughts: 150
Thoughts: **My Thought Process Regarding the `synchronize_srcu` Issue**
Okay, I need to trace this execution path to understand why calling `synchronize_srcu` from a softirq context, specifically within `vub300_delete` which is invoked by `vub300_inactivity_timer_expired`, is problematic.
It starts with `mmc_free_host(mmc)`. I see that this function ultimately leads to `put_device(&host->class_dev)`. This, in turn, calls `mmc_host_classdev_release`.
My attention is then drawn to `mmc_host_classdev_release`. The critical step here is that it invokes `wakeup_source_unregister`.
Following the chain, `wakeup_source_unregister` calls `synchronize_srcu`.
Now, the crucial piece of information I have is that `vub300_delete` is being called from a timer callback, specifically `vub300_inactivity_timer_expired`. Timer callbacks, as I know, execute within the softirq context.
This is where the conflict arises. The documentation and my understanding of kernel synchronization primitives tell me that `synchronize_srcu` is an operation that can potentially sleep. Since it's being called from a softirq context, and softirqs are designed to be non-sleeping contexts, this creates an illegal situation. Calling a sleeping function from a non-sleeping context will lead to deadlocks or other unpredictable behavior.
Therefore, my thought process is to meticulously follow the call stack from `mmc_free_host` to `synchronize_srcu`, identify the context in which `synchronize_srcu` is called (`vub300_delete` from `vub300_inactivity_timer_expired`), and recognize the inherent conflict between the sleeping nature of `synchronize_srcu` and the non-sleeping requirement of the softirq context. The next logical step is to examine the `vub300_inactivity_timer_expired` function itself to understand the complete picture of how `vub300_delete` is being reached.
|
| 10/2 |
2026/09/07 15:11 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_inactivity_timer_expired]
Results: map[SourceCode: 742: static void vub300_inactivity_timer_expired(struct timer_list *t)
743: { /* softirq */
744: struct vub300_mmc_host *vub300 = timer_container_of(vub300, t,
745: inactivity_timer);
746: if (!vub300->interface) {
747: kref_put(&vub300->kref, vub300_delete);
748: } else if (vub300->cmd) {
749: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
750: } else {
751: vub300_queue_dead_work(vub300);
752: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
753: }
754: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 11/2 |
2026/09/07 15:11 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 30087
output: 63
thoughts: 119
Thoughts: **My Thought Process on `vub300_inactivity_timer_expired` and Reference Counting**
So, I'm looking at this `vub300_inactivity_timer_expired` function, and I notice it makes a call to `kref_put(&vub300->kref, vub300_delete);` *if* the condition `!vub300->interface` is true. My immediate thought here is: this timer, when triggered due to an interface disconnection, might be the one responsible for dropping the *final* reference to the `vub300` structure. This is a pretty significant implication, as it suggests that the timer's expiration is intrinsically linked to the deallocation of the `vub300` object itself under certain circumstances.
This leads me to ask a crucial question: why *exactly* is `vub300_inactivity_timer_expired` dropping a reference in the first place? It seems counterintuitive for a timer that's supposed to be monitoring inactivity to be the one actively decrementing the reference count. Typically, one might expect references to be dropped when an object is explicitly no longer needed, or when it's being explicitly released.
To truly understand this behavior, my next step is to dive into the code and investigate the exact places where the `vub300->interface` pointer is set to `NULL`. Pinpointing these assignments will be key to understanding the conditions under which the timer's reference decrementing logic is activated, and ultimately, how the lifecycle of the `vub300` structure is managed in relation to interface disconnections and timer expirations.
|
| 12/2 |
2026/09/07 15:11 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c IncludeSnippetLines:2 Name:vub300_mmc_host::interface SourceTreePrefix:]
Results: map[References:[map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:vub300_cmndwork_thread SourceFile:drivers/mmc/host/vub300.c SourceLine:1741 SourceSnippet:1739: struct vub300_mmc_host *vub300 =
1740: container_of(work, struct vub300_mmc_host, cmndwork);
1741: if (!vub300->interface) {
1742: kref_put(&vub300->kref, vub300_delete);
1743: return;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:vub300_cmndwork_thread SourceFile:drivers/mmc/host/vub300.c SourceLine:1784 SourceSnippet:1782:
1783: result = usb_lock_device_for_reset(vub300->udev,
1784: vub300->interface);
1785: if (result == 0) {
1786: result = usb_reset_device(vub300->udev);
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:vub300_deadwork_thread SourceFile:drivers/mmc/host/vub300.c SourceLine:713 SourceSnippet: 711: struct vub300_mmc_host *vub300 =
712: container_of(work, struct vub300_mmc_host, deadwork);
713: if (!vub300->interface) {
714: kref_put(&vub300->kref, vub300_delete);
715: return;
] map[ReferenceKind:writes ReferencingEntityKind:function ReferencingEntityName:vub300_disconnect SourceFile:drivers/mmc/host/vub300.c SourceLine:2386 SourceSnippet:2384: usb_set_intfdata(interface, NULL);
2385: /* prevent more I/O from starting */
2386: vub300->interface = NULL;
2387: mmc_remove_host(mmc);
2388: kref_put(&vub300->kref, vub300_delete);
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:vub300_enable_sdio_irq SourceFile:drivers/mmc/host/vub300.c SourceLine:2058 SourceSnippet:2056: { /* NOT irq */
2057: struct vub300_mmc_host *vub300 = mmc_priv(mmc);
2058: if (!vub300->interface)
2059: return;
2060: kref_get(&vub300->kref);
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:vub300_inactivity_timer_expired SourceFile:drivers/mmc/host/vub300.c SourceLine:746 SourceSnippet: 744: struct vub300_mmc_host *vub300 = timer_container_of(vub300, t,
745: inactivity_timer);
746: if (!vub300->interface) {
747: kref_put(&vub300->kref, vub300_delete);
748: } else if (vub300->cmd) {
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:vub300_mmc_request SourceFile:drivers/mmc/host/vub300.c SourceLine:1912 SourceSnippet:1910: struct mmc_command *cmd = req->cmd;
1911: struct vub300_mmc_host *vub300 = mmc_priv(mmc);
1912: if (!vub300->interface) {
1913: cmd->error = -ESHUTDOWN;
1914: mmc_request_done(mmc, req);
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:vub300_mmc_request SourceFile:drivers/mmc/host/vub300.c SourceLine:1933 SourceSnippet:1931: return;
1932: }
1933: if (!vub300->interface) {
1934: cmd->error = -ENODEV;
1935: mmc_request_done(mmc, req);
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:vub300_mmc_set_ios SourceFile:drivers/mmc/host/vub300.c SourceLine:2017 SourceSnippet:2015: { /* NOT irq */
2016: struct vub300_mmc_host *vub300 = mmc_priv(mmc);
2017: if (!vub300->interface)
2018: return;
2019: kref_get(&vub300->kref);
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:vub300_pollwork_thread SourceFile:drivers/mmc/host/vub300.c SourceLine:682 SourceSnippet: 680: struct vub300_mmc_host *vub300 = container_of(work,
681: struct vub300_mmc_host, pollwork.work);
682: if (!vub300->interface) {
683: kref_put(&vub300->kref, vub300_delete);
684: return;
] map[ReferenceKind:writes ReferencingEntityKind:function ReferencingEntityName:vub300_probe SourceFile:drivers/mmc/host/vub300.c SourceLine:2210 SourceSnippet:2208:
2209: vub300->udev = udev;
2210: vub300->interface = interface;
2211: vub300->cmnd_res_ep = 0;
2212: vub300->cmnd_out_ep = 0;
] map[ReferenceKind:writes ReferencingEntityKind:function ReferencingEntityName:vub300_probe SourceFile:drivers/mmc/host/vub300.c SourceLine:2352 SourceSnippet:2350:
2351: err_stop_io:
2352: vub300->interface = NULL;
2353: kref_put(&vub300->kref, vub300_delete);
2354:
]] TruncatedOutput:false]
|
| 13/2 |
2026/09/07 15:11 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 31975
output: 45
thoughts: 231
Thoughts: **The Potential for a Double Free Due to Inactivity Timer Race Condition**
My current line of thinking is focused on a potential race condition concerning the `vub300_disconnect` function and the `vub300->inactivity_timer`. Specifically, I'm tracing the lifecycle of the `vub300` structure and its associated `kref` (kernel reference count).
Here's the thought process unfolding:
1. **Initial Observation:** I've identified that `vub300_disconnect` performs two key actions: it sets `vub300->interface = NULL` and then calls `kref_put(&vub300->kref, vub300_delete)`. The `kref_put` is intended to decrement the reference count and, if it reaches zero, trigger the `vub300_delete` function for cleanup.
2. **Identifying the Problematic Scenario:** My concern arises when I consider the possibility of the `vub300->inactivity_timer` firing *after* `vub300_disconnect` has executed, but *before* the `kref_put` in `vub300_disconnect` has decremented the reference count to zero.
3. **Tracing the Timer's Action:** If the timer fires in this window, it will also call `kref_put(&vub300->kref, vub300_delete)`. Crucially, the timer callback likely checks the state of `vub300->interface`. My current hypothesis is that the timer callback will observe that `!vub300->interface` (because `vub300_disconnect` set it to `NULL`) and proceed to call `kref_put`.
4. **The Core of the Race:** This is where the danger lies. If `vub300_disconnect` had already decremented the reference count and the timer's `kref_put` is the *next* decrement to reach zero, then `vub300_delete` will be called from the *timer callback*. This is precisely the scenario I'm trying to pinpoint.
5. **Confirming the Mechanism:** My analysis leads me to believe that this is, in fact, exactly what happens. The timer in question is `vub300->inactivity_timer`.
6. **Questioning Cleanup:** The immediate next question that surfaces is: "When is the timer itself deleted or invalidated?" This is a critical piece of information needed to fully understand the lifecycle.
7. **Seeking the Answer:** To resolve this, I need to go back and meticulously examine the implementation of `vub300_disconnect` to determine how and when the `vub300->inactivity_timer` is managed or deleted within that function. This will be the next step in my debugging process.
|
| 14/2 |
2026/09/07 15:11 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_disconnect]
Results: map[SourceCode:2373: static void vub300_disconnect(struct usb_interface *interface)
2374: { /* NOT irq */
2375: struct vub300_mmc_host *vub300 = usb_get_intfdata(interface);
2376: if (!vub300 || !vub300->mmc) {
2377: return;
2378: } else {
2379: struct mmc_host *mmc = vub300->mmc;
2380: if (!vub300->mmc) {
2381: return;
2382: } else {
2383: int ifnum = interface_to_InterfaceNumber(interface);
2384: usb_set_intfdata(interface, NULL);
2385: /* prevent more I/O from starting */
2386: vub300->interface = NULL;
2387: mmc_remove_host(mmc);
2388: kref_put(&vub300->kref, vub300_delete);
2389: pr_info("USB vub300 remote SDIO host controller[%d]"
2390: " now disconnected", ifnum);
2391: return;
2392: }
2393: }
2394: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 15/2 |
2026/09/07 15:11 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 32637
output: 66
thoughts: 302
Thoughts: **The Subtle Peril of a Pending Timer**
My investigation into `vub300_disconnect` has revealed a critical oversight that's causing me considerable concern. It appears that the disconnect function, in its current state, fails to explicitly cancel the `vub300->inactivity_timer` using `del_timer_sync()`. Instead, it merely sets `vub300->interface` to `NULL` and then calls `kref_put`. This omission is the root of the problem.
If this inactivity timer is already pending when `vub300_disconnect` is executed, it will inevitably fire at a later point. When it does, it will observe that `vub300->interface` is `NULL`. This condition then leads to another call to `kref_put`. The real danger emerges if this second `kref_put` happens to decrement the reference count to zero. In such a scenario, `vub300_delete` is invoked directly from the timer's callback.
The cascade of issues continues within `vub300_delete`. It calls `mmc_free_host(mmc)`, which in turn calls `put_device(&host->class_dev)`. This `put_device` call results in the device being freed and `mmc_host_classdev_release` being invoked. Crucially, `mmc_host_classdev_release` unregisters the wakeup source. The unregistration process, as I understand it, involves a call to `synchronize_srcu`.
Here's where the softirq context becomes problematic: because the timer callback is executing in softirq context, the `synchronize_srcu` call within the wakeup source unregistration triggers a warning. This is because `synchronize_srcu` cannot safely be called from softirq.
Furthermore, I've noted that the timer callback employs `timer_container_of(vub300, t, inactivity_timer)`. This raises a significant question in my mind: if `vub300_disconnect` doesn't cancel the timer, is it possible for the timer callback to execute *after* the `vub300` structure itself has been freed? My initial thought is no, because the timer must hold some form of reference to `vub300`. I need to delve deeper to confirm where this timer is armed and if it indeed acquires a reference to the `vub300` object. The current situation points to a potential race condition where the timer could be referencing freed memory.
|
| 16/2 |
2026/09/07 15:11 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c IncludeSnippetLines:2 Name:vub300_mmc_host::inactivity_timer SourceTreePrefix:]
Results: map[References:[map[ReferenceKind:takes-address-of ReferencingEntityKind:function ReferencingEntityName:__do_poll SourceFile:drivers/mmc/host/vub300.c SourceLine:659 SourceSnippet: 657: /* cmd_mutex is held by vub300_pollwork_thread */
658: unsigned long commretval;
659: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
660: init_completion(&vub300->irqpoll_complete);
661: send_irqpoll(vub300);
] map[ReferenceKind:takes-address-of ReferencingEntityKind:function ReferencingEntityName:vub300_deadwork_thread SourceFile:drivers/mmc/host/vub300.c SourceLine:737 SourceSnippet: 735: check_vub300_port_status(vub300);
736: }
737: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
738: mutex_unlock(&vub300->cmd_mutex);
739: kref_put(&vub300->kref, vub300_delete);
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:vub300_inactivity_timer_expired SourceFile:drivers/mmc/host/vub300.c SourceLine:744 SourceSnippet: 742: static void vub300_inactivity_timer_expired(struct timer_list *t)
743: { /* softirq */
744: struct vub300_mmc_host *vub300 = timer_container_of(vub300, t,
745: inactivity_timer);
746: if (!vub300->interface) {
] map[ReferenceKind:takes-address-of ReferencingEntityKind:function ReferencingEntityName:vub300_inactivity_timer_expired SourceFile:drivers/mmc/host/vub300.c SourceLine:749 SourceSnippet: 747: kref_put(&vub300->kref, vub300_delete);
748: } else if (vub300->cmd) {
749: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
750: } else {
751: vub300_queue_dead_work(vub300);
] map[ReferenceKind:takes-address-of ReferencingEntityKind:function ReferencingEntityName:vub300_inactivity_timer_expired SourceFile:drivers/mmc/host/vub300.c SourceLine:752 SourceSnippet: 750: } else {
751: vub300_queue_dead_work(vub300);
752: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
753: }
754: }
] map[ReferenceKind:takes-address-of ReferencingEntityKind:function ReferencingEntityName:vub300_mmc_request SourceFile:drivers/mmc/host/vub300.c SourceLine:1940 SourceSnippet:1938: kref_get(&vub300->kref);
1939: mutex_lock(&vub300->cmd_mutex);
1940: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
1941: /*
1942: * for performance we have to return immediately
] map[ReferenceKind:takes-address-of ReferencingEntityKind:function ReferencingEntityName:vub300_pollwork_thread SourceFile:drivers/mmc/host/vub300.c SourceLine:698 SourceSnippet: 696: vub300->irqs_queued -= 1;
697: mmc_signal_sdio_irq(vub300->mmc);
698: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
699: mutex_unlock(&vub300->irq_mutex);
700: } else { /* NOT vub300->irqs_queued */
] map[ReferenceKind:takes-address-of ReferencingEntityKind:function ReferencingEntityName:vub300_probe SourceFile:drivers/mmc/host/vub300.c SourceLine:2331 SourceSnippet:2329: timer_setup(&vub300->sg_transfer_timer, vub300_sg_timed_out, 0);
2330: kref_get(&vub300->kref);
2331: timer_setup(&vub300->inactivity_timer,
2332: vub300_inactivity_timer_expired, 0);
2333: vub300->inactivity_timer.expires = jiffies + HZ;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:vub300_probe SourceFile:drivers/mmc/host/vub300.c SourceLine:2333 SourceSnippet:2331: timer_setup(&vub300->inactivity_timer,
2332: vub300_inactivity_timer_expired, 0);
2333: vub300->inactivity_timer.expires = jiffies + HZ;
2334: add_timer(&vub300->inactivity_timer);
2335: if (vub300->card_present)
] map[ReferenceKind:takes-address-of ReferencingEntityKind:function ReferencingEntityName:vub300_probe SourceFile:drivers/mmc/host/vub300.c SourceLine:2334 SourceSnippet:2332: vub300_inactivity_timer_expired, 0);
2333: vub300->inactivity_timer.expires = jiffies + HZ;
2334: add_timer(&vub300->inactivity_timer);
2335: if (vub300->card_present)
2336: dev_info(&vub300->udev->dev,
]] TruncatedOutput:false]
|
| 17/2 |
2026/09/07 15:11 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 34581
output: 45
thoughts: 960
Thoughts: **My Thought Process Regarding the `vub300` Driver and Potential RCU Issues**
As I delve into the `vub300_probe` function, a crucial observation immediately strikes me: the inactivity timer, `vub300->inactivity_timer`, holds a reference to the `vub300` structure via `kref_get(&vub300->kref)`. This means that even after the initial probe completes, there's still an active reference counting this object.
My attention then shifts to what happens when this timer expires, which is handled by `vub300_inactivity_timer_expired`. The logic here is that if `!vub300->interface` evaluates to true, the timer callback calls `kref_put(&vub300->kref, vub300_delete);` and, importantly, *does not* re-arm itself. This action effectively releases the reference that the timer itself was holding.
Now, I consider the scenario where `vub300_disconnect` has already executed. If it has, it would have also dropped its own reference using `kref_put`. So, if the timer is the *last* remaining entity holding a reference to `vub300`, then `vub300_delete` will be invoked directly from the timer callback.
This is where things get concerning. `vub300_delete`, as I recall, is responsible for freeing the MMC host. And critically, it calls `synchronize_srcu` within its execution, which happens to be in a softirq context when invoked from a timer callback. This immediately raises a red flag for me regarding RCU usage.
Let me re-examine `vub300_disconnect`. It sets `vub300->interface = NULL;`, calls `mmc_remove_host(mmc);`, and then `kref_put(&vub300->kref, vub300_delete);`. If the timer is still pending at this point, it *will* run later.
However, I'm now realizing a potential oversight: `vub300_disconnect` itself *doesn't* seem to explicitly delete the timer. If it *did* call `del_timer_sync` within `vub300_disconnect`, then the timer wouldn't execute after `vub300_disconnect` completed. But then, if `del_timer_sync` were called, and it returned 1 (indicating the timer was pending), wouldn't that call *also* need to account for dropping the reference held by the timer? Yes, it should.
The core issue I'm identifying is that `vub300_delete` is being called from a softirq context (the timer callback). To reproduce this specific bug, the sequence of events needs to be:
1. Probe the `vub300` driver, which initiates the timer and increments the reference count.
2. Disconnect the USB device, which calls `vub300_disconnect` and decrements the reference count.
3. Wait for the `inactivity_timer` to expire.
If I simply probe and then disconnect, will this trigger the bug? Let's meticulously trace the reference counts:
**During `vub300_probe`:**
* `vub300` is allocated. `kref_init(&vub300->kref)` sets the reference count to 1.
* `kref_get(&vub300->kref)` is called, increasing the count to 2 (one for the probe itself, and one for the timer).
* `add_timer(&vub300->inactivity_timer)` is called.
* The probe function returns successfully.
**Then, `vub300_disconnect` is invoked:**
* `vub300->interface = NULL;` is set.
* `mmc_remove_host(mmc);` is called.
* `kref_put(&vub300->kref, vub300_delete);` is executed, decrementing the reference count to 1.
**Finally, the timer expires:**
* The `vub300_inactivity_timer_expired` function runs.
* The condition `!vub300->interface` is met (since it was set to `NULL` in `disconnect`).
* `kref_put(&vub300->kref, vub300_delete);` is called again, decrementing the count to 0.
* Crucially, `vub300_delete` is now called *directly from the timer callback*.
* Inside `vub300_delete`, `mmc_free_host(mmc)` is called.
* Then `put_device(&host->class_dev)` is called.
* This leads to `mmc_host_classdev_release`.
* Following that, `wakeup_source_unregister` is called.
* And finally, `synchronize_srcu` is executed.
This sequence clearly leads to the "suspicious RCU usage" warning. It appears that probing and then disconnecting the `vub300` driver is a *100% reproducible* scenario for triggering this bug. I'm now compelled to check `vub300_probe` again to ensure there are no other implicit references I might have missed.
|
| 18/2 |
2026/09/07 15:12 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_probe]
Results: map[SourceCode:2092: static int vub300_probe(struct usb_interface *interface,
2093: const struct usb_device_id *id)
2094: { /* NOT irq */
2095: struct vub300_mmc_host *vub300;
2096: struct usb_host_interface *iface_desc;
2097: struct usb_device *udev = usb_get_dev(interface_to_usbdev(interface));
2098: int i;
2099: int retval = -ENOMEM;
2100: struct urb *command_out_urb;
2101: struct urb *command_res_urb;
2102: struct mmc_host *mmc;
2103: char manufacturer[48];
2104: char product[32];
2105: char serial_number[32];
2106: usb_string(udev, udev->descriptor.iManufacturer, manufacturer,
2107: sizeof(manufacturer));
2108: usb_string(udev, udev->descriptor.iProduct, product, sizeof(product));
2109: usb_string(udev, udev->descriptor.iSerialNumber, serial_number,
2110: sizeof(serial_number));
2111: dev_info(&udev->dev, "probing VID:PID(%04X:%04X) %s %s %s\n",
2112: le16_to_cpu(udev->descriptor.idVendor),
2113: le16_to_cpu(udev->descriptor.idProduct),
2114: manufacturer, product, serial_number);
2115: command_out_urb = usb_alloc_urb(0, GFP_KERNEL);
2116: if (!command_out_urb) {
2117: retval = -ENOMEM;
2118: goto err_put_udev;
2119: }
2120: command_res_urb = usb_alloc_urb(0, GFP_KERNEL);
2121: if (!command_res_urb) {
2122: retval = -ENOMEM;
2123: goto err_free_out_urb;
2124: }
2125: /* this also allocates memory for our VUB300 mmc host device */
2126: mmc = mmc_alloc_host(sizeof(*vub300), &udev->dev);
2127: if (!mmc) {
2128: retval = -ENOMEM;
2129: dev_err(&udev->dev, "not enough memory for the mmc_host\n");
2130: goto err_free_res_urb;
2131: }
2132: /* MMC core transfer sizes tunable parameters */
2133: mmc->caps = 0;
2134: if (!force_1_bit_data_xfers)
2135: mmc->caps |= MMC_CAP_4_BIT_DATA;
2136: if (!force_polling_for_irqs)
2137: mmc->caps |= MMC_CAP_SDIO_IRQ;
2138: mmc->caps &= ~MMC_CAP_NEEDS_POLL;
2139: /*
2140: * MMC_CAP_NEEDS_POLL causes core.c:mmc_rescan() to poll
2141: * for devices which results in spurious CMD7's being
2142: * issued which stops some SDIO cards from working
2143: */
2144: if (limit_speed_to_24_MHz) {
2145: mmc->caps |= MMC_CAP_MMC_HIGHSPEED;
2146: mmc->caps |= MMC_CAP_SD_HIGHSPEED;
2147: mmc->f_max = 24000000;
2148: dev_info(&udev->dev, "limiting SDIO speed to 24_MHz\n");
2149: } else {
2150: mmc->caps |= MMC_CAP_MMC_HIGHSPEED;
2151: mmc->caps |= MMC_CAP_SD_HIGHSPEED;
2152: mmc->f_max = 48000000;
2153: }
2154: mmc->f_min = 200000;
2155: mmc->max_blk_count = 511;
2156: mmc->max_blk_size = 512;
2157: mmc->max_segs = 128;
2158: if (force_max_req_size)
2159: mmc->max_req_size = force_max_req_size * 1024;
2160: else
2161: mmc->max_req_size = 64 * 1024;
2162: mmc->max_seg_size = mmc->max_req_size;
2163: mmc->ocr_avail = 0;
2164: mmc->ocr_avail |= MMC_VDD_165_195;
2165: mmc->ocr_avail |= MMC_VDD_20_21;
2166: mmc->ocr_avail |= MMC_VDD_21_22;
2167: mmc->ocr_avail |= MMC_VDD_22_23;
2168: mmc->ocr_avail |= MMC_VDD_23_24;
2169: mmc->ocr_avail |= MMC_VDD_24_25;
2170: mmc->ocr_avail |= MMC_VDD_25_26;
2171: mmc->ocr_avail |= MMC_VDD_26_27;
2172: mmc->ocr_avail |= MMC_VDD_27_28;
2173: mmc->ocr_avail |= MMC_VDD_28_29;
2174: mmc->ocr_avail |= MMC_VDD_29_30;
2175: mmc->ocr_avail |= MMC_VDD_30_31;
2176: mmc->ocr_avail |= MMC_VDD_31_32;
2177: mmc->ocr_avail |= MMC_VDD_32_33;
2178: mmc->ocr_avail |= MMC_VDD_33_34;
2179: mmc->ocr_avail |= MMC_VDD_34_35;
2180: mmc->ocr_avail |= MMC_VDD_35_36;
2181: mmc->ops = &vub300_mmc_ops;
2182: vub300 = mmc_priv(mmc);
2183: vub300->mmc = mmc;
2184: vub300->card_powered = 0;
2185: vub300->bus_width = 0;
2186: vub300->cmnd.head.block_size[0] = 0x00;
2187: vub300->cmnd.head.block_size[1] = 0x00;
2188: vub300->app_spec = 0;
2189: mutex_init(&vub300->cmd_mutex);
2190: mutex_init(&vub300->irq_mutex);
2191: vub300->command_out_urb = command_out_urb;
2192: vub300->command_res_urb = command_res_urb;
2193: vub300->usb_timed_out = 0;
2194: vub300->dynamic_register_count = 0;
2195:
2196: for (i = 0; i < ARRAY_SIZE(vub300->fn); i++) {
2197: vub300->fn[i].offload_point = 0;
2198: vub300->fn[i].offload_count = 0;
2199: }
2200:
2201: vub300->total_offload_count = 0;
2202: vub300->irq_enabled = 0;
2203: vub300->irq_disabled = 0;
2204: vub300->irqs_queued = 0;
2205:
2206: for (i = 0; i < ARRAY_SIZE(vub300->sdio_register); i++)
2207: vub300->sdio_register[i++].activate = 0;
2208:
2209: vub300->udev = udev;
2210: vub300->interface = interface;
2211: vub300->cmnd_res_ep = 0;
2212: vub300->cmnd_out_ep = 0;
2213: vub300->data_inp_ep = 0;
2214: vub300->data_out_ep = 0;
2215:
2216: for (i = 0; i < ARRAY_SIZE(vub300->fbs); i++)
2217: vub300->fbs[i] = 512;
2218:
2219: /*
2220: * set up the endpoint information
2221: *
2222: * use the first pair of bulk-in and bulk-out
2223: * endpoints for Command/Response+Interrupt
2224: *
2225: * use the second pair of bulk-in and bulk-out
2226: * endpoints for Data In/Out
2227: */
2228: vub300->large_usb_packets = 0;
2229: iface_desc = interface->cur_altsetting;
2230: for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
2231: struct usb_endpoint_descriptor *endpoint =
2232: &iface_desc->endpoint[i].desc;
2233: dev_info(&vub300->udev->dev,
2234: "vub300 testing %s EndPoint(%d) %02X\n",
2235: usb_endpoint_is_bulk_in(endpoint) ? "BULK IN" :
2236: usb_endpoint_is_bulk_out(endpoint) ? "BULK OUT" :
2237: "UNKNOWN", i, endpoint->bEndpointAddress);
2238: if (endpoint->wMaxPacketSize > 64)
2239: vub300->large_usb_packets = 1;
2240: if (usb_endpoint_is_bulk_in(endpoint)) {
2241: if (!vub300->cmnd_res_ep) {
2242: vub300->cmnd_res_ep =
2243: endpoint->bEndpointAddress;
2244: } else if (!vub300->data_inp_ep) {
2245: vub300->data_inp_ep =
2246: endpoint->bEndpointAddress;
2247: } else {
2248: dev_warn(&vub300->udev->dev,
2249: "ignoring"
2250: " unexpected bulk_in endpoint");
2251: }
2252: } else if (usb_endpoint_is_bulk_out(endpoint)) {
2253: if (!vub300->cmnd_out_ep) {
2254: vub300->cmnd_out_ep =
2255: endpoint->bEndpointAddress;
2256: } else if (!vub300->data_out_ep) {
2257: vub300->data_out_ep =
2258: endpoint->bEndpointAddress;
2259: } else {
2260: dev_warn(&vub300->udev->dev,
2261: "ignoring"
2262: " unexpected bulk_out endpoint");
2263: }
2264: } else {
2265: dev_warn(&vub300->udev->dev,
2266: "vub300 ignoring EndPoint(%d) %02X", i,
2267: endpoint->bEndpointAddress);
2268: }
2269: }
2270: if (vub300->cmnd_res_ep && vub300->cmnd_out_ep &&
2271: vub300->data_inp_ep && vub300->data_out_ep) {
2272: dev_info(&vub300->udev->dev,
2273: "vub300 %s packets"
2274: " using EndPoints %02X %02X %02X %02X\n",
2275: vub300->large_usb_packets ? "LARGE" : "SMALL",
2276: vub300->cmnd_out_ep, vub300->cmnd_res_ep,
2277: vub300->data_out_ep, vub300->data_inp_ep);
2278: /* we have the expected EndPoints */
2279: } else {
2280: dev_err(&vub300->udev->dev,
2281: "Could not find two sets of bulk-in/out endpoint pairs\n");
2282: retval = -EINVAL;
2283: goto err_free_host;
2284: }
2285: retval =
2286: usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
2287: GET_HC_INF0,
2288: USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2289: 0x0000, 0x0000, &vub300->hc_info,
2290: sizeof(vub300->hc_info), 1000);
2291: if (retval < 0)
2292: goto err_free_host;
2293: retval =
2294: usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0),
2295: SET_ROM_WAIT_STATES,
2296: USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2297: firmware_rom_wait_states, 0x0000, NULL, 0, 1000);
2298: if (retval < 0)
2299: goto err_free_host;
2300: dev_info(&vub300->udev->dev,
2301: "operating_mode = %s %s %d MHz %s %d byte USB packets\n",
2302: (mmc->caps & MMC_CAP_SDIO_IRQ) ? "IRQs" : "POLL",
2303: (mmc->caps & MMC_CAP_4_BIT_DATA) ? "4-bit" : "1-bit",
2304: mmc->f_max / 1000000,
2305: pad_input_to_usb_pkt ? "padding input data to" : "with",
2306: vub300->large_usb_packets ? 512 : 64);
2307: retval =
2308: usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
2309: GET_SYSTEM_PORT_STATUS,
2310: USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2311: 0x0000, 0x0000, &vub300->system_port_status,
2312: sizeof(vub300->system_port_status), 1000);
2313: if (retval < 0) {
2314: goto err_free_host;
2315: } else if (sizeof(vub300->system_port_status) == retval) {
2316: vub300->card_present =
2317: (0x0001 & vub300->system_port_status.port_flags) ? 1 : 0;
2318: vub300->read_only =
2319: (0x0010 & vub300->system_port_status.port_flags) ? 1 : 0;
2320: } else {
2321: retval = -EINVAL;
2322: goto err_free_host;
2323: }
2324: usb_set_intfdata(interface, vub300);
2325: INIT_DELAYED_WORK(&vub300->pollwork, vub300_pollwork_thread);
2326: INIT_WORK(&vub300->cmndwork, vub300_cmndwork_thread);
2327: INIT_WORK(&vub300->deadwork, vub300_deadwork_thread);
2328: kref_init(&vub300->kref);
2329: timer_setup(&vub300->sg_transfer_timer, vub300_sg_timed_out, 0);
2330: kref_get(&vub300->kref);
2331: timer_setup(&vub300->inactivity_timer,
2332: vub300_inactivity_timer_expired, 0);
2333: vub300->inactivity_timer.expires = jiffies + HZ;
2334: add_timer(&vub300->inactivity_timer);
2335: if (vub300->card_present)
2336: dev_info(&vub300->udev->dev,
2337: "USB vub300 remote SDIO host controller[%d]"
2338: "connected with SD/SDIO card inserted\n",
2339: interface_to_InterfaceNumber(interface));
2340: else
2341: dev_info(&vub300->udev->dev,
2342: "USB vub300 remote SDIO host controller[%d]"
2343: "connected with no SD/SDIO card inserted\n",
2344: interface_to_InterfaceNumber(interface));
2345: retval = mmc_add_host(mmc);
2346: if (retval)
2347: goto err_stop_io;
2348:
2349: return 0;
2350:
2351: err_stop_io:
2352: vub300->interface = NULL;
2353: kref_put(&vub300->kref, vub300_delete);
2354:
2355: return retval;
2356:
2357: err_free_host:
2358: mmc_free_host(mmc);
2359: /*
2360: * and hence also frees vub300
2361: * which is contained at the end of struct mmc
2362: */
2363: err_free_res_urb:
2364: usb_free_urb(command_res_urb);
2365: err_free_out_urb:
2366: usb_free_urb(command_out_urb);
2367: err_put_udev:
2368: usb_put_dev(udev);
2369:
2370: return retval;
2371: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 19/2 |
2026/09/07 15:12 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 41088
output: 45
thoughts: 751
Thoughts: **My Thought Process Unraveling the `vub300` Bug**
I've been digging into the `vub300` driver, and I think I've pinpointed a rather nasty bug. It all revolves around the `inactivity_timer` and the driver's reference counting mechanism.
Here's how I see the flow in `vub300_probe`:
* Initially, when `vub300_probe` is called, the kernel reference count for the `vub300` structure is set to 1 using `kref_init`.
* Immediately after, `kref_get` is called, bumping the refcount to 2. This seems like a standard pattern, perhaps to ensure the structure remains valid while other setup occurs.
* Then, an `inactivity_timer` is set up. This timer is scheduled to expire after `HZ` jiffies (which is roughly 1 second).
* Finally, `mmc_add_host` is invoked.
Now, let's consider what happens during `vub300_disconnect`:
* The `interface` pointer is set to `NULL`. This is a crucial step.
* `mmc_remove_host` is called, indicating the hardware is being taken away.
* `kref_put` is called, decrementing the refcount from 2 back down to 1.
The problem emerges when the `inactivity_timer` finally expires, which happens *after* `vub300_disconnect` might have already set `vub300->interface` to `NULL`.
Inside the timer's expiration handler, I see this logic:
```c
if (!vub300->interface) {
kref_put(&vub300->kref, vub300_delete); // refcount = 0 -> vub300_delete called
}
```
This is the core of the issue. If `vub300->interface` is `NULL` (which it will be after `vub300_disconnect`), the timer handler will call `kref_put` *again*. Since the refcount was already 1 after `vub300_disconnect`, this second `kref_put` will drive the refcount to 0, triggering `vub300_delete`.
And here's the kicker: `vub300_delete` is being called from a softirq context. This is a classic race condition waiting to happen.
So, to reproduce this bug, my thinking is that we need to exploit this timing:
1. Load the `vub300` module.
2. Simulate the arrival of a USB device that the `vub300` driver recognizes. This will trigger `vub300_probe`.
3. Crucially, before the `inactivity_timer` (which was set for `jiffies + HZ`) expires, we need to disconnect the USB device. This will call `vub300_disconnect`.
4. The timer will then expire, and because `vub300->interface` is now `NULL`, it will attempt a double `kref_put`, leading to the crash when `vub300_delete` is invoked from softirq.
I was also pondering what happens if the timer expires *while* the device is still connected. I examined the timer's re-arming logic:
```c
} else if (vub300->cmd) {
mod_timer(&vub300->inactivity_timer, jiffies + HZ);
} else {
vub300_queue_dead_work(vub300);
mod_timer(&vub300->inactivity_timer, jiffies + HZ);
}
```
This confirms my suspicion: if the device is connected, the timer doesn't just stop; it *re-arms itself* to `jiffies + HZ`. This means the timer is essentially a persistent watchdog, always scheduled to go off about a second from its last expiration or arming. This persistent nature of the timer makes the race condition much more probable.
Therefore, my strategy for reproducing this is clear:
1. Use a tool like `syz_usb_connect` to introduce a USB device that the `vub300` driver will bind to.
2. After connecting the device and allowing the probe to complete, use `syz_usb_disconnect` to remove it.
3. Then, simply wait. The timer, which was set up during probe, will eventually expire. If it expires after the disconnect but before any other cleanup that might have adjusted the refcount, we'll hit the bug. The "wait a bit" is indeed optional because the timer is guaranteed to expire within about a second if not re-armed.
I'll need to confirm the specific USB device ID that `vub300` is looking for to set up this test environment.
|
| 20/2 |
2026/09/07 15:12 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_table]
Results: map[SourceCode: 266: static const struct usb_device_id vub300_table[] = {
267: {USB_DEVICE(ELAN_VENDOR_ID, VUB300_PRODUCT_ID)},
268: {USB_DEVICE(VUB300_VENDOR_ID, VUB300_PRODUCT_ID)},
269: {} /* Terminating entry */
270: };
SourceFile:drivers/mmc/host/vub300.c]
|
| 21/2 |
2026/09/07 15:12 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 42008
output: 44
thoughts: 38
Thoughts: **My Thought Process for Identifying Vendor and Product IDs**
Right, my primary objective here is to pinpoint the specific numerical identifiers for the ELAN vendor and both the vendor and product IDs for VUB300. This is a crucial step for any low-level hardware interaction or driver development where precise identification is paramount. I'm looking to extract these values so I can reliably address and communicate with these particular hardware components.
|
| 22/2 |
2026/09/07 15:12 |
tool |
grepper |
0m
Args: map[Expression:#define (ELAN_VENDOR_ID|VUB300_VENDOR_ID|VUB300_PRODUCT_ID)]
Results: map[Output:drivers/input/mouse/elan_i2c_core.c-44-#define DRIVER_NAME "elan_i2c"
drivers/input/mouse/elan_i2c_core.c:45:#define ELAN_VENDOR_ID 0x04f3
drivers/input/mouse/elan_i2c_core.c-46-#define ETP_MAX_PRESSURE 255
--
drivers/mmc/host/vub300.c=260=MODULE_PARM_DESC(firmware_rom_wait_states,
--
drivers/mmc/host/vub300.c-262-
drivers/mmc/host/vub300.c:263:#define ELAN_VENDOR_ID 0x2201
drivers/mmc/host/vub300.c:264:#define VUB300_VENDOR_ID 0x0424
drivers/mmc/host/vub300.c:265:#define VUB300_PRODUCT_ID 0x012C
drivers/mmc/host/vub300.c-266-static const struct usb_device_id vub300_table[] = {
]
|
| 23/2 |
2026/09/07 15:12 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 42394
output: 39
thoughts: 1261
Thoughts: **My Debugging Journey: Unraveling a Kernel Conundrum**
It seems I've stumbled upon a rather intricate kernel bug, and I'm piecing together the thought process to understand its root cause. My initial focus was on identifying specific hardware identifiers, like `ELAN_VENDOR_ID` (0x2201) and `VUB300_VENDOR_ID` (0x0424) with `VUB300_PRODUCT_ID` (0x012C). The key here is that the `0x0424`/`0x012C` combination appears to be the relevant one for the issue at hand.
Then, a specific bug report caught my eye, detailing an `ODEBUG` message: "object ffffc90000007a80 is NOT on stack ffffc90004320000, but annotated." This warning originates from `debug_object_is_on_stack` which is called within `__debug_object_init`. My immediate suspicion is that the `vub300_delete` function is causing a problem. It's responsible for freeing the `vub300` structure (via `mmc_free_host`), but it seems some operations are still pending when this happens.
Digging deeper into `vub300_delete`, I see it explicitly calls `usb_free_urb` for both `command_out_urb` and `command_res_urb`. Following that, `mmc_free_host` is called, which frees the `mmc` structure itself, and importantly, the `vub300` structure is located at the end of this `mmc` struct.
This is where the alarm bells truly start ringing for me. The `vub300` structure contains an `inactivity_timer` (a `struct timer_list`). If `vub300_delete` is somehow invoked by this very timer callback, then it's attempting to free the memory that holds the timer while the timer's callback is still actively executing! This smells strongly of a classic use-after-free scenario, or more precisely, the timer is being freed from its own handler.
I understand that `kfree` doesn't always lead to an immediate crash, but the timer subsystem will inevitably attempt to access this freed timer, either after the callback returns or, as seen here, triggering these `debugobjects` warnings.
Now, I need to understand *why* `__debug_object_init` is being called in the first place. The stack trace associated with the `ODEBUG` warning provides crucial clues:
* `__synchronize_srcu`
* `wakeup_source_remove`
* `wakeup_source_unregister`
* `mmc_host_classdev_release`
* `device_release`
* `kobject_cleanup`
* `kobject_release`
* `kref_put`
* `kobject_put`
* `call_timer_fn`
The presence of `call_timer_fn` at the bottom of the stack further reinforces my suspicion about the timer being involved.
My current hypothesis is centered around `__synchronize_srcu`. This function, as I recall, often uses a completion object that can be initialized on the stack. Looking at the kernel code, indeed, `__synchronize_srcu` initializes a completion on the stack: `init_completion(&rcu.completion);`. This `init_completion` function itself calls `init_swait_queue_head`, which could potentially involve the initialization of debugging mechanisms like lockdep maps.
However, the warning explicitly states: "object ffffc90000007a80 is NOT on stack ffffc90004320000, but annotated." This means that the initialization functions (like `init_completion` or potentially `init_rcu_head_on_stack` which is also called) are marking the object as being on the stack, but the subsequent check by `debug_object_is_on_stack` fails to locate it on the *task* stack.
Why would this check fail? My breakthrough thought is: **we are executing in a softirq context!** `__synchronize_srcu` is called from softirq context. The softirq stack is distinct from the regular task stack. The `debug_object_is_on_stack` function, as I understand it, typically checks against `current->stack`, which refers to the task stack. If the object is on the softirq stack, this check will fail, leading to the "NOT on stack" warning, even though the object was correctly annotated as being on *a* stack (specifically, the softirq stack) by functions like `init_rcu_head_on_stack` and `init_completion`.
The core of the issue seems to be the interaction between timer callbacks, the softirq context, and the debugobject's stack validation logic. I need to investigate further how `debug_object_is_on_stack` handles softirq stacks, or if it's implicitly assuming a task context that is not always true.
|
| 24/2 |
2026/09/07 15:13 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:lib/debugobjects.c Name:debug_object_is_on_stack]
Results: map[SourceCode: 652: static void debug_object_is_on_stack(void *addr, int onstack)
653: {
654: int is_on_stack;
655: static int limit;
656:
657: if (limit > 4)
658: return;
659:
660: is_on_stack = object_is_on_stack(addr);
661: if (is_on_stack == onstack)
662: return;
663:
664: limit++;
665: if (is_on_stack)
666: pr_warn("object %p is on stack %p, but NOT annotated.\n", addr,
667: task_stack_page(current));
668: else
669: pr_warn("object %p is NOT on stack %p, but annotated.\n", addr,
670: task_stack_page(current));
671:
672: WARN_ON(1);
673: }
SourceFile:lib/debugobjects.c]
|
| 25/2 |
2026/09/07 15:13 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 44003
output: 16
thoughts: 401
Thoughts: **My Thought Process Unraveling the `object_is_on_stack` Warning**
Alright, so I've been digging into this `object_is_on_stack` warning, and I think I'm starting to piece together what's really going on here. My understanding is that this function, likely defined in something like `include/linux/sched/task_stack.h`, is designed to tell us whether a given memory address falls within the bounds of a task's kernel stack. The crucial detail I've found is that it explicitly *returns false* if the address happens to be on the *softirq stack*.
This immediately flagged for me that the `debug_object_is_on_stack` warning isn't just a random error; it's specifically alerting me that the object in question is residing on the softirq stack, *not* on what it considers the "normal" task stack. This, in turn, points to a clear symptom: I'm calling a blocking function, specifically `__synchronize_srcu`, from within a softirq context. That's a classic recipe for trouble in the kernel, and this warning is the direct consequence.
The underlying root cause, though, remains the same as what I've identified before: the `vub300_delete` function is being invoked from a timer callback. This timer callback is likely running in a context where softirqs are enabled, hence the problem when `__synchronize_srcu` is called.
Now, to actually reproduce this behavior reliably, I need to set up a scenario where this happens. My plan is to create a dummy USB device. The common way to do this, especially for testing purposes, seems to be using the `syz_usb_connect` mechanism. If I can get a dummy USB device connected and then subsequently disconnect it, I should be able to trigger the problematic sequence.
My initial thought was to construct a C program that directly uses the equivalent of `syz_usb_connect` in C. I recall that syzkaller often leverages the `/dev/raw-gadget` interface for emulating USB devices. If I were writing a syzlang reproducer, I could use the `syz_usb_connect` pseudo-syscall directly. However, since I need a C reproducer, I need to find a way to achieve this device emulation in C.
My next thought was to explore using the `raw-gadget` interface directly, perhaps in conjunction with `dummy_hcd`. I'm hoping there's a simpler, more direct way to achieve this, or perhaps I can leverage the actual C implementation of `syz_usb_connect` that syzkaller itself uses. I've considered searching the syzkaller source for `syz_usb_connect`, but I don't have direct access to that repository at the moment. I'm also wondering if there's a readily available `usb` toolkit that might provide the necessary abstractions. I'll need to check what toolkits are actually available to me.
|
| 26/2 |
2026/09/07 15:13 |
tool |
get-toolkit |
0m
Error:
Args:
Results:
|
| 27/2 |
2026/09/07 15:13 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 44431
output: 18
thoughts: 387
Thoughts: **My Thought Process on Emulating a USB Device for Bug Triggering**
My initial thought was, "Okay, I need to trigger a bug in the `vub300` driver, which is a USB driver. To do that, I'll need to present a specific USB device to the system, identified by `idVendor=0x0424` and `idProduct=0x012C` (or `0x2201:0x012C`). How can I emulate this USB device in C?" My immediate impulse was to look for a `usb` toolkit, but I quickly realized there isn't a direct, standalone one for this specific purpose.
Then, the idea of using `vhci-hcd` (the USB/IP interface) came to mind as a potential way to inject a virtual USB device. My next step was to check for its availability. I recalled that `syzkaller`, a well-known fuzzer, often uses `dummy_hcd` and `raw-gadget`. This sparked a new avenue: could I directly interact with `/dev/raw-gadget` by writing a C program to initialize a virtual USB device?
However, I quickly recognized the complexity involved. Writing a full `raw-gadget` driver in C from scratch felt like a significant undertaking. I started to question if there was a simpler alternative. Perhaps I could trigger the bug through a different pathway, not necessarily by directly emulating the hardware.
But then I refocused on the `vub300` driver and the mandatory USB device requirement. This brought me back to `usbip` and `vhci`. I knew that writing to `/sys/devices/platform/vhci_hcd.0/attach` could be used to attach a device, but I also understood that this would necessitate a userspace server to handle the USB/IP protocol, which again felt like a more involved solution.
Considering the `dummy_hcd` route and the fact that `syzkaller` uses `raw-gadget`, I decided to investigate `raw-gadget` further. My goal was to find a minimal example or documentation within the kernel source tree that could guide me. I was hoping to discover a way to leverage the existing kernel infrastructure.
Finally, a thought struck me: if `syzkaller` already has a mechanism to connect USB devices, perhaps I could find its implementation. I considered the `syz_usb_connect` function, but then I realized I didn't have the `syzkaller` source code readily available to examine its implementation. This led me back to searching the kernel tree itself for any information or examples related to `raw-gadget`, as that seemed to be the most promising kernel-level interface for my needs.
|
| 28/2 |
2026/09/07 15:13 |
tool |
grepper |
0m
Args: map[Expression:raw-gadget]
Results: map[Output:Documentation/translations/zh_CN/usb/index.rst=24=USB 支持
--
Documentation/translations/zh_CN/usb/index.rst-52-* ohci
Documentation/translations/zh_CN/usb/index.rst:53:* raw-gadget
Documentation/translations/zh_CN/usb/index.rst-54-* usbip_protocol
--
Documentation/usb/index.rst=2=USB support
--
Documentation/usb/index.rst-26- ohci
Documentation/usb/index.rst:27: raw-gadget
Documentation/usb/index.rst-28- usbip_protocol
--
Documentation/usb/raw-gadget.rst=43=Userspace interface
--
Documentation/usb/raw-gadget.rst-45-
Documentation/usb/raw-gadget.rst:46:The user can interact with Raw Gadget by opening ``/dev/raw-gadget`` and
Documentation/usb/raw-gadget.rst-47-issuing ioctl calls; see the comments in include/uapi/linux/usb/raw_gadget.h
--
Documentation/usb/raw-gadget.rst=51=A typical usage scenario of Raw Gadget:
Documentation/usb/raw-gadget.rst-52-
Documentation/usb/raw-gadget.rst:53:1. Create a Raw Gadget instance by opening ``/dev/raw-gadget``.
Documentation/usb/raw-gadget.rst-54-2. Initialize the instance via ``USB_RAW_IOCTL_INIT``.
--
Documentation/usb/raw-gadget.rst=69=Raw Gadget usage examples and a test suite:
Documentation/usb/raw-gadget.rst-70-
Documentation/usb/raw-gadget.rst:71:https://github.com/xairy/raw-gadget
Documentation/usb/raw-gadget.rst-72-
--
MAINTAINERS=28331=S: Maintained
MAINTAINERS:28332:B: https://github.com/xairy/raw-gadget/issues
MAINTAINERS:28333:F: Documentation/usb/raw-gadget.rst
MAINTAINERS-28334-F: drivers/usb/gadget/legacy/raw_gadget.c
--
drivers/usb/gadget/legacy/Kconfig=516=config USB_RAW_GADGET
--
drivers/usb/gadget/legacy/Kconfig-526-
drivers/usb/gadget/legacy/Kconfig:527: See Documentation/usb/raw-gadget.rst for details.
drivers/usb/gadget/legacy/Kconfig-528-
--
drivers/usb/gadget/legacy/raw_gadget.c-3- * USB Raw Gadget driver.
drivers/usb/gadget/legacy/raw_gadget.c:4: * See Documentation/usb/raw-gadget.rst for more details.
drivers/usb/gadget/legacy/raw_gadget.c-5- *
--
drivers/usb/gadget/legacy/raw_gadget.c-32-#define DRIVER_DESC "USB Raw Gadget"
drivers/usb/gadget/legacy/raw_gadget.c:33:#define DRIVER_NAME "raw-gadget"
drivers/usb/gadget/legacy/raw_gadget.c-34-
--
include/uapi/linux/usb/raw_gadget.h-4- *
include/uapi/linux/usb/raw_gadget.h:5: * See Documentation/usb/raw-gadget.rst for more details.
include/uapi/linux/usb/raw_gadget.h-6- */
]
|
| 29/2 |
2026/09/07 15:13 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 45734
output: 42
thoughts: 28
Thoughts: **My Thought Process on Approaching the `raw_gadget.h` Header**
Alright, so my immediate goal here is to understand how to *actually use* the Linux USB Raw Gadget API. The most direct way to do that, in my experience, is to dive straight into the header file itself. I'm going to pull up `include/uapi/linux/usb/raw_gadget.h` and start dissecting it. I expect to find the core data structures, function prototypes, and enumeration values that define the API's interface. This is where the rubber meets the road for developers – the concrete definitions of what's available and how to call it. I'll be looking for things like how to represent an endpoint, how to configure it, how to send and receive data, and any error codes or status flags that are part of the interface. This isn't just about passively reading; I'll be actively trying to map these definitions to potential use cases and understand the underlying mechanisms they represent.
|
| 30/2 |
2026/09/07 15:14 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/usb/raw_gadget.h FirstLine:1 LineCount:100]
Results: map[Contents: 1: /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2: /*
3: * USB Raw Gadget driver.
4: *
5: * See Documentation/usb/raw-gadget.rst for more details.
6: */
7:
8: #ifndef _UAPI__LINUX_USB_RAW_GADGET_H
9: #define _UAPI__LINUX_USB_RAW_GADGET_H
10:
11: #include <asm/ioctl.h>
12: #include <linux/types.h>
13: #include <linux/usb/ch9.h>
14:
15: /* Maximum length of driver_name/device_name in the usb_raw_init struct. */
16: #define UDC_NAME_LENGTH_MAX 128
17:
18: /*
19: * struct usb_raw_init - argument for USB_RAW_IOCTL_INIT ioctl.
20: * @speed: The speed of the emulated USB device, takes the same values as
21: * the usb_device_speed enum: USB_SPEED_FULL, USB_SPEED_HIGH, etc.
22: * @driver_name: The name of the UDC driver.
23: * @device_name: The name of a UDC instance.
24: *
25: * The last two fields identify a UDC the gadget driver should bind to.
26: * For example, Dummy UDC has "dummy_udc" as its driver_name and "dummy_udc.N"
27: * as its device_name, where N in the index of the Dummy UDC instance.
28: * At the same time the dwc2 driver that is used on Raspberry Pi Zero, has
29: * "20980000.usb" as both driver_name and device_name.
30: */
31: struct usb_raw_init {
32: __u8 driver_name[UDC_NAME_LENGTH_MAX];
33: __u8 device_name[UDC_NAME_LENGTH_MAX];
34: __u8 speed;
35: };
36:
37: /* The type of event fetched with the USB_RAW_IOCTL_EVENT_FETCH ioctl. */
38: enum usb_raw_event_type {
39: USB_RAW_EVENT_INVALID = 0,
40:
41: /* This event is queued when the driver has bound to a UDC. */
42: USB_RAW_EVENT_CONNECT = 1,
43:
44: /* This event is queued when a new control request arrived to ep0. */
45: USB_RAW_EVENT_CONTROL = 2,
46:
47: /*
48: * These events are queued when the gadget driver is suspended,
49: * resumed, reset, or disconnected. Note that some UDCs (e.g. dwc2)
50: * report a disconnect event instead of a reset.
51: */
52: USB_RAW_EVENT_SUSPEND = 3,
53: USB_RAW_EVENT_RESUME = 4,
54: USB_RAW_EVENT_RESET = 5,
55: USB_RAW_EVENT_DISCONNECT = 6,
56:
57: /* The list might grow in the future. */
58: };
59:
60: /*
61: * struct usb_raw_event - argument for USB_RAW_IOCTL_EVENT_FETCH ioctl.
62: * @type: The type of the fetched event.
63: * @length: Length of the data buffer. Updated by the driver and set to the
64: * actual length of the fetched event data.
65: * @data: A buffer to store the fetched event data.
66: *
67: * The fetched event data buffer contains struct usb_ctrlrequest for
68: * USB_RAW_EVENT_CONTROL and is empty for other events.
69: */
70: struct usb_raw_event {
71: __u32 type;
72: __u32 length;
73: __u8 data[];
74: };
75:
76: #define USB_RAW_IO_FLAGS_ZERO 0x0001
77: #define USB_RAW_IO_FLAGS_MASK 0x0001
78:
79: static inline int usb_raw_io_flags_valid(__u16 flags)
80: {
81: return (flags & ~USB_RAW_IO_FLAGS_MASK) == 0;
82: }
83:
84: static inline int usb_raw_io_flags_zero(__u16 flags)
85: {
86: return (flags & USB_RAW_IO_FLAGS_ZERO);
87: }
88:
89: /*
90: * struct usb_raw_ep_io - argument for USB_RAW_IOCTL_EP0/EP_WRITE/READ ioctls.
91: * @ep: Endpoint handle as returned by USB_RAW_IOCTL_EP_ENABLE for
92: * USB_RAW_IOCTL_EP_WRITE/READ. Ignored for USB_RAW_IOCTL_EP0_WRITE/READ.
93: * @flags: When USB_RAW_IO_FLAGS_ZERO is specified, the zero flag is set on
94: * the submitted USB request, see include/linux/usb/gadget.h for details.
95: * @length: Length of data.
96: * @data: Data to send for USB_RAW_IOCTL_EP0/EP_WRITE. Buffer to store received
97: * data for USB_RAW_IOCTL_EP0/EP_READ.
98: */
99: struct usb_raw_ep_io {
100: __u16 ep;
]
|
| 31/2 |
2026/09/07 15:14 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 47424
output: 20
thoughts: 470
Thoughts: **My Thought Process on Emulating the `vub300` Driver**
Okay, I need to get a handle on this `vub300` driver situation. My initial thought was about `raw-gadget`, but I quickly realized my mistake: `raw-gadget` is for *emulating* a USB device, acting as a USB *gadget*, whereas the `vub300` driver is actually a USB *host* driver. No, wait, I'm getting confused again. The `vub300` driver *binds* to a USB device, meaning it's a device driver. Ah, right, the `vub300` is an MMC host controller that *connects via USB*. So, in the Linux kernel's perspective, the kernel itself is acting as the USB host, and the `vub300` is the USB device it's interacting with.
To *emulate* a USB device that the kernel sees as if it were physically plugged in, I recall that `raw-gadget` is a viable option, *provided* the kernel is built with `dummy_hcd`. This `dummy_hcd` provides a virtual USB host controller and a virtual USB device controller. When `raw-gadget` is used to emulate a device connected to `dummy_udc` (the USB device controller part), the kernel's USB host subsystem will detect this as a new USB device connected to `dummy_hcd`. It's at this point that the `vub300` driver would then attempt to bind to this emulated device.
However, I'm acutely aware that `raw-gadget` demands a significant amount of work in userspace. I'd have to manually handle *all* USB control requests, things like `GET_DESCRIPTOR`, and writing that in C is frankly tedious. This leads me to wonder: is there a simpler way to just trigger the `vub300_probe` and `vub300_disconnect` functions?
Perhaps I could leverage `usbip` for this? Or maybe the `vhci-hcd` interface directly? Then I remembered something crucial: `syzkaller` uses `raw-gadget` extensively for emulating USB devices. This sparks another idea. If I don't want to go through the whole ordeal of writing a full `raw-gadget` userspace driver, could I get away with just using `dummy_hcd` and a generic gadget like `g_zero`?
No, that won't work. The `vub300` driver is specifically looking for a device with a particular `idVendor=0x0424` and `idProduct=0x012C`. A generic gadget won't have these specific identifiers.
This is where `configfs` comes to mind. I know `configfs` provides a way to dynamically create USB gadgets from userspace without needing to write a full C program to handle every single USB control request. This is exactly what I need! I can use `configfs` to construct a USB gadget with the precise Vendor and Product IDs that the `vub300` driver expects. This should allow me to trigger the probe and disconnect sequences without the heavy lifting of `raw-gadget`. My next step is to verify that the `configfs` gadget functionality is indeed available and usable in my environment.
|
| 32/2 |
2026/09/07 15:14 |
tool |
grepper |
0m
Args: map[Expression:CONFIG_USB_CONFIGFS]
Results: map[Output:Documentation/sound/designs/midi-2.0.rst=403=function driver, which can be used for prototyping and debugging MIDI
--
Documentation/sound/designs/midi-2.0.rst-405-
Documentation/sound/designs/midi-2.0.rst:406:`CONFIG_USB_GADGET`, `CONFIG_USB_CONFIGFS` and
Documentation/sound/designs/midi-2.0.rst:407:`CONFIG_USB_CONFIGFS_F_MIDI2` need to be enabled for the MIDI2 gadget
Documentation/sound/designs/midi-2.0.rst-408-driver.
--
arch/arm/configs/aspeed_g4_defconfig=173=CONFIG_USB_ASPEED_VHUB=y
arch/arm/configs/aspeed_g4_defconfig:174:CONFIG_USB_CONFIGFS=y
arch/arm/configs/aspeed_g4_defconfig:175:CONFIG_USB_CONFIGFS_SERIAL=y
arch/arm/configs/aspeed_g4_defconfig:176:CONFIG_USB_CONFIGFS_ACM=y
arch/arm/configs/aspeed_g4_defconfig:177:CONFIG_USB_CONFIGFS_OBEX=y
arch/arm/configs/aspeed_g4_defconfig:178:CONFIG_USB_CONFIGFS_NCM=y
arch/arm/configs/aspeed_g4_defconfig:179:CONFIG_USB_CONFIGFS_ECM=y
arch/arm/configs/aspeed_g4_defconfig:180:CONFIG_USB_CONFIGFS_ECM_SUBSET=y
arch/arm/configs/aspeed_g4_defconfig:181:CONFIG_USB_CONFIGFS_RNDIS=y
arch/arm/configs/aspeed_g4_defconfig:182:CONFIG_USB_CONFIGFS_EEM=y
arch/arm/configs/aspeed_g4_defconfig:183:CONFIG_USB_CONFIGFS_MASS_STORAGE=y
arch/arm/configs/aspeed_g4_defconfig:184:CONFIG_USB_CONFIGFS_F_LB_SS=y
arch/arm/configs/aspeed_g4_defconfig:185:CONFIG_USB_CONFIGFS_F_FS=y
arch/arm/configs/aspeed_g4_defconfig:186:CONFIG_USB_CONFIGFS_F_HID=y
arch/arm/configs/aspeed_g4_defconfig:187:CONFIG_USB_CONFIGFS_F_PRINTER=y
arch/arm/configs/aspeed_g4_defconfig-188-CONFIG_MMC=y
--
arch/arm/configs/aspeed_g5_defconfig=217=CONFIG_USB_ASPEED_VHUB=y
arch/arm/configs/aspeed_g5_defconfig:218:CONFIG_USB_CONFIGFS=y
arch/arm/configs/aspeed_g5_defconfig:219:CONFIG_USB_CONFIGFS_MASS_STORAGE=y
arch/arm/configs/aspeed_g5_defconfig:220:CONFIG_USB_CONFIGFS_F_HID=y
arch/arm/configs/aspeed_g5_defconfig-221-CONFIG_MMC=y
--
arch/arm/configs/imx_v6_v7_defconfig=344=CONFIG_USB_GADGET=y
arch/arm/configs/imx_v6_v7_defconfig:345:CONFIG_USB_CONFIGFS=y
arch/arm/configs/imx_v6_v7_defconfig:346:CONFIG_USB_CONFIGFS_SERIAL=y
arch/arm/configs/imx_v6_v7_defconfig:347:CONFIG_USB_CONFIGFS_ACM=y
arch/arm/configs/imx_v6_v7_defconfig:348:CONFIG_USB_CONFIGFS_OBEX=y
arch/arm/configs/imx_v6_v7_defconfig:349:CONFIG_USB_CONFIGFS_NCM=y
arch/arm/configs/imx_v6_v7_defconfig:350:CONFIG_USB_CONFIGFS_ECM=y
arch/arm/configs/imx_v6_v7_defconfig:351:CONFIG_USB_CONFIGFS_ECM_SUBSET=y
arch/arm/configs/imx_v6_v7_defconfig:352:CONFIG_USB_CONFIGFS_RNDIS=y
arch/arm/configs/imx_v6_v7_defconfig:353:CONFIG_USB_CONFIGFS_EEM=y
arch/arm/configs/imx_v6_v7_defconfig:354:CONFIG_USB_CONFIGFS_MASS_STORAGE=y
arch/arm/configs/imx_v6_v7_defconfig:355:CONFIG_USB_CONFIGFS_F_LB_SS=y
arch/arm/configs/imx_v6_v7_defconfig:356:CONFIG_USB_CONFIGFS_F_FS=y
arch/arm/configs/imx_v6_v7_defconfig:357:CONFIG_USB_CONFIGFS_F_UAC1=y
arch/arm/configs/imx_v6_v7_defconfig:358:CONFIG_USB_CONFIGFS_F_UAC2=y
arch/arm/configs/imx_v6_v7_defconfig:359:CONFIG_USB_CONFIGFS_F_MIDI=y
arch/arm/configs/imx_v6_v7_defconfig:360:CONFIG_USB_CONFIGFS_F_HID=y
arch/arm/configs/imx_v6_v7_defconfig:361:CONFIG_USB_CONFIGFS_F_UVC=y
arch/arm/configs/imx_v6_v7_defconfig:362:CONFIG_USB_CONFIGFS_F_PRINTER=y
arch/arm/configs/imx_v6_v7_defconfig-363-CONFIG_USB_ZERO=m
--
arch/arm/configs/multi_v5_defconfig=217=CONFIG_USB_ASPEED_VHUB=m
arch/arm/configs/multi_v5_defconfig:218:CONFIG_USB_CONFIGFS=m
arch/arm/configs/multi_v5_defconfig-219-CONFIG_MMC=y
--
arch/arm/configs/multi_v7_defconfig=928=CONFIG_USB_ASPEED_VHUB=m
arch/arm/configs/multi_v7_defconfig:929:CONFIG_USB_CONFIGFS=m
arch/arm/configs/multi_v7_defconfig:930:CONFIG_USB_CONFIGFS_SERIAL=y
arch/arm/configs/multi_v7_defconfig:931:CONFIG_USB_CONFIGFS_ACM=y
arch/arm/configs/multi_v7_defconfig:932:CONFIG_USB_CONFIGFS_OBEX=y
arch/arm/configs/multi_v7_defconfig:933:CONFIG_USB_CONFIGFS_NCM=y
arch/arm/configs/multi_v7_defconfig:934:CONFIG_USB_CONFIGFS_ECM=y
arch/arm/configs/multi_v7_defconfig:935:CONFIG_USB_CONFIGFS_ECM_SUBSET=y
arch/arm/configs/multi_v7_defconfig:936:CONFIG_USB_CONFIGFS_RNDIS=y
arch/arm/configs/multi_v7_defconfig:937:CONFIG_USB_CONFIGFS_EEM=y
arch/arm/configs/multi_v7_defconfig:938:CONFIG_USB_CONFIGFS_MASS_STORAGE=y
arch/arm/configs/multi_v7_defconfig:939:CONFIG_USB_CONFIGFS_F_LB_SS=y
arch/arm/configs/multi_v7_defconfig:940:CONFIG_USB_CONFIGFS_F_FS=y
arch/arm/configs/multi_v7_defconfig:941:CONFIG_USB_CONFIGFS_F_UAC1=y
arch/arm/configs/multi_v7_defconfig:942:CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=y
arch/arm/configs/multi_v7_defconfig:943:CONFIG_USB_CONFIGFS_F_UAC2=y
arch/arm/configs/multi_v7_defconfig:944:CONFIG_USB_CONFIGFS_F_MIDI=y
arch/arm/configs/multi_v7_defconfig:945:CONFIG_USB_CONFIGFS_F_HID=y
arch/arm/configs/multi_v7_defconfig:946:CONFIG_USB_CONFIGFS_F_UVC=y
arch/arm/configs/multi_v7_defconfig:947:CONFIG_USB_CONFIGFS_F_PRINTER=y
arch/arm/configs/multi_v7_defconfig-948-CONFIG_USB_ETH=m
--
arch/arm/configs/omap2plus_defconfig=579=CONFIG_USB_GADGET_DEBUG_FS=y
arch/arm/configs/omap2plus_defconfig:580:CONFIG_USB_CONFIGFS=m
arch/arm/configs/omap2plus_defconfig:581:CONFIG_USB_CONFIGFS_SERIAL=y
arch/arm/configs/omap2plus_defconfig:582:CONFIG_USB_CONFIGFS_ACM=y
arch/arm/configs/omap2plus_defconfig:583:CONFIG_USB_CONFIGFS_OBEX=y
arch/arm/configs/omap2plus_defconfig:584:CONFIG_USB_CONFIGFS_NCM=y
arch/arm/configs/omap2plus_defconfig:585:CONFIG_USB_CONFIGFS_ECM=y
arch/arm/configs/omap2plus_defconfig:586:CONFIG_USB_CONFIGFS_ECM_SUBSET=y
arch/arm/configs/omap2plus_defconfig:587:CONFIG_USB_CONFIGFS_RNDIS=y
arch/arm/configs/omap2plus_defconfig:588:CONFIG_USB_CONFIGFS_EEM=y
arch/arm/configs/omap2plus_defconfig:589:CONFIG_USB_CONFIGFS_PHONET=y
arch/arm/configs/omap2plus_defconfig:590:CONFIG_USB_CONFIGFS_MASS_STORAGE=y
arch/arm/configs/omap2plus_defconfig:591:CONFIG_USB_CONFIGFS_F_LB_SS=y
arch/arm/configs/omap2plus_defconfig:592:CONFIG_USB_CONFIGFS_F_FS=y
arch/arm/configs/omap2plus_defconfig:593:CONFIG_USB_CONFIGFS_F_UAC1=y
arch/arm/configs/omap2plus_defconfig:594:CONFIG_USB_CONFIGFS_F_UAC2=y
arch/arm/configs/omap2plus_defconfig:595:CONFIG_USB_CONFIGFS_F_MIDI=y
arch/arm/configs/omap2plus_defconfig:596:CONFIG_USB_CONFIGFS_F_HID=y
arch/arm/configs/omap2plus_defconfig-597-CONFIG_USB_ZERO=m
--
arch/arm/configs/qcom_defconfig=184=CONFIG_USB_GADGET_VBUS_DRAW=500
arch/arm/configs/qcom_defconfig:185:CONFIG_USB_CONFIGFS=y
arch/arm/configs/qcom_defconfig:186:CONFIG_USB_CONFIGFS_NCM=y
arch/arm/configs/qcom_defconfig:187:CONFIG_USB_CONFIGFS_ECM=y
arch/arm/configs/qcom_defconfig:188:CONFIG_USB_CONFIGFS_F_FS=y
arch/arm/configs/qcom_defconfig-189-CONFIG_USB_ULPI_BUS=y
--
arch/arm/configs/sama7_defconfig=181=CONFIG_USB_ATMEL_USBA=m
arch/arm/configs/sama7_defconfig:182:CONFIG_USB_CONFIGFS=y
arch/arm/configs/sama7_defconfig:183:CONFIG_USB_CONFIGFS_ACM=y
arch/arm/configs/sama7_defconfig:184:CONFIG_USB_CONFIGFS_MASS_STORAGE=y
arch/arm/configs/sama7_defconfig:185:CONFIG_USB_CONFIGFS_F_UVC=y
arch/arm/configs/sama7_defconfig-186-CONFIG_USB_G_SERIAL=m
--
arch/arm/configs/wpcm450_defconfig=138=CONFIG_USB_GADGET=y
arch/arm/configs/wpcm450_defconfig:139:CONFIG_USB_CONFIGFS=y
arch/arm/configs/wpcm450_defconfig:140:CONFIG_USB_CONFIGFS_SERIAL=y
arch/arm/configs/wpcm450_defconfig:141:CONFIG_USB_CONFIGFS_ACM=y
arch/arm/configs/wpcm450_defconfig:142:CONFIG_USB_CONFIGFS_EEM=y
arch/arm/configs/wpcm450_defconfig:143:CONFIG_USB_CONFIGFS_MASS_STORAGE=y
arch/arm/configs/wpcm450_defconfig:144:CONFIG_USB_CONFIGFS_F_FS=y
arch/arm/configs/wpcm450_defconfig:145:CONFIG_USB_CONFIGFS_F_HID=y
arch/arm/configs/wpcm450_defconfig-146-CONFIG_NEW_LEDS=y
--
arch/arm64/configs/defconfig=1242=CONFIG_USB_TEGRA_XUDC=m
arch/arm64/configs/defconfig:1243:CONFIG_USB_CONFIGFS=m
arch/arm64/configs/defconfig:1244:CONFIG_USB_CONFIGFS_SERIAL=y
arch/arm64/configs/defconfig:1245:CONFIG_USB_CONFIGFS_ACM=y
arch/arm64/configs/defconfig:1246:CONFIG_USB_CONFIGFS_OBEX=y
arch/arm64/configs/defconfig:1247:CONFIG_USB_CONFIGFS_NCM=y
arch/arm64/configs/defconfig:1248:CONFIG_USB_CONFIGFS_ECM=y
arch/arm64/configs/defconfig:1249:CONFIG_USB_CONFIGFS_ECM_SUBSET=y
arch/arm64/configs/defconfig:1250:CONFIG_USB_CONFIGFS_RNDIS=y
arch/arm64/configs/defconfig:1251:CONFIG_USB_CONFIGFS_EEM=y
arch/arm64/configs/defconfig:1252:CONFIG_USB_CONFIGFS_MASS_STORAGE=y
arch/arm64/configs/defconfig:1253:CONFIG_USB_CONFIGFS_F_FS=y
arch/arm64/configs/defconfig-1254-CONFIG_USB_MASS_STORAGE=m
--
arch/mips/configs/rs90_defconfig=122=CONFIG_USB_GADGET_VBUS_DRAW=500
arch/mips/configs/rs90_defconfig:123:CONFIG_USB_CONFIGFS=y
arch/mips/configs/rs90_defconfig:124:CONFIG_USB_CONFIGFS_ECM_SUBSET=y
arch/mips/configs/rs90_defconfig:125:CONFIG_USB_CONFIGFS_RNDIS=y
arch/mips/configs/rs90_defconfig:126:CONFIG_USB_CONFIGFS_F_FS=y
arch/mips/configs/rs90_defconfig-127-CONFIG_MMC=y
--
arch/riscv/configs/defconfig=226=CONFIG_USB_GADGET=y
arch/riscv/configs/defconfig:227:CONFIG_USB_CONFIGFS=m
arch/riscv/configs/defconfig:228:CONFIG_USB_CONFIGFS_SERIAL=y
arch/riscv/configs/defconfig:229:CONFIG_USB_CONFIGFS_ACM=y
arch/riscv/configs/defconfig:230:CONFIG_USB_CONFIGFS_OBEX=y
arch/riscv/configs/defconfig:231:CONFIG_USB_CONFIGFS_NCM=y
arch/riscv/configs/defconfig:232:CONFIG_USB_CONFIGFS_ECM=y
arch/riscv/configs/defconfig:233:CONFIG_USB_CONFIGFS_ECM_SUBSET=y
arch/riscv/configs/defconfig:234:CONFIG_USB_CONFIGFS_RNDIS=y
arch/riscv/configs/defconfig:235:CONFIG_USB_CONFIGFS_EEM=y
arch/riscv/configs/defconfig:236:CONFIG_USB_CONFIGFS_MASS_STORAGE=y
arch/riscv/configs/defconfig:237:CONFIG_USB_CONFIGFS_F_FS=y
arch/riscv/configs/defconfig-238-CONFIG_MMC=y
]
|
| 33/2 |
2026/09/07 15:14 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 52198
output: 45
thoughts: 653
Thoughts: **My Thought Process on USB Gadget Emulation**
Okay, so the core problem is to get the `vub300` driver to bind to a USB device that I'm emulating in userspace for testing purposes with syzkaller. I've been exploring a few different avenues.
Initially, I considered `raw-gadget`. I know that syzkaller often uses `dummy_hcd` and `raw-gadget` for USB fuzzing. The idea with `raw-gadget` is straightforward: write a simple C program, open `/dev/raw-gadget`, initialize it, and bind it to `dummy_udc.0`. I also recalled that `syz_usb_connect`, which syzkaller uses to set up USB connections, is actually implemented using `raw-gadget` under the hood. This seemed promising, as I could theoretically write a C program to emulate a device with `idVendor=0x0424` and `idProduct=0x012C` using `raw-gadget`. I even started looking for minimal `raw-gadget` examples.
However, I realized that if I go down the `dummy_hcd` and `raw-gadget` route, I'd have to handle all the control requests, particularly `GET_DESCRIPTOR` requests, which the kernel's USB core will send when it enumerates the device and tries to discover its capabilities. While I don't need a *perfect* implementation, I at least need to provide the device and configuration descriptors so that the `vub300` driver can be considered for binding. This means I'd have to write code to reply to those requests accurately.
Then I thought about `usbip`. With `vhci-hcd`, I could potentially use `/sys/devices/platform/vhci_hcd.0/attach`. But again, I remembered that `vhci-hcd` also relies on a userspace program to handle the URBs (USB Request Blocks) by communicating over a socket. This also seemed to involve a significant amount of userspace handling.
This led me back to `configfs`. I know that `configfs` is designed to handle much of the boilerplate USB gadget setup directly in the kernel. The key advantage here is that the kernel itself will manage the standard control requests, including `GET_DESCRIPTOR`. My job would then be simplified to just configuring the device's vendor and product IDs within `configfs` and binding it to `dummy_udc.0`. I started to sketch out the steps: creating a gadget instance in `/sys/kernel/config/usb_gadget/`, setting `idVendor` and `idProduct`, defining strings for the device, and setting up a configuration.
The initial `configfs` commands I outlined (`mkdir /sys/kernel/config/usb_gadget/g1`, `echo 0x0424 > idVendor`, etc.) seem like the right direction. The challenge that popped up was regarding the endpoints. I know that the `vub300` driver needs specific types of endpoints, likely bulk endpoints, given its functionality. I was contemplating whether I could just use a generic function that provides bulk endpoints, or if `vub300` has stricter requirements on the specific endpoint characteristics. I realized I needed to revisit the `vub300_probe` function to understand its exact endpoint expectations. This is where I paused, needing to dive deeper into the driver's requirements before I could fully implement the `configfs` setup for the specific endpoint configuration.
|
| 34/2 |
2026/09/07 15:14 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_probe]
Results: map[SourceCode:2092: static int vub300_probe(struct usb_interface *interface,
2093: const struct usb_device_id *id)
2094: { /* NOT irq */
2095: struct vub300_mmc_host *vub300;
2096: struct usb_host_interface *iface_desc;
2097: struct usb_device *udev = usb_get_dev(interface_to_usbdev(interface));
2098: int i;
2099: int retval = -ENOMEM;
2100: struct urb *command_out_urb;
2101: struct urb *command_res_urb;
2102: struct mmc_host *mmc;
2103: char manufacturer[48];
2104: char product[32];
2105: char serial_number[32];
2106: usb_string(udev, udev->descriptor.iManufacturer, manufacturer,
2107: sizeof(manufacturer));
2108: usb_string(udev, udev->descriptor.iProduct, product, sizeof(product));
2109: usb_string(udev, udev->descriptor.iSerialNumber, serial_number,
2110: sizeof(serial_number));
2111: dev_info(&udev->dev, "probing VID:PID(%04X:%04X) %s %s %s\n",
2112: le16_to_cpu(udev->descriptor.idVendor),
2113: le16_to_cpu(udev->descriptor.idProduct),
2114: manufacturer, product, serial_number);
2115: command_out_urb = usb_alloc_urb(0, GFP_KERNEL);
2116: if (!command_out_urb) {
2117: retval = -ENOMEM;
2118: goto err_put_udev;
2119: }
2120: command_res_urb = usb_alloc_urb(0, GFP_KERNEL);
2121: if (!command_res_urb) {
2122: retval = -ENOMEM;
2123: goto err_free_out_urb;
2124: }
2125: /* this also allocates memory for our VUB300 mmc host device */
2126: mmc = mmc_alloc_host(sizeof(*vub300), &udev->dev);
2127: if (!mmc) {
2128: retval = -ENOMEM;
2129: dev_err(&udev->dev, "not enough memory for the mmc_host\n");
2130: goto err_free_res_urb;
2131: }
2132: /* MMC core transfer sizes tunable parameters */
2133: mmc->caps = 0;
2134: if (!force_1_bit_data_xfers)
2135: mmc->caps |= MMC_CAP_4_BIT_DATA;
2136: if (!force_polling_for_irqs)
2137: mmc->caps |= MMC_CAP_SDIO_IRQ;
2138: mmc->caps &= ~MMC_CAP_NEEDS_POLL;
2139: /*
2140: * MMC_CAP_NEEDS_POLL causes core.c:mmc_rescan() to poll
2141: * for devices which results in spurious CMD7's being
2142: * issued which stops some SDIO cards from working
2143: */
2144: if (limit_speed_to_24_MHz) {
2145: mmc->caps |= MMC_CAP_MMC_HIGHSPEED;
2146: mmc->caps |= MMC_CAP_SD_HIGHSPEED;
2147: mmc->f_max = 24000000;
2148: dev_info(&udev->dev, "limiting SDIO speed to 24_MHz\n");
2149: } else {
2150: mmc->caps |= MMC_CAP_MMC_HIGHSPEED;
2151: mmc->caps |= MMC_CAP_SD_HIGHSPEED;
2152: mmc->f_max = 48000000;
2153: }
2154: mmc->f_min = 200000;
2155: mmc->max_blk_count = 511;
2156: mmc->max_blk_size = 512;
2157: mmc->max_segs = 128;
2158: if (force_max_req_size)
2159: mmc->max_req_size = force_max_req_size * 1024;
2160: else
2161: mmc->max_req_size = 64 * 1024;
2162: mmc->max_seg_size = mmc->max_req_size;
2163: mmc->ocr_avail = 0;
2164: mmc->ocr_avail |= MMC_VDD_165_195;
2165: mmc->ocr_avail |= MMC_VDD_20_21;
2166: mmc->ocr_avail |= MMC_VDD_21_22;
2167: mmc->ocr_avail |= MMC_VDD_22_23;
2168: mmc->ocr_avail |= MMC_VDD_23_24;
2169: mmc->ocr_avail |= MMC_VDD_24_25;
2170: mmc->ocr_avail |= MMC_VDD_25_26;
2171: mmc->ocr_avail |= MMC_VDD_26_27;
2172: mmc->ocr_avail |= MMC_VDD_27_28;
2173: mmc->ocr_avail |= MMC_VDD_28_29;
2174: mmc->ocr_avail |= MMC_VDD_29_30;
2175: mmc->ocr_avail |= MMC_VDD_30_31;
2176: mmc->ocr_avail |= MMC_VDD_31_32;
2177: mmc->ocr_avail |= MMC_VDD_32_33;
2178: mmc->ocr_avail |= MMC_VDD_33_34;
2179: mmc->ocr_avail |= MMC_VDD_34_35;
2180: mmc->ocr_avail |= MMC_VDD_35_36;
2181: mmc->ops = &vub300_mmc_ops;
2182: vub300 = mmc_priv(mmc);
2183: vub300->mmc = mmc;
2184: vub300->card_powered = 0;
2185: vub300->bus_width = 0;
2186: vub300->cmnd.head.block_size[0] = 0x00;
2187: vub300->cmnd.head.block_size[1] = 0x00;
2188: vub300->app_spec = 0;
2189: mutex_init(&vub300->cmd_mutex);
2190: mutex_init(&vub300->irq_mutex);
2191: vub300->command_out_urb = command_out_urb;
2192: vub300->command_res_urb = command_res_urb;
2193: vub300->usb_timed_out = 0;
2194: vub300->dynamic_register_count = 0;
2195:
2196: for (i = 0; i < ARRAY_SIZE(vub300->fn); i++) {
2197: vub300->fn[i].offload_point = 0;
2198: vub300->fn[i].offload_count = 0;
2199: }
2200:
2201: vub300->total_offload_count = 0;
2202: vub300->irq_enabled = 0;
2203: vub300->irq_disabled = 0;
2204: vub300->irqs_queued = 0;
2205:
2206: for (i = 0; i < ARRAY_SIZE(vub300->sdio_register); i++)
2207: vub300->sdio_register[i++].activate = 0;
2208:
2209: vub300->udev = udev;
2210: vub300->interface = interface;
2211: vub300->cmnd_res_ep = 0;
2212: vub300->cmnd_out_ep = 0;
2213: vub300->data_inp_ep = 0;
2214: vub300->data_out_ep = 0;
2215:
2216: for (i = 0; i < ARRAY_SIZE(vub300->fbs); i++)
2217: vub300->fbs[i] = 512;
2218:
2219: /*
2220: * set up the endpoint information
2221: *
2222: * use the first pair of bulk-in and bulk-out
2223: * endpoints for Command/Response+Interrupt
2224: *
2225: * use the second pair of bulk-in and bulk-out
2226: * endpoints for Data In/Out
2227: */
2228: vub300->large_usb_packets = 0;
2229: iface_desc = interface->cur_altsetting;
2230: for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
2231: struct usb_endpoint_descriptor *endpoint =
2232: &iface_desc->endpoint[i].desc;
2233: dev_info(&vub300->udev->dev,
2234: "vub300 testing %s EndPoint(%d) %02X\n",
2235: usb_endpoint_is_bulk_in(endpoint) ? "BULK IN" :
2236: usb_endpoint_is_bulk_out(endpoint) ? "BULK OUT" :
2237: "UNKNOWN", i, endpoint->bEndpointAddress);
2238: if (endpoint->wMaxPacketSize > 64)
2239: vub300->large_usb_packets = 1;
2240: if (usb_endpoint_is_bulk_in(endpoint)) {
2241: if (!vub300->cmnd_res_ep) {
2242: vub300->cmnd_res_ep =
2243: endpoint->bEndpointAddress;
2244: } else if (!vub300->data_inp_ep) {
2245: vub300->data_inp_ep =
2246: endpoint->bEndpointAddress;
2247: } else {
2248: dev_warn(&vub300->udev->dev,
2249: "ignoring"
2250: " unexpected bulk_in endpoint");
2251: }
2252: } else if (usb_endpoint_is_bulk_out(endpoint)) {
2253: if (!vub300->cmnd_out_ep) {
2254: vub300->cmnd_out_ep =
2255: endpoint->bEndpointAddress;
2256: } else if (!vub300->data_out_ep) {
2257: vub300->data_out_ep =
2258: endpoint->bEndpointAddress;
2259: } else {
2260: dev_warn(&vub300->udev->dev,
2261: "ignoring"
2262: " unexpected bulk_out endpoint");
2263: }
2264: } else {
2265: dev_warn(&vub300->udev->dev,
2266: "vub300 ignoring EndPoint(%d) %02X", i,
2267: endpoint->bEndpointAddress);
2268: }
2269: }
2270: if (vub300->cmnd_res_ep && vub300->cmnd_out_ep &&
2271: vub300->data_inp_ep && vub300->data_out_ep) {
2272: dev_info(&vub300->udev->dev,
2273: "vub300 %s packets"
2274: " using EndPoints %02X %02X %02X %02X\n",
2275: vub300->large_usb_packets ? "LARGE" : "SMALL",
2276: vub300->cmnd_out_ep, vub300->cmnd_res_ep,
2277: vub300->data_out_ep, vub300->data_inp_ep);
2278: /* we have the expected EndPoints */
2279: } else {
2280: dev_err(&vub300->udev->dev,
2281: "Could not find two sets of bulk-in/out endpoint pairs\n");
2282: retval = -EINVAL;
2283: goto err_free_host;
2284: }
2285: retval =
2286: usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
2287: GET_HC_INF0,
2288: USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2289: 0x0000, 0x0000, &vub300->hc_info,
2290: sizeof(vub300->hc_info), 1000);
2291: if (retval < 0)
2292: goto err_free_host;
2293: retval =
2294: usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0),
2295: SET_ROM_WAIT_STATES,
2296: USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2297: firmware_rom_wait_states, 0x0000, NULL, 0, 1000);
2298: if (retval < 0)
2299: goto err_free_host;
2300: dev_info(&vub300->udev->dev,
2301: "operating_mode = %s %s %d MHz %s %d byte USB packets\n",
2302: (mmc->caps & MMC_CAP_SDIO_IRQ) ? "IRQs" : "POLL",
2303: (mmc->caps & MMC_CAP_4_BIT_DATA) ? "4-bit" : "1-bit",
2304: mmc->f_max / 1000000,
2305: pad_input_to_usb_pkt ? "padding input data to" : "with",
2306: vub300->large_usb_packets ? 512 : 64);
2307: retval =
2308: usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
2309: GET_SYSTEM_PORT_STATUS,
2310: USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2311: 0x0000, 0x0000, &vub300->system_port_status,
2312: sizeof(vub300->system_port_status), 1000);
2313: if (retval < 0) {
2314: goto err_free_host;
2315: } else if (sizeof(vub300->system_port_status) == retval) {
2316: vub300->card_present =
2317: (0x0001 & vub300->system_port_status.port_flags) ? 1 : 0;
2318: vub300->read_only =
2319: (0x0010 & vub300->system_port_status.port_flags) ? 1 : 0;
2320: } else {
2321: retval = -EINVAL;
2322: goto err_free_host;
2323: }
2324: usb_set_intfdata(interface, vub300);
2325: INIT_DELAYED_WORK(&vub300->pollwork, vub300_pollwork_thread);
2326: INIT_WORK(&vub300->cmndwork, vub300_cmndwork_thread);
2327: INIT_WORK(&vub300->deadwork, vub300_deadwork_thread);
2328: kref_init(&vub300->kref);
2329: timer_setup(&vub300->sg_transfer_timer, vub300_sg_timed_out, 0);
2330: kref_get(&vub300->kref);
2331: timer_setup(&vub300->inactivity_timer,
2332: vub300_inactivity_timer_expired, 0);
2333: vub300->inactivity_timer.expires = jiffies + HZ;
2334: add_timer(&vub300->inactivity_timer);
2335: if (vub300->card_present)
2336: dev_info(&vub300->udev->dev,
2337: "USB vub300 remote SDIO host controller[%d]"
2338: "connected with SD/SDIO card inserted\n",
2339: interface_to_InterfaceNumber(interface));
2340: else
2341: dev_info(&vub300->udev->dev,
2342: "USB vub300 remote SDIO host controller[%d]"
2343: "connected with no SD/SDIO card inserted\n",
2344: interface_to_InterfaceNumber(interface));
2345: retval = mmc_add_host(mmc);
2346: if (retval)
2347: goto err_stop_io;
2348:
2349: return 0;
2350:
2351: err_stop_io:
2352: vub300->interface = NULL;
2353: kref_put(&vub300->kref, vub300_delete);
2354:
2355: return retval;
2356:
2357: err_free_host:
2358: mmc_free_host(mmc);
2359: /*
2360: * and hence also frees vub300
2361: * which is contained at the end of struct mmc
2362: */
2363: err_free_res_urb:
2364: usb_free_urb(command_res_urb);
2365: err_free_out_urb:
2366: usb_free_urb(command_out_urb);
2367: err_put_udev:
2368: usb_put_dev(udev);
2369:
2370: return retval;
2371: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 35/2 |
2026/09/07 15:14 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 58398
output: 44
thoughts: 433
Thoughts: **My Thought Process on USB Gadget Initialization and Vendor-Specific Requests**
Alright, I'm trying to get this `vub300_probe` function to work, and my initial analysis tells me it has a few key requirements. First, it needs two pairs of bulk-in and bulk-out endpoints. That's standard enough.
The real wrinkle is the three vendor-specific control requests it sends right out of the gate:
1. `GET_HC_INF0`: This is an IN transfer, vendor type, targeting the device itself, with a specific request code of 0 and a length of 28 bytes.
2. `SET_ROM_WAIT_STATES`: This is an OUT transfer, again vendor type and device target, with request code 1. It takes a `firmware_rom_wait_states` value and has a zero length payload.
3. `GET_SYSTEM_PORT_STATUS`: Another IN transfer, vendor type, device target, request code 2, and a short 4-byte payload.
Now, my immediate thought is about how to implement these in the Linux kernel. My first instinct might be to use `configfs`, as it's the modern, more user-friendly way to set up USB gadget functionality. However, I've run into a wall here. `configfs`, by itself, doesn't provide a straightforward mechanism to directly handle *arbitrary* vendor-specific control requests.
The problem is that if the kernel's composite gadget framework encounters a control request it doesn't recognize or isn't configured to handle, it will simply STALL the endpoint. This is problematic because `vub300_probe` *expects* these requests to succeed. If any of these initial `usb_control_msg` calls fail and return a negative error code, `vub300_probe` will bail out, jumping to `err_free_host`. This means the `vub300` device won't be properly initialized, and critically, the necessary timer won't even be added.
Therefore, I've concluded that simply using `configfs` is insufficient. I *must* find a way to handle these vendor-specific control requests and ensure they return success.
This leads me to believe that `raw-gadget` is the path I need to take. `raw-gadget` offers a lower-level interface, which gives me the control needed to intercept and respond to these custom requests.
So, my plan now is to leverage `raw-gadget`. To do that, I'll need to perform the following steps:
1. Open the `/dev/raw-gadget` device file.
2. Initialize the raw gadget driver using the `USB_RAW_IOCTL_INIT` ioctl, specifying a `driver_name` like "dummy_udc" and a `device_name` like "dummy_udc.0".
3. Then, I'll need to run the gadget. I'm just double-checking my notes here... yes, I believe there's a `USB_RAW_IOCTL_RUN` ioctl that I'll need to call to activate the gadget. This will allow me to then register my custom request handlers.
|
| 36/2 |
2026/09/07 15:15 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/usb/raw_gadget.h FirstLine:101 LineCount:100]
Results: map[Contents: 101: __u16 flags;
102: __u32 length;
103: __u8 data[];
104: };
105:
106: /* Maximum number of non-control endpoints in struct usb_raw_eps_info. */
107: #define USB_RAW_EPS_NUM_MAX 30
108:
109: /* Maximum length of UDC endpoint name in struct usb_raw_ep_info. */
110: #define USB_RAW_EP_NAME_MAX 16
111:
112: /* Used as addr in struct usb_raw_ep_info if endpoint accepts any address. */
113: #define USB_RAW_EP_ADDR_ANY 0xff
114:
115: /*
116: * struct usb_raw_ep_caps - exposes endpoint capabilities from struct usb_ep
117: * (technically from its member struct usb_ep_caps).
118: */
119: struct usb_raw_ep_caps {
120: __u32 type_control : 1;
121: __u32 type_iso : 1;
122: __u32 type_bulk : 1;
123: __u32 type_int : 1;
124: __u32 dir_in : 1;
125: __u32 dir_out : 1;
126: };
127:
128: /*
129: * struct usb_raw_ep_limits - exposes endpoint limits from struct usb_ep.
130: * @maxpacket_limit: Maximum packet size value supported by this endpoint.
131: * @max_streams: maximum number of streams supported by this endpoint
132: * (actual number is 2^n).
133: * @reserved: Empty, reserved for potential future extensions.
134: */
135: struct usb_raw_ep_limits {
136: __u16 maxpacket_limit;
137: __u16 max_streams;
138: __u32 reserved;
139: };
140:
141: /*
142: * struct usb_raw_ep_info - stores information about a gadget endpoint.
143: * @name: Name of the endpoint as it is defined in the UDC driver.
144: * @addr: Address of the endpoint that must be specified in the endpoint
145: * descriptor passed to USB_RAW_IOCTL_EP_ENABLE ioctl.
146: * @caps: Endpoint capabilities.
147: * @limits: Endpoint limits.
148: */
149: struct usb_raw_ep_info {
150: __u8 name[USB_RAW_EP_NAME_MAX];
151: __u32 addr;
152: struct usb_raw_ep_caps caps;
153: struct usb_raw_ep_limits limits;
154: };
155:
156: /*
157: * struct usb_raw_eps_info - argument for USB_RAW_IOCTL_EPS_INFO ioctl.
158: * eps: Structures that store information about non-control endpoints.
159: */
160: struct usb_raw_eps_info {
161: struct usb_raw_ep_info eps[USB_RAW_EPS_NUM_MAX];
162: };
163:
164: /*
165: * Initializes a Raw Gadget instance.
166: * Accepts a pointer to the usb_raw_init struct as an argument.
167: * Returns 0 on success or negative error code on failure.
168: */
169: #define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
170:
171: /*
172: * Instructs Raw Gadget to bind to a UDC and start emulating a USB device.
173: * Returns 0 on success or negative error code on failure.
174: */
175: #define USB_RAW_IOCTL_RUN _IO('U', 1)
176:
177: /*
178: * A blocking ioctl that waits for an event and returns fetched event data to
179: * the user.
180: * Accepts a pointer to the usb_raw_event struct.
181: * Returns 0 on success or negative error code on failure.
182: */
183: #define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
184:
185: /*
186: * Queues an IN (OUT for READ) request as a response to the last setup request
187: * received on endpoint 0 (provided that was an IN (OUT for READ) request), and
188: * waits until the request is completed. Copies received data to user for READ.
189: * Accepts a pointer to the usb_raw_ep_io struct as an argument.
190: * Returns length of transferred data on success or negative error code on
191: * failure.
192: */
193: #define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
194: #define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
195:
196: /*
197: * Finds an endpoint that satisfies the parameters specified in the provided
198: * descriptors (address, transfer type, etc.) and enables it.
199: * Accepts a pointer to the usb_raw_ep_descs struct as an argument.
200: * Returns enabled endpoint handle on success or negative error code on failure.
]
|
| 37/2 |
2026/09/07 15:15 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 60548
output: 44
thoughts: 133
Thoughts: **My Thought Process Regarding USB RAW I/O Operations**
Alright, let's break down this USB RAW I/O interaction. My primary focus here is understanding the available mechanisms for controlling and interacting with the USB device at a low level.
I recall confirming the existence of `USB_RAW_IOCTL_RUN`. This is clearly the entry point, the command to actually initiate or enable the raw USB I/O operations for the device. It's the foundational step.
Following that, I identified `USB_RAW_IOCTL_EVENT_FETCH`. This is crucial for any event-driven communication. My understanding is that this ioctl will be used to poll for and retrieve any pending events from the USB device. It’s how we stay informed about what the device is doing or has done.
Now, when I specifically receive an event of type `USB_RAW_EVENT_CONTROL`, that’s a signal that a USB control transfer is in progress or has occurred. The key piece of information I'm looking for here is the setup packet. This packet contains all the critical details of the control request, defining the operation the host is trying to perform.
My immediate thought upon receiving this control event is, "Where is that setup packet?" The text confirms my suspicion: the `usb_raw_event` structure itself contains the setup packet within its `data` field. This simplifies things considerably; I don't have to perform a separate read operation just to get the setup data. It's conveniently bundled.
The next logical step, after understanding the incoming control request, is to formulate a response. This is where the endpoint 0 (EP0) specific ioctls come into play. I can use `USB_RAW_IOCTL_EP0_WRITE` to send data back to the host as part of the control transfer. Conversely, `USB_RAW_IOCTL_EP0_READ` would be for receiving data from the host if the control transfer requires it (e.g., a vendor-specific command with a data phase).
I also briefly considered the possibility of STALLing EP0. This is a standard USB control transfer mechanism to indicate an error or that the request is not supported. I've made a mental note to verify if there's a dedicated `STALL` ioctl like `USB_RAW_IOCTL_EP0_STALL`. If such an ioctl exists, it would provide a clean and explicit way to handle unsupported or erroneous control requests. If not, I'll need to investigate how a stall condition is typically signaled or if it's handled implicitly by other operations.
|
| 38/2 |
2026/09/07 15:15 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/usb/raw_gadget.h FirstLine:201 LineCount:100]
Results: map[Contents: 201: */
202: #define USB_RAW_IOCTL_EP_ENABLE _IOW('U', 5, struct usb_endpoint_descriptor)
203:
204: /*
205: * Disables specified endpoint.
206: * Accepts endpoint handle as an argument.
207: * Returns 0 on success or negative error code on failure.
208: */
209: #define USB_RAW_IOCTL_EP_DISABLE _IOW('U', 6, __u32)
210:
211: /*
212: * Queues an IN (OUT for READ) request as a response to the last setup request
213: * received on endpoint usb_raw_ep_io.ep (provided that was an IN (OUT for READ)
214: * request), and waits until the request is completed. Copies received data to
215: * user for READ.
216: * Accepts a pointer to the usb_raw_ep_io struct as an argument.
217: * Returns length of transferred data on success or negative error code on
218: * failure.
219: */
220: #define USB_RAW_IOCTL_EP_WRITE _IOW('U', 7, struct usb_raw_ep_io)
221: #define USB_RAW_IOCTL_EP_READ _IOWR('U', 8, struct usb_raw_ep_io)
222:
223: /*
224: * Switches the gadget into the configured state.
225: * Returns 0 on success or negative error code on failure.
226: */
227: #define USB_RAW_IOCTL_CONFIGURE _IO('U', 9)
228:
229: /*
230: * Constrains UDC VBUS power usage.
231: * Accepts current limit in 2 mA units as an argument.
232: * Returns 0 on success or negative error code on failure.
233: */
234: #define USB_RAW_IOCTL_VBUS_DRAW _IOW('U', 10, __u32)
235:
236: /*
237: * Fills in the usb_raw_eps_info structure with information about non-control
238: * endpoints available for the currently connected UDC.
239: * Returns the number of available endpoints on success or negative error code
240: * on failure.
241: */
242: #define USB_RAW_IOCTL_EPS_INFO _IOR('U', 11, struct usb_raw_eps_info)
243:
244: /*
245: * Stalls a pending control request on endpoint 0.
246: * Returns 0 on success or negative error code on failure.
247: */
248: #define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
249:
250: /*
251: * Sets or clears halt or wedge status of the endpoint.
252: * Accepts endpoint handle as an argument.
253: * Returns 0 on success or negative error code on failure.
254: */
255: #define USB_RAW_IOCTL_EP_SET_HALT _IOW('U', 13, __u32)
256: #define USB_RAW_IOCTL_EP_CLEAR_HALT _IOW('U', 14, __u32)
257: #define USB_RAW_IOCTL_EP_SET_WEDGE _IOW('U', 15, __u32)
258:
259: #endif /* _UAPI__LINUX_USB_RAW_GADGET_H */
]
|
| 39/2 |
2026/09/07 15:15 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 61770
output: 20
thoughts: 229
Thoughts: **My Thought Process on USB Gadget Interaction**
Okay, so I've confirmed that the `USB_RAW_IOCTL_EP0_STALL` ioctl is indeed a thing. That's a useful piece of information.
However, the idea of writing a full-blown C program to manage the entire USB enumeration process using `raw-gadget` – handling all the `GET_DESCRIPTOR` requests for the device, configuration, strings, and the like – feels like a significant undertaking. It's doable, certainly, but I'm wondering if there's a more efficient or less involved path to achieving my goal, which seems to be triggering the `vub300_probe` function.
This leads me to consider alternatives. Could `vhci-hcd` be a viable option? My initial thought was that with `vhci-hcd`, I could simply inject a USB device into the system by writing to the `/sys/devices/platform/vhci_hcd.0/attach` file. That seems much simpler on the host side.
But then I recall that `vhci-hcd` itself relies on the USB/IP protocol. This means that to make it work, I would still need to implement the USB/IP server-side logic to correctly reply to the URBs (USB Request Blocks) that `vhci-hcd` would send. So, while it simplifies the *attachment* mechanism, it introduces its own complexity in terms of protocol implementation. That's not quite the shortcut I was hoping for.
So, back to the drawing board, or rather, looking for a different approach. What if I try a combination of `dummy_hcd` with a standard gadget, like `g_zero`? The idea here would be to leverage the existing gadget structure but customize its identity. Specifically, I'm thinking about modifying the `idVendor` and `idProduct` values. Could I achieve this by using module parameters for `g_zero`? This would allow me to present a custom vendor and product ID without having to rewrite the entire gadget's core functionality.
My next step is to verify if `g_zero` actually supports accepting `idVendor` and `idProduct` as module parameters. That's the crucial check I need to make to see if this particular avenue is feasible.
|
| 40/2 |
2026/09/07 15:15 |
tool |
grepper |
0m
Args: map[Expression:module_param.*idVendor]
Results: map[Output:include/linux/usb/composite.h=528=struct usb_composite_overwrite {
--
include/linux/usb/composite.h-538- \
include/linux/usb/composite.h:539: module_param_named(idVendor, coverwrite.idVendor, ushort, S_IRUGO); \
include/linux/usb/composite.h-540- MODULE_PARM_DESC(idVendor, "USB Vendor ID"); \
]
|
| 41/2 |
2026/09/07 15:15 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 62134
output: 22
thoughts: 44
Thoughts: **My Thought Process Regarding Composite Gadget Module Parameters**
Ah, I've just discovered something quite significant in the kernel source! It seems `include/linux/usb/composite.h` defines a rather useful macro. This macro, as I understand it, has the capability to dynamically add `idVendor` and `idProduct` module parameters to composite gadgets. This is a crucial piece of information, as it suggests a standardized and potentially more flexible way to manage vendor and product identifiers for these types of USB devices at the module level. My immediate next step, naturally, is to delve into the code and identify exactly which composite gadgets are leveraging this macro. Understanding its current adoption will give me a clear picture of its impact and potential for future development.
|
| 42/2 |
2026/09/07 15:15 |
tool |
grepper |
0m
Args: map[Expression:module_param_named\(idVendor]
Results: map[Output:include/linux/usb/composite.h=528=struct usb_composite_overwrite {
--
include/linux/usb/composite.h-538- \
include/linux/usb/composite.h:539: module_param_named(idVendor, coverwrite.idVendor, ushort, S_IRUGO); \
include/linux/usb/composite.h-540- MODULE_PARM_DESC(idVendor, "USB Vendor ID"); \
]
|
| 43/2 |
2026/09/07 15:16 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 62315
output: 24
thoughts: 19
Thoughts: **My Thought Process:**
Okay, so I'm looking at this code, and my immediate instinct is to question the name of the macro being used. I'm thinking, "Is that really the right one?" My experience tells me that when dealing with composite USB gadget configurations, the naming conventions are usually quite specific. Therefore, I'm hypothesizing that the macro I should be looking for, or the one that's more likely to be correct in this context, is `USB_GADGET_COMPOSITE_OPTIONS`. This is based on my understanding of how these types of configurations are typically defined and named within the relevant codebase or framework.
|
| 44/2 |
2026/09/07 15:16 |
tool |
grepper |
0m
Args: map[Expression:USB_GADGET_COMPOSITE_OPTIONS]
Results: map[Output:drivers/usb/gadget/legacy/acm_ms.c-32-/*-------------------------------------------------------------------------*/
drivers/usb/gadget/legacy/acm_ms.c:33:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/acm_ms.c-34-
--
drivers/usb/gadget/legacy/audio.c-17-
drivers/usb/gadget/legacy/audio.c:18:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/audio.c-19-
--
drivers/usb/gadget/legacy/cdc2.c-31-
drivers/usb/gadget/legacy/cdc2.c:32:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/cdc2.c-33-
--
drivers/usb/gadget/legacy/ether.c=82=static inline bool has_rndis(void)
--
drivers/usb/gadget/legacy/ether.c-103-/*-------------------------------------------------------------------------*/
drivers/usb/gadget/legacy/ether.c:104:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/ether.c-105-
--
drivers/usb/gadget/legacy/g_ffs.c=55=MODULE_LICENSE("GPL");
--
drivers/usb/gadget/legacy/g_ffs.c-61-
drivers/usb/gadget/legacy/g_ffs.c:62:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/g_ffs.c-63-
--
drivers/usb/gadget/legacy/gmidi.c=37=static const char longname[] = "MIDI Gadget";
drivers/usb/gadget/legacy/gmidi.c-38-
drivers/usb/gadget/legacy/gmidi.c:39:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/gmidi.c-40-
--
drivers/usb/gadget/legacy/hid.c=37=static LIST_HEAD(hidg_func_list);
--
drivers/usb/gadget/legacy/hid.c-39-/*-------------------------------------------------------------------------*/
drivers/usb/gadget/legacy/hid.c:40:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/hid.c-41-
--
drivers/usb/gadget/legacy/mass_storage.c-47-/*-------------------------------------------------------------------------*/
drivers/usb/gadget/legacy/mass_storage.c:48:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/mass_storage.c-49-
--
drivers/usb/gadget/legacy/multi.c=29=MODULE_LICENSE("GPL");
--
drivers/usb/gadget/legacy/multi.c-40-
drivers/usb/gadget/legacy/multi.c:41:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/multi.c-42-
--
drivers/usb/gadget/legacy/ncm.c-39-/*-------------------------------------------------------------------------*/
drivers/usb/gadget/legacy/ncm.c:40:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/ncm.c-41-
--
drivers/usb/gadget/legacy/nokia.c-29-
drivers/usb/gadget/legacy/nokia.c:30:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/nokia.c-31-
--
drivers/usb/gadget/legacy/printer.c-17-
drivers/usb/gadget/legacy/printer.c:18:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/printer.c-19-
--
drivers/usb/gadget/legacy/serial.c-28-/*-------------------------------------------------------------------------*/
drivers/usb/gadget/legacy/serial.c:29:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/serial.c-30-
--
drivers/usb/gadget/legacy/tcm_usb_gadget.c-25-
drivers/usb/gadget/legacy/tcm_usb_gadget.c:26:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/tcm_usb_gadget.c-27-
--
drivers/usb/gadget/legacy/webcam.c-16-
drivers/usb/gadget/legacy/webcam.c:17:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/webcam.c-18-
--
drivers/usb/gadget/legacy/zero.c-46-/*-------------------------------------------------------------------------*/
drivers/usb/gadget/legacy/zero.c:47:USB_GADGET_COMPOSITE_OPTIONS();
drivers/usb/gadget/legacy/zero.c-48-
--
include/linux/usb/composite.h=528=struct usb_composite_overwrite {
--
include/linux/usb/composite.h-535-};
include/linux/usb/composite.h:536:#define USB_GADGET_COMPOSITE_OPTIONS() \
include/linux/usb/composite.h-537- static struct usb_composite_overwrite coverwrite; \
]
|
| 45/2 |
2026/09/07 15:16 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 63726
output: 39
thoughts: 142
Thoughts: **My Thought Process Regarding `g_zero` and `vub300` Compatibility**
Ah, excellent! I've just confirmed that `g_zero`, which I've been referring to as the `zero` gadget, utilizes the `USB_GADGET_COMPOSITE_OPTIONS()` macro. This is a crucial piece of information. It means that configuring `g_zero` with specific `idVendor` and `idProduct` values, in this case `0x0424` and `0x012C` respectively, should be straightforward. This particular vendor and product ID pair immediately brings `vub300` to mind, as it's what I'm trying to interface with.
However, a nagging question arises: I recall that `vub300` specifically requires two pairs of bulk endpoints to function correctly. My immediate concern, then, is whether `g_zero`, in its standard configuration, actually provides this necessary dual-bulk-endpoint capability.
I know that `g_zero` is designed with two primary functions: a loopback function and a source/sink function. My understanding is that *each* of these individual functions offers its own distinct pair of bulk endpoints. This is where the potential lies! If both the loopback and the source/sink functions can be enabled concurrently within `g_zero`, then it stands to reason that we might indeed achieve the desired two pairs of bulk endpoints. This would be the ideal scenario for compatibility with `vub300`.
To definitively answer this, my next logical step is to dive into the source code. I need to examine `zero.c` to confirm the exact endpoint configuration when both functions are activated. This will be the ultimate verification of whether `g_zero` can meet `vub300`'s endpoint requirements.
|
| 46/2 |
2026/09/07 15:16 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:drivers/usb/gadget/legacy/zero.c Name:zero_bind]
Results: map[SourceCode: SourceFile:]
|
| 47/2 |
2026/09/07 15:16 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 63912
output: 17
thoughts: 25
Thoughts: **My Thought Process on `zero_bind` in `drivers/usb/gadget/legacy/zero.c`**
Alright, so I'm looking at the `drivers/usb/gadget/legacy/zero.c` file, and the immediate impulse is to get a grip on what exactly `zero_bind` is doing within this context. My goal here is to understand its role in the USB gadget driver infrastructure, specifically the legacy aspects. I anticipate `zero_bind` will be the function responsible for hooking up the "zero" gadget driver to a specific USB port or function. This means it's likely the point where the driver registers itself with the underlying USB hardware and potentially sets up some initial state or callbacks. I'll be paying close attention to what parameters it takes, what it returns, and the core operations it performs. Is it just a simple registration, or does it involve more complex setup like allocating resources, configuring endpoints, or establishing communication channels? Given it's in a legacy driver, I'm also bracing myself for potentially older patterns or less streamlined approaches compared to more modern gadget implementations. Ultimately, understanding `zero_bind` is key to understanding how the zero gadget operates and how it integrates into the broader USB gadget framework.
|
| 48/2 |
2026/09/07 15:16 |
tool |
grepper |
0m
Args: map[Expression:zero_bind]
Results: map[Output:drivers/usb/gadget/legacy/zero.c=272=MODULE_PARM_DESC(iso_qlen, "depth of sourcesink queue for iso transfer");
drivers/usb/gadget/legacy/zero.c-273-
drivers/usb/gadget/legacy/zero.c:274:static int zero_bind(struct usb_composite_dev *cdev)
drivers/usb/gadget/legacy/zero.c-275-{
--
drivers/usb/gadget/legacy/zero.c=423=static struct usb_composite_driver zero_driver = {
--
drivers/usb/gadget/legacy/zero.c-427- .max_speed = USB_SPEED_SUPER,
drivers/usb/gadget/legacy/zero.c:428: .bind = zero_bind,
drivers/usb/gadget/legacy/zero.c-429- .unbind = zero_unbind,
]
|
| 49/2 |
2026/09/07 15:16 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 64183
output: 39
thoughts: 9
Thoughts: **My Thought Process on Approaching `zero_bind`**
Alright, I'm about to dive into this `zero_bind` code. My initial reaction is one of focused curiosity, and frankly, a touch of anticipation. I'm an expert in my field, so I'm not just reading code; I'm dissecting it, looking for its intent, its elegant solutions, and potential pitfalls. My brain is already buzzing with hypotheses about what `zero_bind` might represent. Is it about optimizing for zero overhead bindings? Perhaps some form of garbage collection avoidance or a highly specialized, low-latency data binding mechanism? The name itself suggests a focus on efficiency, on eliminating any unnecessary steps or allocations that might typically be associated with binding operations.
As I begin to read, I'm not just scanning lines. I'm looking for patterns, for familiar architectural structures, and for any novel constructs. I'll be paying close attention to the types involved. What kind of data is being bound? Are we dealing with primitive types, complex objects, or something more esoteric like streams or futures? The type signatures are my initial roadmap. I'll be looking for generic parameters, their constraints, and how they are being used. This will give me a strong indication of the flexibility and intended scope of `zero_bind`.
Then, the implementation details. I'll be scrutinizing the algorithms. Are there loops? Recursive calls? Are they optimized for tail recursion? What about memory management? I'll be on the lookout for explicit memory allocation, deallocation, or any patterns that suggest manual memory management or clever reuse of existing resources. My mind is also racing ahead, considering the implications of different implementation choices. For instance, a solution that relies heavily on immutability might be elegant and safe, but could introduce performance overhead if not handled carefully. Conversely, a mutable approach, while potentially faster, requires much more vigilance to avoid race conditions or unexpected side effects.
I'll be asking myself: What problem is this `zero_bind` solving? Is it a general-purpose binding utility, or is it tailored for a very specific use case? Understanding the *why* behind the *what* is crucial for a deep comprehension. I'll be looking for any comments, although I anticipate that well-written code, especially something as potentially performance-critical as `zero_bind`, might be largely self-documenting through its clarity. If there are comments, I'll be evaluating their accuracy and usefulness.
Furthermore, I'll be mentally constructing test cases as I read. What are the edge cases? What happens with null inputs, empty collections, or extreme values? How would I break this code? This critical self-interrogation is essential for identifying potential bugs or areas for improvement. I'm also considering the broader context. Where does `zero_bind` fit into the larger system? What are its dependencies? How does it interact with other modules?
Ultimately, as I read `zero_bind`, I'm not just reading code; I'm engaging in a mental dialogue with its creator, trying to anticipate their design decisions, appreciate their craftsmanship, and perhaps even identify opportunities for further optimization or generalization. It's a process of immersion, analysis, and synthesis, all driven by the desire to understand not just *how* it works, but *why* it works the way it does.
|
| 50/2 |
2026/09/07 15:17 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:drivers/usb/gadget/legacy/zero.c Name:zero_bind]
Results: map[SourceCode: SourceFile:]
|
| 51/2 |
2026/09/07 15:17 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 64236
output: 41
thoughts: 16
Thoughts: **My Thought Process Regarding `zero_bind`**
Alright, I've just realized something critical here: `zero_bind` is static. This immediately tells me a lot. Because it's static, its behavior is predictable and, importantly, I can readily examine its contents. I don't have to worry about dynamic instantiation or runtime variations affecting how it operates or what data it holds. This means I can directly access and analyze the file associated with it, which is a significant advantage for understanding its role and potential implications within the system.
|
| 52/2 |
2026/09/07 15:17 |
tool |
read-file |
0m
Args: map[File:drivers/usb/gadget/legacy/zero.c FirstLine:274 LineCount:100]
Results: map[Contents: 274: static int zero_bind(struct usb_composite_dev *cdev)
275: {
276: struct f_ss_opts *ss_opts;
277: struct f_lb_opts *lb_opts;
278: int status;
279:
280: /* Allocate string descriptor numbers ... note that string
281: * contents can be overridden by the composite_dev glue.
282: */
283: status = usb_string_ids_tab(cdev, strings_dev);
284: if (status < 0)
285: return status;
286:
287: device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id;
288: device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id;
289: device_desc.iSerialNumber = strings_dev[USB_GADGET_SERIAL_IDX].id;
290:
291: autoresume_cdev = cdev;
292: timer_setup(&autoresume_timer, zero_autoresume, 0);
293:
294: func_inst_ss = usb_get_function_instance("SourceSink");
295: if (IS_ERR(func_inst_ss))
296: return PTR_ERR(func_inst_ss);
297:
298: ss_opts = container_of(func_inst_ss, struct f_ss_opts, func_inst);
299: ss_opts->pattern = gzero_options.pattern;
300: ss_opts->isoc_interval = gzero_options.isoc_interval;
301: ss_opts->isoc_maxpacket = gzero_options.isoc_maxpacket;
302: ss_opts->isoc_mult = gzero_options.isoc_mult;
303: ss_opts->isoc_maxburst = gzero_options.isoc_maxburst;
304: ss_opts->bulk_buflen = gzero_options.bulk_buflen;
305: ss_opts->bulk_qlen = gzero_options.ss_bulk_qlen;
306: ss_opts->iso_qlen = gzero_options.ss_iso_qlen;
307:
308: func_ss = usb_get_function(func_inst_ss);
309: if (IS_ERR(func_ss)) {
310: status = PTR_ERR(func_ss);
311: goto err_put_func_inst_ss;
312: }
313:
314: func_inst_lb = usb_get_function_instance("Loopback");
315: if (IS_ERR(func_inst_lb)) {
316: status = PTR_ERR(func_inst_lb);
317: goto err_put_func_ss;
318: }
319:
320: lb_opts = container_of(func_inst_lb, struct f_lb_opts, func_inst);
321: lb_opts->bulk_buflen = gzero_options.bulk_buflen;
322: lb_opts->qlen = gzero_options.qlen;
323:
324: func_lb = usb_get_function(func_inst_lb);
325: if (IS_ERR(func_lb)) {
326: status = PTR_ERR(func_lb);
327: goto err_put_func_inst_lb;
328: }
329:
330: sourcesink_driver.iConfiguration = strings_dev[USB_GZERO_SS_DESC].id;
331: loopback_driver.iConfiguration = strings_dev[USB_GZERO_LB_DESC].id;
332:
333: /* support autoresume for remote wakeup testing */
334: sourcesink_driver.bmAttributes &= ~USB_CONFIG_ATT_WAKEUP;
335: loopback_driver.bmAttributes &= ~USB_CONFIG_ATT_WAKEUP;
336: sourcesink_driver.descriptors = NULL;
337: loopback_driver.descriptors = NULL;
338: if (autoresume) {
339: sourcesink_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
340: loopback_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
341: autoresume_step_ms = autoresume * 1000;
342: }
343:
344: /* support OTG systems */
345: if (gadget_is_otg(cdev->gadget)) {
346: if (!otg_desc[0]) {
347: struct usb_descriptor_header *usb_desc;
348:
349: usb_desc = usb_otg_descriptor_alloc(cdev->gadget);
350: if (!usb_desc) {
351: status = -ENOMEM;
352: goto err_conf_flb;
353: }
354: usb_otg_descriptor_init(cdev->gadget, usb_desc);
355: otg_desc[0] = usb_desc;
356: otg_desc[1] = NULL;
357: }
358: sourcesink_driver.descriptors = otg_desc;
359: sourcesink_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
360: loopback_driver.descriptors = otg_desc;
361: loopback_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
362: }
363:
364: /* Register primary, then secondary configuration. Note that
365: * SH3 only allows one config...
366: */
367: if (loopdefault) {
368: usb_add_config_only(cdev, &loopback_driver);
369: usb_add_config_only(cdev, &sourcesink_driver);
370: } else {
371: usb_add_config_only(cdev, &sourcesink_driver);
372: usb_add_config_only(cdev, &loopback_driver);
373: }
]
|
| 53/2 |
2026/09/07 15:17 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 66073
output: 40
thoughts: 860
Thoughts: **My Thought Process on Satisfying the `vub300` Driver's Requirements**
Alright, so I'm looking at this `vub300` driver, and it's got some rather specific expectations regarding USB descriptors. My initial thought was to leverage the `g_zero` gadget driver, which offers `sourcesink_driver` and `loopback_driver` configurations. However, each of these configurations only provides a single function, and crucially, each function only defines two endpoints: one bulk IN and one bulk OUT.
The problem is that `vub300` *demands* an interface with *two pairs* of bulk endpoints – so, a total of four bulk endpoints (two IN and two OUT) – all within the *same* interface. I confirmed this by looking at the `vub300_probe` function. It iterates through the endpoints in `interface->cur_altsetting`, and then it specifically checks if it found `cmnd_res_ep`, `cmnd_out_ep`, `data_inp_ep`, and `data_out_ep`. This clearly indicates the need for four endpoints.
Therefore, `g_zero`, as it stands, simply won't satisfy `vub300_probe` because it only offers two endpoints per interface. We need a gadget that can present an interface with four bulk endpoints.
My mind immediately jumped to two potential solutions:
1. **A custom gadget driver:** I could write a new gadget driver that specifically exposes an interface with the required four bulk endpoints.
2. **`raw-gadget`:** This seems like a more direct and minimal approach. With `raw-gadget`, I can provide the exact USB descriptors that `vub300` expects.
Then, I considered `configfs`. I know `configfs` allows us to assemble configurations by adding multiple functions. However, my understanding is that each function typically gets its own interface. If `vub300` needs all four endpoints in a single interface, then `configfs` likely doesn't have a pre-built function that can provide this specific endpoint configuration. So, `configfs` doesn't seem to be the right tool for this particular constraint.
This leads me back to `raw-gadget`. It's the most straightforward way to craft an interface with the precise descriptor layout `vub300` is looking for.
So, the plan is to write a minimal C program using `raw-gadget`:
* I'll need to open `/dev/raw-gadget`.
* Initialize it with `USB_RAW_IOCTL_INIT`, specifying `dummy_udc.0` as the UDC.
* Then, run it with `USB_RAW_IOCTL_RUN`.
* I'll enter a loop to fetch events using `USB_RAW_IOCTL_EVENT_FETCH`.
* The key will be handling `USB_RAW_EVENT_CONTROL`. When I receive a control request, I'll need to inspect the setup packet:
* For `GET_DESCRIPTOR` requests targeting the Device descriptor, I'll need to return the correct `idVendor=0x0424` and `idProduct=0x012C`.
* For `GET_DESCRIPTOR` requests targeting the Configuration descriptor, I'll have to craft a descriptor that describes one interface containing four endpoints (two bulk IN, two bulk OUT).
* For `SET_CONFIGURATION`, a simple empty data response should suffice.
* Crucially, I'll need to handle the specific vendor-specific requests that `vub300` makes. These are `GET_HC_INF0`, `SET_ROM_WAIT_STATES`, and `GET_SYSTEM_PORT_STATUS`. I'll need to check the exact values of these macros to ensure I'm responding correctly, and then provide the expected data lengths: 28 bytes for `GET_HC_INF0`, 0 bytes for `SET_ROM_WAIT_STATES`, and 4 bytes for `GET_SYSTEM_PORT_STATUS`.
Once `vub300_probe` successfully completes, the intended next step is simply to close `/dev/raw-gadget` (or let the program exit). This action will effectively simulate a USB disconnect. The subsequent timer expiration within `vub300` should then trigger the bug I'm investigating.
I should double-check the exact numerical definitions for those `vub300` vendor requests (`GET_HC_INF0`, `SET_ROM_WAIT_STATES`, `GET_SYSTEM_PORT_STATUS`) to ensure perfect compliance.
|
| 54/2 |
2026/09/07 15:17 |
tool |
grepper |
0m
Args: map[Expression:#define (GET_HC_INF0|SET_ROM_WAIT_STATES|GET_SYSTEM_PORT_STATUS)]
Results: map[Output:drivers/mmc/host/vub300.c=296=struct vub300_mmc_host {
--
drivers/mmc/host/vub300.c-358-#define SET_FAILURE_MODE 18
drivers/mmc/host/vub300.c:359:#define SET_ROM_WAIT_STATES 16
drivers/mmc/host/vub300.c-360-#define SET_IRQ_ENABLE 13
--
drivers/mmc/host/vub300.c-365-#define ENTER_DFU_MODE 3
drivers/mmc/host/vub300.c:366:#define GET_HC_INF0 1
drivers/mmc/host/vub300.c:367:#define GET_SYSTEM_PORT_STATUS 0
drivers/mmc/host/vub300.c-368-
]
|
| 55/2 |
2026/09/07 15:17 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 67206
output: 41
thoughts: 89
Thoughts: **My Thought Process on Memory and State Initialization**
Alright, so the first thing I'm doing here is establishing some critical initial states for the hardware controller (HC). I'm setting `GET_HC_INF0` to `1`, which I understand as an affirmative signal to retrieve hardware information. Concurrently, I'm setting `SET_ROM_WAIT_STATES` to `16`. This value, 16, immediately tells me we're configuring the ROM wait states to a specific timing, likely to ensure reliable access to read-only memory given the specific hardware architecture we're dealing with. On the other hand, `GET_SYSTEM_PORT_STATUS` is being set to `0`, indicating that I'm *not* currently requesting the system port status, perhaps to avoid unnecessary overhead or because that check is deferred.
Now, as I'm defining these initial states, my mind naturally drifts to the implications for memory management and data structures. Specifically, when I set `GET_HC_INF0` to `1`, I immediately need to consider the expected size of the data that will be returned. My thought is, "What exactly is the expected length for this `GET_HC_INF0` request?" And the answer to that, based on how I'm structuring this, is going to be dictated by the size of the `vub300->hc_info` structure. This, in turn, leads me to a more granular inquiry: I need to verify the exact size of `struct hc_info`. Understanding the precise memory footprint of `hc_info` is crucial for allocating the correct buffer and ensuring the integrity of the data transfer when we do indeed fetch that hardware information.
|
| 56/2 |
2026/09/07 15:18 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:hc_info]
Results: map[SourceCode: SourceFile:]
|
| 57/2 |
2026/09/07 15:18 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 67341
output: 48
thoughts: 23
Thoughts: **My Thought Process Regarding Anonymous Structs and `vub300_mmc_host`**
Ah, I see what's happening here. My initial observation is that this structure, whatever it is, appears to be defined in a way that makes it "anonymous" – meaning it doesn't have a distinct, named type identifier in the typical sense. Or, perhaps more accurately, its definition is scoped *directly* within the context of `vub300_mmc_host`. This is a common pattern, especially when a structure is intended for very specific, localized use and isn't meant to be a standalone, reusable type. It suggests that this particular data layout is intimately tied to the functionality or internal workings of the `vub300_mmc_host` component, and it's likely not exposed or intended for use by other parts of the system. My immediate thought is to investigate the immediate vicinity of where this structure is declared to understand its members and its precise role within `vub300_mmc_host`.
|
| 58/2 |
2026/09/07 15:18 |
tool |
codesearch-struct-layout |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_mmc_host]
Results: map[Fields:[map[Name:udev OffsetBits:0 SizeBits:64] map[Name:interface OffsetBits:64 SizeBits:64] map[Name:kref OffsetBits:128 SizeBits:32] map[Name:cmd_mutex OffsetBits:192 SizeBits:1088] map[Name:irq_mutex OffsetBits:1280 SizeBits:1088] map[Name:vub_name OffsetBits:2368 SizeBits:640] map[Name:cmnd_out_ep OffsetBits:3008 SizeBits:8] map[Name:cmnd_res_ep OffsetBits:3016 SizeBits:8] map[Name:data_out_ep OffsetBits:3024 SizeBits:8] map[Name:data_inp_ep OffsetBits:3032 SizeBits:8] map[Name:card_powered OffsetBits:3040 SizeBits:8] map[Name:card_present OffsetBits:3048 SizeBits:8] map[Name:read_only OffsetBits:3056 SizeBits:8] map[Name:large_usb_packets OffsetBits:3064 SizeBits:8] map[Name:app_spec OffsetBits:3072 SizeBits:8] map[Name:irq_enabled OffsetBits:3080 SizeBits:8] map[Name:irq_disabled OffsetBits:3088 SizeBits:8] map[Name:bus_width OffsetBits:3096 SizeBits:4] map[Name:total_offload_count OffsetBits:3104 SizeBits:8] map[Name:dynamic_register_count OffsetBits:3112 SizeBits:8] map[Name:resp_len OffsetBits:3120 SizeBits:8] map[Name:datasize OffsetBits:3136 SizeBits:32] map[Name:errors OffsetBits:3168 SizeBits:32] map[Name:usb_transport_fail OffsetBits:3200 SizeBits:32] map[Name:usb_timed_out OffsetBits:3232 SizeBits:32] map[Name:irqs_queued OffsetBits:3264 SizeBits:32] map[Name:sdio_register OffsetBits:3296 SizeBits:1536] map[Name:fn OffsetBits:4832 SizeBits:8704] map[Name:fbs OffsetBits:13536 SizeBits:128] map[Name:cmd OffsetBits:13696 SizeBits:64] map[Name:req OffsetBits:13760 SizeBits:64] map[Name:data OffsetBits:13824 SizeBits:64] map[Name:mmc OffsetBits:13888 SizeBits:64] map[Name:urb OffsetBits:13952 SizeBits:64] map[Name:command_out_urb OffsetBits:14016 SizeBits:64] map[Name:command_res_urb OffsetBits:14080 SizeBits:64] map[Name:command_complete OffsetBits:14144 SizeBits:704] map[Name:irqpoll_complete OffsetBits:14848 SizeBits:704] map[Name:cmnd OffsetBits:15552 SizeBits:512] map[Name:resp OffsetBits:16064 SizeBits:984] map[Name:sg_transfer_timer OffsetBits:17088 SizeBits:640] map[Name:sg_request OffsetBits:17728 SizeBits:1600] map[Name:inactivity_timer OffsetBits:19328 SizeBits:640] map[Name:deadwork OffsetBits:19968 SizeBits:576] map[Name:cmndwork OffsetBits:20544 SizeBits:576] map[Name:pollwork OffsetBits:21120 SizeBits:1344] map[Name:hc_info OffsetBits:22464 SizeBits:32] map[Name:system_port_status OffsetBits:22496 SizeBits:120] map[Name:padded_buffer OffsetBits:22616 SizeBits:512]]]
|
| 59/2 |
2026/09/07 15:18 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 68134
output: 48
thoughts: 57
Thoughts: **My Internal Monologue on Data Structure Sizing**
Okay, so I'm looking at this `hc_info` structure, and my immediate thought is, "Wait a minute, this thing is 32 bits." That translates to 4 bytes, which seems pretty standard for this kind of identifier or control information. No red flags there, just a quick mental confirmation.
But then my attention shifts to `system_port_status`. My initial read, or perhaps a quick estimate based on common patterns, suggests it's quite a bit larger. I'm thinking, "120 bits? That can't be right... let me re-calculate." So, I do the math: 120 divided by 8 bits per byte gives me 15 bytes. Fifteen bytes! That feels... substantial for what I'm expecting `system_port_status` to represent. It's not an impossible size, of course, but it immediately triggers a need for verification because it deviates from my immediate assumptions.
My next logical step, driven by this discrepancy and the need for absolute certainty, is to go directly to the source. I need to *see* the struct definitions. I'm not just going to take my initial mental impression or a quick calculation at face value. I need to pull up the actual code, the definitive definitions of these structures, to confirm the precise bit and byte allocation for both `hc_info` and, critically, `system_port_status`. This is about ensuring I have an accurate understanding of the memory footprint and data layout, which is fundamental to my work.
|
| 60/2 |
2026/09/07 15:18 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_mmc_host]
Results: map[SourceCode: 296: struct vub300_mmc_host {
297: struct usb_device *udev;
298: struct usb_interface *interface;
299: struct kref kref;
300: struct mutex cmd_mutex;
301: struct mutex irq_mutex;
302: char vub_name[3 + (9 * 8) + 4 + 1]; /* max of 7 sdio fn's */
303: u8 cmnd_out_ep; /* EndPoint for commands */
304: u8 cmnd_res_ep; /* EndPoint for responses */
305: u8 data_out_ep; /* EndPoint for out data */
306: u8 data_inp_ep; /* EndPoint for inp data */
307: bool card_powered;
308: bool card_present;
309: bool read_only;
310: bool large_usb_packets;
311: bool app_spec; /* ApplicationSpecific */
312: bool irq_enabled; /* by the MMC CORE */
313: bool irq_disabled; /* in the firmware */
314: unsigned bus_width:4;
315: u8 total_offload_count;
316: u8 dynamic_register_count;
317: u8 resp_len;
318: u32 datasize;
319: int errors;
320: int usb_transport_fail;
321: int usb_timed_out;
322: int irqs_queued;
323: struct sdio_register sdio_register[16];
324: struct offload_interrupt_function_register {
325: #define MAXREGBITS 4
326: #define MAXREGS (1<<MAXREGBITS)
327: #define MAXREGMASK (MAXREGS-1)
328: u8 offload_count;
329: u32 offload_point;
330: struct offload_registers_access reg[MAXREGS];
331: } fn[8];
332: u16 fbs[8]; /* Function Block Size */
333: struct mmc_command *cmd;
334: struct mmc_request *req;
335: struct mmc_data *data;
336: struct mmc_host *mmc;
337: struct urb *urb;
338: struct urb *command_out_urb;
339: struct urb *command_res_urb;
340: struct completion command_complete;
341: struct completion irqpoll_complete;
342: union sd_command cmnd;
343: union sd_response resp;
344: struct timer_list sg_transfer_timer;
345: struct usb_sg_request sg_request;
346: struct timer_list inactivity_timer;
347: struct work_struct deadwork;
348: struct work_struct cmndwork;
349: struct delayed_work pollwork;
350: struct host_controller_info hc_info;
351: struct sd_status_header system_port_status;
352: u8 padded_buffer[64];
353: };
SourceFile:drivers/mmc/host/vub300.c]
|
| 61/2 |
2026/09/07 15:18 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 69180
output: 43
thoughts: 21
Thoughts: **My Thought Process on System Data Structures**
Alright, before I can even begin to dive into the finer points of the operations I'm analyzing, I need to get a solid grasp of the fundamental data structures involved. It's like understanding the alphabet before attempting to read Shakespeare.
So, my immediate priority is to thoroughly examine `struct host_controller_info`. I need to understand *exactly* what information this structure holds about the host controller itself. What are its capabilities? What are its operational states? What are the relevant configuration parameters? Without a clear picture of the host controller's identity and its general characteristics, I can't make sense of any commands or status reports that emanate from it. This is the bedrock.
Concurrently, I'm turning my attention to `struct sd_status_header`. This header, I suspect, is crucial for interpreting the status of the SD (Secure Digital) card or device. What kind of status information does it convey? Is it error codes, operational flags, capacity details, or something else entirely? Understanding this header will be key to knowing the health and current state of the SD device as perceived by the host controller.
These two structures, `host_controller_info` and `sd_status_header`, feel like the entry points to understanding the system's behavior. I need to map out their fields, understand the meaning of each byte and bit, and how they relate to each other and the overall system architecture. Once I have that foundational knowledge, I can then start to piece together the larger picture of the data flow and control mechanisms at play.
|
| 62/2 |
2026/09/07 15:18 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:host_controller_info]
Results: map[SourceCode: 53: struct host_controller_info {
54: u8 info_size;
55: u16 firmware_version;
56: u8 number_of_ports;
57: } __packed;
SourceFile:drivers/mmc/host/vub300.c]
|
| 63/2 |
2026/09/07 15:18 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 69323
output: 43
thoughts: 26
Thoughts: **My Thought Process on `host_controller_info` and `sd_status_header`**
Right, so I'm looking at this `host_controller_info` structure. The initial observation is that it's a fixed size, 4 bytes. That's a concrete piece of data I can work with. My next logical step, given the context of system status and controllers, is to immediately pivot and examine the `sd_status_header` structure. I'm anticipating that `sd_status_header` will provide the broader context or the detailed breakdown of the information contained within, or perhaps related to, that initial 4-byte `host_controller_info`. I want to understand how these two pieces of data interrelate, whether `host_controller_info` is a part of `sd_status_header`, or if they are distinct but complementary. My goal is to build a comprehensive understanding of the status reporting mechanism.
|
| 64/2 |
2026/09/07 15:18 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:sd_status_header]
Results: map[SourceCode: 101: struct sd_status_header {
102: u8 header_size;
103: u8 header_type;
104: u8 port_number;
105: u16 port_flags;
106: u32 sdio_clock;
107: u16 host_header_size;
108: u16 func_header_size;
109: u16 ctrl_header_size;
110: } __packed;
SourceFile:drivers/mmc/host/vub300.c]
|
| 65/2 |
2026/09/07 15:18 |
llm |
initial-researcher |
1m
Model:
Tokens:
input: 69550
output: 2515
thoughts: 12984
Thoughts: **My Thoughts on Replicating the `vub300` Driver Bug**
Okay, I've been analyzing this `vub300` driver bug, and I think I've got a handle on how to reproduce it. It seems to stem from a race condition between the driver's inactivity timer and device disconnection, specifically when the timer tries to do something that's not allowed in its context.
The core of the issue is that when the USB device is unplugged, the `vub300_disconnect` function is called. This function correctly decrements a reference counter for the `vub300` driver's internal structure. However, it doesn't cancel or reschedule a pending `inactivity_timer`. This timer, which is set up during the `vub300_probe` function, will eventually expire. When it does, it checks if the device's interface is still present. If it's not (because we simulated a disconnect), it proceeds to drop the *final* reference to the `vub300` structure.
The real problem is *where* this final reference is dropped. It happens within the timer's callback function (`vub300_inactivity_timer_expired`). This callback is executed in a softirq context. When this callback tries to free the `vub300` structure by calling `mmc_free_host` (which eventually leads to `synchronize_srcu`), it's attempting to call a sleeping function from an invalid context. That's the smoking gun – the kernel flags this as a "suspicious RCU usage" and a "sleeping function called from invalid context."
To trigger this, I need to:
1. **Emulate the USB Device:** The `vub300` driver expects specific USB descriptors and vendor-specific control requests during its `probe` function. The `raw-gadget` interface in the Linux kernel is perfect for this. I can use it to create a virtual USB device on the fly.
2. **Satisfy `vub300_probe`:** I'll need to respond to the control requests made by the kernel's USB core as it enumerates the device. This includes:
* Providing the standard USB Device Descriptor and Configuration Descriptor.
* Responding to specific vendor requests like `GET_HC_INF0` and `GET_SYSTEM_PORT_STATUS`. Crucially, for `GET_SYSTEM_PORT_STATUS`, I need to set the `port_flags` to indicate a card is present, which allows `vub300_probe` to succeed.
3. **Simulate Disconnection:** Once `vub300_probe` finishes successfully (meaning the driver has bound to the device and set up its timer), I need to disconnect the virtual USB device. The simplest way to do this with `raw-gadget` is to close the file descriptor. This will cause the kernel to call `vub300_disconnect`.
4. **Wait for the Timer:** After disconnecting, I need to wait long enough for the `inactivity_timer` to expire. A short `sleep` should do the trick.
**The Plan in Code:**
Here's how I'm thinking about structuring the C program for `raw-gadget`:
* **Initialization:**
* Open `/dev/raw-gadget`.
* Use `USB_RAW_IOCTL_INIT` to declare our gadget as `dummy_udc` with a `dummy_udc.0` device name, and set the speed to high.
* Start the gadget with `USB_RAW_IOCTL_RUN`.
* **Event Loop:**
* Continuously fetch events using `USB_RAW_IOCTL_EVENT_FETCH`.
* When a `USB_RAW_EVENT_CONTROL` is received:
* Parse the `struct usb_ctrlrequest`.
* **Handle `GET_DESCRIPTOR` requests (bRequest 6):**
* For `USB_DT_DEVICE` (wValue >> 8 == 1), send the 18-byte device descriptor (with `idVendor=0x0424`, `idProduct=0x012C`).
* For `USB_DT_CONFIG` (wValue >> 8 == 2), send the combined configuration, interface, and four endpoint descriptors. I'll define two bulk-in and two bulk-out endpoints, as `vub300_probe` expects these.
* **Handle Vendor Requests (bRequestType 0xC0 for IN, 0x40 for OUT):**
* For `GET_HC_INF0` (bRequest 1, direction IN), reply with 4 bytes.
* For `SET_ROM_WAIT_STATES` (bRequest 16, direction OUT), reply with an empty packet (length 0).
* For `GET_SYSTEM_PORT_STATUS` (bRequest 0, direction IN), reply with 15 bytes, setting `port_flags` to 1 to signal a card is present. This is the key request that allows `vub300_probe` to succeed. I'll set a flag (`done = 1`) after handling this so I know when to break the loop.
* **Handle `SET_CONFIGURATION` (bRequest 9, direction OUT):** Reply with an empty packet. This is what enables the device and triggers `vub300_probe` to call `mmc_add_host`.
* **Default Handling:** For any other requests, I'll acknowledge them with an empty reply, or explicitly stall if it's an unexpected descriptor type, to keep the enumeration clean.
* **Responding to Requests:**
* If it's an IN request (`bRequestType & 0x80`), use `USB_RAW_IOCTL_EP0_WRITE` to send the data.
* If it's an OUT request, use `USB_RAW_IOCTL_EP0_READ` to receive data (even if it's length 0).
* **Triggering the Bug:**
* After the loop breaks (because `done` is set after handling `GET_SYSTEM_PORT_STATUS`), I'll add a small delay (`usleep(100000)`) to ensure `vub300_probe` has fully completed its work (especially `mmc_add_host`).
* Close the `/dev/raw-gadget` file descriptor. This will simulate the device disconnect.
* Wait for 2 seconds (`sleep(2)`). This should be ample time for the `inactivity_timer` to expire.
This sequence should reliably trigger the race condition and demonstrate the bug. The enclosed C code implements exactly this strategy.
|
| 66/1 |
2026/09/07 15:20 |
loop |
|
11m
|
| 67/2 |
2026/09/07 15:20 |
iteration |
0 |
3m
|
| 68/3 |
2026/09/07 15:20 |
action |
If |
0m
Args:
|
| 69/3 |
2026/09/07 15:20 |
action |
merge-strategy |
0m
Results: map[CurrentReproStrategy:An analysis of the bug report and kernel source reveals the following root cause and reproduction strategy.
### Root Cause Analysis
The bug is a classic case of freeing an object and calling sleeping functions from an atomic context (timer callback).
During initialization (`vub300_probe`), the `vub300` MMC host driver arms an `inactivity_timer` and holds a reference to the `vub300` object for it.
When the USB device is disconnected, `vub300_disconnect` is invoked. It sets `vub300->interface = NULL` and drops its reference to the object, but **crucially fails to delete the pending `inactivity_timer`** (e.g., via `del_timer_sync`).
When the timer eventually expires, its callback `vub300_inactivity_timer_expired` runs in softirq (atomic) context. It sees that the interface is disconnected (`!vub300->interface`) and drops the timer's reference to the object. Since this is the last reference, `vub300_delete` is executed directly from the timer callback.
`vub300_delete` calls `mmc_free_host()`, which drops the device reference and triggers `mmc_host_classdev_release()`. This function unregisters the wakeup source, which calls `synchronize_srcu()`. Because `synchronize_srcu()` can sleep, calling it from a softirq context is illegal and triggers the observed `WARNING: suspicious RCU usage` and `BUG: sleeping function called from invalid context`.
### Reproduction Strategy
To reproduce this bug, we need to trick the kernel into probing the `vub300` driver and then immediately disconnect the device. We can achieve this from userspace using the `raw-gadget` subsystem to emulate a USB device that matches the `vub300` driver's expected Vendor/Product IDs (`0x0424:0x012C`).
1. Open `/dev/raw-gadget` and initialize a dummy USB device.
2. Respond to standard USB enumeration requests (`GET_DESCRIPTOR` for Device and Configuration). The configuration must expose 4 bulk endpoints (2 IN, 2 OUT) as expected by the driver.
3. Respond to the three specific vendor control requests sent by `vub300_probe` (`GET_HC_INF0`, `SET_ROM_WAIT_STATES`, and `GET_SYSTEM_PORT_STATUS`).
4. Once `vub300_probe` completes successfully, close the `raw-gadget` file descriptor to simulate a physical USB disconnect.
5. Sleep for a couple of seconds to allow the `inactivity_timer` (armed to `jiffies + HZ`) to expire and trigger the bug.
### Minimal C Reproducer
```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
#define USB_RAW_IOCTL_RUN _IO('U', 1)
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
struct usb_raw_event {
uint32_t type;
uint32_t length;
uint8_t data[0];
};
struct usb_raw_ep_io {
uint16_t ep;
uint16_t flags;
uint32_t length;
uint8_t data[0];
};
struct usb_ctrlrequest {
uint8_t bRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} __attribute__((packed));
int main() {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
perror("open /dev/raw-gadget");
return 1;
}
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
if (ioctl(fd, USB_RAW_IOCTL_INIT, &init) < 0) {
perror("USB_RAW_IOCTL_INIT");
return 1;
}
if (ioctl(fd, USB_RAW_IOCTL_RUN, 0) < 0) {
perror("USB_RAW_IOCTL_RUN");
return 1;
}
int done = 0;
while (!done) {
struct usb_raw_event *event = malloc(sizeof(*event) + 1024);
event->type = 0;
event->length = 1024;
if (ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event) < 0) {
free(event);
break;
}
if (event->type == 2) { // USB_RAW_EVENT_CONTROL
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)event->data;
struct usb_raw_ep_io *io = malloc(sizeof(*io) + 1024);
io->ep = 0;
io->flags = 0;
io->length = 0;
int handled = 0;
if (req->bRequestType == 0x80 && req->bRequest == 6) { // GET_DESCRIPTOR
if ((req->wValue >> 8) == 1) { // DEVICE
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
} else if ((req->wValue >> 8) == 2) { // CONFIG
uint8_t desc[] = {
9, 2, 46, 0, 1, 1, 0, 0x80, 50,
9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0,
7, 5, 0x81, 2, 0, 2, 0,
7, 5, 0x02, 2, 0, 2, 0,
7, 5, 0x83, 2, 0, 2, 0,
7, 5, 0x04, 2, 0, 2, 0,
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
}
} else if (req->bRequestType == 0xC0) { // VENDOR IN
if (req->bRequest == 1) { // GET_HC_INF0
uint8_t data[4] = {4, 0, 0, 1};
io->length = req->wLength < 4 ? req->wLength : 4;
memcpy(io->data, data, io->length);
handled = 1;
} else if (req->bRequest == 0) { // GET_SYSTEM_PORT_STATUS
uint8_t data[15] = {15, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
io->length = req->wLength < 15 ? req->wLength : 15;
memcpy(io->data, data, io->length);
handled = 1;
done = 1; // Last request in vub300_probe
}
} else if (req->bRequestType == 0x40) { // VENDOR OUT
if (req->bRequest == 16) { // SET_ROM_WAIT_STATES
io->length = 0;
handled = 1;
}
} else if (req->bRequestType == 0x00 && req->bRequest == 9) { // SET_CONFIGURATION
io->length = 0;
handled = 1;
} else {
// ACK other standard requests (e.g. SET_ADDRESS)
io->length = 0;
handled = 1;
}
if (handled) {
if (req->bRequestType & 0x80) {
ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
free(io);
}
free(event);
}
// Give vub300_probe a moment to finish mmc_add_host
usleep(200000);
// Close fd to simulate USB disconnect
close(fd);
// Wait for the inactivity_timer to expire (it is set to jiffies + HZ)
sleep(2);
return 0;
}
```]
|
| 70/3 |
2026/09/07 15:20 |
agent |
repro-generator |
0m
Model:
Results: map[IsProbe:true RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
int main(void) {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
printf("[+] open /dev/raw-gadget successful.\n");
struct usb_raw_init init = {0};
strcpy((char *)init.driver_name, "dummy_udc");
strcpy((char *)init.device_name, "dummy_udc.0");
init.speed = 3; // USB_SPEED_HIGH
int res = ioctl(fd, USB_RAW_IOCTL_INIT, &init);
if (res < 0) {
printf("[-] Failed to ioctl USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
printf("[+] ioctl USB_RAW_IOCTL_INIT successful.\n");
res = close(fd);
if (res < 0) {
printf("[-] Failed to close: %s\n", strerror(errno));
exit(1);
}
printf("[+] close successful.\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: WARNING: suspicious RCU usage in wakeup_source_unregister
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
=============================
WARNING: suspicious RCU usage
syzkaller #0 Tainted: G W L
-----------------------------
kernel/rcu/srcutree.c:1468 Illegal synchronize_srcu() in same-type SRCU (or in RCU) read-side critical section!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
locks held by syz-executor/5675: 5, last CPU#0:
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1542 [inline]
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm+0x10f/0x480 kernel/fork.c:1595
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:562 [inline]
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: dup_mmap+0x195/0x1dc0 mm/mmap.c:1716
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: mmap_write_lock_nested include/linux/mmap_lock.h:552 [inline]
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: dup_mmap+0x221/0x1dc0 mm/mmap.c:1723
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: __pte_offset_map+0x29/0x240 mm/pgtable-generic.c:290
#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
stack backtrace:
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
Call Trace:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
lockdep_rcu_suspicious+0x140/0x1d0 kernel/locking/lockdep.c:6938
__synchronize_srcu+0x157/0x2f0 kernel/rcu/srcutree.c:1464
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
BUG: sleeping function called from invalid context at kernel/rcu/srcutree.c:1472
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 5675, name: syz-executor
preempt_count: 101, expected: 0
RCU nest depth: 1, expected: 0
locks held by syz-executor/5675: 5, last CPU#0:
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1542 [inline]
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm+0x10f/0x480 kernel/fork.c:1595
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:562 [inline]
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: dup_mmap+0x195/0x1dc0 mm/mmap.c:1716
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: mmap_write_lock_nested include/linux/mmap_lock.h:552 [inline]
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: dup_mmap+0x221/0x1dc0 mm/mmap.c:1723
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: __pte_offset_map+0x29/0x240 mm/pgtable-generic.c:290
#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
Preemption disabled at:
[<ffffffff81336576>] preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
Call Trace:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x36a/0x4c0 kernel/sched/core.c:9234
__synchronize_srcu+0x1a1/0x2f0 kernel/rcu/srcutree.c:1472
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
ODEBUG: object ffffc90000007a80 is NOT on stack ffffc90004320000, but annotated.
------------[ cut here ]------------
1
WARNING: lib/debugobjects.c:672 at debug_object_is_on_stack lib/debugobjects.c:672 [inline], CPU#0: syz-executor/5675
WARNING: lib/debugobjects.c:672 at lookup_object_or_alloc lib/debugobjects.c:705 [inline], CPU#0: syz-executor/5675
WARNING: lib/debugobjects.c:672 at __debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798, CPU#0: syz-executor/5675
Modules linked in:
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:672 [inline]
RIP: 0010:lookup_object_or_alloc lib/debugobjects.c:705 [inline]
RIP: 0010:__debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798
Code: cc cc cc 41 ff c7 44 89 3d c9 75 e8 15 48 c7 c1 80 9d 6d 8c 48 c7 c7 e0 9d 6d 8c 84 c0 48 0f 45 f9 48 89 de e8 4d fa 3d fc 90 <0f> 0b 90 e9 c0 fe ff ff e8 4f 1c 00 00 8b 05 a1 cd 6e 0a 3b 05 9f
RSP: 0018:ffffc900000079b8 EFLAGS: 00010046
RAX: 0000000000000050 RBX: ffffc90000007a80 RCX: 0978036a12caea00
RDX: 0000000000000100 RSI: 0000000000000100 RDI: 0000000000000000
RBP: ffff88803588dde0 R08: 0000000000000100 R09: 0000000000080000
R10: 0000000000008000 R11: ffffffff8ec362b8 R12: 1ffff92000000f4c
R13: ffff888021b995e8 R14: dffffc0000000000 R15: 0000000000000001
FS: 000055558fe74500(0000) GS:ffff888124cd9000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fdafb3556c8 CR3: 00000000640ca000 CR4: 00000000003526f0
Call Trace:
<IRQ>
__synchronize_srcu+0x1d5/0x2f0 kernel/rcu/srcutree.c:1475
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
----------------
Code disassembly (best guess), 1 bytes skipped:
0: 00 00 add %al,(%rax)
2: 41 c7 84 24 20 0e 00 movl $0x0,0xe20(%r12)
9: 00 00 00 00 00
e: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
13: 49 83 c4 48 add $0x48,%r12
17: 4c 89 e7 mov %r12,%rdi
1a: e8 f7 ed 50 0a call 0xa50ee16
1f: e8 d2 00 3a 00 call 0x3a00f6
24: fb sti
25: 4c 8b 65 c8 mov -0x38(%rbp),%r12
* 29: 49 8d bc 24 10 17 00 lea 0x1710(%r12),%rdi <-- trapping instruction
30: 00
31: 48 89 f8 mov %rdi,%rax
34: 48 c1 e8 03 shr $0x3,%rax
38: 42 0f b6 04 30 movzbl (%rax,%r14,1),%eax
3d: 84 c0 test %al,%al
Strategy: An analysis of the bug report and kernel source reveals the following root cause and reproduction strategy.
### Root Cause Analysis
The bug is a classic case of freeing an object and calling sleeping functions from an atomic context (timer callback).
During initialization (`vub300_probe`), the `vub300` MMC host driver arms an `inactivity_timer` and holds a reference to the `vub300` object for it.
When the USB device is disconnected, `vub300_disconnect` is invoked. It sets `vub300->interface = NULL` and drops its reference to the object, but **crucially fails to delete the pending `inactivity_timer`** (e.g., via `del_timer_sync`).
When the timer eventually expires, its callback `vub300_inactivity_timer_expired` runs in softirq (atomic) context. It sees that the interface is disconnected (`!vub300->interface`) and drops the timer's reference to the object. Since this is the last reference, `vub300_delete` is executed directly from the timer callback.
`vub300_delete` calls `mmc_free_host()`, which drops the device reference and triggers `mmc_host_classdev_release()`. This function unregisters the wakeup source, which calls `synchronize_srcu()`. Because `synchronize_srcu()` can sleep, calling it from a softirq context is illegal and triggers the observed `WARNING: suspicious RCU usage` and `BUG: sleeping function called from invalid context`.
### Reproduction Strategy
To reproduce this bug, we need to trick the kernel into probing the `vub300` driver and then immediately disconnect the device. We can achieve this from userspace using the `raw-gadget` subsystem to emulate a USB device that matches the `vub300` driver's expected Vendor/Product IDs (`0x0424:0x012C`).
1. Open `/dev/raw-gadget` and initialize a dummy USB device.
2. Respond to standard USB enumeration requests (`GET_DESCRIPTOR` for Device and Configuration). The configuration must expose 4 bulk endpoints (2 IN, 2 OUT) as expected by the driver.
3. Respond to the three specific vendor control requests sent by `vub300_probe` (`GET_HC_INF0`, `SET_ROM_WAIT_STATES`, and `GET_SYSTEM_PORT_STATUS`).
4. Once `vub300_probe` completes successfully, close the `raw-gadget` file descriptor to simulate a physical USB disconnect.
5. Sleep for a couple of seconds to allow the `inactivity_timer` (armed to `jiffies + HZ`) to expire and trigger the bug.
### Minimal C Reproducer
```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
#define USB_RAW_IOCTL_RUN _IO('U', 1)
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
struct usb_raw_event {
uint32_t type;
uint32_t length;
uint8_t data[0];
};
struct usb_raw_ep_io {
uint16_t ep;
uint16_t flags;
uint32_t length;
uint8_t data[0];
};
struct usb_ctrlrequest {
uint8_t bRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} __attribute__((packed));
int main() {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
perror("open /dev/raw-gadget");
return 1;
}
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
if (ioctl(fd, USB_RAW_IOCTL_INIT, &init) < 0) {
perror("USB_RAW_IOCTL_INIT");
return 1;
}
if (ioctl(fd, USB_RAW_IOCTL_RUN, 0) < 0) {
perror("USB_RAW_IOCTL_RUN");
return 1;
}
int done = 0;
while (!done) {
struct usb_raw_event *event = malloc(sizeof(*event) + 1024);
event->type = 0;
event->length = 1024;
if (ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event) < 0) {
free(event);
break;
}
if (event->type == 2) { // USB_RAW_EVENT_CONTROL
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)event->data;
struct usb_raw_ep_io *io = malloc(sizeof(*io) + 1024);
io->ep = 0;
io->flags = 0;
io->length = 0;
int handled = 0;
if (req->bRequestType == 0x80 && req->bRequest == 6) { // GET_DESCRIPTOR
if ((req->wValue >> 8) == 1) { // DEVICE
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
} else if ((req->wValue >> 8) == 2) { // CONFIG
uint8_t desc[] = {
9, 2, 46, 0, 1, 1, 0, 0x80, 50,
9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0,
7, 5, 0x81, 2, 0, 2, 0,
7, 5, 0x02, 2, 0, 2, 0,
7, 5, 0x83, 2, 0, 2, 0,
7, 5, 0x04, 2, 0, 2, 0,
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
}
} else if (req->bRequestType == 0xC0) { // VENDOR IN
if (req->bRequest == 1) { // GET_HC_INF0
uint8_t data[4] = {4, 0, 0, 1};
io->length = req->wLength < 4 ? req->wLength : 4;
memcpy(io->data, data, io->length);
handled = 1;
} else if (req->bRequest == 0) { // GET_SYSTEM_PORT_STATUS
uint8_t data[15] = {15, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
io->length = req->wLength < 15 ? req->wLength : 15;
memcpy(io->data, data, io->length);
handled = 1;
done = 1; // Last request in vub300_probe
}
} else if (req->bRequestType == 0x40) { // VENDOR OUT
if (req->bRequest == 16) { // SET_ROM_WAIT_STATES
io->length = 0;
handled = 1;
}
} else if (req->bRequestType == 0x00 && req->bRequest == 9) { // SET_CONFIGURATION
io->length = 0;
handled = 1;
} else {
// ACK other standard requests (e.g. SET_ADDRESS)
io->length = 0;
handled = 1;
}
if (handled) {
if (req->bRequestType & 0x80) {
ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
free(io);
}
free(event);
}
// Give vub300_probe a moment to finish mmc_add_host
usleep(200000);
// Close fd to simulate USB disconnect
close(fd);
// Wait for the inactivity_timer to expire (it is set to jiffies + HZ)
sleep(2);
return 0;
}
```
|
| 71/4 |
2026/09/07 15:20 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 15716
output: 469
thoughts: 1558
Thoughts: **My Thought Process for Generating the Capability Probe**
My primary objective here is to meticulously verify the environment before even attempting to reproduce the reported bug. The instructions are crystal clear: Phase 1, Capability Probing, is non-negotiable. This means my immediate task isn't to debug the `vub300` driver or the RCU usage directly, but to ensure the testbed itself is properly configured and has the necessary kernel capabilities to even *attempt* such an operation.
The user has provided a strategy and a reproducer, but the strict mandate for Phase 1 dictates a specific approach. I need to generate a minimal, standalone C program that acts as a "probe." The sole purpose of this probe is to check for subsystem availability and the correct privilege levels by interacting with specific device files, subsystems, or system calls that are relevant to the reproducer.
The reproducer, as I understand it, relies on `/dev/raw-gadget` for USB device emulation. Therefore, my probe program must focus on this interface. It needs to ascertain if this device file is accessible and, more importantly, if the underlying kernel module responsible for this functionality – specifically, `dummy_udc` – is present and can be initialized.
My initial thought is to simply open `/dev/raw-gadget`. However, the reproducer likely does more than just open it; it probably tries to configure it. So, a more robust probe would attempt a basic initialization sequence. This will not only confirm the device file's existence but also check if the necessary kernel module (`dummy_udc`) is loaded and responds to basic initialization requests.
I need to be careful. If `dummy_udc` isn't loaded, the `ioctl` call to initialize it might fail. My probe should gracefully handle this. The goal is to confirm *accessibility and basic functionality*, not to fully load and configure the module if it's not already present. Simply trying to open `/dev/raw-gadget` and then performing an `ioctl` for initialization should be sufficient. If either of these steps fails, it indicates a problem with the test environment's capabilities, which is exactly what Phase 1 is designed to detect.
Now, I must adhere strictly to the user's requirements for code generation. Every `printf` call is for progress or error logging. Every system call must be checked for failure. If a failure occurs, I need to print a specific, informative error message, including the function name and the `strerror(errno)`, and then exit with a non-zero status. I must also print a success message after each major successful step. The pattern for system calls and their checks is well-defined: `int res = call(); if (res < 0) { ... error ... } printf("... success ...");`. Crucially, no compilation tools or shell commands should be part of the *output* of this phase; the C code itself is the deliverable.
Considering the nature of kernel timeouts, if my reproducer *were* to involve asynchronous operations and timeouts, I'd need to incorporate sufficient delays. However, for this initial probe, that's not yet relevant.
Let me draft the C code. I'll include the necessary headers: `stdio.h`, `stdlib.h`, `stdint.h`, `string.h`, `unistd.h`, `fcntl.h`, `sys/ioctl.h`, and `errno.h`. I'll define the `USB_RAW_IOCTL_INIT` and its associated `struct usb_raw_init`.
My first attempt at the code would look something like this:
```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
int main() {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
printf("[+] Successfully opened /dev/raw-gadget.\n");
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
int res = ioctl(fd, USB_RAW_IOCTL_INIT, &init);
if (res < 0) {
printf("[-] Failed to USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_INIT successful.\n");
// Add close call for completeness and adherence to requirements
res = close(fd);
if (res < 0) {
printf("[-] Failed to close: %s\n", strerror(errno));
exit(1);
}
printf("[+] close successful.\n");
return 0;
}
```
Refining this slightly to ensure all strings are properly copied and the initial structure is zero-initialized for safety:
```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
// Define the IOCTL command and structure for raw gadget initialization
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed; // Corresponds to USB speed (e.g., 3 for HIGH)
};
int main(void) { // Use 'void' as no arguments are expected
// Attempt to open the raw gadget device file in read-write mode.
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
// If opening fails, print an error with the system error message and exit.
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
// Report successful opening of the device.
printf("[+] open /dev/raw-gadget successful.\n");
// Prepare the initialization parameters for the raw gadget.
struct usb_raw_init init = {0}; // Initialize all members to zero.
// Set the driver name.
strcpy((char *)init.driver_name, "dummy_udc");
// Set the device name.
strcpy((char *)init.device_name, "dummy_udc.0");
// Set the desired USB speed (USB_SPEED_HIGH is typically 3).
init.speed = 3;
// Perform the ioctl to initialize the raw gadget.
int res = ioctl(fd, USB_RAW_IOCTL_INIT, &init);
if (res < 0) {
// If initialization fails, print an error and exit.
printf("[-] Failed to ioctl USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
// Report successful initialization.
printf("[+] ioctl USB_RAW_IOCTL_INIT successful.\n");
// Close the file descriptor.
res = close(fd);
if (res < 0) {
// If closing fails, report and exit.
printf("[-] Failed to close: %s\n", strerror(errno));
exit(1);
}
// Report successful closing.
printf("[+] close successful.\n");
// Exit with a success status.
return 0;
}
```
This refined version directly addresses the requirements: it's minimal, standalone, uses `printf` for all output, checks all system calls, prints detailed errors on failure, reports success, and follows the required pattern. It specifically targets the `/dev/raw-gadget` interface, attempting an initialization that would likely involve the `dummy_udc` kernel module. If this probe passes, it indicates that the environment has the basic capability to proceed to the next phase. If it fails, the error message will clearly point to the problem, be it device access or module initialization.
Finally, I will package this code using the `set-results` tool, marking it as a probe (`IsProbe: true`) and providing the C code as `RawCandidateReproC`.
|
| 72/4 |
2026/09/07 15:21 |
tool |
set-results |
0m
Args: map[IsProbe:true RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
int main(void) {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
printf("[+] open /dev/raw-gadget successful.\n");
struct usb_raw_init init = {0};
strcpy((char *)init.driver_name, "dummy_udc");
strcpy((char *)init.device_name, "dummy_udc.0");
init.speed = 3; // USB_SPEED_HIGH
int res = ioctl(fd, USB_RAW_IOCTL_INIT, &init);
if (res < 0) {
printf("[-] Failed to ioctl USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
printf("[+] ioctl USB_RAW_IOCTL_INIT successful.\n");
res = close(fd);
if (res < 0) {
printf("[-] Failed to close: %s\n", strerror(errno));
exit(1);
}
printf("[+] close successful.\n");
return 0;
}
]
Results: map[IsProbe:true RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
int main(void) {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
printf("[+] open /dev/raw-gadget successful.\n");
struct usb_raw_init init = {0};
strcpy((char *)init.driver_name, "dummy_udc");
strcpy((char *)init.device_name, "dummy_udc.0");
init.speed = 3; // USB_SPEED_HIGH
int res = ioctl(fd, USB_RAW_IOCTL_INIT, &init);
if (res < 0) {
printf("[-] Failed to ioctl USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
printf("[+] ioctl USB_RAW_IOCTL_INIT successful.\n");
res = close(fd);
if (res < 0) {
printf("[-] Failed to close: %s\n", strerror(errno));
exit(1);
}
printf("[+] close successful.\n");
return 0;
}
]
|
| 73/3 |
2026/09/07 15:21 |
loop |
|
0m
|
| 74/4 |
2026/09/07 15:21 |
iteration |
0 |
0m
|
| 75/5 |
2026/09/07 15:21 |
action |
merge-repro-c |
0m
Results: map[CurrentCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
int main(void) {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
printf("[+] open /dev/raw-gadget successful.\n");
struct usb_raw_init init = {0};
strcpy((char *)init.driver_name, "dummy_udc");
strcpy((char *)init.device_name, "dummy_udc.0");
init.speed = 3; // USB_SPEED_HIGH
int res = ioctl(fd, USB_RAW_IOCTL_INIT, &init);
if (res < 0) {
printf("[-] Failed to ioctl USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
printf("[+] ioctl USB_RAW_IOCTL_INIT successful.\n");
res = close(fd);
if (res < 0) {
printf("[-] Failed to close: %s\n", strerror(errno));
exit(1);
}
printf("[+] close successful.\n");
return 0;
}
]
|
| 76/5 |
2026/09/07 15:21 |
action |
compile-c-prog |
0m
Results: map[CompilerError: FormattedReproC:#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
int main(void) {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
printf("[+] open /dev/raw-gadget successful.\n");
struct usb_raw_init init = {0};
strcpy((char *)init.driver_name, "dummy_udc");
strcpy((char *)init.device_name, "dummy_udc.0");
init.speed = 3; // USB_SPEED_HIGH
int res = ioctl(fd, USB_RAW_IOCTL_INIT, &init);
if (res < 0) {
printf("[-] Failed to ioctl USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
printf("[+] ioctl USB_RAW_IOCTL_INIT successful.\n");
res = close(fd);
if (res < 0) {
printf("[-] Failed to close: %s\n", strerror(errno));
exit(1);
}
printf("[+] close successful.\n");
return 0;
}
]
|
| 77/5 |
2026/09/07 15:21 |
action |
If |
0m
Args:
|
| 78/3 |
2026/09/07 15:21 |
action |
run-c-repro |
2m
Results: map[CandidateBugTitle: CandidateCrashReport: CandidateReproduced:false ConsoleOutput:[ 63.055785][ T34] kauditd_printk_skb: 10 callbacks suppressed
[ 63.055836][ T34] audit: type=1400 audit(1788794535.374:202): avc: denied { transition } for pid=5834 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
[ 63.065044][ T34] audit: type=1400 audit(1788794535.384:203): avc: denied { noatsecure } for pid=5834 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.065066][ T34] audit: type=1400 audit(1788794535.384:204): avc: denied { rlimitinh } for pid=5834 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.065080][ T34] audit: type=1400 audit(1788794535.384:205): avc: denied { siginh } for pid=5834 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:15166' (ED25519) to the list of known hosts.
[ 65.790856][ T34] audit: type=1400 audit(1788794538.104:206): avc: denied { read write } for pid=5847 comm="syz-executor313" name="raw-gadget" dev="devtmpfs" ino=824 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
[ 65.799090][ T34] audit: type=1400 audit(1788794538.114:207): avc: denied { open } for pid=5847 comm="syz-executor313" path="/dev/raw-gadget" dev="devtmpfs" ino=824 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
[+] open /dev/raw-gadget successful.
[+] ioctl USB_RAW_IOCTL_INIT successful.
[+] close successful.
[ 65.807039][ T34] audit: type=1400 audit(1788794538.124:208): avc: denied { ioctl } for pid=5847 comm="syz-executor313" path="/dev/raw-gadget" dev="devtmpfs" ino=824 ioctlcmd=0x5500 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
[ 66.021962][ T34] audit: type=1400 audit(1788794538.344:209): avc: denied { write } for pid=5848 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
[ 66.059540][ T34] audit: type=1400 audit(1788794538.374:210): avc: denied { write } for pid=5851 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
[ 66.326913][ T34] audit: type=1400 audit(1788794538.644:211): avc: denied { write } for pid=5854 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
[ 68.127079][ T34] kauditd_printk_skb: 7 callbacks suppressed
[ 68.127132][ T34] audit: type=1400 audit(1788794540.444:219): 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
[ 68.174626][ T34] audit: type=1400 audit(1788794540.494:220): 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
[ 68.245675][ T34] audit: type=1400 audit(1788794540.564:221): 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
[ 68.296628][ T34] audit: type=1400 audit(1788794540.614:222): 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
[ 68.361311][ T34] audit: type=1400 audit(1788794540.684:223): avc: denied { write } for pid=5890 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
[ 68.407438][ T34] audit: type=1400 audit(1788794540.724:224): avc: denied { write } for pid=5893 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
[ 71.653396][ T1383] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.655618][ T1383] ieee802154 phy1 wpan1: encryption failed: -22
OtherCrashReports:<nil> StraceOutput:/strace -e \!wait4,clock_nanosleep,nanosleep -s 100 -x -f /syz-executor3629340635
<...>
[ 62.388582][ T34] audit: type=1400 audit(1788794616.401:205): avc: denied { transition } for pid=5826 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
[ 62.396136][ T34] audit: type=1400 audit(1788794616.411:206): avc: denied { noatsecure } for pid=5826 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 62.396158][ T34] audit: type=1400 audit(1788794616.411:207): avc: denied { rlimitinh } for pid=5826 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 62.396174][ T34] audit: type=1400 audit(1788794616.411:208): avc: denied { siginh } for pid=5826 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 66.338615][ T34] audit: type=1400 audit(1788794620.351:209): avc: denied { write } for pid=5840 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
[ 66.378634][ T34] audit: type=1400 audit(1788794620.391:210): avc: denied { write } for pid=5843 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
[ 66.460551][ T34] audit: type=1400 audit(1788794620.471:211): avc: denied { write } for pid=5846 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
[ 66.509784][ T34] audit: type=1400 audit(1788794620.521:212): avc: denied { write } for pid=5849 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
[ 67.260633][ T34] audit: type=1400 audit(1788794621.271:213): 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
[ 67.314080][ T34] audit: type=1400 audit(1788794621.331:214): avc: denied { write } for pid=5857 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
[ 67.532891][ T34] audit: type=1400 audit(1788794621.551:215): avc: denied { write } for pid=5862 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
[ 67.589324][ T34] audit: type=1400 audit(1788794621.601:216): avc: denied { write } for pid=5866 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]:49119' (ED25519) to the list of known hosts.
[ 67.711208][ T34] audit: type=1400 audit(1788794621.721:217): avc: denied { write } for pid=5870 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
[ 67.765074][ T34] audit: type=1400 audit(1788794621.781:218): 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
execve("/syz-executor3629340635", ["/syz-executor3629340635"], 0x7ffe05a77b50 /* 11 vars */) = 0
brk(NULL) = 0x55558311e000
brk(0x55558311ed80) = 0x55558311ed80
arch_prctl(ARCH_SET_FS, 0x55558311e400) = 0
set_tid_address(0x55558311e6d0) = 5878
set_robust_list(0x55558311e6e0, 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-executor3629340635", 4096) = 23
getrandom("\x9f\x7c\x19\x16\x31\x95\xd0\xf3", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x55558311ed80
brk(0x55558313fd80) = 0x55558313fd80
brk(0x555583140000) = 0x555583140000
mprotect(0x7f187a96a000, 20480, PROT_READ) = 0
[ 67.861146][ T34] audit: type=1400 audit(1788794621.871:219): avc: denied { read write } for pid=5878 comm="syz-executor362" name="raw-gadget" dev="devtmpfs" ino=824 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
openat(AT_FDCWD, "/dev/raw-gadget", O_RDWR) = 3
[ 67.861657][ T34] audit: type=1400 audit(1788794621.871:220): avc: denied { open } for pid=5878 comm="syz-executor362" path="/dev/raw-gadget" dev="devtmpfs" ino=824 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
[ 67.873388][ T34] audit: type=1400 audit(1788794621.881:221): avc: denied { ioctl } for pid=5878 comm="syz-executor362" path="/dev/raw-gadget" dev="devtmpfs" ino=824 ioctlcmd=0x5500 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
ioctl(3, USB_RAW_IOCTL_INIT, 0x7ffc8a8e2cd0) = 0
close(3) = 0
[+] open /dev/raw-gadget successful.
[+] ioctl USB_RAW_IOCTL_INIT successful.
[+] close successful.
write(1, "[+] open /dev/raw-gadget successful.\n[+] ioctl USB_RAW_IOCTL_INIT successful.\n[+] close successful.\n", 100) = 100
exit_group(0) = ?
+++ exited with 0 +++
[ 68.448680][ T34] audit: type=1400 audit(1788794622.461:222): avc: denied { write } for pid=5880 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
[ 68.489544][ T34] audit: type=1400 audit(1788794622.501:223): avc: denied { write } for pid=5883 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
[ 68.629417][ T34] audit: type=1400 audit(1788794622.641:224): avc: denied { write } for pid=5886 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
[ 71.705175][ T1381] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.705247][ T1381] ieee802154 phy1 wpan1: encryption failed: -22
[ 76.826694][ T33] cfg80211: failed to load regulatory.db
TestError:]
|
| 79/3 |
2026/09/07 15:23 |
action |
truncate-log |
0m
Results: map[TruncatedConsoleOutput:[ 63.055785][ T34] kauditd_printk_skb: 10 callbacks suppressed
[ 63.055836][ T34] audit: type=1400 audit(1788794535.374:202): avc: denied { transition } for pid=5834 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
[ 63.065044][ T34] audit: type=1400 audit(1788794535.384:203): avc: denied { noatsecure } for pid=5834 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.065066][ T34] audit: type=1400 audit(1788794535.384:204): avc: denied { rlimitinh } for pid=5834 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.065080][ T34] audit: type=1400 audit(1788794535.384:205): avc: denied { siginh } for pid=5834 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:15166' (ED25519) to the list of known hosts.
[ 65.790856][ T34] audit: type=1400 audit(1788794538.104:206): avc: denied { read write } for pid=5847 comm="syz-executor313" name="raw-gadget" dev="devtmpfs" ino=824 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
[ 65.799090][ T34] audit: type=1400 audit(1788794538.114:207): avc: denied { open } for pid=5847 comm="syz-executor313" path="/dev/raw-gadget" dev="devtmpfs" ino=824 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
[+] open /dev/raw-gadget successful.
[+] ioctl USB_RAW_IOCTL_INIT successful.
[+] close successful.
[ 65.807039][ T34] audit: type=1400 audit(1788794538.124:208): avc: denied { ioctl } for pid=5847 comm="syz-executor313" path="/dev/raw-gadget" dev="devtmpfs" ino=824 ioctlcmd=0x5500 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
[ 66.021962][ T34] audit: type=1400 audit(1788794538.344:209): avc: denied { write } for pid=5848 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
[ 66.059540][ T34] audit: type=1400 audit(1788794538.374:210): avc: denied { write } for pid=5851 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
[ 66.326913][ T34] audit: type=1400 audit(1788794538.644:211): avc: denied { write } for pid=5854 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
[ 68.127079][ T34] kauditd_printk_skb: 7 callbacks suppressed
[ 68.127132][ T34] audit: type=1400 audit(1788794540.444:219): 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
[ 68.174626][ T34] audit: type=1400 audit(1788794540.494:220): 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
[ 68.245675][ T34] audit: type=1400 audit(1788794540.564:221): 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
[ 68.296628][ T34] audit: type=1400 audit(1788794540.614:222): 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
[ 68.361311][ T34] audit: type=1400 audit(1788794540.684:223): avc: denied { write } for pid=5890 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
[ 68.407438][ T34] audit: type=1400 audit(1788794540.724:224): avc: denied { write } for pid=5893 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
[ 71.653396][ T1383] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.655618][ T1383] ieee802154 phy1 wpan1: encryption failed: -22
TruncatedCrashReport: TruncatedStraceOutput:/strace -e \!wait4,clock_nanosleep,nanosleep -s 100 -x -f /syz-executor3629340635
<...>
[ 62.388582][ T34] audit: type=1400 audit(1788794616.401:205): avc: denied { transition } for pid=5826 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
[ 62.396136][ T34] audit: type=1400 audit(1788794616.411:206): avc: denied { noatsecure } for pid=5826 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 62.396158][ T34] audit: type=1400 audit(1788794616.411:207): avc: denied { rlimitinh } for pid=5826 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 62.396174][ T34] audit: type=1400 audit(1788794616.411:208): avc: denied { siginh } for pid=5826 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 66.338615][ T34] audit: type=1400 audit(1788794620.351:209): avc: denied { write } for pid=5840 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
[ 66.378634][ T34] audit: type=1400 audit(1788794620.391:210): avc: denied { write } for pid=5843 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
[ 66.460551][ T34] audit: type=1400 audit(1788794620.471:211): avc: denied { write } for pid=5846 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
[ 66.509784][ T34] audit: type=1400 audit(1788794620.521:212): avc: denied { write } for pid=5849 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
[ 67.260633][ T34] audit: type=1400 audit(1788794621.271:213): 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
[ 67.314080][ T34] audit: type=1400 audit(1788794621.331:214): avc: denied { write } for pid=5857 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
[ 67.532891][ T34] audit: type=1400 audit(1788794621.551:215): avc: denied { write } for pid=5862 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
[ 67.589324][ T34] audit: type=1400 audit(1788794621.601:216): avc: denied { write } for pid=5866 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]:49119' (ED25519) to the list of known hosts.
[ 67.711208][ T34] audit: type=1400 audit(1788794621.721:217): avc: denied { write } for pid=5870 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
[ 67.765074][ T34] audit: type=1400 audit(1788794621.781:218): 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
execve("/syz-executor3629340635", ["/syz-executor3629340635"], 0x7ffe05a77b50 /* 11 vars */) = 0
brk(NULL) = 0x55558311e000
brk(0x55558311ed80) = 0x55558311ed80
arch_prctl(ARCH_SET_FS, 0x55558311e400) = 0
set_tid_address(0x55558311e6d0) = 5878
set_robust_list(0x55558311e6e0, 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-executor3629340635", 4096) = 23
getrandom("\x9f\x7c\x19\x16\x31\x95\xd0\xf3", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x55558311ed80
brk(0x55558313fd80) = 0x55558313fd80
brk(0x555583140000) = 0x555583140000
mprotect(0x7f187a96a000, 20480, PROT_READ) = 0
[ 67.861146][ T34] audit: type=1400 audit(1788794621.871:219): avc: denied { read write } for pid=5878 comm="syz-executor362" name="raw-gadget" dev="devtmpfs" ino=824 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
openat(AT_FDCWD, "/dev/raw-gadget", O_RDWR) = 3
[ 67.861657][ T34] audit: type=1400 audit(1788794621.871:220): avc: denied { open } for pid=5878 comm="syz-executor362" path="/dev/raw-gadget" dev="devtmpfs" ino=824 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
[ 67.873388][ T34] audit: type=1400 audit(1788794621.881:221): avc: denied { ioctl } for pid=5878 comm="syz-executor362" path="/dev/raw-gadget" dev="devtmpfs" ino=824 ioctlcmd=0x5500 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
ioctl(3, USB_RAW_IOCTL_INIT, 0x7ffc8a8e2cd0) = 0
close(3) = 0
[+] open /dev/raw-gadget successful.
[+] ioctl USB_RAW_IOCTL_INIT successful.
[+] close successful.
write(1, "[+] open /dev/raw-gadget successful.\n[+] ioctl USB_RAW_IOCTL_INIT successful.\n[+] close successful.\n", 100) = 100
exit_group(0) = ?
+++ exited with 0 +++
[ 68.448680][ T34] audit: type=1400 audit(1788794622.461:222): avc: denied { write } for pid=5880 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
[ 68.489544][ T34] audit: type=1400 audit(1788794622.501:223): avc: denied { write } for pid=5883 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
[ 68.629417][ T34] audit: type=1400 audit(1788794622.641:224): avc: denied { write } for pid=5886 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
[ 71.705175][ T1381] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.705247][ T1381] ieee802154 phy1 wpan1: encryption failed: -22
[ 76.826694][ T33] cfg80211: failed to load regulatory.db
]
|
| 80/3 |
2026/09/07 15:23 |
agent |
repro-oracle |
0m
Model:
Results: map[Feedback:The capability probe was successful. The environment is ready, and /dev/raw-gadget can be opened and initialized. 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: WARNING: suspicious RCU usage in wakeup_source_unregister
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
=============================
WARNING: suspicious RCU usage
syzkaller #0 Tainted: G W L
-----------------------------
kernel/rcu/srcutree.c:1468 Illegal synchronize_srcu() in same-type SRCU (or in RCU) read-side critical section!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
locks held by syz-executor/5675: 5, last CPU#0:
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1542 [inline]
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm+0x10f/0x480 kernel/fork.c:1595
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:562 [inline]
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: dup_mmap+0x195/0x1dc0 mm/mmap.c:1716
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: mmap_write_lock_nested include/linux/mmap_lock.h:552 [inline]
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: dup_mmap+0x221/0x1dc0 mm/mmap.c:1723
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: __pte_offset_map+0x29/0x240 mm/pgtable-generic.c:290
#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
stack backtrace:
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
Call Trace:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
lockdep_rcu_suspicious+0x140/0x1d0 kernel/locking/lockdep.c:6938
__synchronize_srcu+0x157/0x2f0 kernel/rcu/srcutree.c:1464
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
BUG: sleeping function called from invalid context at kernel/rcu/srcutree.c:1472
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 5675, name: syz-executor
preempt_count: 101, expected: 0
RCU nest depth: 1, expected: 0
locks held by syz-executor/5675: 5, last CPU#0:
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1542 [inline]
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm+0x10f/0x480 kernel/fork.c:1595
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:562 [inline]
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: dup_mmap+0x195/0x1dc0 mm/mmap.c:1716
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: mmap_write_lock_nested include/linux/mmap_lock.h:552 [inline]
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: dup_mmap+0x221/0x1dc0 mm/mmap.c:1723
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: __pte_offset_map+0x29/0x240 mm/pgtable-generic.c:290
#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
Preemption disabled at:
[<ffffffff81336576>] preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
Call Trace:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x36a/0x4c0 kernel/sched/core.c:9234
__synchronize_srcu+0x1a1/0x2f0 kernel/rcu/srcutree.c:1472
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
ODEBUG: object ffffc90000007a80 is NOT on stack ffffc90004320000, but annotated.
------------[ cut here ]------------
1
WARNING: lib/debugobjects.c:672 at debug_object_is_on_stack lib/debugobjects.c:672 [inline], CPU#0: syz-executor/5675
WARNING: lib/debugobjects.c:672 at lookup_object_or_alloc lib/debugobjects.c:705 [inline], CPU#0: syz-executor/5675
WARNING: lib/debugobjects.c:672 at __debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798, CPU#0: syz-executor/5675
Modules linked in:
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:672 [inline]
RIP: 0010:lookup_object_or_alloc lib/debugobjects.c:705 [inline]
RIP: 0010:__debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798
Code: cc cc cc 41 ff c7 44 89 3d c9 75 e8 15 48 c7 c1 80 9d 6d 8c 48 c7 c7 e0 9d 6d 8c 84 c0 48 0f 45 f9 48 89 de e8 4d fa 3d fc 90 <0f> 0b 90 e9 c0 fe ff ff e8 4f 1c 00 00 8b 05 a1 cd 6e 0a 3b 05 9f
RSP: 0018:ffffc900000079b8 EFLAGS: 00010046
RAX: 0000000000000050 RBX: ffffc90000007a80 RCX: 0978036a12caea00
RDX: 0000000000000100 RSI: 0000000000000100 RDI: 0000000000000000
RBP: ffff88803588dde0 R08: 0000000000000100 R09: 0000000000080000
R10: 0000000000008000 R11: ffffffff8ec362b8 R12: 1ffff92000000f4c
R13: ffff888021b995e8 R14: dffffc0000000000 R15: 0000000000000001
FS: 000055558fe74500(0000) GS:ffff888124cd9000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fdafb3556c8 CR3: 00000000640ca000 CR4: 00000000003526f0
Call Trace:
<IRQ>
__synchronize_srcu+0x1d5/0x2f0 kernel/rcu/srcutree.c:1475
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
----------------
Code disassembly (best guess), 1 bytes skipped:
0: 00 00 add %al,(%rax)
2: 41 c7 84 24 20 0e 00 movl $0x0,0xe20(%r12)
9: 00 00 00 00 00
e: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
13: 49 83 c4 48 add $0x48,%r12
17: 4c 89 e7 mov %r12,%rdi
1a: e8 f7 ed 50 0a call 0xa50ee16
1f: e8 d2 00 3a 00 call 0x3a00f6
24: fb sti
25: 4c 8b 65 c8 mov -0x38(%rbp),%r12
* 29: 49 8d bc 24 10 17 00 lea 0x1710(%r12),%rdi <-- trapping instruction
30: 00
31: 48 89 f8 mov %rdi,%rax
34: 48 c1 e8 03 shr $0x3,%rax
38: 42 0f b6 04 30 movzbl (%rax,%r14,1),%eax
3d: 84 c0 test %al,%al
IsProbe: true
Reproduced: false
Console Output: [ 63.055785][ T34] kauditd_printk_skb: 10 callbacks suppressed
[ 63.055836][ T34] audit: type=1400 audit(1788794535.374:202): avc: denied { transition } for pid=5834 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
[ 63.065044][ T34] audit: type=1400 audit(1788794535.384:203): avc: denied { noatsecure } for pid=5834 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.065066][ T34] audit: type=1400 audit(1788794535.384:204): avc: denied { rlimitinh } for pid=5834 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.065080][ T34] audit: type=1400 audit(1788794535.384:205): avc: denied { siginh } for pid=5834 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:15166' (ED25519) to the list of known hosts.
[ 65.790856][ T34] audit: type=1400 audit(1788794538.104:206): avc: denied { read write } for pid=5847 comm="syz-executor313" name="raw-gadget" dev="devtmpfs" ino=824 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
[ 65.799090][ T34] audit: type=1400 audit(1788794538.114:207): avc: denied { open } for pid=5847 comm="syz-executor313" path="/dev/raw-gadget" dev="devtmpfs" ino=824 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
[+] open /dev/raw-gadget successful.
[+] ioctl USB_RAW_IOCTL_INIT successful.
[+] close successful.
[ 65.807039][ T34] audit: type=1400 audit(1788794538.124:208): avc: denied { ioctl } for pid=5847 comm="syz-executor313" path="/dev/raw-gadget" dev="devtmpfs" ino=824 ioctlcmd=0x5500 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
[ 66.021962][ T34] audit: type=1400 audit(1788794538.344:209): avc: denied { write } for pid=5848 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
[ 66.059540][ T34] audit: type=1400 audit(1788794538.374:210): avc: denied { write } for pid=5851 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
[ 66.326913][ T34] audit: type=1400 audit(1788794538.644:211): avc: denied { write } for pid=5854 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
[ 68.127079][ T34] kauditd_printk_skb: 7 callbacks suppressed
[ 68.127132][ T34] audit: type=1400 audit(1788794540.444:219): 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
[ 68.174626][ T34] audit: type=1400 audit(1788794540.494:220): 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
[ 68.245675][ T34] audit: type=1400 audit(1788794540.564:221): 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
[ 68.296628][ T34] audit: type=1400 audit(1788794540.614:222): 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
[ 68.361311][ T34] audit: type=1400 audit(1788794540.684:223): avc: denied { write } for pid=5890 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
[ 68.407438][ T34] audit: type=1400 audit(1788794540.724:224): avc: denied { write } for pid=5893 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
[ 71.653396][ T1383] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.655618][ T1383] ieee802154 phy1 wpan1: encryption failed: -22
Strace Output: /strace -e \!wait4,clock_nanosleep,nanosleep -s 100 -x -f /syz-executor3629340635
<...>
[ 62.388582][ T34] audit: type=1400 audit(1788794616.401:205): avc: denied { transition } for pid=5826 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
[ 62.396136][ T34] audit: type=1400 audit(1788794616.411:206): avc: denied { noatsecure } for pid=5826 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 62.396158][ T34] audit: type=1400 audit(1788794616.411:207): avc: denied { rlimitinh } for pid=5826 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 62.396174][ T34] audit: type=1400 audit(1788794616.411:208): avc: denied { siginh } for pid=5826 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 66.338615][ T34] audit: type=1400 audit(1788794620.351:209): avc: denied { write } for pid=5840 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
[ 66.378634][ T34] audit: type=1400 audit(1788794620.391:210): avc: denied { write } for pid=5843 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
[ 66.460551][ T34] audit: type=1400 audit(1788794620.471:211): avc: denied { write } for pid=5846 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
[ 66.509784][ T34] audit: type=1400 audit(1788794620.521:212): avc: denied { write } for pid=5849 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
[ 67.260633][ T34] audit: type=1400 audit(1788794621.271:213): 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
[ 67.314080][ T34] audit: type=1400 audit(1788794621.331:214): avc: denied { write } for pid=5857 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
[ 67.532891][ T34] audit: type=1400 audit(1788794621.551:215): avc: denied { write } for pid=5862 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
[ 67.589324][ T34] audit: type=1400 audit(1788794621.601:216): avc: denied { write } for pid=5866 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]:49119' (ED25519) to the list of known hosts.
[ 67.711208][ T34] audit: type=1400 audit(1788794621.721:217): avc: denied { write } for pid=5870 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
[ 67.765074][ T34] audit: type=1400 audit(1788794621.781:218): 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
execve("/syz-executor3629340635", ["/syz-executor3629340635"], 0x7ffe05a77b50 /* 11 vars */) = 0
brk(NULL) = 0x55558311e000
brk(0x55558311ed80) = 0x55558311ed80
arch_prctl(ARCH_SET_FS, 0x55558311e400) = 0
set_tid_address(0x55558311e6d0) = 5878
set_robust_list(0x55558311e6e0, 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-executor3629340635", 4096) = 23
getrandom("\x9f\x7c\x19\x16\x31\x95\xd0\xf3", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x55558311ed80
brk(0x55558313fd80) = 0x55558313fd80
brk(0x555583140000) = 0x555583140000
mprotect(0x7f187a96a000, 20480, PROT_READ) = 0
[ 67.861146][ T34] audit: type=1400 audit(1788794621.871:219): avc: denied { read write } for pid=5878 comm="syz-executor362" name="raw-gadget" dev="devtmpfs" ino=824 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
openat(AT_FDCWD, "/dev/raw-gadget", O_RDWR) = 3
[ 67.861657][ T34] audit: type=1400 audit(1788794621.871:220): avc: denied { open } for pid=5878 comm="syz-executor362" path="/dev/raw-gadget" dev="devtmpfs" ino=824 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
[ 67.873388][ T34] audit: type=1400 audit(1788794621.881:221): avc: denied { ioctl } for pid=5878 comm="syz-executor362" path="/dev/raw-gadget" dev="devtmpfs" ino=824 ioctlcmd=0x5500 scontext=root:sysadm_r:sysadm_t tcontext=system_u:object_r:device_t tclass=chr_file permissive=1
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
ioctl(3, USB_RAW_IOCTL_INIT, 0x7ffc8a8e2cd0) = 0
close(3) = 0
[+] open /dev/raw-gadget successful.
[+] ioctl USB_RAW_IOCTL_INIT successful.
[+] close successful.
write(1, "[+] open /dev/raw-gadget successful.\n[+] ioctl USB_RAW_IOCTL_INIT successful.\n[+] close successful.\n", 100) = 100
exit_group(0) = ?
+++ exited with 0 +++
[ 68.448680][ T34] audit: type=1400 audit(1788794622.461:222): avc: denied { write } for pid=5880 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
[ 68.489544][ T34] audit: type=1400 audit(1788794622.501:223): avc: denied { write } for pid=5883 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
[ 68.629417][ T34] audit: type=1400 audit(1788794622.641:224): avc: denied { write } for pid=5886 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
[ 71.705175][ T1381] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.705247][ T1381] ieee802154 phy1 wpan1: encryption failed: -22
[ 76.826694][ T33] cfg80211: failed to load regulatory.db
Crash Report:
|
| 81/4 |
2026/09/07 15:23 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 18801
output: 69
thoughts: 244
Thoughts: **Analysis of Generated Program Results and Probe Status**
I've just reviewed the output from running a generated program, and it seems our efforts have led to a successful probe. The key piece of information is the bug description itself: "WARNING: suspicious RCU usage in wakeup_source_unregister". However, what's immediately striking is the absence of a crash report. This tells me that the specific bug we were targeting, despite its warning, did not manifest in a reproducible way during this run.
The probe's outcome confirms this. We see `IsProbe: true` and, crucially, `Reproduced: false`. This indicates that while the environment was set up correctly and the program executed, the intended bug wasn't triggered.
Looking at the console output, it's all positive: `[+] open /dev/raw-gadget successful.`, `[+] ioctl USB_RAW_IOCTL_INIT successful.`, and `[+] close successful.`. This, along with the `strace` output showing the same successful sequence of `openat`, `ioctl`, and `close` operations on `/dev/raw-gadget`, solidifies my understanding. The system calls executed exactly as expected, indicating a clean and functional environment.
Therefore, my conclusion is that the probe was indeed successful. The environment is ready, the necessary setup completed without issue, and we can confidently proceed. My next step is to reflect this in our system by setting `ProbePassed` to true. Furthermore, I need to explicitly communicate this readiness to the agent, letting it know that the environment is prepared and it should now focus on generating the full reproducer in the subsequent iteration. To achieve this, I will utilize the `set-results` tool.
|
| 82/4 |
2026/09/07 15:24 |
tool |
set-results |
0m
Args: map[Feedback:The capability probe was successful. The environment is ready, and /dev/raw-gadget can be opened and initialized. Please proceed to generate the full reproducer in the next iteration. ProbePassed:true TerminalError: TitleMatches:false]
Results: map[Feedback:The capability probe was successful. The environment is ready, and /dev/raw-gadget can be opened and initialized. Please proceed to generate the full reproducer in the next iteration. ProbePassed:true TerminalError: TitleMatches:false]
|
| 83/3 |
2026/09/07 15:24 |
action |
loop-controller |
0m
Results: map[CapabilitiesVerified:true ContinueSignal:continue EquivalenceAnalysis: OracleFeedback:The capability probe was successful. The environment is ready, and /dev/raw-gadget can be opened and initialized. Please proceed to generate the full reproducer in the next iteration. ReproC: Reproduced:false ReproducedBugTitle: ReproducedCrashReport:]
|
| 84/2 |
2026/09/07 15:24 |
iteration |
1 |
7m
|
| 85/3 |
2026/09/07 15:24 |
action |
If |
2m
Args: map[OracleFeedback:The capability probe was successful. The environment is ready, and /dev/raw-gadget can be opened and initialized. Please proceed to generate the full reproducer in the next iteration.]
|
| 86/4 |
2026/09/07 15:24 |
agent |
strategy-refiner |
2m
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: WARNING: suspicious RCU usage in wakeup_source_unregister
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
=============================
WARNING: suspicious RCU usage
syzkaller #0 Tainted: G W L
-----------------------------
kernel/rcu/srcutree.c:1468 Illegal synchronize_srcu() in same-type SRCU (or in RCU) read-side critical section!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
locks held by syz-executor/5675: 5, last CPU#0:
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1542 [inline]
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm+0x10f/0x480 kernel/fork.c:1595
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:562 [inline]
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: dup_mmap+0x195/0x1dc0 mm/mmap.c:1716
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: mmap_write_lock_nested include/linux/mmap_lock.h:552 [inline]
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: dup_mmap+0x221/0x1dc0 mm/mmap.c:1723
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: __pte_offset_map+0x29/0x240 mm/pgtable-generic.c:290
#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
stack backtrace:
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
Call Trace:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
lockdep_rcu_suspicious+0x140/0x1d0 kernel/locking/lockdep.c:6938
__synchronize_srcu+0x157/0x2f0 kernel/rcu/srcutree.c:1464
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
BUG: sleeping function called from invalid context at kernel/rcu/srcutree.c:1472
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 5675, name: syz-executor
preempt_count: 101, expected: 0
RCU nest depth: 1, expected: 0
locks held by syz-executor/5675: 5, last CPU#0:
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1542 [inline]
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm+0x10f/0x480 kernel/fork.c:1595
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:562 [inline]
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: dup_mmap+0x195/0x1dc0 mm/mmap.c:1716
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: mmap_write_lock_nested include/linux/mmap_lock.h:552 [inline]
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: dup_mmap+0x221/0x1dc0 mm/mmap.c:1723
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: __pte_offset_map+0x29/0x240 mm/pgtable-generic.c:290
#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
Preemption disabled at:
[<ffffffff81336576>] preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
Call Trace:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x36a/0x4c0 kernel/sched/core.c:9234
__synchronize_srcu+0x1a1/0x2f0 kernel/rcu/srcutree.c:1472
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
ODEBUG: object ffffc90000007a80 is NOT on stack ffffc90004320000, but annotated.
------------[ cut here ]------------
1
WARNING: lib/debugobjects.c:672 at debug_object_is_on_stack lib/debugobjects.c:672 [inline], CPU#0: syz-executor/5675
WARNING: lib/debugobjects.c:672 at lookup_object_or_alloc lib/debugobjects.c:705 [inline], CPU#0: syz-executor/5675
WARNING: lib/debugobjects.c:672 at __debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798, CPU#0: syz-executor/5675
Modules linked in:
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:672 [inline]
RIP: 0010:lookup_object_or_alloc lib/debugobjects.c:705 [inline]
RIP: 0010:__debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798
Code: cc cc cc 41 ff c7 44 89 3d c9 75 e8 15 48 c7 c1 80 9d 6d 8c 48 c7 c7 e0 9d 6d 8c 84 c0 48 0f 45 f9 48 89 de e8 4d fa 3d fc 90 <0f> 0b 90 e9 c0 fe ff ff e8 4f 1c 00 00 8b 05 a1 cd 6e 0a 3b 05 9f
RSP: 0018:ffffc900000079b8 EFLAGS: 00010046
RAX: 0000000000000050 RBX: ffffc90000007a80 RCX: 0978036a12caea00
RDX: 0000000000000100 RSI: 0000000000000100 RDI: 0000000000000000
RBP: ffff88803588dde0 R08: 0000000000000100 R09: 0000000000080000
R10: 0000000000008000 R11: ffffffff8ec362b8 R12: 1ffff92000000f4c
R13: ffff888021b995e8 R14: dffffc0000000000 R15: 0000000000000001
FS: 000055558fe74500(0000) GS:ffff888124cd9000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fdafb3556c8 CR3: 00000000640ca000 CR4: 00000000003526f0
Call Trace:
<IRQ>
__synchronize_srcu+0x1d5/0x2f0 kernel/rcu/srcutree.c:1475
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
----------------
Code disassembly (best guess), 1 bytes skipped:
0: 00 00 add %al,(%rax)
2: 41 c7 84 24 20 0e 00 movl $0x0,0xe20(%r12)
9: 00 00 00 00 00
e: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
13: 49 83 c4 48 add $0x48,%r12
17: 4c 89 e7 mov %r12,%rdi
1a: e8 f7 ed 50 0a call 0xa50ee16
1f: e8 d2 00 3a 00 call 0x3a00f6
24: fb sti
25: 4c 8b 65 c8 mov -0x38(%rbp),%r12
* 29: 49 8d bc 24 10 17 00 lea 0x1710(%r12),%rdi <-- trapping instruction
30: 00
31: 48 89 f8 mov %rdi,%rax
34: 48 c1 e8 03 shr $0x3,%rax
38: 42 0f b6 04 30 movzbl (%rax,%r14,1),%eax
3d: 84 c0 test %al,%al
Current Strategy: An analysis of the bug report and kernel source reveals the following root cause and reproduction strategy.
### Root Cause Analysis
The bug is a classic case of freeing an object and calling sleeping functions from an atomic context (timer callback).
During initialization (`vub300_probe`), the `vub300` MMC host driver arms an `inactivity_timer` and holds a reference to the `vub300` object for it.
When the USB device is disconnected, `vub300_disconnect` is invoked. It sets `vub300->interface = NULL` and drops its reference to the object, but **crucially fails to delete the pending `inactivity_timer`** (e.g., via `del_timer_sync`).
When the timer eventually expires, its callback `vub300_inactivity_timer_expired` runs in softirq (atomic) context. It sees that the interface is disconnected (`!vub300->interface`) and drops the timer's reference to the object. Since this is the last reference, `vub300_delete` is executed directly from the timer callback.
`vub300_delete` calls `mmc_free_host()`, which drops the device reference and triggers `mmc_host_classdev_release()`. This function unregisters the wakeup source, which calls `synchronize_srcu()`. Because `synchronize_srcu()` can sleep, calling it from a softirq context is illegal and triggers the observed `WARNING: suspicious RCU usage` and `BUG: sleeping function called from invalid context`.
### Reproduction Strategy
To reproduce this bug, we need to trick the kernel into probing the `vub300` driver and then immediately disconnect the device. We can achieve this from userspace using the `raw-gadget` subsystem to emulate a USB device that matches the `vub300` driver's expected Vendor/Product IDs (`0x0424:0x012C`).
1. Open `/dev/raw-gadget` and initialize a dummy USB device.
2. Respond to standard USB enumeration requests (`GET_DESCRIPTOR` for Device and Configuration). The configuration must expose 4 bulk endpoints (2 IN, 2 OUT) as expected by the driver.
3. Respond to the three specific vendor control requests sent by `vub300_probe` (`GET_HC_INF0`, `SET_ROM_WAIT_STATES`, and `GET_SYSTEM_PORT_STATUS`).
4. Once `vub300_probe` completes successfully, close the `raw-gadget` file descriptor to simulate a physical USB disconnect.
5. Sleep for a couple of seconds to allow the `inactivity_timer` (armed to `jiffies + HZ`) to expire and trigger the bug.
### Minimal C Reproducer
```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
#define USB_RAW_IOCTL_RUN _IO('U', 1)
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
struct usb_raw_event {
uint32_t type;
uint32_t length;
uint8_t data[0];
};
struct usb_raw_ep_io {
uint16_t ep;
uint16_t flags;
uint32_t length;
uint8_t data[0];
};
struct usb_ctrlrequest {
uint8_t bRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} __attribute__((packed));
int main() {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
perror("open /dev/raw-gadget");
return 1;
}
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
if (ioctl(fd, USB_RAW_IOCTL_INIT, &init) < 0) {
perror("USB_RAW_IOCTL_INIT");
return 1;
}
if (ioctl(fd, USB_RAW_IOCTL_RUN, 0) < 0) {
perror("USB_RAW_IOCTL_RUN");
return 1;
}
int done = 0;
while (!done) {
struct usb_raw_event *event = malloc(sizeof(*event) + 1024);
event->type = 0;
event->length = 1024;
if (ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event) < 0) {
free(event);
break;
}
if (event->type == 2) { // USB_RAW_EVENT_CONTROL
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)event->data;
struct usb_raw_ep_io *io = malloc(sizeof(*io) + 1024);
io->ep = 0;
io->flags = 0;
io->length = 0;
int handled = 0;
if (req->bRequestType == 0x80 && req->bRequest == 6) { // GET_DESCRIPTOR
if ((req->wValue >> 8) == 1) { // DEVICE
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
} else if ((req->wValue >> 8) == 2) { // CONFIG
uint8_t desc[] = {
9, 2, 46, 0, 1, 1, 0, 0x80, 50,
9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0,
7, 5, 0x81, 2, 0, 2, 0,
7, 5, 0x02, 2, 0, 2, 0,
7, 5, 0x83, 2, 0, 2, 0,
7, 5, 0x04, 2, 0, 2, 0,
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
}
} else if (req->bRequestType == 0xC0) { // VENDOR IN
if (req->bRequest == 1) { // GET_HC_INF0
uint8_t data[4] = {4, 0, 0, 1};
io->length = req->wLength < 4 ? req->wLength : 4;
memcpy(io->data, data, io->length);
handled = 1;
} else if (req->bRequest == 0) { // GET_SYSTEM_PORT_STATUS
uint8_t data[15] = {15, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
io->length = req->wLength < 15 ? req->wLength : 15;
memcpy(io->data, data, io->length);
handled = 1;
done = 1; // Last request in vub300_probe
}
} else if (req->bRequestType == 0x40) { // VENDOR OUT
if (req->bRequest == 16) { // SET_ROM_WAIT_STATES
io->length = 0;
handled = 1;
}
} else if (req->bRequestType == 0x00 && req->bRequest == 9) { // SET_CONFIGURATION
io->length = 0;
handled = 1;
} else {
// ACK other standard requests (e.g. SET_ADDRESS)
io->length = 0;
handled = 1;
}
if (handled) {
if (req->bRequestType & 0x80) {
ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
free(io);
}
free(event);
}
// Give vub300_probe a moment to finish mmc_add_host
usleep(200000);
// Close fd to simulate USB disconnect
close(fd);
// Wait for the inactivity_timer to expire (it is set to jiffies + HZ)
sleep(2);
return 0;
}
```
Feedback: The capability probe was successful. The environment is ready, and /dev/raw-gadget can be opened and initialized. Please proceed to generate the full reproducer in the next iteration.
Reply: The root cause of the bug is that `vub300_disconnect` fails to delete the `inactivity_timer` when the USB device is disconnected. When the timer later expires, its callback `vub300_inactivity_timer_expired` runs in an atomic (softirq) context. It notices that the device is disconnected (`!vub300->interface`) and drops the last reference to the object. This triggers `vub300_delete`, which calls `mmc_free_host()`, eventually leading to `synchronize_srcu()` being called from an atomic context, causing the `suspicious RCU usage` and `sleeping function called from invalid context` warnings.
The provided strategy is correct. We emulate a `vub300` USB device using `/dev/raw-gadget`, let `vub300_probe` initialize the driver and arm the `inactivity_timer`, and then immediately close the gadget file descriptor to simulate a physical disconnect. Waiting for the timer to expire will trigger the bug.
I have refined the reproducer to ensure that `GET_SYSTEM_PORT_STATUS` returns `port_flags = 0` (card not present). This prevents `mmc_add_host` from attempting to probe an SD card, making the reproduction faster and more reliable.
Here is the complete C reproducer:
```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
#define USB_RAW_IOCTL_RUN _IO('U', 1)
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
struct usb_raw_event {
uint32_t type;
uint32_t length;
uint8_t data[0];
};
struct usb_raw_ep_io {
uint16_t ep;
uint16_t flags;
uint32_t length;
uint8_t data[0];
};
struct usb_ctrlrequest {
uint8_t bRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} __attribute__((packed));
int main() {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
perror("open /dev/raw-gadget");
return 1;
}
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
if (ioctl(fd, USB_RAW_IOCTL_INIT, &init) < 0) {
perror("USB_RAW_IOCTL_INIT");
return 1;
}
if (ioctl(fd, USB_RAW_IOCTL_RUN, 0) < 0) {
perror("USB_RAW_IOCTL_RUN");
return 1;
}
int done = 0;
while (!done) {
struct usb_raw_event *event = malloc(sizeof(*event) + 1024);
event->type = 0;
event->length = 1024;
if (ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event) < 0) {
free(event);
break;
}
if (event->type == 2) { // USB_RAW_EVENT_CONTROL
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)event->data;
struct usb_raw_ep_io *io = malloc(sizeof(*io) + 1024);
io->ep = 0;
io->flags = 0;
io->length = 0;
int handled = 0;
if (req->bRequestType == 0x80 && req->bRequest == 6) { // GET_DESCRIPTOR
if ((req->wValue >> 8) == 1) { // DEVICE
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
} else if ((req->wValue >> 8) == 2) { // CONFIG
uint8_t desc[] = {
9, 2, 46, 0, 1, 1, 0, 0x80, 50,
9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0,
7, 5, 0x81, 2, 0, 2, 0,
7, 5, 0x02, 2, 0, 2, 0,
7, 5, 0x83, 2, 0, 2, 0,
7, 5, 0x04, 2, 0, 2, 0,
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
}
} else if (req->bRequestType == 0xC0) { // VENDOR IN
if (req->bRequest == 1) { // GET_HC_INF0
uint8_t data[4] = {4, 0, 0, 1};
io->length = req->wLength < 4 ? req->wLength : 4;
memcpy(io->data, data, io->length);
handled = 1;
} else if (req->bRequest == 0) { // GET_SYSTEM_PORT_STATUS
// port_flags = 0 (card_present = 0) to avoid mmc_add_host probing
uint8_t data[15] = {15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
io->length = req->wLength < 15 ? req->wLength : 15;
memcpy(io->data, data, io->length);
handled = 1;
done = 1; // Last request in vub300_probe
}
} else if (req->bRequestType == 0x40) { // VENDOR OUT
if (req->bRequest == 16) { // SET_ROM_WAIT_STATES
io->length = 0;
handled = 1;
}
} else if (req->bRequestType == 0x00 && req->bRequest == 9) { // SET_CONFIGURATION
io->length = 0;
handled = 1;
} else {
// ACK other standard requests (e.g. SET_ADDRESS)
io->length = 0;
handled = 1;
}
if (handled) {
if (req->bRequestType & 0x80) {
ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
free(io);
}
free(event);
}
// Give vub300_probe a moment to finish mmc_add_host
usleep(200000);
// Close fd to simulate USB disconnect
close(fd);
// Wait for the inactivity_timer to expire (it is set to jiffies + HZ)
sleep(2);
return 0;
}
```
|
| 87/5 |
2026/09/07 15:24 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 15194
output: 19
thoughts: 930
Thoughts: **My Thought Process on Diagnosing and Reproducing the RCU Bug**
I'm looking at this bug report: `WARNING: suspicious RCU usage in wakeup_source_unregister` and `BUG: sleeping function called from invalid context at kernel/rcu/srcutree.c:1472`. It's clearly indicating a problem with how RCU (Read-Copy Update) is being used, specifically in the context of unregistering a wakeup source.
The technical diagnosis points to the root cause: the `vub300_delete` function is being invoked from `vub300_inactivity_timer_expired`. The critical piece of information here is that `vub300_inactivity_timer_expired` is a timer callback, and timer callbacks execute in softirq context. This is where the conflict arises.
When `vub300_delete` is called, it subsequently calls `mmc_free_host()`. This function, as I understand it, drops the device reference count. This action then triggers `mmc_host_classdev_release()`. The key event within `mmc_host_classdev_release()` is that it unregisters the wakeup source, which in turn calls `synchronize_srcu()`.
Now, here's the critical flaw: `synchronize_srcu()` is a function that *can sleep*. And, as established, we're already in a softirq context. It is strictly forbidden to call a sleeping function from a softirq context in the Linux kernel. This is precisely what leads to the `BUG: sleeping function called from invalid context` error.
The user has provided a C reproducer that utilizes `/dev/raw-gadget` to emulate a USB device that matches the `vub300` driver's specific Vendor ID (0x0424) and Product ID (0x012C). The feedback from the previous attempt is encouraging: "The capability probe was successful. The environment is ready, and /dev/raw-gadget can be opened and initialized. Please proceed to generate the full reproducer in the next iteration." This means the basic setup for emulating the device is working.
My immediate thought is, "Wait, the user *already* provided a C reproducer in the prompt." I need to make sure I'm properly outputting that or using the `generate_reproducer` function if that's the intended workflow.
Then, I pause and remind myself of my role: "Wait, I am the AI." The prompt is asking me to *refine* the reproduction strategy based on the feedback and translate the technical diagnosis into concrete instructions for a repro-generator. It's not simply about spitting out existing code.
The feedback specifically states: "Please proceed to generate the full reproducer in the next iteration." This, combined with the earlier instruction to "Refine the reproduction strategy based on feedback... Analyze the technical diagnosis... and translate it into concrete, step-by-step instructions for the repro-generator," tells me I need to leverage the provided C code, understand the *implications* of the diagnosis, and guide the generation of the *complete* reproducer.
So, I need to review the C code the user provided. I see standard headers for file I/O, control structures, and some `ioctl` definitions related to `usb_raw`. I recognize the `struct usb_raw_init` and `struct usb_raw_event`, which are crucial for initializing and interacting with the raw gadget. I also see the `struct usb_ctrlrequest`, which is fundamental to USB control transfers.
However, a key observation arises: The `vub300` driver, as I recall, relies on specific endpoint configurations. To ensure the reproducer accurately targets the bug, I must verify that the endpoints used in the provided C code (or to be generated) align with what the `vub300` driver expects. I'll need to consult the `vub300` driver's source code to confirm these endpoint requirements. My next step would be to use tools like `codesearch-file-index` or `grepper` to locate `vub300.c` and examine its endpoint definitions. This verification is critical for creating a reproducer that reliably triggers the bug.
|
| 88/5 |
2026/09/07 15:24 |
tool |
grepper |
0m
Args:
Results: map[Output:
Full output is too long, showing 500 out of 1644 lines.
Use more precise expression if possible.
MAINTAINERS=29293=S: Orphan
MAINTAINERS:29294:F: drivers/mmc/host/vub300.c
MAINTAINERS-29295-
--
drivers/mmc/host/Kconfig=920=config MMC_VUB300
--
drivers/mmc/host/Kconfig-944- To compile this mmc host controller driver as a module,
drivers/mmc/host/Kconfig:945: choose M here: the module will be called vub300.
drivers/mmc/host/Kconfig-946-
--
drivers/mmc/host/Makefile=62=obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
drivers/mmc/host/Makefile:63:obj-$(CONFIG_MMC_VUB300) += vub300.o
drivers/mmc/host/Makefile-64-obj-$(CONFIG_MMC_USHC) += ushc.o
--
drivers/mmc/host/vub300.c=260=MODULE_PARM_DESC(firmware_rom_wait_states,
--
drivers/mmc/host/vub300.c-265-#define VUB300_PRODUCT_ID 0x012C
drivers/mmc/host/vub300.c:266:static const struct usb_device_id vub300_table[] = {
drivers/mmc/host/vub300.c-267- {USB_DEVICE(ELAN_VENDOR_ID, VUB300_PRODUCT_ID)},
--
drivers/mmc/host/vub300.c-270-};
drivers/mmc/host/vub300.c:271:MODULE_DEVICE_TABLE(usb, vub300_table);
drivers/mmc/host/vub300.c-272-
--
drivers/mmc/host/vub300.c=286=struct sdio_register {
--
drivers/mmc/host/vub300.c-295-
drivers/mmc/host/vub300.c:296:struct vub300_mmc_host {
drivers/mmc/host/vub300.c-297- struct usb_device *udev;
--
drivers/mmc/host/vub300.c-354-
drivers/mmc/host/vub300.c:355:#define kref_to_vub300_mmc_host(d) container_of(d, struct vub300_mmc_host, kref)
drivers/mmc/host/vub300.c-356-#define SET_TRANSFER_PSEUDOCODE 21
--
drivers/mmc/host/vub300.c-368-
drivers/mmc/host/vub300.c:369:static void vub300_delete(struct kref *kref)
drivers/mmc/host/vub300.c-370-{ /* kref callback - softirq */
drivers/mmc/host/vub300.c:371: struct vub300_mmc_host *vub300 = kref_to_vub300_mmc_host(kref);
drivers/mmc/host/vub300.c:372: struct mmc_host *mmc = vub300->mmc;
drivers/mmc/host/vub300.c-373-
drivers/mmc/host/vub300.c:374: usb_free_urb(vub300->command_out_urb);
drivers/mmc/host/vub300.c:375: vub300->command_out_urb = NULL;
drivers/mmc/host/vub300.c:376: usb_free_urb(vub300->command_res_urb);
drivers/mmc/host/vub300.c:377: vub300->command_res_urb = NULL;
drivers/mmc/host/vub300.c:378: usb_put_dev(vub300->udev);
drivers/mmc/host/vub300.c-379- mmc_free_host(mmc);
drivers/mmc/host/vub300.c-380- /*
drivers/mmc/host/vub300.c:381: * and hence also frees vub300
drivers/mmc/host/vub300.c-382- * which is contained at the end of struct mmc
--
drivers/mmc/host/vub300.c-385-
drivers/mmc/host/vub300.c:386:static void vub300_queue_cmnd_work(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-387-{
drivers/mmc/host/vub300.c:388: kref_get(&vub300->kref);
drivers/mmc/host/vub300.c:389: if (queue_work(cmndworkqueue, &vub300->cmndwork)) {
drivers/mmc/host/vub300.c-390- /*
--
drivers/mmc/host/vub300.c-401- */
drivers/mmc/host/vub300.c:402: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-403- }
--
drivers/mmc/host/vub300.c-405-
drivers/mmc/host/vub300.c:406:static void vub300_queue_poll_work(struct vub300_mmc_host *vub300, int delay)
drivers/mmc/host/vub300.c-407-{
drivers/mmc/host/vub300.c:408: kref_get(&vub300->kref);
drivers/mmc/host/vub300.c:409: if (queue_delayed_work(pollworkqueue, &vub300->pollwork, delay)) {
drivers/mmc/host/vub300.c-410- /*
--
drivers/mmc/host/vub300.c-421- */
drivers/mmc/host/vub300.c:422: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-423- }
--
drivers/mmc/host/vub300.c-425-
drivers/mmc/host/vub300.c:426:static void vub300_queue_dead_work(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-427-{
drivers/mmc/host/vub300.c:428: kref_get(&vub300->kref);
drivers/mmc/host/vub300.c:429: if (queue_work(deadworkqueue, &vub300->deadwork)) {
drivers/mmc/host/vub300.c-430- /*
--
drivers/mmc/host/vub300.c-441- */
drivers/mmc/host/vub300.c:442: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-443- }
--
drivers/mmc/host/vub300.c=446=static void irqpoll_res_completed(struct urb *urb)
drivers/mmc/host/vub300.c-447-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:448: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-449- if (urb->status)
drivers/mmc/host/vub300.c:450: vub300->usb_transport_fail = urb->status;
drivers/mmc/host/vub300.c:451: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-452-}
--
drivers/mmc/host/vub300.c=454=static void irqpoll_out_completed(struct urb *urb)
drivers/mmc/host/vub300.c-455-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:456: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-457- if (urb->status) {
drivers/mmc/host/vub300.c:458: vub300->usb_transport_fail = urb->status;
drivers/mmc/host/vub300.c:459: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-460- return;
--
drivers/mmc/host/vub300.c-463- unsigned int pipe =
drivers/mmc/host/vub300.c:464: usb_rcvbulkpipe(vub300->udev, vub300->cmnd_res_ep);
drivers/mmc/host/vub300.c:465: usb_fill_bulk_urb(vub300->command_res_urb, vub300->udev, pipe,
drivers/mmc/host/vub300.c:466: &vub300->resp, sizeof(vub300->resp),
drivers/mmc/host/vub300.c:467: irqpoll_res_completed, vub300);
drivers/mmc/host/vub300.c:468: vub300->command_res_urb->actual_length = 0;
drivers/mmc/host/vub300.c:469: ret = usb_submit_urb(vub300->command_res_urb, GFP_ATOMIC);
drivers/mmc/host/vub300.c-470- if (ret) {
drivers/mmc/host/vub300.c:471: vub300->usb_transport_fail = ret;
drivers/mmc/host/vub300.c:472: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-473- }
--
drivers/mmc/host/vub300.c-477-
drivers/mmc/host/vub300.c:478:static void send_irqpoll(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-479-{
drivers/mmc/host/vub300.c:480: /* cmd_mutex is held by vub300_pollwork_thread */
drivers/mmc/host/vub300.c-481- int retval;
drivers/mmc/host/vub300.c-482- int timeout = 0xFFFF & (0x0001FFFF - firmware_irqpoll_timeout);
drivers/mmc/host/vub300.c:483: vub300->cmnd.poll.header_size = 22;
drivers/mmc/host/vub300.c:484: vub300->cmnd.poll.header_type = 1;
drivers/mmc/host/vub300.c:485: vub300->cmnd.poll.port_number = 0;
drivers/mmc/host/vub300.c:486: vub300->cmnd.poll.command_type = 2;
drivers/mmc/host/vub300.c:487: vub300->cmnd.poll.poll_timeout_lsb = 0xFF & (unsigned)timeout;
drivers/mmc/host/vub300.c:488: vub300->cmnd.poll.poll_timeout_msb = 0xFF & (unsigned)(timeout >> 8);
drivers/mmc/host/vub300.c:489: usb_fill_bulk_urb(vub300->command_out_urb, vub300->udev,
drivers/mmc/host/vub300.c:490: usb_sndbulkpipe(vub300->udev, vub300->cmnd_out_ep)
drivers/mmc/host/vub300.c:491: , &vub300->cmnd, sizeof(vub300->cmnd)
drivers/mmc/host/vub300.c:492: , irqpoll_out_completed, vub300);
drivers/mmc/host/vub300.c:493: retval = usb_submit_urb(vub300->command_out_urb, GFP_KERNEL);
drivers/mmc/host/vub300.c-494- if (0 > retval) {
drivers/mmc/host/vub300.c:495: vub300->usb_transport_fail = retval;
drivers/mmc/host/vub300.c:496: vub300_queue_poll_work(vub300, 1);
drivers/mmc/host/vub300.c:497: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-498- return;
--
drivers/mmc/host/vub300.c-503-
drivers/mmc/host/vub300.c:504:static void new_system_port_status(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-505-{
drivers/mmc/host/vub300.c:506: int old_card_present = vub300->card_present;
drivers/mmc/host/vub300.c-507- int new_card_present =
drivers/mmc/host/vub300.c:508: (0x0001 & vub300->system_port_status.port_flags) ? 1 : 0;
drivers/mmc/host/vub300.c:509: vub300->read_only =
drivers/mmc/host/vub300.c:510: (0x0010 & vub300->system_port_status.port_flags) ? 1 : 0;
drivers/mmc/host/vub300.c-511- if (new_card_present && !old_card_present) {
drivers/mmc/host/vub300.c:512: dev_info(&vub300->udev->dev, "card just inserted\n");
drivers/mmc/host/vub300.c:513: vub300->card_present = 1;
drivers/mmc/host/vub300.c:514: vub300->bus_width = 0;
drivers/mmc/host/vub300.c-515- if (disable_offload_processing)
drivers/mmc/host/vub300.c:516: strscpy(vub300->vub_name, "EMPTY Processing Disabled",
drivers/mmc/host/vub300.c:517: sizeof(vub300->vub_name));
drivers/mmc/host/vub300.c-518- else
drivers/mmc/host/vub300.c:519: vub300->vub_name[0] = 0;
drivers/mmc/host/vub300.c:520: mmc_detect_change(vub300->mmc, 1);
drivers/mmc/host/vub300.c-521- } else if (!new_card_present && old_card_present) {
drivers/mmc/host/vub300.c:522: dev_info(&vub300->udev->dev, "card just ejected\n");
drivers/mmc/host/vub300.c:523: vub300->card_present = 0;
drivers/mmc/host/vub300.c:524: mmc_detect_change(vub300->mmc, 0);
drivers/mmc/host/vub300.c-525- } else {
--
drivers/mmc/host/vub300.c-529-
drivers/mmc/host/vub300.c:530:static void __add_offloaded_reg_to_fifo(struct vub300_mmc_host *vub300,
drivers/mmc/host/vub300.c-531- struct offload_registers_access
--
drivers/mmc/host/vub300.c-533-{
drivers/mmc/host/vub300.c:534: u8 r = vub300->fn[func].offload_point + vub300->fn[func].offload_count;
drivers/mmc/host/vub300.c:535: memcpy(&vub300->fn[func].reg[MAXREGMASK & r], register_access,
drivers/mmc/host/vub300.c-536- sizeof(struct offload_registers_access));
drivers/mmc/host/vub300.c:537: vub300->fn[func].offload_count += 1;
drivers/mmc/host/vub300.c:538: vub300->total_offload_count += 1;
drivers/mmc/host/vub300.c-539-}
drivers/mmc/host/vub300.c-540-
drivers/mmc/host/vub300.c:541:static void add_offloaded_reg(struct vub300_mmc_host *vub300,
drivers/mmc/host/vub300.c-542- struct offload_registers_access *register_access)
--
drivers/mmc/host/vub300.c-547- u8 func = ((0x70 & register_access->command_byte[0]) >> 4);
drivers/mmc/host/vub300.c:548: u8 regs = vub300->dynamic_register_count;
drivers/mmc/host/vub300.c-549- u8 i = 0;
drivers/mmc/host/vub300.c:550: while (0 < regs-- && 1 == vub300->sdio_register[i].activate) {
drivers/mmc/host/vub300.c:551: if (vub300->sdio_register[i].func_num == func &&
drivers/mmc/host/vub300.c:552: vub300->sdio_register[i].sdio_reg == Register) {
drivers/mmc/host/vub300.c:553: if (vub300->sdio_register[i].prepared == 0)
drivers/mmc/host/vub300.c:554: vub300->sdio_register[i].prepared = 1;
drivers/mmc/host/vub300.c:555: vub300->sdio_register[i].response =
drivers/mmc/host/vub300.c-556- register_access->Respond_Byte[2];
drivers/mmc/host/vub300.c:557: vub300->sdio_register[i].regvalue =
drivers/mmc/host/vub300.c-558- register_access->Respond_Byte[3];
--
drivers/mmc/host/vub300.c-564- }
drivers/mmc/host/vub300.c:565: __add_offloaded_reg_to_fifo(vub300, register_access, func);
drivers/mmc/host/vub300.c-566-}
drivers/mmc/host/vub300.c-567-
drivers/mmc/host/vub300.c:568:static void check_vub300_port_status(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-569-{
drivers/mmc/host/vub300.c-570- /*
drivers/mmc/host/vub300.c:571: * cmd_mutex is held by vub300_pollwork_thread,
drivers/mmc/host/vub300.c:572: * vub300_deadwork_thread or vub300_cmndwork_thread
drivers/mmc/host/vub300.c-573- */
--
drivers/mmc/host/vub300.c-575- retval =
drivers/mmc/host/vub300.c:576: usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
drivers/mmc/host/vub300.c-577- GET_SYSTEM_PORT_STATUS,
drivers/mmc/host/vub300.c-578- USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
drivers/mmc/host/vub300.c:579: 0x0000, 0x0000, &vub300->system_port_status,
drivers/mmc/host/vub300.c:580: sizeof(vub300->system_port_status), 1000);
drivers/mmc/host/vub300.c:581: if (sizeof(vub300->system_port_status) == retval)
drivers/mmc/host/vub300.c:582: new_system_port_status(vub300);
drivers/mmc/host/vub300.c-583-}
drivers/mmc/host/vub300.c-584-
drivers/mmc/host/vub300.c:585:static void __vub300_irqpoll_response(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-586-{
drivers/mmc/host/vub300.c:587: /* cmd_mutex is held by vub300_pollwork_thread */
drivers/mmc/host/vub300.c:588: if (vub300->command_res_urb->actual_length == 0)
drivers/mmc/host/vub300.c-589- return;
drivers/mmc/host/vub300.c-590-
drivers/mmc/host/vub300.c:591: switch (vub300->resp.common.header_type) {
drivers/mmc/host/vub300.c-592- case RESPONSE_INTERRUPT:
drivers/mmc/host/vub300.c:593: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:594: if (vub300->irq_enabled)
drivers/mmc/host/vub300.c:595: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c-596- else
drivers/mmc/host/vub300.c:597: vub300->irqs_queued += 1;
drivers/mmc/host/vub300.c:598: vub300->irq_disabled = 1;
drivers/mmc/host/vub300.c:599: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c-600- break;
drivers/mmc/host/vub300.c-601- case RESPONSE_ERROR:
drivers/mmc/host/vub300.c:602: if (vub300->resp.error.error_code == SD_ERROR_NO_DEVICE)
drivers/mmc/host/vub300.c:603: check_vub300_port_status(vub300);
drivers/mmc/host/vub300.c-604- break;
drivers/mmc/host/vub300.c-605- case RESPONSE_STATUS:
drivers/mmc/host/vub300.c:606: vub300->system_port_status = vub300->resp.status;
drivers/mmc/host/vub300.c:607: new_system_port_status(vub300);
drivers/mmc/host/vub300.c:608: if (!vub300->card_present)
drivers/mmc/host/vub300.c:609: vub300_queue_poll_work(vub300, HZ / 5);
drivers/mmc/host/vub300.c-610- break;
--
drivers/mmc/host/vub300.c-612- {
drivers/mmc/host/vub300.c:613: int offloaded_data_length = vub300->resp.common.header_size - 3;
drivers/mmc/host/vub300.c-614- int register_count = offloaded_data_length >> 3;
--
drivers/mmc/host/vub300.c-616- while (register_count--) {
drivers/mmc/host/vub300.c:617: add_offloaded_reg(vub300, &vub300->resp.irq.reg[ri]);
drivers/mmc/host/vub300.c-618- ri += 1;
drivers/mmc/host/vub300.c-619- }
drivers/mmc/host/vub300.c:620: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:621: if (vub300->irq_enabled)
drivers/mmc/host/vub300.c:622: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c-623- else
drivers/mmc/host/vub300.c:624: vub300->irqs_queued += 1;
drivers/mmc/host/vub300.c:625: vub300->irq_disabled = 1;
drivers/mmc/host/vub300.c:626: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c-627- break;
--
drivers/mmc/host/vub300.c-630- {
drivers/mmc/host/vub300.c:631: int offloaded_data_length = vub300->resp.common.header_size - 3;
drivers/mmc/host/vub300.c-632- int register_count = offloaded_data_length >> 3;
--
drivers/mmc/host/vub300.c-634- while (register_count--) {
drivers/mmc/host/vub300.c:635: add_offloaded_reg(vub300, &vub300->resp.irq.reg[ri]);
drivers/mmc/host/vub300.c-636- ri += 1;
drivers/mmc/host/vub300.c-637- }
drivers/mmc/host/vub300.c:638: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:639: if (vub300->irq_enabled)
drivers/mmc/host/vub300.c:640: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c-641- else
drivers/mmc/host/vub300.c:642: vub300->irqs_queued += 1;
drivers/mmc/host/vub300.c:643: vub300->irq_disabled = 0;
drivers/mmc/host/vub300.c:644: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c-645- break;
--
drivers/mmc/host/vub300.c-647- case RESPONSE_NO_INTERRUPT:
drivers/mmc/host/vub300.c:648: vub300_queue_poll_work(vub300, 1);
drivers/mmc/host/vub300.c-649- break;
--
drivers/mmc/host/vub300.c-654-
drivers/mmc/host/vub300.c:655:static void __do_poll(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-656-{
drivers/mmc/host/vub300.c:657: /* cmd_mutex is held by vub300_pollwork_thread */
drivers/mmc/host/vub300.c-658- unsigned long commretval;
drivers/mmc/host/vub300.c:659: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c:660: init_completion(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c:661: send_irqpoll(vub300);
drivers/mmc/host/vub300.c:662: commretval = wait_for_completion_timeout(&vub300->irqpoll_complete,
drivers/mmc/host/vub300.c-663- msecs_to_jiffies(500));
drivers/mmc/host/vub300.c:664: if (vub300->usb_transport_fail) {
drivers/mmc/host/vub300.c-665- /* no need to do anything */
drivers/mmc/host/vub300.c-666- } else if (commretval == 0) {
drivers/mmc/host/vub300.c:667: vub300->usb_timed_out = 1;
drivers/mmc/host/vub300.c:668: usb_kill_urb(vub300->command_out_urb);
drivers/mmc/host/vub300.c:669: usb_kill_urb(vub300->command_res_urb);
drivers/mmc/host/vub300.c-670- } else { /* commretval > 0 */
drivers/mmc/host/vub300.c:671: __vub300_irqpoll_response(vub300);
drivers/mmc/host/vub300.c-672- }
--
drivers/mmc/host/vub300.c-677- */
drivers/mmc/host/vub300.c:678:static void vub300_pollwork_thread(struct work_struct *work)
drivers/mmc/host/vub300.c-679-{ /* NOT irq */
drivers/mmc/host/vub300.c:680: struct vub300_mmc_host *vub300 = container_of(work,
drivers/mmc/host/vub300.c:681: struct vub300_mmc_host, pollwork.work);
drivers/mmc/host/vub300.c:682: if (!vub300->interface) {
drivers/mmc/host/vub300.c:683: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-684- return;
drivers/mmc/host/vub300.c-685- }
drivers/mmc/host/vub300.c:686: mutex_lock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:687: if (vub300->cmd) {
drivers/mmc/host/vub300.c:688: vub300_queue_poll_work(vub300, 1);
drivers/mmc/host/vub300.c:689: } else if (!vub300->card_present) {
drivers/mmc/host/vub300.c-690- /* no need to do anything */
drivers/mmc/host/vub300.c:691: } else { /* vub300->card_present */
drivers/mmc/host/vub300.c:692: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:693: if (!vub300->irq_enabled) {
drivers/mmc/host/vub300.c:694: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:695: } else if (vub300->irqs_queued) {
drivers/mmc/host/vub300.c:696: vub300->irqs_queued -= 1;
drivers/mmc/host/vub300.c:697: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c:698: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c:699: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:700: } else { /* NOT vub300->irqs_queued */
drivers/mmc/host/vub300.c:701: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:702: __do_poll(vub300);
drivers/mmc/host/vub300.c-703- }
drivers/mmc/host/vub300.c-704- }
drivers/mmc/host/vub300.c:705: mutex_unlock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:706: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-707-}
drivers/mmc/host/vub300.c-708-
drivers/mmc/host/vub300.c:709:static void vub300_deadwork_thread(struct work_struct *work)
drivers/mmc/host/vub300.c-710-{ /* NOT irq */
drivers/mmc/host/vub300.c:711: struct vub300_mmc_host *vub300 =
drivers/mmc/host/vub300.c:712: container_of(work, struct vub300_mmc_host, deadwork);
drivers/mmc/host/vub300.c:713: if (!vub300->interface) {
drivers/mmc/host/vub300.c:714: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-715- return;
drivers/mmc/host/vub300.c-716- }
drivers/mmc/host/vub300.c:717: mutex_lock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:718: if (vub300->cmd) {
drivers/mmc/host/vub300.c-719- /*
--
drivers/mmc/host/vub300.c-724- */
drivers/mmc/host/vub300.c:725: } else if (vub300->card_present) {
drivers/mmc/host/vub300.c:726: check_vub300_port_status(vub300);
drivers/mmc/host/vub300.c:727: } else if (vub300->mmc && vub300->mmc->card) {
drivers/mmc/host/vub300.c-728- /*
--
drivers/mmc/host/vub300.c-734- } else {
drivers/mmc/host/vub300.c:735: check_vub300_port_status(vub300);
drivers/mmc/host/vub300.c-736- }
drivers/mmc/host/vub300.c:737: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c:738: mutex_unlock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:739: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-740-}
drivers/mmc/host/vub300.c-741-
drivers/mmc/host/vub300.c:742:static void vub300_inactivity_timer_expired(struct timer_list *t)
drivers/mmc/host/vub300.c-743-{ /* softirq */
drivers/mmc/host/vub300.c:744: struct vub300_mmc_host *vub300 = timer_container_of(vub300, t,
drivers/mmc/host/vub300.c-745- inactivity_timer);
drivers/mmc/host/vub300.c:746: if (!vub300->interface) {
drivers/mmc/host/vub300.c:747: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c:748: } else if (vub300->cmd) {
drivers/mmc/host/vub300.c:749: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-750- } else {
drivers/mmc/host/vub300.c:751: vub300_queue_dead_work(vub300);
drivers/mmc/host/vub300.c:752: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-753- }
--
drivers/mmc/host/vub300.c-755-
drivers/mmc/host/vub300.c:756:static int vub300_response_error(u8 error_code)
drivers/mmc/host/vub300.c-757-{
--
drivers/mmc/host/vub300.c=792=static void command_res_completed(struct urb *urb)
drivers/mmc/host/vub300.c-793-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:794: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-795- if (urb->status) {
drivers/mmc/host/vub300.c-796- /* we have to let the initiator handle the error */
drivers/mmc/host/vub300.c:797: } else if (vub300->command_res_urb->actual_length == 0) {
drivers/mmc/host/vub300.c-798- /*
--
drivers/mmc/host/vub300.c-801- */
drivers/mmc/host/vub300.c:802: } else if (!vub300->data) {
drivers/mmc/host/vub300.c-803- /* this means that the command (typically CMD52) succeeded */
drivers/mmc/host/vub300.c:804: } else if (vub300->resp.common.header_type != 0x02) {
drivers/mmc/host/vub300.c-805- /*
--
drivers/mmc/host/vub300.c-808- */
drivers/mmc/host/vub300.c:809: } else if (vub300->urb) {
drivers/mmc/host/vub300.c:810: vub300->cmd->error =
drivers/mmc/host/vub300.c:811: vub300_response_error(vub300->resp.error.error_code);
drivers/mmc/host/vub300.c:812: usb_unlink_urb(vub300->urb);
drivers/mmc/host/vub300.c-813- } else {
drivers/mmc/host/vub300.c:814: vub300->cmd->error =
drivers/mmc/host/vub300.c:815: vub300_response_error(vub300->resp.error.error_code);
drivers/mmc/host/vub300.c:816: usb_sg_cancel(&vub300->sg_request);
drivers/mmc/host/vub300.c-817- }
drivers/mmc/host/vub300.c:818: complete(&vub300->command_complete); /* got_response_in */
drivers/mmc/host/vub300.c-819-}
--
drivers/mmc/host/vub300.c=821=static void command_out_completed(struct urb *urb)
drivers/mmc/host/vub300.c-822-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:823: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-824- if (urb->status) {
drivers/mmc/host/vub300.c:825: complete(&vub300->command_complete);
drivers/mmc/host/vub300.c-826- } else {
--
drivers/mmc/host/vub300.c-828- unsigned int pipe =
drivers/mmc/host/vub300.c:829: usb_rcvbulkpipe(vub300->udev, vub300->cmnd_res_ep);
drivers/mmc/host/vub300.c:830: usb_fill_bulk_urb(vub300->command_res_urb, vub300->udev, pipe,
drivers/mmc/host/vub300.c:831: &vub300->resp, sizeof(vub300->resp),
drivers/mmc/host/vub300.c:832: command_res_completed, vub300);
drivers/mmc/host/vub300.c:833: vub300->command_res_urb->actual_length = 0;
drivers/mmc/host/vub300.c:834: ret = usb_submit_urb(vub300->command_res_urb, GFP_ATOMIC);
drivers/mmc/host/vub300.c-835- if (ret == 0) {
--
drivers/mmc/host/vub300.c-844- */
drivers/mmc/host/vub300.c:845: complete(&vub300->command_complete);
drivers/mmc/host/vub300.c-846- }
--
drivers/mmc/host/vub300.c-852- */
drivers/mmc/host/vub300.c:853:static void snoop_block_size_and_bus_width(struct vub300_mmc_host *vub300,
drivers/mmc/host/vub300.c-854- u32 cmd_arg)
--
drivers/mmc/host/vub300.c-856- if ((0xFBFFFE00 & cmd_arg) == 0x80022200)
drivers/mmc/host/vub300.c:857: vub300->fbs[1] = (cmd_arg << 8) | (0x00FF & vub300->fbs[1]);
drivers/mmc/host/vub300.c-858- else if ((0xFBFFFE00 & cmd_arg) == 0x80022000)
drivers/mmc/host/vub300.c:859: vub300->fbs[1] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[1]);
drivers/mmc/host/vub300.c-860- else if ((0xFBFFFE00 & cmd_arg) == 0x80042200)
drivers/mmc/host/vub300.c:861: vub300->fbs[2] = (cmd_arg << 8) | (0x00FF & vub300->fbs[2]);
drivers/mmc/host/vub300.c-862- else if ((0xFBFFFE00 & cmd_arg) == 0x80042000)
drivers/mmc/host/vub300.c:863: vub300->fbs[2] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[2]);
drivers/mmc/host/vub300.c-864- else if ((0xFBFFFE00 & cmd_arg) == 0x80062200)
drivers/mmc/host/vub300.c:865: vub300->fbs[3] = (cmd_arg << 8) | (0x00FF & vub300->fbs[3]);
drivers/mmc/host/vub300.c-866- else if ((0xFBFFFE00 & cmd_arg) == 0x80062000)
drivers/mmc/host/vub300.c:867: vub300->fbs[3] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[3]);
drivers/mmc/host/vub300.c-868- else if ((0xFBFFFE00 & cmd_arg) == 0x80082200)
drivers/mmc/host/vub300.c:869: vub300->fbs[4] = (cmd_arg << 8) | (0x00FF & vub300->fbs[4]);
drivers/mmc/host/vub300.c-870- else if ((0xFBFFFE00 & cmd_arg) == 0x80082000)
drivers/mmc/host/vub300.c:871: vub300->fbs[4] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[4]);
drivers/mmc/host/vub300.c-872- else if ((0xFBFFFE00 & cmd_arg) == 0x800A2200)
drivers/mmc/host/vub300.c:873: vub300->fbs[5] = (cmd_arg << 8) | (0x00FF & vub300->fbs[5]);
drivers/mmc/host/vub300.c-874- else if ((0xFBFFFE00 & cmd_arg) == 0x800A2000)
drivers/mmc/host/vub300.c:875: vub300->fbs[5] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[5]);
drivers/mmc/host/vub300.c-876- else if ((0xFBFFFE00 & cmd_arg) == 0x800C2200)
drivers/mmc/host/vub300.c:877: vub300->fbs[6] = (cmd_arg << 8) | (0x00FF & vub300->fbs[6]);
drivers/mmc/host/vub300.c-878- else if ((0xFBFFFE00 & cmd_arg) == 0x800C2000)
drivers/mmc/host/vub300.c:879: vub300->fbs[6] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[6]);
drivers/mmc/host/vub300.c-880- else if ((0xFBFFFE00 & cmd_arg) == 0x800E2200)
drivers/mmc/host/vub300.c:881: vub300->fbs[7] = (cmd_arg << 8) | (0x00FF & vub300->fbs[7]);
drivers/mmc/host/vub300.c-882- else if ((0xFBFFFE00 & cmd_arg) == 0x800E2000)
drivers/mmc/host/vub300.c:883: vub300->fbs[7] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[7]);
drivers/mmc/host/vub300.c-884- else if ((0xFBFFFE03 & cmd_arg) == 0x80000E00)
drivers/mmc/host/vub300.c:885: vub300->bus_width = 1;
drivers/mmc/host/vub300.c-886- else if ((0xFBFFFE03 & cmd_arg) == 0x80000E02)
drivers/mmc/host/vub300.c:887: vub300->bus_width = 4;
drivers/mmc/host/vub300.c-888-}
drivers/mmc/host/vub300.c-889-
drivers/mmc/host/vub300.c:890:static void send_command(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-891-{
drivers/mmc/host/vub300.c:892: /* cmd_mutex is held by vub300_cmndwork_thread */
drivers/mmc/host/vub300.c:893: struct mmc_command *cmd = vub300->cmd;
drivers/mmc/host/vub300.c:894: struct mmc_data *data = vub300->data;
drivers/mmc/host/vub300.c-895- int retval;
--
drivers/mmc/host/vub300.c-897- u8 response_type;
drivers/mmc/host/vub300.c:898: if (vub300->app_spec) {
drivers/mmc/host/vub300.c-899- switch (cmd->opcode) {
--
drivers/mmc/host/vub300.c-901- response_type = SDRT_1;
drivers/mmc/host/vub300.c:902: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-903- if (0x00000000 == (0x00000003 & cmd->arg))
drivers/mmc/host/vub300.c:904: vub300->bus_width = 1;
drivers/mmc/host/vub300.c-905- else if (0x00000002 == (0x00000003 & cmd->arg))
drivers/mmc/host/vub300.c:906: vub300->bus_width = 4;
drivers/mmc/host/vub300.c-907- else
drivers/mmc/host/vub300.c:908: dev_err(&vub300->udev->dev,
drivers/mmc/host/vub300.c-909- "unexpected ACMD6 bus_width=%d\n",
--
drivers/mmc/host/vub300.c-913- response_type = SDRT_1;
drivers/mmc/host/vub300.c:914: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-915- break;
--
drivers/mmc/host/vub300.c-917- response_type = SDRT_1;
drivers/mmc/host/vub300.c:918: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-919- break;
--
drivers/mmc/host/vub300.c-921- response_type = SDRT_1;
drivers/mmc/host/vub300.c:922: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-923- break;
--
drivers/mmc/host/vub300.c-925- response_type = SDRT_3;
drivers/mmc/host/vub300.c:926: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-927- break;
--
drivers/mmc/host/vub300.c-929- response_type = SDRT_1;
drivers/mmc/host/vub300.c:930: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-931- break;
--
drivers/mmc/host/vub300.c-933- response_type = SDRT_1;
drivers/mmc/host/vub300.c:934: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-935- break;
--
drivers/mmc/host/vub300.c-937- response_type = SDRT_1;
drivers/mmc/host/vub300.c:938: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-939- break;
]
|
| 89/5 |
2026/09/07 15:24 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 31807
output: 45
thoughts: 67
Thoughts: **My Thought Process Regarding the `vub300` Driver Endpoint Initialization**
Alright, so I'm looking at the `vub300` driver, and the first thing that stands out is its dependency on a specific set of USB endpoints. My mind immediately flags these: `cmnd_out_ep`, `cmnd_res_ep`, `data_out_ep`, and `data_in_ep`. These aren't just arbitrary labels; they represent distinct communication channels – command output, command response, data output, and data input. For this driver to function, it *must* successfully locate and utilize each of these.
My next logical step, given this prerequisite, is to understand *how* the driver goes about acquiring these necessary endpoints. This leads me directly to examining the `vub300_probe` function. The `probe` function in a device driver is, after all, the primary place where device-specific resources, including USB endpoints, are identified and initialized during the device detection and attachment process. I'm looking for the code within `vub300_probe` that enumerates the device's endpoint descriptors and then maps them to the driver's internal representation, ensuring that each of the four required endpoints is correctly discovered and allocated. This is the critical handshake that allows the driver to establish communication with the hardware.
|
| 90/5 |
2026/09/07 15:24 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_probe]
Results: map[SourceCode:2092: static int vub300_probe(struct usb_interface *interface,
2093: const struct usb_device_id *id)
2094: { /* NOT irq */
2095: struct vub300_mmc_host *vub300;
2096: struct usb_host_interface *iface_desc;
2097: struct usb_device *udev = usb_get_dev(interface_to_usbdev(interface));
2098: int i;
2099: int retval = -ENOMEM;
2100: struct urb *command_out_urb;
2101: struct urb *command_res_urb;
2102: struct mmc_host *mmc;
2103: char manufacturer[48];
2104: char product[32];
2105: char serial_number[32];
2106: usb_string(udev, udev->descriptor.iManufacturer, manufacturer,
2107: sizeof(manufacturer));
2108: usb_string(udev, udev->descriptor.iProduct, product, sizeof(product));
2109: usb_string(udev, udev->descriptor.iSerialNumber, serial_number,
2110: sizeof(serial_number));
2111: dev_info(&udev->dev, "probing VID:PID(%04X:%04X) %s %s %s\n",
2112: le16_to_cpu(udev->descriptor.idVendor),
2113: le16_to_cpu(udev->descriptor.idProduct),
2114: manufacturer, product, serial_number);
2115: command_out_urb = usb_alloc_urb(0, GFP_KERNEL);
2116: if (!command_out_urb) {
2117: retval = -ENOMEM;
2118: goto err_put_udev;
2119: }
2120: command_res_urb = usb_alloc_urb(0, GFP_KERNEL);
2121: if (!command_res_urb) {
2122: retval = -ENOMEM;
2123: goto err_free_out_urb;
2124: }
2125: /* this also allocates memory for our VUB300 mmc host device */
2126: mmc = mmc_alloc_host(sizeof(*vub300), &udev->dev);
2127: if (!mmc) {
2128: retval = -ENOMEM;
2129: dev_err(&udev->dev, "not enough memory for the mmc_host\n");
2130: goto err_free_res_urb;
2131: }
2132: /* MMC core transfer sizes tunable parameters */
2133: mmc->caps = 0;
2134: if (!force_1_bit_data_xfers)
2135: mmc->caps |= MMC_CAP_4_BIT_DATA;
2136: if (!force_polling_for_irqs)
2137: mmc->caps |= MMC_CAP_SDIO_IRQ;
2138: mmc->caps &= ~MMC_CAP_NEEDS_POLL;
2139: /*
2140: * MMC_CAP_NEEDS_POLL causes core.c:mmc_rescan() to poll
2141: * for devices which results in spurious CMD7's being
2142: * issued which stops some SDIO cards from working
2143: */
2144: if (limit_speed_to_24_MHz) {
2145: mmc->caps |= MMC_CAP_MMC_HIGHSPEED;
2146: mmc->caps |= MMC_CAP_SD_HIGHSPEED;
2147: mmc->f_max = 24000000;
2148: dev_info(&udev->dev, "limiting SDIO speed to 24_MHz\n");
2149: } else {
2150: mmc->caps |= MMC_CAP_MMC_HIGHSPEED;
2151: mmc->caps |= MMC_CAP_SD_HIGHSPEED;
2152: mmc->f_max = 48000000;
2153: }
2154: mmc->f_min = 200000;
2155: mmc->max_blk_count = 511;
2156: mmc->max_blk_size = 512;
2157: mmc->max_segs = 128;
2158: if (force_max_req_size)
2159: mmc->max_req_size = force_max_req_size * 1024;
2160: else
2161: mmc->max_req_size = 64 * 1024;
2162: mmc->max_seg_size = mmc->max_req_size;
2163: mmc->ocr_avail = 0;
2164: mmc->ocr_avail |= MMC_VDD_165_195;
2165: mmc->ocr_avail |= MMC_VDD_20_21;
2166: mmc->ocr_avail |= MMC_VDD_21_22;
2167: mmc->ocr_avail |= MMC_VDD_22_23;
2168: mmc->ocr_avail |= MMC_VDD_23_24;
2169: mmc->ocr_avail |= MMC_VDD_24_25;
2170: mmc->ocr_avail |= MMC_VDD_25_26;
2171: mmc->ocr_avail |= MMC_VDD_26_27;
2172: mmc->ocr_avail |= MMC_VDD_27_28;
2173: mmc->ocr_avail |= MMC_VDD_28_29;
2174: mmc->ocr_avail |= MMC_VDD_29_30;
2175: mmc->ocr_avail |= MMC_VDD_30_31;
2176: mmc->ocr_avail |= MMC_VDD_31_32;
2177: mmc->ocr_avail |= MMC_VDD_32_33;
2178: mmc->ocr_avail |= MMC_VDD_33_34;
2179: mmc->ocr_avail |= MMC_VDD_34_35;
2180: mmc->ocr_avail |= MMC_VDD_35_36;
2181: mmc->ops = &vub300_mmc_ops;
2182: vub300 = mmc_priv(mmc);
2183: vub300->mmc = mmc;
2184: vub300->card_powered = 0;
2185: vub300->bus_width = 0;
2186: vub300->cmnd.head.block_size[0] = 0x00;
2187: vub300->cmnd.head.block_size[1] = 0x00;
2188: vub300->app_spec = 0;
2189: mutex_init(&vub300->cmd_mutex);
2190: mutex_init(&vub300->irq_mutex);
2191: vub300->command_out_urb = command_out_urb;
2192: vub300->command_res_urb = command_res_urb;
2193: vub300->usb_timed_out = 0;
2194: vub300->dynamic_register_count = 0;
2195:
2196: for (i = 0; i < ARRAY_SIZE(vub300->fn); i++) {
2197: vub300->fn[i].offload_point = 0;
2198: vub300->fn[i].offload_count = 0;
2199: }
2200:
2201: vub300->total_offload_count = 0;
2202: vub300->irq_enabled = 0;
2203: vub300->irq_disabled = 0;
2204: vub300->irqs_queued = 0;
2205:
2206: for (i = 0; i < ARRAY_SIZE(vub300->sdio_register); i++)
2207: vub300->sdio_register[i++].activate = 0;
2208:
2209: vub300->udev = udev;
2210: vub300->interface = interface;
2211: vub300->cmnd_res_ep = 0;
2212: vub300->cmnd_out_ep = 0;
2213: vub300->data_inp_ep = 0;
2214: vub300->data_out_ep = 0;
2215:
2216: for (i = 0; i < ARRAY_SIZE(vub300->fbs); i++)
2217: vub300->fbs[i] = 512;
2218:
2219: /*
2220: * set up the endpoint information
2221: *
2222: * use the first pair of bulk-in and bulk-out
2223: * endpoints for Command/Response+Interrupt
2224: *
2225: * use the second pair of bulk-in and bulk-out
2226: * endpoints for Data In/Out
2227: */
2228: vub300->large_usb_packets = 0;
2229: iface_desc = interface->cur_altsetting;
2230: for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
2231: struct usb_endpoint_descriptor *endpoint =
2232: &iface_desc->endpoint[i].desc;
2233: dev_info(&vub300->udev->dev,
2234: "vub300 testing %s EndPoint(%d) %02X\n",
2235: usb_endpoint_is_bulk_in(endpoint) ? "BULK IN" :
2236: usb_endpoint_is_bulk_out(endpoint) ? "BULK OUT" :
2237: "UNKNOWN", i, endpoint->bEndpointAddress);
2238: if (endpoint->wMaxPacketSize > 64)
2239: vub300->large_usb_packets = 1;
2240: if (usb_endpoint_is_bulk_in(endpoint)) {
2241: if (!vub300->cmnd_res_ep) {
2242: vub300->cmnd_res_ep =
2243: endpoint->bEndpointAddress;
2244: } else if (!vub300->data_inp_ep) {
2245: vub300->data_inp_ep =
2246: endpoint->bEndpointAddress;
2247: } else {
2248: dev_warn(&vub300->udev->dev,
2249: "ignoring"
2250: " unexpected bulk_in endpoint");
2251: }
2252: } else if (usb_endpoint_is_bulk_out(endpoint)) {
2253: if (!vub300->cmnd_out_ep) {
2254: vub300->cmnd_out_ep =
2255: endpoint->bEndpointAddress;
2256: } else if (!vub300->data_out_ep) {
2257: vub300->data_out_ep =
2258: endpoint->bEndpointAddress;
2259: } else {
2260: dev_warn(&vub300->udev->dev,
2261: "ignoring"
2262: " unexpected bulk_out endpoint");
2263: }
2264: } else {
2265: dev_warn(&vub300->udev->dev,
2266: "vub300 ignoring EndPoint(%d) %02X", i,
2267: endpoint->bEndpointAddress);
2268: }
2269: }
2270: if (vub300->cmnd_res_ep && vub300->cmnd_out_ep &&
2271: vub300->data_inp_ep && vub300->data_out_ep) {
2272: dev_info(&vub300->udev->dev,
2273: "vub300 %s packets"
2274: " using EndPoints %02X %02X %02X %02X\n",
2275: vub300->large_usb_packets ? "LARGE" : "SMALL",
2276: vub300->cmnd_out_ep, vub300->cmnd_res_ep,
2277: vub300->data_out_ep, vub300->data_inp_ep);
2278: /* we have the expected EndPoints */
2279: } else {
2280: dev_err(&vub300->udev->dev,
2281: "Could not find two sets of bulk-in/out endpoint pairs\n");
2282: retval = -EINVAL;
2283: goto err_free_host;
2284: }
2285: retval =
2286: usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
2287: GET_HC_INF0,
2288: USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2289: 0x0000, 0x0000, &vub300->hc_info,
2290: sizeof(vub300->hc_info), 1000);
2291: if (retval < 0)
2292: goto err_free_host;
2293: retval =
2294: usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0),
2295: SET_ROM_WAIT_STATES,
2296: USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2297: firmware_rom_wait_states, 0x0000, NULL, 0, 1000);
2298: if (retval < 0)
2299: goto err_free_host;
2300: dev_info(&vub300->udev->dev,
2301: "operating_mode = %s %s %d MHz %s %d byte USB packets\n",
2302: (mmc->caps & MMC_CAP_SDIO_IRQ) ? "IRQs" : "POLL",
2303: (mmc->caps & MMC_CAP_4_BIT_DATA) ? "4-bit" : "1-bit",
2304: mmc->f_max / 1000000,
2305: pad_input_to_usb_pkt ? "padding input data to" : "with",
2306: vub300->large_usb_packets ? 512 : 64);
2307: retval =
2308: usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
2309: GET_SYSTEM_PORT_STATUS,
2310: USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2311: 0x0000, 0x0000, &vub300->system_port_status,
2312: sizeof(vub300->system_port_status), 1000);
2313: if (retval < 0) {
2314: goto err_free_host;
2315: } else if (sizeof(vub300->system_port_status) == retval) {
2316: vub300->card_present =
2317: (0x0001 & vub300->system_port_status.port_flags) ? 1 : 0;
2318: vub300->read_only =
2319: (0x0010 & vub300->system_port_status.port_flags) ? 1 : 0;
2320: } else {
2321: retval = -EINVAL;
2322: goto err_free_host;
2323: }
2324: usb_set_intfdata(interface, vub300);
2325: INIT_DELAYED_WORK(&vub300->pollwork, vub300_pollwork_thread);
2326: INIT_WORK(&vub300->cmndwork, vub300_cmndwork_thread);
2327: INIT_WORK(&vub300->deadwork, vub300_deadwork_thread);
2328: kref_init(&vub300->kref);
2329: timer_setup(&vub300->sg_transfer_timer, vub300_sg_timed_out, 0);
2330: kref_get(&vub300->kref);
2331: timer_setup(&vub300->inactivity_timer,
2332: vub300_inactivity_timer_expired, 0);
2333: vub300->inactivity_timer.expires = jiffies + HZ;
2334: add_timer(&vub300->inactivity_timer);
2335: if (vub300->card_present)
2336: dev_info(&vub300->udev->dev,
2337: "USB vub300 remote SDIO host controller[%d]"
2338: "connected with SD/SDIO card inserted\n",
2339: interface_to_InterfaceNumber(interface));
2340: else
2341: dev_info(&vub300->udev->dev,
2342: "USB vub300 remote SDIO host controller[%d]"
2343: "connected with no SD/SDIO card inserted\n",
2344: interface_to_InterfaceNumber(interface));
2345: retval = mmc_add_host(mmc);
2346: if (retval)
2347: goto err_stop_io;
2348:
2349: return 0;
2350:
2351: err_stop_io:
2352: vub300->interface = NULL;
2353: kref_put(&vub300->kref, vub300_delete);
2354:
2355: return retval;
2356:
2357: err_free_host:
2358: mmc_free_host(mmc);
2359: /*
2360: * and hence also frees vub300
2361: * which is contained at the end of struct mmc
2362: */
2363: err_free_res_urb:
2364: usb_free_urb(command_res_urb);
2365: err_free_out_urb:
2366: usb_free_urb(command_out_urb);
2367: err_put_udev:
2368: usb_put_dev(udev);
2369:
2370: return retval;
2371: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 91/5 |
2026/09/07 15:24 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 37421
output: 22
thoughts: 823
Thoughts: **Understanding the USB Endpoint Allocation Logic and a Specific Device Descriptor**
My primary focus here is to dissect how USB endpoints are being identified and allocated, and then to scrutinize a particular device descriptor to see how it aligns with those requirements.
Looking at the provided C code snippet iterating through `iface_desc->desc.bNumEndpoints`, my immediate thought is about the *structure* of the USB communication. The code is clearly designed to find and assign specific USB endpoints for different communication types. Specifically, it's looking for bulk IN and bulk OUT endpoints. The logic dictates that I need to identify two distinct bulk IN endpoints and two distinct bulk OUT endpoints. The first bulk IN endpoint found will be assigned to `vub300->cmnd_res_ep` (presumably for command responses), and the second one encountered will be `vub300->data_inp_ep` (likely for data ingress). Similarly, the first bulk OUT endpoint will go to `vub300->cmnd_out_ep` (for commands), and the subsequent one to `vub300->data_out_ep` (for data egress). This implies a dual-channel approach for both inbound and outbound data flow.
Now, let's turn my attention to the provided C reproducer's `desc` array. My immediate task is to parse this byte array into meaningful USB descriptor structures.
* The first block, `9, 2, 46, 0, 1, 1, 0, 0x80, 50`, I recognize as a **Configuration Descriptor**. The length `9` is standard, type `2` confirms it's a Configuration descriptor. The total length `46` is also noted and will be checked against the sum of all subsequent descriptors. `1 interface` is important, meaning this configuration supports only one interface. The `config value 1` and `index 0` are standard identifiers. `attr 0x80` signifies bus-powered with remote wakeup, and `max power 50` (mA) is noted.
* The next block, `9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0`, is the **Interface Descriptor**. Length `9` is standard, type `4` indicates an Interface descriptor. `interface 0` and `alt 0` are straightforward. `4 endpoints` is a key piece of information – this interface exposes four endpoints. The class `0xff`, subclass `0xff`, and protocol `0xff` signal a vendor-specific device, which aligns with the `vub300` naming in the endpoint assignment code.
* Following that, I see four blocks of length `7`, type `5`. This type `5` identifies them as **Endpoint Descriptors**.
* The first one: `7, 5, 0x81, 2, 0, 2, 0`. Address `0x81` immediately tells me this is an **IN** endpoint (the high bit is set). The `attr 2` signifies a **Bulk** transfer type. The `0, 2` bytes, when interpreted as `0x0200`, represent a maximum packet size of `512` bytes. The `interval 0` is typical for bulk transfers.
* The second one: `7, 5, 0x02, 2, 0, 2, 0`. Address `0x02` indicates an **OUT** endpoint. Again, `attr 2` means **Bulk**. Max packet size is `512` bytes (`0x0200`).
* The third one: `7, 5, 0x83, 2, 0, 2, 0`. Address `0x83` is another **IN** endpoint, and `attr 2` confirms it's **Bulk**. Max packet size `512`.
* The fourth one: `7, 5, 0x04, 2, 0, 2, 0`. Address `0x04` is an **OUT** endpoint, and `attr 2` signifies **Bulk**. Max packet size `512`.
A quick cross-check: the total length of the descriptors is `9` (config) + `9` (interface) + `4 * 7` (endpoints) = `9 + 9 + 28 = 46`. This matches the total length specified in the Configuration Descriptor, so the descriptor structure itself is internally consistent.
Now, connecting this back to the endpoint allocation logic, I see a perfect match. The descriptor provides exactly two bulk IN endpoints (`0x81` and `0x83`) and two bulk OUT endpoints (`0x02` and `0x04`). The logic will correctly pick up `0x81` for `cmnd_res_ep`, `0x83` for `data_inp_ep`, `0x02` for `cmnd_out_ep`, and `0x04` for `data_out_ep`. The max packet size of `512` is also consistent, though the endpoint allocation logic itself doesn't directly *use* this value, it's just part of the descriptor discovery.
Finally, there's a mention of `GET_HC_INF0 = 1?`. This is a bit of an outlier to the descriptor parsing, but it suggests an external operation or a specific command related to host controller information. My current focus is on the endpoint structure, so I'll defer a deep dive into `GET_HC_INF0` until I have a clearer understanding of its context within the overall system. However, the presence of a `1` suggests it might be a specific request code or an index.
|
| 92/5 |
2026/09/07 15:24 |
tool |
grepper |
0m
Args: map[Expression:#define GET_HC_INF0]
Results: map[Output:drivers/mmc/host/vub300.c=296=struct vub300_mmc_host {
--
drivers/mmc/host/vub300.c-365-#define ENTER_DFU_MODE 3
drivers/mmc/host/vub300.c:366:#define GET_HC_INF0 1
drivers/mmc/host/vub300.c-367-#define GET_SYSTEM_PORT_STATUS 0
]
|
| 93/5 |
2026/09/07 15:24 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 38388
output: 23
thoughts: 43
Thoughts: **My Internal State and Configuration**
Ah, it seems I've just performed a quick internal check or update. My system registers indicate that the `GET_HC_INF0` flag is currently set to `1`. This suggests that I am actively preparing to retrieve or have just retrieved health and configuration information. Concurrently, `GET_SYSTEM_PORT_STATUS` is at `0`, which implies that I'm not currently focused on monitoring the status of system ports, perhaps because that task is either complete, not yet initiated, or deprioritized. Finally, I've adjusted the `SET_ROM_WAIT_STATES` parameter to `16`. This value suggests a deliberate configuration of memory access timing, likely to ensure stable and reliable read operations from ROM, possibly in response to specific hardware requirements or performance tuning.
|
| 94/5 |
2026/09/07 15:24 |
tool |
grepper |
0m
Args: map[Expression:#define SET_ROM_WAIT_STATES]
Results: map[Output:drivers/mmc/host/vub300.c=296=struct vub300_mmc_host {
--
drivers/mmc/host/vub300.c-358-#define SET_FAILURE_MODE 18
drivers/mmc/host/vub300.c:359:#define SET_ROM_WAIT_STATES 16
drivers/mmc/host/vub300.c-360-#define SET_IRQ_ENABLE 13
]
|
| 95/5 |
2026/09/07 15:24 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 38577
output: 28
thoughts: 386
Thoughts: **My Thought Process Regarding the VUB300 USB Host Controller and its Initialization Sequence**
Alright, let's walk through what I'm seeing here regarding this VUB300 device. I've just confirmed that `SET_ROM_WAIT_STATES` is indeed configured for 16 wait states. This is an important parameter for ensuring proper communication timing, especially with the ROM.
Now, I'm examining the provided reproducer code, specifically how it handles USB control requests. I see two distinct branches for `VENDOR IN` requests (`0xC0`):
* One is for `GET_HC_INF0` (`bRequest == 1`). The code prepares a 4-byte data buffer: `{4, 0, 0, 1}`. It then copies data into the output buffer, limited by `req->wLength` or 4 bytes, whichever is smaller. This tells me it's providing some host controller information.
* The other `VENDOR IN` request is `GET_SYSTEM_PORT_STATUS` (`bRequest == 0`). Here, a 15-byte buffer `{15, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}` is prepared. Similar to the previous case, the data is copied into the output buffer, capped by `req->wLength` or 15 bytes. Crucially, this request also sets `done = 1`, indicating it's the final request in the `vub300_probe` sequence.
Then I look at the `VENDOR OUT` requests (`0x40`):
* The specific request I'm interested in is `SET_ROM_WAIT_STATES` (`bRequest == 16`). The provided code simply sets `io->length = 0` and marks it as handled. This implies that this command itself doesn't expect any data back from the device; it's a configuration command.
However, as I'm processing this, a potential inconsistency or point of concern arises: I recall that `GET_HC_INF0` typically expects to return the full size of the host controller information structure. The reproducer is only providing 4 bytes of data. This makes me pause and think, "Wait, what is the *actual* expected size of `vub300->hc_info`?" I need to verify if the 4 bytes provided are indeed sufficient or if the reproducer is undersizing the response for `GET_HC_INF0`, which could lead to incomplete information being read by the host. This is something I'd need to investigate further by checking the definition of `vub300->hc_info` and comparing it to the 4 bytes being returned.
|
| 96/5 |
2026/09/07 15:25 |
tool |
codesearch-struct-layout |
0m
Args: map[Name:vub300_mmc_host]
Results: map[Fields:[map[Name:udev OffsetBits:0 SizeBits:64] map[Name:interface OffsetBits:64 SizeBits:64] map[Name:kref OffsetBits:128 SizeBits:32] map[Name:cmd_mutex OffsetBits:192 SizeBits:1088] map[Name:irq_mutex OffsetBits:1280 SizeBits:1088] map[Name:vub_name OffsetBits:2368 SizeBits:640] map[Name:cmnd_out_ep OffsetBits:3008 SizeBits:8] map[Name:cmnd_res_ep OffsetBits:3016 SizeBits:8] map[Name:data_out_ep OffsetBits:3024 SizeBits:8] map[Name:data_inp_ep OffsetBits:3032 SizeBits:8] map[Name:card_powered OffsetBits:3040 SizeBits:8] map[Name:card_present OffsetBits:3048 SizeBits:8] map[Name:read_only OffsetBits:3056 SizeBits:8] map[Name:large_usb_packets OffsetBits:3064 SizeBits:8] map[Name:app_spec OffsetBits:3072 SizeBits:8] map[Name:irq_enabled OffsetBits:3080 SizeBits:8] map[Name:irq_disabled OffsetBits:3088 SizeBits:8] map[Name:bus_width OffsetBits:3096 SizeBits:4] map[Name:total_offload_count OffsetBits:3104 SizeBits:8] map[Name:dynamic_register_count OffsetBits:3112 SizeBits:8] map[Name:resp_len OffsetBits:3120 SizeBits:8] map[Name:datasize OffsetBits:3136 SizeBits:32] map[Name:errors OffsetBits:3168 SizeBits:32] map[Name:usb_transport_fail OffsetBits:3200 SizeBits:32] map[Name:usb_timed_out OffsetBits:3232 SizeBits:32] map[Name:irqs_queued OffsetBits:3264 SizeBits:32] map[Name:sdio_register OffsetBits:3296 SizeBits:1536] map[Name:fn OffsetBits:4832 SizeBits:8704] map[Name:fbs OffsetBits:13536 SizeBits:128] map[Name:cmd OffsetBits:13696 SizeBits:64] map[Name:req OffsetBits:13760 SizeBits:64] map[Name:data OffsetBits:13824 SizeBits:64] map[Name:mmc OffsetBits:13888 SizeBits:64] map[Name:urb OffsetBits:13952 SizeBits:64] map[Name:command_out_urb OffsetBits:14016 SizeBits:64] map[Name:command_res_urb OffsetBits:14080 SizeBits:64] map[Name:command_complete OffsetBits:14144 SizeBits:704] map[Name:irqpoll_complete OffsetBits:14848 SizeBits:704] map[Name:cmnd OffsetBits:15552 SizeBits:512] map[Name:resp OffsetBits:16064 SizeBits:984] map[Name:sg_transfer_timer OffsetBits:17088 SizeBits:640] map[Name:sg_request OffsetBits:17728 SizeBits:1600] map[Name:inactivity_timer OffsetBits:19328 SizeBits:640] map[Name:deadwork OffsetBits:19968 SizeBits:576] map[Name:cmndwork OffsetBits:20544 SizeBits:576] map[Name:pollwork OffsetBits:21120 SizeBits:1344] map[Name:hc_info OffsetBits:22464 SizeBits:32] map[Name:system_port_status OffsetBits:22496 SizeBits:120] map[Name:padded_buffer OffsetBits:22616 SizeBits:512]]]
|
| 97/5 |
2026/09/07 15:25 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 39717
output: 45
thoughts: 662
Thoughts: **My Thought Process Regarding the VUB300 USB Device Driver and mmc_add_host Synchronization**
Initially, I was analyzing the `hc_info` and `system_port_status` structures, confirming their sizes. `hc_info` is indeed 32 bits (4 bytes) and `system_port_status` is 120 bits (15 bytes). This aligns perfectly with the values I'm seeing in the reproducer code, so from that perspective, everything appears correct.
However, my attention was drawn to the sequence of operations within the `vub300_probe` function. I observed the `usb_control_msg` calls for `GET_HC_INF0`, `SET_ROM_WAIT_STATES`, and `GET_SYSTEM_PORT_STATUS`. These calls are handling the initial setup and data retrieval from the USB device.
Then, the critical part: `vub300_probe` proceeds to call `mmc_add_host(mmc)`. This is where my concern began to form. I know that `mmc_add_host` can be a relatively time-consuming operation; it's not an instantaneous call.
Looking at the reproducer's timing mechanisms, I see `usleep(200000)` (200 milliseconds) placed *after* the `mmc_add_host` call, with a comment indicating it's to "Give vub300_probe a moment to finish mmc_add_host." This comment confirms my suspicion – there's an explicit acknowledgment that `mmc_add_host` needs time and that the subsequent actions might occur before it's fully complete.
Following this delay, the reproducer simulates a USB disconnect by `close(fd)`, and then it `sleep(2)` to wait for an `inactivity_timer` to expire. Now, this is where it all ties together. I recall that `vub300->inactivity_timer` is actually armed *within* `vub300_probe` itself, with `vub300->inactivity_timer.expires = jiffies + HZ;` and `add_timer(&vub300->inactivity_timer);`.
Therefore, my current line of thought is that if the device is disconnected *before* `mmc_add_host` has fully completed and potentially before the inactivity timer's expiry logic has been properly processed due to the rapid disconnect, we might be encountering a race condition. The reproducer's `usleep` is a workaround, but it doesn't fundamentally address the potential for the disconnect to be handled prematurely in relation to the ongoing `mmc_add_host` operation. This could lead to unexpected behavior or even crashes if `vub300_disconnect` is invoked while `mmc_add_host` is still in its critical path or if the timer's state is inconsistent.
|
| 98/5 |
2026/09/07 15:25 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_disconnect]
Results: map[SourceCode:2373: static void vub300_disconnect(struct usb_interface *interface)
2374: { /* NOT irq */
2375: struct vub300_mmc_host *vub300 = usb_get_intfdata(interface);
2376: if (!vub300 || !vub300->mmc) {
2377: return;
2378: } else {
2379: struct mmc_host *mmc = vub300->mmc;
2380: if (!vub300->mmc) {
2381: return;
2382: } else {
2383: int ifnum = interface_to_InterfaceNumber(interface);
2384: usb_set_intfdata(interface, NULL);
2385: /* prevent more I/O from starting */
2386: vub300->interface = NULL;
2387: mmc_remove_host(mmc);
2388: kref_put(&vub300->kref, vub300_delete);
2389: pr_info("USB vub300 remote SDIO host controller[%d]"
2390: " now disconnected", ifnum);
2391: return;
2392: }
2393: }
2394: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 99/5 |
2026/09/07 15:25 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 40810
output: 29
thoughts: 3377
Thoughts: **My Thoughts on the `vub300` Kernel Bug and Reproducer Development**
Okay, let's trace this through. My initial understanding is that the `vub300_disconnect` function, when called, proceeds to set `vub300->interface` to `NULL` and then immediately calls `kref_put` with `vub300_delete`. What's concerning here is that `vub300_disconnect` *doesn't* touch the `inactivity_timer`.
This leaves the `inactivity_timer` to potentially expire later. When it *does* expire, it triggers `vub300_inactivity_timer_expired`. Now, within this softirq context, I see a critical check: `if (!vub300->interface)`.
If `vub300->interface` is indeed `NULL` (which it is, due to `vub300_disconnect`), this condition becomes true, and the function proceeds to call `kref_put(&vub300->kref, vub300_delete);` again. If this `kref_put` is the one that drops the reference count to zero, it means `vub300_delete` is invoked.
And here's the crux of the problem: `vub300_delete`, being called from a softirq context, then proceeds to call `mmc_free_host(mmc)`. The cascade continues through `device_release`, `mmc_host_classdev_release`, `wakeup_source_unregister`, and finally `synchronize_srcu`. This sequence, particularly `synchronize_srcu` from softirq, is where the bug manifests.
Now, about the reproducer: the user-provided one appears to be quite solid. I've double-checked the `raw-gadget` initialization, specifically the `struct usb_raw_init`. The `driver_name` is set to "dummy_udc" and `device_name` to "dummy_udc.0". This seems correct, as `dummy_udc.0` is typically associated with `dummy_hcd` in this context, and syzkaller also uses this convention. The user's feedback confirming that the capability probe was successful and the environment is ready to open and initialize `/dev/raw-gadget` further solidifies my confidence in the reproducer's foundation.
The next step is to ensure the C code for the reproducer is correctly generated and will execute the intended sequence. I've reviewed the provided C code snippet. It opens `/dev/raw-gadget`, initializes it with "dummy_udc" and "dummy_udc.0", and then enters a loop to fetch events. The handling of `USB_RAW_EVENT_CONTROL` seems to correctly mimic the initial requests that `vub300_probe` would make, including `GET_DESCRIPTOR` for DEVICE and CONFIG, and importantly, the `GET_SYSTEM_PORT_STATUS` request.
I've ensured that the `GET_SYSTEM_PORT_STATUS` (vendor request 0, type 0x80) returns exactly 15 bytes, as the kernel code expects. This is crucial for `vub300_probe` to proceed without an immediate error. The reproducer code also simulates a USB disconnect by closing the file descriptor and then waits for a short period to allow the inactivity timer to expire, thereby triggering the bug.
One detail I've paid close attention to is the `vub300_probe` function's interaction with `mmc_add_host`. If `card_present` is zero (which my `GET_SYSTEM_PORT_STATUS` response implies), `mmc_add_host` shouldn't immediately send commands to a non-existent card. This is good, as it simplifies the reproduction. The structure of `system_port_status` and where `port_flags` resides within that structure will be important for ensuring the `card_present` bit is set correctly (or not set, depending on the desired path). Based on the current setup, it seems I'm aiming to trigger the disconnect path, so the `port_flags` value will be critical.
Ultimately, my goal is to output a C code snippet that, when compiled and run, reliably triggers the race condition between the softirq-driven timer expiration and the consequences of the earlier disconnect operation. The provided C code appears to achieve this by simulating the initial device enumeration and then the disconnect.
|
| 100/5 |
2026/09/07 15:25 |
tool |
codesearch-struct-layout |
0m
Error:
Args: map[Name:vub300_system_port_status]
Results:
|
| 101/5 |
2026/09/07 15:25 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 44225
output: 26
thoughts: 21
Thoughts: **My Thought Process:**
Right, the first thing I need to do is dive into the code. My focus is specifically on `vub300.c`. Within that file, my immediate objective is to locate any occurrences of the `system_port_status` identifier. I need to see how it's defined, where it's used, and what its behavior is within that specific module.
|
| 102/5 |
2026/09/07 15:25 |
tool |
grepper |
0m
Error:
Args: map[Expression:struct vub300_system_port_status]
Results:
|
| 103/5 |
2026/09/07 15:25 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 44274
output: 19
thoughts: 21
Thoughts: **My Thought Process:**
Right, the first thing I need to do is dive into the code. My focus is specifically on `vub300.c`. Within that file, my immediate objective is to locate any occurrences of the `system_port_status` identifier. I need to see how it's defined, where it's used, and what its behavior is within that specific module.
|
| 104/5 |
2026/09/07 15:25 |
tool |
grepper |
0m
Args: map[Expression:system_port_status]
Results: map[Output:drivers/mmc/host/vub300.c=296=struct vub300_mmc_host {
--
drivers/mmc/host/vub300.c-350- struct host_controller_info hc_info;
drivers/mmc/host/vub300.c:351: struct sd_status_header system_port_status;
drivers/mmc/host/vub300.c-352- u8 padded_buffer[64];
--
drivers/mmc/host/vub300.c=478=static void send_irqpoll(struct vub300_mmc_host *vub300)
--
drivers/mmc/host/vub300.c-503-
drivers/mmc/host/vub300.c:504:static void new_system_port_status(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-505-{
--
drivers/mmc/host/vub300.c-507- int new_card_present =
drivers/mmc/host/vub300.c:508: (0x0001 & vub300->system_port_status.port_flags) ? 1 : 0;
drivers/mmc/host/vub300.c-509- vub300->read_only =
drivers/mmc/host/vub300.c:510: (0x0010 & vub300->system_port_status.port_flags) ? 1 : 0;
drivers/mmc/host/vub300.c-511- if (new_card_present && !old_card_present) {
--
drivers/mmc/host/vub300.c=568=static void check_vub300_port_status(struct vub300_mmc_host *vub300)
--
drivers/mmc/host/vub300.c-578- USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
drivers/mmc/host/vub300.c:579: 0x0000, 0x0000, &vub300->system_port_status,
drivers/mmc/host/vub300.c:580: sizeof(vub300->system_port_status), 1000);
drivers/mmc/host/vub300.c:581: if (sizeof(vub300->system_port_status) == retval)
drivers/mmc/host/vub300.c:582: new_system_port_status(vub300);
drivers/mmc/host/vub300.c-583-}
--
drivers/mmc/host/vub300.c=585=static void __vub300_irqpoll_response(struct vub300_mmc_host *vub300)
--
drivers/mmc/host/vub300.c-605- case RESPONSE_STATUS:
drivers/mmc/host/vub300.c:606: vub300->system_port_status = vub300->resp.status;
drivers/mmc/host/vub300.c:607: new_system_port_status(vub300);
drivers/mmc/host/vub300.c-608- if (!vub300->card_present)
--
drivers/mmc/host/vub300.c=2092=static int vub300_probe(struct usb_interface *interface,
--
drivers/mmc/host/vub300.c-2310- USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
drivers/mmc/host/vub300.c:2311: 0x0000, 0x0000, &vub300->system_port_status,
drivers/mmc/host/vub300.c:2312: sizeof(vub300->system_port_status), 1000);
drivers/mmc/host/vub300.c-2313- if (retval < 0) {
drivers/mmc/host/vub300.c-2314- goto err_free_host;
drivers/mmc/host/vub300.c:2315: } else if (sizeof(vub300->system_port_status) == retval) {
drivers/mmc/host/vub300.c-2316- vub300->card_present =
drivers/mmc/host/vub300.c:2317: (0x0001 & vub300->system_port_status.port_flags) ? 1 : 0;
drivers/mmc/host/vub300.c-2318- vub300->read_only =
drivers/mmc/host/vub300.c:2319: (0x0010 & vub300->system_port_status.port_flags) ? 1 : 0;
drivers/mmc/host/vub300.c-2320- } else {
]
|
| 105/5 |
2026/09/07 15:25 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 45730
output: 23
thoughts: 19
Thoughts: **My Thought Process on `sd_status_header` Layout**
Okay, so I'm looking at this `sd_status_header` structure, and my immediate instinct is to dive into its memory layout. Understanding how the fields are arranged is paramount. I need to know exactly what's where in memory to properly interpret the data it holds, manage its size efficiently, and ensure correct alignment. This is fundamental to working with low-level data structures like this, especially if it's part of a serialization, network protocol, or direct memory manipulation. I'll be checking field sizes, their order, and any padding the compiler might introduce.
|
| 106/5 |
2026/09/07 15:26 |
tool |
codesearch-struct-layout |
0m
Args: map[Name:sd_status_header]
Results: map[Fields:[map[Name:header_size OffsetBits:0 SizeBits:8] map[Name:header_type OffsetBits:8 SizeBits:8] map[Name:port_number OffsetBits:16 SizeBits:8] map[Name:port_flags OffsetBits:24 SizeBits:16] map[Name:sdio_clock OffsetBits:40 SizeBits:32] map[Name:host_header_size OffsetBits:72 SizeBits:16] map[Name:func_header_size OffsetBits:88 SizeBits:16] map[Name:ctrl_header_size OffsetBits:104 SizeBits:16]]]
|
| 107/5 |
2026/09/07 15:26 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 45875
output: 2211
thoughts: 5666
Thoughts: **My Thought Process on Addressing the `vub300` Bug**
Here's a breakdown of how I arrived at the solution for the `vub300` kernel bug.
First, I examined the `port_flags` field. I noted it's located at bit offset 24, which translates to the 3rd byte in the data structure. My initial code snippet looked like this:
```c
uint8_t data[15] = {15, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
```
In this setup, `data[0]` is `header_size` (15), `data[1]` is `header_type` (0), `data[2]` is `port_number` (0), and crucially, `data[3]` (the least significant byte of `port_flags`) is 1. `data[4]` is the most significant byte of `port_flags`, which is 0. This means `port_flags` was effectively set to `1`.
The consequence of `port_flags` being 1 is that the `card_present` flag gets set to 1. When `card_present` is 1, the `mmc_add_host` function is invoked to probe the SD card. My concern was that this probing action could potentially block or send commands, which might interfere with the intended execution flow or introduce unwanted delays.
To avoid this potential blocking behavior, I considered setting `port_flags` to 0. This would result in `card_present` being 0, and `mmc_add_host` would then return immediately without attempting any card probing. The modified data structure would look like this:
```c
uint8_t data[15] = {15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
```
However, I then paused to consider if `vub300_probe` would still succeed if `card_present` was 0. I reviewed the relevant code snippet:
```c
if (vub300->card_present)
dev_info(&vub300->udev->dev,
"USB vub300 remote SDIO host controller[%d]"
"connected with SD/SDIO card inserted\n",
interface_to_InterfaceNumber(interface));
else
dev_info(&vub300->udev->dev,
"USB vub300 remote SDIO host controller[%d]"
"connected with no SD/SDIO card inserted\n",
interface_to_InterfaceNumber(interface));
retval = mmc_add_host(mmc);
if (retval)
goto err_stop_io;
return 0;
```
This snippet confirms that `vub300_probe` proceeds to `mmc_add_host(mmc)` regardless of the `card_present` status. If `mmc_add_host` returns successfully, the function returns 0. Therefore, setting `port_flags` to 0 indeed seemed like a safer and faster approach to avoid the MMC probing side effects.
Next, I began analyzing the provided reproducer code to ensure its correctness and completeness. I checked the necessary include headers (`stdio.h`, `stdlib.h`, `stdint.h`, `string.h`, `unistd.h`, `fcntl.h`, `sys/ioctl.h`) and confirmed they were sufficient.
I also considered the `dummy_udc` driver. While it might not be universally available or named identically across all systems, the reproducer uses `dummy_udc.0`, which is what `syzkaller` typically uses, so I concluded the reproducer was likely fine in this regard.
A critical part of my analysis involved understanding the sequence of USB control requests and how they map to the reproducer's logic. The USB core typically sends requests in this order:
1. `GET_DESCRIPTOR` (Device)
2. `GET_DESCRIPTOR` (Config)
3. `SET_CONFIGURATION`
4. Then, interface drivers like `vub300_probe` are called.
Within `vub300_probe`, I expected the following requests:
1. `GET_HC_INF0`
2. `SET_ROM_WAIT_STATES`
3. `GET_SYSTEM_PORT_STATUS`
The reproducer's loop breaks (`done = 1;`) when it handles the `GET_SYSTEM_PORT_STATUS` request. My reasoning was that this is indeed the last request in the `vub300_probe` sequence, especially when `card_present` is 0. Once the loop breaks, the reproducer sleeps for 200ms, simulates a disconnect by closing the file descriptor (`close(fd)`), and then sleeps for another 2 seconds. This sequence of actions is designed to trigger `vub300_disconnect` and allow the inactivity timer (set to `jiffies + HZ`) to expire, which is the critical path leading to the `WARNING: suspicious RCU usage in wakeup_source_unregister`. The 2-second sleep is sufficient to cover typical `HZ` values.
I confirmed that the `SET_CONFIGURATION` request happens *before* `vub300_probe`, so its placement in the reproducer's logic was correct. I also verified that `GET_SYSTEM_PORT_STATUS` is sent exactly once within `vub300_probe`.
Ultimately, I concluded that the reproducer was robust and accurately simulated the conditions leading to the bug. The logic of setting `port_flags` to 0 to bypass MMC probing, combined with the controlled sequence of USB requests and the simulated disconnect, forms a solid basis for triggering the RCU warning.
|
| 108/3 |
2026/09/07 15:26 |
action |
merge-strategy |
0m
Results: map[CurrentReproStrategy:The root cause of the bug is that `vub300_disconnect` fails to delete the `inactivity_timer` when the USB device is disconnected. When the timer later expires, its callback `vub300_inactivity_timer_expired` runs in an atomic (softirq) context. It notices that the device is disconnected (`!vub300->interface`) and drops the last reference to the object. This triggers `vub300_delete`, which calls `mmc_free_host()`, eventually leading to `synchronize_srcu()` being called from an atomic context, causing the `suspicious RCU usage` and `sleeping function called from invalid context` warnings.
The provided strategy is correct. We emulate a `vub300` USB device using `/dev/raw-gadget`, let `vub300_probe` initialize the driver and arm the `inactivity_timer`, and then immediately close the gadget file descriptor to simulate a physical disconnect. Waiting for the timer to expire will trigger the bug.
I have refined the reproducer to ensure that `GET_SYSTEM_PORT_STATUS` returns `port_flags = 0` (card not present). This prevents `mmc_add_host` from attempting to probe an SD card, making the reproduction faster and more reliable.
Here is the complete C reproducer:
```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
#define USB_RAW_IOCTL_RUN _IO('U', 1)
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
struct usb_raw_event {
uint32_t type;
uint32_t length;
uint8_t data[0];
};
struct usb_raw_ep_io {
uint16_t ep;
uint16_t flags;
uint32_t length;
uint8_t data[0];
};
struct usb_ctrlrequest {
uint8_t bRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} __attribute__((packed));
int main() {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
perror("open /dev/raw-gadget");
return 1;
}
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
if (ioctl(fd, USB_RAW_IOCTL_INIT, &init) < 0) {
perror("USB_RAW_IOCTL_INIT");
return 1;
}
if (ioctl(fd, USB_RAW_IOCTL_RUN, 0) < 0) {
perror("USB_RAW_IOCTL_RUN");
return 1;
}
int done = 0;
while (!done) {
struct usb_raw_event *event = malloc(sizeof(*event) + 1024);
event->type = 0;
event->length = 1024;
if (ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event) < 0) {
free(event);
break;
}
if (event->type == 2) { // USB_RAW_EVENT_CONTROL
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)event->data;
struct usb_raw_ep_io *io = malloc(sizeof(*io) + 1024);
io->ep = 0;
io->flags = 0;
io->length = 0;
int handled = 0;
if (req->bRequestType == 0x80 && req->bRequest == 6) { // GET_DESCRIPTOR
if ((req->wValue >> 8) == 1) { // DEVICE
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
} else if ((req->wValue >> 8) == 2) { // CONFIG
uint8_t desc[] = {
9, 2, 46, 0, 1, 1, 0, 0x80, 50,
9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0,
7, 5, 0x81, 2, 0, 2, 0,
7, 5, 0x02, 2, 0, 2, 0,
7, 5, 0x83, 2, 0, 2, 0,
7, 5, 0x04, 2, 0, 2, 0,
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
}
} else if (req->bRequestType == 0xC0) { // VENDOR IN
if (req->bRequest == 1) { // GET_HC_INF0
uint8_t data[4] = {4, 0, 0, 1};
io->length = req->wLength < 4 ? req->wLength : 4;
memcpy(io->data, data, io->length);
handled = 1;
} else if (req->bRequest == 0) { // GET_SYSTEM_PORT_STATUS
// port_flags = 0 (card_present = 0) to avoid mmc_add_host probing
uint8_t data[15] = {15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
io->length = req->wLength < 15 ? req->wLength : 15;
memcpy(io->data, data, io->length);
handled = 1;
done = 1; // Last request in vub300_probe
}
} else if (req->bRequestType == 0x40) { // VENDOR OUT
if (req->bRequest == 16) { // SET_ROM_WAIT_STATES
io->length = 0;
handled = 1;
}
} else if (req->bRequestType == 0x00 && req->bRequest == 9) { // SET_CONFIGURATION
io->length = 0;
handled = 1;
} else {
// ACK other standard requests (e.g. SET_ADDRESS)
io->length = 0;
handled = 1;
}
if (handled) {
if (req->bRequestType & 0x80) {
ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
free(io);
}
free(event);
}
// Give vub300_probe a moment to finish mmc_add_host
usleep(200000);
// Close fd to simulate USB disconnect
close(fd);
// Wait for the inactivity_timer to expire (it is set to jiffies + HZ)
sleep(2);
return 0;
}
```]
|
| 109/3 |
2026/09/07 15:26 |
agent |
repro-generator |
1m
Model:
Results: map[IsProbe:false RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
#define USB_RAW_IOCTL_RUN _IO('U', 1)
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
struct usb_raw_event {
uint32_t type;
uint32_t length;
uint8_t data[0];
};
struct usb_raw_ep_io {
uint16_t ep;
uint16_t flags;
uint32_t length;
uint8_t data[0];
};
struct usb_ctrlrequest {
uint8_t bRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} __attribute__((packed));
int main() {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
printf("[+] open /dev/raw-gadget successful.\n");
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
if (ioctl(fd, USB_RAW_IOCTL_INIT, &init) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_INIT successful.\n");
if (ioctl(fd, USB_RAW_IOCTL_RUN, 0) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_RUN: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_RUN successful.\n");
int done = 0;
while (!done) {
struct usb_raw_event *event = malloc(sizeof(*event) + 1024);
event->type = 0;
event->length = 1024;
if (ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_EVENT_FETCH: %s\n", strerror(errno));
free(event);
break;
}
if (event->type == 2) { // USB_RAW_EVENT_CONTROL
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)event->data;
struct usb_raw_ep_io *io = malloc(sizeof(*io) + 1024);
io->ep = 0;
io->flags = 0;
io->length = 0;
int handled = 0;
if (req->bRequestType == 0x80 && req->bRequest == 6) { // GET_DESCRIPTOR
if ((req->wValue >> 8) == 1) { // DEVICE
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
} else if ((req->wValue >> 8) == 2) { // CONFIG
uint8_t desc[] = {
9, 2, 46, 0, 1, 1, 0, 0x80, 50,
9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0,
7, 5, 0x81, 2, 0, 2, 0,
7, 5, 0x02, 2, 0, 2, 0,
7, 5, 0x83, 2, 0, 2, 0,
7, 5, 0x04, 2, 0, 2, 0,
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
}
} else if (req->bRequestType == 0xC0) { // VENDOR IN
if (req->bRequest == 1) { // GET_HC_INF0
uint8_t data[4] = {4, 0, 0, 1};
io->length = req->wLength < 4 ? req->wLength : 4;
memcpy(io->data, data, io->length);
handled = 1;
} else if (req->bRequest == 0) { // GET_SYSTEM_PORT_STATUS
// port_flags = 0 (card_present = 0) to avoid mmc_add_host probing
uint8_t data[15] = {15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
io->length = req->wLength < 15 ? req->wLength : 15;
memcpy(io->data, data, io->length);
handled = 1;
done = 1; // Last request in vub300_probe
}
} else if (req->bRequestType == 0x40) { // VENDOR OUT
if (req->bRequest == 16) { // SET_ROM_WAIT_STATES
io->length = 0;
handled = 1;
}
} else if (req->bRequestType == 0x00 && req->bRequest == 9) { // SET_CONFIGURATION
io->length = 0;
handled = 1;
} else {
// ACK other standard requests (e.g. SET_ADDRESS)
io->length = 0;
handled = 1;
}
if (handled) {
if (req->bRequestType & 0x80) {
ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
free(io);
}
free(event);
}
printf("[+] USB enumeration completed.\n");
// Give vub300_probe a moment to finish mmc_add_host
usleep(200000);
// Close fd to simulate USB disconnect
close(fd);
printf("[+] Gadget closed, simulating disconnect.\n");
// Wait for the inactivity_timer to expire (it is set to jiffies + HZ)
sleep(2);
printf("[+] Done.\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 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: WARNING: suspicious RCU usage in wakeup_source_unregister
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
=============================
WARNING: suspicious RCU usage
syzkaller #0 Tainted: G W L
-----------------------------
kernel/rcu/srcutree.c:1468 Illegal synchronize_srcu() in same-type SRCU (or in RCU) read-side critical section!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
locks held by syz-executor/5675: 5, last CPU#0:
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1542 [inline]
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm+0x10f/0x480 kernel/fork.c:1595
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:562 [inline]
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: dup_mmap+0x195/0x1dc0 mm/mmap.c:1716
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: mmap_write_lock_nested include/linux/mmap_lock.h:552 [inline]
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: dup_mmap+0x221/0x1dc0 mm/mmap.c:1723
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: __pte_offset_map+0x29/0x240 mm/pgtable-generic.c:290
#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
stack backtrace:
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
Call Trace:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
lockdep_rcu_suspicious+0x140/0x1d0 kernel/locking/lockdep.c:6938
__synchronize_srcu+0x157/0x2f0 kernel/rcu/srcutree.c:1464
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
BUG: sleeping function called from invalid context at kernel/rcu/srcutree.c:1472
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 5675, name: syz-executor
preempt_count: 101, expected: 0
RCU nest depth: 1, expected: 0
locks held by syz-executor/5675: 5, last CPU#0:
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1542 [inline]
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm+0x10f/0x480 kernel/fork.c:1595
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:562 [inline]
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: dup_mmap+0x195/0x1dc0 mm/mmap.c:1716
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: mmap_write_lock_nested include/linux/mmap_lock.h:552 [inline]
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: dup_mmap+0x221/0x1dc0 mm/mmap.c:1723
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: __pte_offset_map+0x29/0x240 mm/pgtable-generic.c:290
#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
Preemption disabled at:
[<ffffffff81336576>] preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
Call Trace:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x36a/0x4c0 kernel/sched/core.c:9234
__synchronize_srcu+0x1a1/0x2f0 kernel/rcu/srcutree.c:1472
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
ODEBUG: object ffffc90000007a80 is NOT on stack ffffc90004320000, but annotated.
------------[ cut here ]------------
1
WARNING: lib/debugobjects.c:672 at debug_object_is_on_stack lib/debugobjects.c:672 [inline], CPU#0: syz-executor/5675
WARNING: lib/debugobjects.c:672 at lookup_object_or_alloc lib/debugobjects.c:705 [inline], CPU#0: syz-executor/5675
WARNING: lib/debugobjects.c:672 at __debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798, CPU#0: syz-executor/5675
Modules linked in:
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:672 [inline]
RIP: 0010:lookup_object_or_alloc lib/debugobjects.c:705 [inline]
RIP: 0010:__debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798
Code: cc cc cc 41 ff c7 44 89 3d c9 75 e8 15 48 c7 c1 80 9d 6d 8c 48 c7 c7 e0 9d 6d 8c 84 c0 48 0f 45 f9 48 89 de e8 4d fa 3d fc 90 <0f> 0b 90 e9 c0 fe ff ff e8 4f 1c 00 00 8b 05 a1 cd 6e 0a 3b 05 9f
RSP: 0018:ffffc900000079b8 EFLAGS: 00010046
RAX: 0000000000000050 RBX: ffffc90000007a80 RCX: 0978036a12caea00
RDX: 0000000000000100 RSI: 0000000000000100 RDI: 0000000000000000
RBP: ffff88803588dde0 R08: 0000000000000100 R09: 0000000000080000
R10: 0000000000008000 R11: ffffffff8ec362b8 R12: 1ffff92000000f4c
R13: ffff888021b995e8 R14: dffffc0000000000 R15: 0000000000000001
FS: 000055558fe74500(0000) GS:ffff888124cd9000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fdafb3556c8 CR3: 00000000640ca000 CR4: 00000000003526f0
Call Trace:
<IRQ>
__synchronize_srcu+0x1d5/0x2f0 kernel/rcu/srcutree.c:1475
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
----------------
Code disassembly (best guess), 1 bytes skipped:
0: 00 00 add %al,(%rax)
2: 41 c7 84 24 20 0e 00 movl $0x0,0xe20(%r12)
9: 00 00 00 00 00
e: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
13: 49 83 c4 48 add $0x48,%r12
17: 4c 89 e7 mov %r12,%rdi
1a: e8 f7 ed 50 0a call 0xa50ee16
1f: e8 d2 00 3a 00 call 0x3a00f6
24: fb sti
25: 4c 8b 65 c8 mov -0x38(%rbp),%r12
* 29: 49 8d bc 24 10 17 00 lea 0x1710(%r12),%rdi <-- trapping instruction
30: 00
31: 48 89 f8 mov %rdi,%rax
34: 48 c1 e8 03 shr $0x3,%rax
38: 42 0f b6 04 30 movzbl (%rax,%r14,1),%eax
3d: 84 c0 test %al,%al
Strategy: The root cause of the bug is that `vub300_disconnect` fails to delete the `inactivity_timer` when the USB device is disconnected. When the timer later expires, its callback `vub300_inactivity_timer_expired` runs in an atomic (softirq) context. It notices that the device is disconnected (`!vub300->interface`) and drops the last reference to the object. This triggers `vub300_delete`, which calls `mmc_free_host()`, eventually leading to `synchronize_srcu()` being called from an atomic context, causing the `suspicious RCU usage` and `sleeping function called from invalid context` warnings.
The provided strategy is correct. We emulate a `vub300` USB device using `/dev/raw-gadget`, let `vub300_probe` initialize the driver and arm the `inactivity_timer`, and then immediately close the gadget file descriptor to simulate a physical disconnect. Waiting for the timer to expire will trigger the bug.
I have refined the reproducer to ensure that `GET_SYSTEM_PORT_STATUS` returns `port_flags = 0` (card not present). This prevents `mmc_add_host` from attempting to probe an SD card, making the reproduction faster and more reliable.
Here is the complete C reproducer:
```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
#define USB_RAW_IOCTL_RUN _IO('U', 1)
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
struct usb_raw_event {
uint32_t type;
uint32_t length;
uint8_t data[0];
};
struct usb_raw_ep_io {
uint16_t ep;
uint16_t flags;
uint32_t length;
uint8_t data[0];
};
struct usb_ctrlrequest {
uint8_t bRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} __attribute__((packed));
int main() {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
perror("open /dev/raw-gadget");
return 1;
}
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
if (ioctl(fd, USB_RAW_IOCTL_INIT, &init) < 0) {
perror("USB_RAW_IOCTL_INIT");
return 1;
}
if (ioctl(fd, USB_RAW_IOCTL_RUN, 0) < 0) {
perror("USB_RAW_IOCTL_RUN");
return 1;
}
int done = 0;
while (!done) {
struct usb_raw_event *event = malloc(sizeof(*event) + 1024);
event->type = 0;
event->length = 1024;
if (ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event) < 0) {
free(event);
break;
}
if (event->type == 2) { // USB_RAW_EVENT_CONTROL
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)event->data;
struct usb_raw_ep_io *io = malloc(sizeof(*io) + 1024);
io->ep = 0;
io->flags = 0;
io->length = 0;
int handled = 0;
if (req->bRequestType == 0x80 && req->bRequest == 6) { // GET_DESCRIPTOR
if ((req->wValue >> 8) == 1) { // DEVICE
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
} else if ((req->wValue >> 8) == 2) { // CONFIG
uint8_t desc[] = {
9, 2, 46, 0, 1, 1, 0, 0x80, 50,
9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0,
7, 5, 0x81, 2, 0, 2, 0,
7, 5, 0x02, 2, 0, 2, 0,
7, 5, 0x83, 2, 0, 2, 0,
7, 5, 0x04, 2, 0, 2, 0,
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
}
} else if (req->bRequestType == 0xC0) { // VENDOR IN
if (req->bRequest == 1) { // GET_HC_INF0
uint8_t data[4] = {4, 0, 0, 1};
io->length = req->wLength < 4 ? req->wLength : 4;
memcpy(io->data, data, io->length);
handled = 1;
} else if (req->bRequest == 0) { // GET_SYSTEM_PORT_STATUS
// port_flags = 0 (card_present = 0) to avoid mmc_add_host probing
uint8_t data[15] = {15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
io->length = req->wLength < 15 ? req->wLength : 15;
memcpy(io->data, data, io->length);
handled = 1;
done = 1; // Last request in vub300_probe
}
} else if (req->bRequestType == 0x40) { // VENDOR OUT
if (req->bRequest == 16) { // SET_ROM_WAIT_STATES
io->length = 0;
handled = 1;
}
} else if (req->bRequestType == 0x00 && req->bRequest == 9) { // SET_CONFIGURATION
io->length = 0;
handled = 1;
} else {
// ACK other standard requests (e.g. SET_ADDRESS)
io->length = 0;
handled = 1;
}
if (handled) {
if (req->bRequestType & 0x80) {
ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
free(io);
}
free(event);
}
// Give vub300_probe a moment to finish mmc_add_host
usleep(200000);
// Close fd to simulate USB disconnect
close(fd);
// Wait for the inactivity_timer to expire (it is set to jiffies + HZ)
sleep(2);
return 0;
}
```
Previous Reproducer Attempt:
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
int main(void) {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
printf("[+] open /dev/raw-gadget successful.\n");
struct usb_raw_init init = {0};
strcpy((char *)init.driver_name, "dummy_udc");
strcpy((char *)init.device_name, "dummy_udc.0");
init.speed = 3; // USB_SPEED_HIGH
int res = ioctl(fd, USB_RAW_IOCTL_INIT, &init);
if (res < 0) {
printf("[-] Failed to ioctl USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
printf("[+] ioctl USB_RAW_IOCTL_INIT successful.\n");
res = close(fd);
if (res < 0) {
printf("[-] Failed to close: %s\n", strerror(errno));
exit(1);
}
printf("[+] close successful.\n");
return 0;
}
Execution Results & Debugging Feedback:
The capability probe was successful. The environment is ready, and /dev/raw-gadget can be opened and initialized. Please proceed to generate the full reproducer in the next iteration.
|
| 110/4 |
2026/09/07 15:26 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 15864
output: 32
thoughts: 2435
Thoughts: **My Thoughts on Generating a Full Reproducer for the `vub300` Bug**
Okay, so my immediate goal is to craft a complete, self-contained C reproducer for this `vub300` bug. I understand the core issue: it's an RCU usage problem during `wakeup_source_unregister`. The sequence is `vub300_disconnect` fails to delete its `inactivity_timer`. When this timer eventually fires, it executes in softirq context. This context then drops the last reference to the object, triggering `vub300_delete`. Inside `vub300_delete`, `mmc_free_host()` is called, which in turn calls `wakeup_source_unregister()`. The critical failure point is that `synchronize_srcu()` is invoked from an atomic context within this chain.
I've been looking back at the strategy section, and I see a C reproducer was provided. However, it seems the actual generated code in that section was more of a probe than a full reproducer. My task now is to take that existing code, flesh it out, and ensure it truly triggers the bug.
Let me walk through the provided C code snippet that I'll be using as the foundation for my full reproducer:
```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
// Define the IOCTLs for the raw gadget driver.
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
#define USB_RAW_IOCTL_RUN _IO('U', 1)
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
// Structures for the raw gadget IOCTLs.
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
struct usb_raw_event {
uint32_t type;
uint32_t length;
uint8_t data[0]; // Flexible array member for event data.
};
struct usb_raw_ep_io {
uint16_t ep;
uint16_t flags;
uint32_t length;
uint8_t data[0]; // Flexible array member for IO data.
};
// Standard USB control request structure.
struct usb_ctrlrequest {
uint8_t bRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} __attribute__((packed));
int main() {
// Open the raw gadget device. This is the entry point.
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
printf("[+] open /dev/raw-gadget successful.\n");
// Initialize the raw gadget with dummy driver and device names.
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
if (ioctl(fd, USB_RAW_IOCTL_INIT, &init) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_INIT successful.\n");
// Start the gadget.
if (ioctl(fd, USB_RAW_IOCTL_RUN, 0) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_RUN: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_RUN successful.\n");
int done = 0;
// Main loop to process USB events.
while (!done) {
// Allocate buffer for event data.
struct usb_raw_event *event = malloc(sizeof(*event) + 1024);
event->type = 0;
event->length = 1024;
// Fetch the next USB event.
if (ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_EVENT_FETCH: %s\n", strerror(errno));
free(event);
break;
}
// Process control events.
if (event->type == 2) { // USB_RAW_EVENT_CONTROL
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)event->data;
// Allocate buffer for EP0 IO.
struct usb_raw_ep_io *io = malloc(sizeof(*io) + 1024);
io->ep = 0;
io->flags = 0;
io->length = 0;
int handled = 0;
// Handle standard USB requests like GET_DESCRIPTOR.
if (req->bRequestType == 0x80 && req->bRequest == 6) { // GET_DESCRIPTOR
if ((req->wValue >> 8) == 1) { // DEVICE descriptor
// Define a dummy device descriptor.
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
} else if ((req->wValue >> 8) == 2) { // CONFIGURATION descriptor
// Define a dummy configuration descriptor.
uint8_t desc[] = {
9, 2, 46, 0, 1, 1, 0, 0x80, 50,
9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0,
7, 5, 0x81, 2, 0, 2, 0,
7, 5, 0x02, 2, 0, 2, 0,
7, 5, 0x83, 2, 0, 2, 0,
7, 5, 0x04, 2, 0, 2, 0,
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
}
}
// Handle vendor-specific requests.
else if (req->bRequestType == 0xC0) { // VENDOR IN
if (req->bRequest == 1) { // GET_HC_INF0
uint8_t data[4] = {4, 0, 0, 1};
io->length = req->wLength < 4 ? req->wLength : 4;
memcpy(io->data, data, io->length);
handled = 1;
} else if (req->bRequest == 0) { // GET_SYSTEM_PORT_STATUS
// This request is crucial. By returning port_flags = 0 (card_present = 0),
// we prevent the mmc_add_host function from being called. This is key
// to setting up the scenario where the inactivity timer isn't managed
// properly by the mmc subsystem.
uint8_t data[15] = {15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
io->length = req->wLength < 15 ? req->wLength : 15;
memcpy(io->data, data, io->length);
handled = 1;
// This specific request marks the end of the vub300_probe sequence.
done = 1;
}
} else if (req->bRequestType == 0x40) { // VENDOR OUT
if (req->bRequest == 16) { // SET_ROM_WAIT_STATES
io->length = 0;
handled = 1;
}
} else if (req->bRequestType == 0x00 && req->bRequest == 9) { // SET_CONFIGURATION
io->length = 0;
handled = 1;
} else {
// Acknowledge other standard requests (like SET_ADDRESS) with an empty response.
io->length = 0;
handled = 1;
}
// Send the response back to the host.
if (handled) {
if (req->bRequestType & 0x80) { // IN transfer
ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
} else { // OUT transfer
ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
} else {
// Stall EP0 if the request was not handled.
ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
free(io);
}
free(event);
}
printf("[+] USB enumeration completed.\n");
// A small delay is needed to ensure vub300_probe has completed its mmc_add_host call
// before we simulate the disconnect.
usleep(200000);
// Close the file descriptor. This is what simulates the USB disconnect.
// This action should trigger vub300_disconnect.
close(fd);
printf("[+] Gadget closed, simulating disconnect.\n");
// Now, we need to wait for the inactivity_timer to expire. The vub300 driver
// sets this timer to jiffies + HZ. A sleep of 2 seconds should be sufficient
// to guarantee it fires. This is where the bug should manifest.
sleep(2);
printf("[+] Done.\n");
return 0;
}
```
Now, I need to double-check a crucial detail. The `vub300` driver, like many kernel drivers, relies on specific Vendor and Product IDs to identify the device it's supposed to manage. Looking at the `GET_DESCRIPTOR` response within the code:
```c
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
```
I see the Vendor ID encoded as `0x0424` (from `0x24 0x04`) and the Product ID as `0x012C` (from `0x2C 0x01`). My next step is to verify these IDs against the actual `vub300` driver source code. If they don't match, the driver won't recognize the gadget, and the reproducer will fail to trigger the intended behavior. This check is essential before I can confidently consider this a complete reproducer.
|
| 111/4 |
2026/09/07 15:27 |
tool |
grepper |
0m
Args: map[Expression:vub300 PathPrefix:drivers/mmc/host/]
Results: map[Output:
Full output is too long, showing 500 out of 1640 lines.
Use more precise expression if possible.
drivers/mmc/host/Kconfig=920=config MMC_VUB300
--
drivers/mmc/host/Kconfig-944- To compile this mmc host controller driver as a module,
drivers/mmc/host/Kconfig:945: choose M here: the module will be called vub300.
drivers/mmc/host/Kconfig-946-
--
drivers/mmc/host/Makefile=62=obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
drivers/mmc/host/Makefile:63:obj-$(CONFIG_MMC_VUB300) += vub300.o
drivers/mmc/host/Makefile-64-obj-$(CONFIG_MMC_USHC) += ushc.o
--
drivers/mmc/host/vub300.c=260=MODULE_PARM_DESC(firmware_rom_wait_states,
--
drivers/mmc/host/vub300.c-265-#define VUB300_PRODUCT_ID 0x012C
drivers/mmc/host/vub300.c:266:static const struct usb_device_id vub300_table[] = {
drivers/mmc/host/vub300.c-267- {USB_DEVICE(ELAN_VENDOR_ID, VUB300_PRODUCT_ID)},
--
drivers/mmc/host/vub300.c-270-};
drivers/mmc/host/vub300.c:271:MODULE_DEVICE_TABLE(usb, vub300_table);
drivers/mmc/host/vub300.c-272-
--
drivers/mmc/host/vub300.c=286=struct sdio_register {
--
drivers/mmc/host/vub300.c-295-
drivers/mmc/host/vub300.c:296:struct vub300_mmc_host {
drivers/mmc/host/vub300.c-297- struct usb_device *udev;
--
drivers/mmc/host/vub300.c-354-
drivers/mmc/host/vub300.c:355:#define kref_to_vub300_mmc_host(d) container_of(d, struct vub300_mmc_host, kref)
drivers/mmc/host/vub300.c-356-#define SET_TRANSFER_PSEUDOCODE 21
--
drivers/mmc/host/vub300.c-368-
drivers/mmc/host/vub300.c:369:static void vub300_delete(struct kref *kref)
drivers/mmc/host/vub300.c-370-{ /* kref callback - softirq */
drivers/mmc/host/vub300.c:371: struct vub300_mmc_host *vub300 = kref_to_vub300_mmc_host(kref);
drivers/mmc/host/vub300.c:372: struct mmc_host *mmc = vub300->mmc;
drivers/mmc/host/vub300.c-373-
drivers/mmc/host/vub300.c:374: usb_free_urb(vub300->command_out_urb);
drivers/mmc/host/vub300.c:375: vub300->command_out_urb = NULL;
drivers/mmc/host/vub300.c:376: usb_free_urb(vub300->command_res_urb);
drivers/mmc/host/vub300.c:377: vub300->command_res_urb = NULL;
drivers/mmc/host/vub300.c:378: usb_put_dev(vub300->udev);
drivers/mmc/host/vub300.c-379- mmc_free_host(mmc);
drivers/mmc/host/vub300.c-380- /*
drivers/mmc/host/vub300.c:381: * and hence also frees vub300
drivers/mmc/host/vub300.c-382- * which is contained at the end of struct mmc
--
drivers/mmc/host/vub300.c-385-
drivers/mmc/host/vub300.c:386:static void vub300_queue_cmnd_work(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-387-{
drivers/mmc/host/vub300.c:388: kref_get(&vub300->kref);
drivers/mmc/host/vub300.c:389: if (queue_work(cmndworkqueue, &vub300->cmndwork)) {
drivers/mmc/host/vub300.c-390- /*
--
drivers/mmc/host/vub300.c-401- */
drivers/mmc/host/vub300.c:402: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-403- }
--
drivers/mmc/host/vub300.c-405-
drivers/mmc/host/vub300.c:406:static void vub300_queue_poll_work(struct vub300_mmc_host *vub300, int delay)
drivers/mmc/host/vub300.c-407-{
drivers/mmc/host/vub300.c:408: kref_get(&vub300->kref);
drivers/mmc/host/vub300.c:409: if (queue_delayed_work(pollworkqueue, &vub300->pollwork, delay)) {
drivers/mmc/host/vub300.c-410- /*
--
drivers/mmc/host/vub300.c-421- */
drivers/mmc/host/vub300.c:422: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-423- }
--
drivers/mmc/host/vub300.c-425-
drivers/mmc/host/vub300.c:426:static void vub300_queue_dead_work(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-427-{
drivers/mmc/host/vub300.c:428: kref_get(&vub300->kref);
drivers/mmc/host/vub300.c:429: if (queue_work(deadworkqueue, &vub300->deadwork)) {
drivers/mmc/host/vub300.c-430- /*
--
drivers/mmc/host/vub300.c-441- */
drivers/mmc/host/vub300.c:442: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-443- }
--
drivers/mmc/host/vub300.c=446=static void irqpoll_res_completed(struct urb *urb)
drivers/mmc/host/vub300.c-447-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:448: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-449- if (urb->status)
drivers/mmc/host/vub300.c:450: vub300->usb_transport_fail = urb->status;
drivers/mmc/host/vub300.c:451: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-452-}
--
drivers/mmc/host/vub300.c=454=static void irqpoll_out_completed(struct urb *urb)
drivers/mmc/host/vub300.c-455-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:456: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-457- if (urb->status) {
drivers/mmc/host/vub300.c:458: vub300->usb_transport_fail = urb->status;
drivers/mmc/host/vub300.c:459: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-460- return;
--
drivers/mmc/host/vub300.c-463- unsigned int pipe =
drivers/mmc/host/vub300.c:464: usb_rcvbulkpipe(vub300->udev, vub300->cmnd_res_ep);
drivers/mmc/host/vub300.c:465: usb_fill_bulk_urb(vub300->command_res_urb, vub300->udev, pipe,
drivers/mmc/host/vub300.c:466: &vub300->resp, sizeof(vub300->resp),
drivers/mmc/host/vub300.c:467: irqpoll_res_completed, vub300);
drivers/mmc/host/vub300.c:468: vub300->command_res_urb->actual_length = 0;
drivers/mmc/host/vub300.c:469: ret = usb_submit_urb(vub300->command_res_urb, GFP_ATOMIC);
drivers/mmc/host/vub300.c-470- if (ret) {
drivers/mmc/host/vub300.c:471: vub300->usb_transport_fail = ret;
drivers/mmc/host/vub300.c:472: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-473- }
--
drivers/mmc/host/vub300.c-477-
drivers/mmc/host/vub300.c:478:static void send_irqpoll(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-479-{
drivers/mmc/host/vub300.c:480: /* cmd_mutex is held by vub300_pollwork_thread */
drivers/mmc/host/vub300.c-481- int retval;
drivers/mmc/host/vub300.c-482- int timeout = 0xFFFF & (0x0001FFFF - firmware_irqpoll_timeout);
drivers/mmc/host/vub300.c:483: vub300->cmnd.poll.header_size = 22;
drivers/mmc/host/vub300.c:484: vub300->cmnd.poll.header_type = 1;
drivers/mmc/host/vub300.c:485: vub300->cmnd.poll.port_number = 0;
drivers/mmc/host/vub300.c:486: vub300->cmnd.poll.command_type = 2;
drivers/mmc/host/vub300.c:487: vub300->cmnd.poll.poll_timeout_lsb = 0xFF & (unsigned)timeout;
drivers/mmc/host/vub300.c:488: vub300->cmnd.poll.poll_timeout_msb = 0xFF & (unsigned)(timeout >> 8);
drivers/mmc/host/vub300.c:489: usb_fill_bulk_urb(vub300->command_out_urb, vub300->udev,
drivers/mmc/host/vub300.c:490: usb_sndbulkpipe(vub300->udev, vub300->cmnd_out_ep)
drivers/mmc/host/vub300.c:491: , &vub300->cmnd, sizeof(vub300->cmnd)
drivers/mmc/host/vub300.c:492: , irqpoll_out_completed, vub300);
drivers/mmc/host/vub300.c:493: retval = usb_submit_urb(vub300->command_out_urb, GFP_KERNEL);
drivers/mmc/host/vub300.c-494- if (0 > retval) {
drivers/mmc/host/vub300.c:495: vub300->usb_transport_fail = retval;
drivers/mmc/host/vub300.c:496: vub300_queue_poll_work(vub300, 1);
drivers/mmc/host/vub300.c:497: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-498- return;
--
drivers/mmc/host/vub300.c-503-
drivers/mmc/host/vub300.c:504:static void new_system_port_status(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-505-{
drivers/mmc/host/vub300.c:506: int old_card_present = vub300->card_present;
drivers/mmc/host/vub300.c-507- int new_card_present =
drivers/mmc/host/vub300.c:508: (0x0001 & vub300->system_port_status.port_flags) ? 1 : 0;
drivers/mmc/host/vub300.c:509: vub300->read_only =
drivers/mmc/host/vub300.c:510: (0x0010 & vub300->system_port_status.port_flags) ? 1 : 0;
drivers/mmc/host/vub300.c-511- if (new_card_present && !old_card_present) {
drivers/mmc/host/vub300.c:512: dev_info(&vub300->udev->dev, "card just inserted\n");
drivers/mmc/host/vub300.c:513: vub300->card_present = 1;
drivers/mmc/host/vub300.c:514: vub300->bus_width = 0;
drivers/mmc/host/vub300.c-515- if (disable_offload_processing)
drivers/mmc/host/vub300.c:516: strscpy(vub300->vub_name, "EMPTY Processing Disabled",
drivers/mmc/host/vub300.c:517: sizeof(vub300->vub_name));
drivers/mmc/host/vub300.c-518- else
drivers/mmc/host/vub300.c:519: vub300->vub_name[0] = 0;
drivers/mmc/host/vub300.c:520: mmc_detect_change(vub300->mmc, 1);
drivers/mmc/host/vub300.c-521- } else if (!new_card_present && old_card_present) {
drivers/mmc/host/vub300.c:522: dev_info(&vub300->udev->dev, "card just ejected\n");
drivers/mmc/host/vub300.c:523: vub300->card_present = 0;
drivers/mmc/host/vub300.c:524: mmc_detect_change(vub300->mmc, 0);
drivers/mmc/host/vub300.c-525- } else {
--
drivers/mmc/host/vub300.c-529-
drivers/mmc/host/vub300.c:530:static void __add_offloaded_reg_to_fifo(struct vub300_mmc_host *vub300,
drivers/mmc/host/vub300.c-531- struct offload_registers_access
--
drivers/mmc/host/vub300.c-533-{
drivers/mmc/host/vub300.c:534: u8 r = vub300->fn[func].offload_point + vub300->fn[func].offload_count;
drivers/mmc/host/vub300.c:535: memcpy(&vub300->fn[func].reg[MAXREGMASK & r], register_access,
drivers/mmc/host/vub300.c-536- sizeof(struct offload_registers_access));
drivers/mmc/host/vub300.c:537: vub300->fn[func].offload_count += 1;
drivers/mmc/host/vub300.c:538: vub300->total_offload_count += 1;
drivers/mmc/host/vub300.c-539-}
drivers/mmc/host/vub300.c-540-
drivers/mmc/host/vub300.c:541:static void add_offloaded_reg(struct vub300_mmc_host *vub300,
drivers/mmc/host/vub300.c-542- struct offload_registers_access *register_access)
--
drivers/mmc/host/vub300.c-547- u8 func = ((0x70 & register_access->command_byte[0]) >> 4);
drivers/mmc/host/vub300.c:548: u8 regs = vub300->dynamic_register_count;
drivers/mmc/host/vub300.c-549- u8 i = 0;
drivers/mmc/host/vub300.c:550: while (0 < regs-- && 1 == vub300->sdio_register[i].activate) {
drivers/mmc/host/vub300.c:551: if (vub300->sdio_register[i].func_num == func &&
drivers/mmc/host/vub300.c:552: vub300->sdio_register[i].sdio_reg == Register) {
drivers/mmc/host/vub300.c:553: if (vub300->sdio_register[i].prepared == 0)
drivers/mmc/host/vub300.c:554: vub300->sdio_register[i].prepared = 1;
drivers/mmc/host/vub300.c:555: vub300->sdio_register[i].response =
drivers/mmc/host/vub300.c-556- register_access->Respond_Byte[2];
drivers/mmc/host/vub300.c:557: vub300->sdio_register[i].regvalue =
drivers/mmc/host/vub300.c-558- register_access->Respond_Byte[3];
--
drivers/mmc/host/vub300.c-564- }
drivers/mmc/host/vub300.c:565: __add_offloaded_reg_to_fifo(vub300, register_access, func);
drivers/mmc/host/vub300.c-566-}
drivers/mmc/host/vub300.c-567-
drivers/mmc/host/vub300.c:568:static void check_vub300_port_status(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-569-{
drivers/mmc/host/vub300.c-570- /*
drivers/mmc/host/vub300.c:571: * cmd_mutex is held by vub300_pollwork_thread,
drivers/mmc/host/vub300.c:572: * vub300_deadwork_thread or vub300_cmndwork_thread
drivers/mmc/host/vub300.c-573- */
--
drivers/mmc/host/vub300.c-575- retval =
drivers/mmc/host/vub300.c:576: usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
drivers/mmc/host/vub300.c-577- GET_SYSTEM_PORT_STATUS,
drivers/mmc/host/vub300.c-578- USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
drivers/mmc/host/vub300.c:579: 0x0000, 0x0000, &vub300->system_port_status,
drivers/mmc/host/vub300.c:580: sizeof(vub300->system_port_status), 1000);
drivers/mmc/host/vub300.c:581: if (sizeof(vub300->system_port_status) == retval)
drivers/mmc/host/vub300.c:582: new_system_port_status(vub300);
drivers/mmc/host/vub300.c-583-}
drivers/mmc/host/vub300.c-584-
drivers/mmc/host/vub300.c:585:static void __vub300_irqpoll_response(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-586-{
drivers/mmc/host/vub300.c:587: /* cmd_mutex is held by vub300_pollwork_thread */
drivers/mmc/host/vub300.c:588: if (vub300->command_res_urb->actual_length == 0)
drivers/mmc/host/vub300.c-589- return;
drivers/mmc/host/vub300.c-590-
drivers/mmc/host/vub300.c:591: switch (vub300->resp.common.header_type) {
drivers/mmc/host/vub300.c-592- case RESPONSE_INTERRUPT:
drivers/mmc/host/vub300.c:593: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:594: if (vub300->irq_enabled)
drivers/mmc/host/vub300.c:595: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c-596- else
drivers/mmc/host/vub300.c:597: vub300->irqs_queued += 1;
drivers/mmc/host/vub300.c:598: vub300->irq_disabled = 1;
drivers/mmc/host/vub300.c:599: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c-600- break;
drivers/mmc/host/vub300.c-601- case RESPONSE_ERROR:
drivers/mmc/host/vub300.c:602: if (vub300->resp.error.error_code == SD_ERROR_NO_DEVICE)
drivers/mmc/host/vub300.c:603: check_vub300_port_status(vub300);
drivers/mmc/host/vub300.c-604- break;
drivers/mmc/host/vub300.c-605- case RESPONSE_STATUS:
drivers/mmc/host/vub300.c:606: vub300->system_port_status = vub300->resp.status;
drivers/mmc/host/vub300.c:607: new_system_port_status(vub300);
drivers/mmc/host/vub300.c:608: if (!vub300->card_present)
drivers/mmc/host/vub300.c:609: vub300_queue_poll_work(vub300, HZ / 5);
drivers/mmc/host/vub300.c-610- break;
--
drivers/mmc/host/vub300.c-612- {
drivers/mmc/host/vub300.c:613: int offloaded_data_length = vub300->resp.common.header_size - 3;
drivers/mmc/host/vub300.c-614- int register_count = offloaded_data_length >> 3;
--
drivers/mmc/host/vub300.c-616- while (register_count--) {
drivers/mmc/host/vub300.c:617: add_offloaded_reg(vub300, &vub300->resp.irq.reg[ri]);
drivers/mmc/host/vub300.c-618- ri += 1;
drivers/mmc/host/vub300.c-619- }
drivers/mmc/host/vub300.c:620: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:621: if (vub300->irq_enabled)
drivers/mmc/host/vub300.c:622: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c-623- else
drivers/mmc/host/vub300.c:624: vub300->irqs_queued += 1;
drivers/mmc/host/vub300.c:625: vub300->irq_disabled = 1;
drivers/mmc/host/vub300.c:626: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c-627- break;
--
drivers/mmc/host/vub300.c-630- {
drivers/mmc/host/vub300.c:631: int offloaded_data_length = vub300->resp.common.header_size - 3;
drivers/mmc/host/vub300.c-632- int register_count = offloaded_data_length >> 3;
--
drivers/mmc/host/vub300.c-634- while (register_count--) {
drivers/mmc/host/vub300.c:635: add_offloaded_reg(vub300, &vub300->resp.irq.reg[ri]);
drivers/mmc/host/vub300.c-636- ri += 1;
drivers/mmc/host/vub300.c-637- }
drivers/mmc/host/vub300.c:638: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:639: if (vub300->irq_enabled)
drivers/mmc/host/vub300.c:640: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c-641- else
drivers/mmc/host/vub300.c:642: vub300->irqs_queued += 1;
drivers/mmc/host/vub300.c:643: vub300->irq_disabled = 0;
drivers/mmc/host/vub300.c:644: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c-645- break;
--
drivers/mmc/host/vub300.c-647- case RESPONSE_NO_INTERRUPT:
drivers/mmc/host/vub300.c:648: vub300_queue_poll_work(vub300, 1);
drivers/mmc/host/vub300.c-649- break;
--
drivers/mmc/host/vub300.c-654-
drivers/mmc/host/vub300.c:655:static void __do_poll(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-656-{
drivers/mmc/host/vub300.c:657: /* cmd_mutex is held by vub300_pollwork_thread */
drivers/mmc/host/vub300.c-658- unsigned long commretval;
drivers/mmc/host/vub300.c:659: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c:660: init_completion(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c:661: send_irqpoll(vub300);
drivers/mmc/host/vub300.c:662: commretval = wait_for_completion_timeout(&vub300->irqpoll_complete,
drivers/mmc/host/vub300.c-663- msecs_to_jiffies(500));
drivers/mmc/host/vub300.c:664: if (vub300->usb_transport_fail) {
drivers/mmc/host/vub300.c-665- /* no need to do anything */
drivers/mmc/host/vub300.c-666- } else if (commretval == 0) {
drivers/mmc/host/vub300.c:667: vub300->usb_timed_out = 1;
drivers/mmc/host/vub300.c:668: usb_kill_urb(vub300->command_out_urb);
drivers/mmc/host/vub300.c:669: usb_kill_urb(vub300->command_res_urb);
drivers/mmc/host/vub300.c-670- } else { /* commretval > 0 */
drivers/mmc/host/vub300.c:671: __vub300_irqpoll_response(vub300);
drivers/mmc/host/vub300.c-672- }
--
drivers/mmc/host/vub300.c-677- */
drivers/mmc/host/vub300.c:678:static void vub300_pollwork_thread(struct work_struct *work)
drivers/mmc/host/vub300.c-679-{ /* NOT irq */
drivers/mmc/host/vub300.c:680: struct vub300_mmc_host *vub300 = container_of(work,
drivers/mmc/host/vub300.c:681: struct vub300_mmc_host, pollwork.work);
drivers/mmc/host/vub300.c:682: if (!vub300->interface) {
drivers/mmc/host/vub300.c:683: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-684- return;
drivers/mmc/host/vub300.c-685- }
drivers/mmc/host/vub300.c:686: mutex_lock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:687: if (vub300->cmd) {
drivers/mmc/host/vub300.c:688: vub300_queue_poll_work(vub300, 1);
drivers/mmc/host/vub300.c:689: } else if (!vub300->card_present) {
drivers/mmc/host/vub300.c-690- /* no need to do anything */
drivers/mmc/host/vub300.c:691: } else { /* vub300->card_present */
drivers/mmc/host/vub300.c:692: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:693: if (!vub300->irq_enabled) {
drivers/mmc/host/vub300.c:694: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:695: } else if (vub300->irqs_queued) {
drivers/mmc/host/vub300.c:696: vub300->irqs_queued -= 1;
drivers/mmc/host/vub300.c:697: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c:698: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c:699: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:700: } else { /* NOT vub300->irqs_queued */
drivers/mmc/host/vub300.c:701: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:702: __do_poll(vub300);
drivers/mmc/host/vub300.c-703- }
drivers/mmc/host/vub300.c-704- }
drivers/mmc/host/vub300.c:705: mutex_unlock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:706: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-707-}
drivers/mmc/host/vub300.c-708-
drivers/mmc/host/vub300.c:709:static void vub300_deadwork_thread(struct work_struct *work)
drivers/mmc/host/vub300.c-710-{ /* NOT irq */
drivers/mmc/host/vub300.c:711: struct vub300_mmc_host *vub300 =
drivers/mmc/host/vub300.c:712: container_of(work, struct vub300_mmc_host, deadwork);
drivers/mmc/host/vub300.c:713: if (!vub300->interface) {
drivers/mmc/host/vub300.c:714: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-715- return;
drivers/mmc/host/vub300.c-716- }
drivers/mmc/host/vub300.c:717: mutex_lock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:718: if (vub300->cmd) {
drivers/mmc/host/vub300.c-719- /*
--
drivers/mmc/host/vub300.c-724- */
drivers/mmc/host/vub300.c:725: } else if (vub300->card_present) {
drivers/mmc/host/vub300.c:726: check_vub300_port_status(vub300);
drivers/mmc/host/vub300.c:727: } else if (vub300->mmc && vub300->mmc->card) {
drivers/mmc/host/vub300.c-728- /*
--
drivers/mmc/host/vub300.c-734- } else {
drivers/mmc/host/vub300.c:735: check_vub300_port_status(vub300);
drivers/mmc/host/vub300.c-736- }
drivers/mmc/host/vub300.c:737: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c:738: mutex_unlock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:739: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-740-}
drivers/mmc/host/vub300.c-741-
drivers/mmc/host/vub300.c:742:static void vub300_inactivity_timer_expired(struct timer_list *t)
drivers/mmc/host/vub300.c-743-{ /* softirq */
drivers/mmc/host/vub300.c:744: struct vub300_mmc_host *vub300 = timer_container_of(vub300, t,
drivers/mmc/host/vub300.c-745- inactivity_timer);
drivers/mmc/host/vub300.c:746: if (!vub300->interface) {
drivers/mmc/host/vub300.c:747: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c:748: } else if (vub300->cmd) {
drivers/mmc/host/vub300.c:749: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-750- } else {
drivers/mmc/host/vub300.c:751: vub300_queue_dead_work(vub300);
drivers/mmc/host/vub300.c:752: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-753- }
--
drivers/mmc/host/vub300.c-755-
drivers/mmc/host/vub300.c:756:static int vub300_response_error(u8 error_code)
drivers/mmc/host/vub300.c-757-{
--
drivers/mmc/host/vub300.c=792=static void command_res_completed(struct urb *urb)
drivers/mmc/host/vub300.c-793-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:794: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-795- if (urb->status) {
drivers/mmc/host/vub300.c-796- /* we have to let the initiator handle the error */
drivers/mmc/host/vub300.c:797: } else if (vub300->command_res_urb->actual_length == 0) {
drivers/mmc/host/vub300.c-798- /*
--
drivers/mmc/host/vub300.c-801- */
drivers/mmc/host/vub300.c:802: } else if (!vub300->data) {
drivers/mmc/host/vub300.c-803- /* this means that the command (typically CMD52) succeeded */
drivers/mmc/host/vub300.c:804: } else if (vub300->resp.common.header_type != 0x02) {
drivers/mmc/host/vub300.c-805- /*
--
drivers/mmc/host/vub300.c-808- */
drivers/mmc/host/vub300.c:809: } else if (vub300->urb) {
drivers/mmc/host/vub300.c:810: vub300->cmd->error =
drivers/mmc/host/vub300.c:811: vub300_response_error(vub300->resp.error.error_code);
drivers/mmc/host/vub300.c:812: usb_unlink_urb(vub300->urb);
drivers/mmc/host/vub300.c-813- } else {
drivers/mmc/host/vub300.c:814: vub300->cmd->error =
drivers/mmc/host/vub300.c:815: vub300_response_error(vub300->resp.error.error_code);
drivers/mmc/host/vub300.c:816: usb_sg_cancel(&vub300->sg_request);
drivers/mmc/host/vub300.c-817- }
drivers/mmc/host/vub300.c:818: complete(&vub300->command_complete); /* got_response_in */
drivers/mmc/host/vub300.c-819-}
--
drivers/mmc/host/vub300.c=821=static void command_out_completed(struct urb *urb)
drivers/mmc/host/vub300.c-822-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:823: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-824- if (urb->status) {
drivers/mmc/host/vub300.c:825: complete(&vub300->command_complete);
drivers/mmc/host/vub300.c-826- } else {
--
drivers/mmc/host/vub300.c-828- unsigned int pipe =
drivers/mmc/host/vub300.c:829: usb_rcvbulkpipe(vub300->udev, vub300->cmnd_res_ep);
drivers/mmc/host/vub300.c:830: usb_fill_bulk_urb(vub300->command_res_urb, vub300->udev, pipe,
drivers/mmc/host/vub300.c:831: &vub300->resp, sizeof(vub300->resp),
drivers/mmc/host/vub300.c:832: command_res_completed, vub300);
drivers/mmc/host/vub300.c:833: vub300->command_res_urb->actual_length = 0;
drivers/mmc/host/vub300.c:834: ret = usb_submit_urb(vub300->command_res_urb, GFP_ATOMIC);
drivers/mmc/host/vub300.c-835- if (ret == 0) {
--
drivers/mmc/host/vub300.c-844- */
drivers/mmc/host/vub300.c:845: complete(&vub300->command_complete);
drivers/mmc/host/vub300.c-846- }
--
drivers/mmc/host/vub300.c-852- */
drivers/mmc/host/vub300.c:853:static void snoop_block_size_and_bus_width(struct vub300_mmc_host *vub300,
drivers/mmc/host/vub300.c-854- u32 cmd_arg)
--
drivers/mmc/host/vub300.c-856- if ((0xFBFFFE00 & cmd_arg) == 0x80022200)
drivers/mmc/host/vub300.c:857: vub300->fbs[1] = (cmd_arg << 8) | (0x00FF & vub300->fbs[1]);
drivers/mmc/host/vub300.c-858- else if ((0xFBFFFE00 & cmd_arg) == 0x80022000)
drivers/mmc/host/vub300.c:859: vub300->fbs[1] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[1]);
drivers/mmc/host/vub300.c-860- else if ((0xFBFFFE00 & cmd_arg) == 0x80042200)
drivers/mmc/host/vub300.c:861: vub300->fbs[2] = (cmd_arg << 8) | (0x00FF & vub300->fbs[2]);
drivers/mmc/host/vub300.c-862- else if ((0xFBFFFE00 & cmd_arg) == 0x80042000)
drivers/mmc/host/vub300.c:863: vub300->fbs[2] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[2]);
drivers/mmc/host/vub300.c-864- else if ((0xFBFFFE00 & cmd_arg) == 0x80062200)
drivers/mmc/host/vub300.c:865: vub300->fbs[3] = (cmd_arg << 8) | (0x00FF & vub300->fbs[3]);
drivers/mmc/host/vub300.c-866- else if ((0xFBFFFE00 & cmd_arg) == 0x80062000)
drivers/mmc/host/vub300.c:867: vub300->fbs[3] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[3]);
drivers/mmc/host/vub300.c-868- else if ((0xFBFFFE00 & cmd_arg) == 0x80082200)
drivers/mmc/host/vub300.c:869: vub300->fbs[4] = (cmd_arg << 8) | (0x00FF & vub300->fbs[4]);
drivers/mmc/host/vub300.c-870- else if ((0xFBFFFE00 & cmd_arg) == 0x80082000)
drivers/mmc/host/vub300.c:871: vub300->fbs[4] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[4]);
drivers/mmc/host/vub300.c-872- else if ((0xFBFFFE00 & cmd_arg) == 0x800A2200)
drivers/mmc/host/vub300.c:873: vub300->fbs[5] = (cmd_arg << 8) | (0x00FF & vub300->fbs[5]);
drivers/mmc/host/vub300.c-874- else if ((0xFBFFFE00 & cmd_arg) == 0x800A2000)
drivers/mmc/host/vub300.c:875: vub300->fbs[5] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[5]);
drivers/mmc/host/vub300.c-876- else if ((0xFBFFFE00 & cmd_arg) == 0x800C2200)
drivers/mmc/host/vub300.c:877: vub300->fbs[6] = (cmd_arg << 8) | (0x00FF & vub300->fbs[6]);
drivers/mmc/host/vub300.c-878- else if ((0xFBFFFE00 & cmd_arg) == 0x800C2000)
drivers/mmc/host/vub300.c:879: vub300->fbs[6] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[6]);
drivers/mmc/host/vub300.c-880- else if ((0xFBFFFE00 & cmd_arg) == 0x800E2200)
drivers/mmc/host/vub300.c:881: vub300->fbs[7] = (cmd_arg << 8) | (0x00FF & vub300->fbs[7]);
drivers/mmc/host/vub300.c-882- else if ((0xFBFFFE00 & cmd_arg) == 0x800E2000)
drivers/mmc/host/vub300.c:883: vub300->fbs[7] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[7]);
drivers/mmc/host/vub300.c-884- else if ((0xFBFFFE03 & cmd_arg) == 0x80000E00)
drivers/mmc/host/vub300.c:885: vub300->bus_width = 1;
drivers/mmc/host/vub300.c-886- else if ((0xFBFFFE03 & cmd_arg) == 0x80000E02)
drivers/mmc/host/vub300.c:887: vub300->bus_width = 4;
drivers/mmc/host/vub300.c-888-}
drivers/mmc/host/vub300.c-889-
drivers/mmc/host/vub300.c:890:static void send_command(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-891-{
drivers/mmc/host/vub300.c:892: /* cmd_mutex is held by vub300_cmndwork_thread */
drivers/mmc/host/vub300.c:893: struct mmc_command *cmd = vub300->cmd;
drivers/mmc/host/vub300.c:894: struct mmc_data *data = vub300->data;
drivers/mmc/host/vub300.c-895- int retval;
--
drivers/mmc/host/vub300.c-897- u8 response_type;
drivers/mmc/host/vub300.c:898: if (vub300->app_spec) {
drivers/mmc/host/vub300.c-899- switch (cmd->opcode) {
--
drivers/mmc/host/vub300.c-901- response_type = SDRT_1;
drivers/mmc/host/vub300.c:902: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-903- if (0x00000000 == (0x00000003 & cmd->arg))
drivers/mmc/host/vub300.c:904: vub300->bus_width = 1;
drivers/mmc/host/vub300.c-905- else if (0x00000002 == (0x00000003 & cmd->arg))
drivers/mmc/host/vub300.c:906: vub300->bus_width = 4;
drivers/mmc/host/vub300.c-907- else
drivers/mmc/host/vub300.c:908: dev_err(&vub300->udev->dev,
drivers/mmc/host/vub300.c-909- "unexpected ACMD6 bus_width=%d\n",
--
drivers/mmc/host/vub300.c-913- response_type = SDRT_1;
drivers/mmc/host/vub300.c:914: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-915- break;
--
drivers/mmc/host/vub300.c-917- response_type = SDRT_1;
drivers/mmc/host/vub300.c:918: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-919- break;
--
drivers/mmc/host/vub300.c-921- response_type = SDRT_1;
drivers/mmc/host/vub300.c:922: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-923- break;
--
drivers/mmc/host/vub300.c-925- response_type = SDRT_3;
drivers/mmc/host/vub300.c:926: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-927- break;
--
drivers/mmc/host/vub300.c-929- response_type = SDRT_1;
drivers/mmc/host/vub300.c:930: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-931- break;
--
drivers/mmc/host/vub300.c-933- response_type = SDRT_1;
drivers/mmc/host/vub300.c:934: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-935- break;
--
drivers/mmc/host/vub300.c-937- response_type = SDRT_1;
drivers/mmc/host/vub300.c:938: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-939- break;
drivers/mmc/host/vub300.c-940- default:
drivers/mmc/host/vub300.c:941: vub300->resp_len = 0;
drivers/mmc/host/vub300.c-942- cmd->error = -EINVAL;
drivers/mmc/host/vub300.c:943: complete(&vub300->command_complete);
]
|
| 112/4 |
2026/09/07 15:27 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 34050
output: 26
thoughts: 46
Thoughts: **My Thought Process on Identifying the VID and PID**
Okay, so the first thing I need to get a handle on is the specific hardware I'm dealing with. My internal notation tells me the VID is `ELAN_VENDOR_ID` and the PID is `VUB300_PRODUCT_ID`, with the numerical representation being `0x012C`. The immediate priority for me is to nail down exactly what `ELAN_VENDOR_ID` refers to. Once I have that resolved, I'll have a complete and unambiguous identifier for this device.
|
| 113/4 |
2026/09/07 15:27 |
tool |
grepper |
0m
Args: map[Expression:ELAN_VENDOR_ID PathPrefix:]
Results: map[Output:drivers/input/mouse/elan_i2c_core.c-44-#define DRIVER_NAME "elan_i2c"
drivers/input/mouse/elan_i2c_core.c:45:#define ELAN_VENDOR_ID 0x04f3
drivers/input/mouse/elan_i2c_core.c-46-#define ETP_MAX_PRESSURE 255
--
drivers/input/mouse/elan_i2c_core.c=1124=static int elan_setup_trackpoint_input_device(struct elan_tp_data *data)
--
drivers/input/mouse/elan_i2c_core.c-1134- input->id.bustype = BUS_I2C;
drivers/input/mouse/elan_i2c_core.c:1135: input->id.vendor = ELAN_VENDOR_ID;
drivers/input/mouse/elan_i2c_core.c-1136- input->id.product = data->product_id;
--
drivers/input/mouse/elan_i2c_core.c=1153=static int elan_setup_input_device(struct elan_tp_data *data)
--
drivers/input/mouse/elan_i2c_core.c-1166- input->id.bustype = BUS_I2C;
drivers/input/mouse/elan_i2c_core.c:1167: input->id.vendor = ELAN_VENDOR_ID;
drivers/input/mouse/elan_i2c_core.c-1168- input->id.product = data->product_id;
--
drivers/mmc/host/vub300.c=260=MODULE_PARM_DESC(firmware_rom_wait_states,
--
drivers/mmc/host/vub300.c-262-
drivers/mmc/host/vub300.c:263:#define ELAN_VENDOR_ID 0x2201
drivers/mmc/host/vub300.c-264-#define VUB300_VENDOR_ID 0x0424
--
drivers/mmc/host/vub300.c=266=static const struct usb_device_id vub300_table[] = {
drivers/mmc/host/vub300.c:267: {USB_DEVICE(ELAN_VENDOR_ID, VUB300_PRODUCT_ID)},
drivers/mmc/host/vub300.c-268- {USB_DEVICE(VUB300_VENDOR_ID, VUB300_PRODUCT_ID)},
]
|
| 114/4 |
2026/09/07 15:27 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 34787
output: 34
thoughts: 970
Thoughts: **My Thought Process on the VUB300 Bug and Reproducer**
Alright, let's break down my current thinking on this VUB300 issue. I've confirmed that the `VUB300_VENDOR_ID` is indeed `0x0424` and the `VUB300_PRODUCT_ID` is `0x012C`. I've double-checked these values against the provided reproducer snippet, and they line up perfectly: `0x24, 0x04` correctly maps to `0x0424` and `0x2C, 0x01` maps to `0x012C`.
Looking back at my previous steps, I realized I hadn't actually executed the *full* reproducer, only a portion related to the `probe` function. That's a critical oversight. My immediate next step is to run the complete reproducer to ensure I'm seeing the entire interaction leading up to the failure.
I'm meticulously reviewing the reproducer code to ensure I haven't missed anything. The bug, as I understand it, is triggered by the `vub300_disconnect` function. This function is called when the USB device is effectively disconnected. In the context of the reproducer, this disconnection is simulated by closing the `/dev/raw-gadget` file descriptor. Following that, the plan is to wait for a timer to expire. This timer is set for `jiffies + HZ`, meaning a simple `sleep(2)` should be sufficient to allow the timer to elapse and trigger the relevant logic.
Furthermore, I'm paying close attention to how the reproducer handles the USB enumeration process. Specifically, I'm examining the `GET_DESCRIPTOR` requests. The code correctly identifies that `req->bRequestType == 0x80` and `req->bRequest == 6` signify a `GET_DESCRIPTOR` request.
When the request is for the *DEVICE* descriptor (`(req->wValue >> 8) == 1`), the provided `desc` array contains the expected values, including the confirmed Vendor and Product IDs.
For the *CONFIGURATION* descriptor (`(req->wValue >> 8) == 2`), I've calculated the total length to be 46 bytes. This is derived from:
* The configuration descriptor itself (9 bytes).
* The interface descriptor (9 bytes).
* Four endpoint descriptors, each 7 bytes long (4 * 7 = 28 bytes).
So, 9 + 9 + 28 = 46 bytes.
I've also reviewed the endpoint definitions within the configuration descriptor:
* Endpoint 0x81 (IN), bulk, with a maximum packet size of 512 bytes (represented by `0, 2`).
* Endpoint 0x02 (OUT), bulk, also with a maximum packet size of 512 bytes.
* Endpoint 0x83 (IN), bulk, max packet size 512 bytes.
* Endpoint 0x04 (OUT), bulk, max packet size 512 bytes.
My next step, before anything else, is to correlate these expected endpoint configurations with what the `vub300_probe` function actually expects. I need to ensure there's no mismatch there that could be contributing to the problem.
|
| 115/4 |
2026/09/07 15:27 |
tool |
grepper |
0m
Args: map[Expression:vub300_probe PathPrefix:drivers/mmc/host/]
Results: map[Output:drivers/mmc/host/vub300.c=2085=static const struct mmc_host_ops vub300_mmc_ops = {
--
drivers/mmc/host/vub300.c-2091-
drivers/mmc/host/vub300.c:2092:static int vub300_probe(struct usb_interface *interface,
drivers/mmc/host/vub300.c-2093- const struct usb_device_id *id)
--
drivers/mmc/host/vub300.c=2426=static struct usb_driver vub300_driver = {
drivers/mmc/host/vub300.c-2427- .name = "vub300",
drivers/mmc/host/vub300.c:2428: .probe = vub300_probe,
drivers/mmc/host/vub300.c-2429- .disconnect = vub300_disconnect,
]
|
| 116/4 |
2026/09/07 15:27 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 36057
output: 45
thoughts: 16
Thoughts: **My Deep Dive into `vub300_probe`**
Alright, let's get right to it. I'm pulling up the `vub300_probe` implementation now, ready to dissect it. My primary objective here is to thoroughly understand its inner workings. I'm not just skimming; I'm looking for the architectural decisions, the core logic, and how it all fits together within the larger system. I want to grasp its purpose, its responsibilities, and the specific mechanisms it employs to achieve its goals. This is about getting a foundational understanding, so when I see it used elsewhere or need to debug it, I'll have the context firmly in hand.
|
| 117/4 |
2026/09/07 15:27 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_probe]
Results: map[SourceCode:2092: static int vub300_probe(struct usb_interface *interface,
2093: const struct usb_device_id *id)
2094: { /* NOT irq */
2095: struct vub300_mmc_host *vub300;
2096: struct usb_host_interface *iface_desc;
2097: struct usb_device *udev = usb_get_dev(interface_to_usbdev(interface));
2098: int i;
2099: int retval = -ENOMEM;
2100: struct urb *command_out_urb;
2101: struct urb *command_res_urb;
2102: struct mmc_host *mmc;
2103: char manufacturer[48];
2104: char product[32];
2105: char serial_number[32];
2106: usb_string(udev, udev->descriptor.iManufacturer, manufacturer,
2107: sizeof(manufacturer));
2108: usb_string(udev, udev->descriptor.iProduct, product, sizeof(product));
2109: usb_string(udev, udev->descriptor.iSerialNumber, serial_number,
2110: sizeof(serial_number));
2111: dev_info(&udev->dev, "probing VID:PID(%04X:%04X) %s %s %s\n",
2112: le16_to_cpu(udev->descriptor.idVendor),
2113: le16_to_cpu(udev->descriptor.idProduct),
2114: manufacturer, product, serial_number);
2115: command_out_urb = usb_alloc_urb(0, GFP_KERNEL);
2116: if (!command_out_urb) {
2117: retval = -ENOMEM;
2118: goto err_put_udev;
2119: }
2120: command_res_urb = usb_alloc_urb(0, GFP_KERNEL);
2121: if (!command_res_urb) {
2122: retval = -ENOMEM;
2123: goto err_free_out_urb;
2124: }
2125: /* this also allocates memory for our VUB300 mmc host device */
2126: mmc = mmc_alloc_host(sizeof(*vub300), &udev->dev);
2127: if (!mmc) {
2128: retval = -ENOMEM;
2129: dev_err(&udev->dev, "not enough memory for the mmc_host\n");
2130: goto err_free_res_urb;
2131: }
2132: /* MMC core transfer sizes tunable parameters */
2133: mmc->caps = 0;
2134: if (!force_1_bit_data_xfers)
2135: mmc->caps |= MMC_CAP_4_BIT_DATA;
2136: if (!force_polling_for_irqs)
2137: mmc->caps |= MMC_CAP_SDIO_IRQ;
2138: mmc->caps &= ~MMC_CAP_NEEDS_POLL;
2139: /*
2140: * MMC_CAP_NEEDS_POLL causes core.c:mmc_rescan() to poll
2141: * for devices which results in spurious CMD7's being
2142: * issued which stops some SDIO cards from working
2143: */
2144: if (limit_speed_to_24_MHz) {
2145: mmc->caps |= MMC_CAP_MMC_HIGHSPEED;
2146: mmc->caps |= MMC_CAP_SD_HIGHSPEED;
2147: mmc->f_max = 24000000;
2148: dev_info(&udev->dev, "limiting SDIO speed to 24_MHz\n");
2149: } else {
2150: mmc->caps |= MMC_CAP_MMC_HIGHSPEED;
2151: mmc->caps |= MMC_CAP_SD_HIGHSPEED;
2152: mmc->f_max = 48000000;
2153: }
2154: mmc->f_min = 200000;
2155: mmc->max_blk_count = 511;
2156: mmc->max_blk_size = 512;
2157: mmc->max_segs = 128;
2158: if (force_max_req_size)
2159: mmc->max_req_size = force_max_req_size * 1024;
2160: else
2161: mmc->max_req_size = 64 * 1024;
2162: mmc->max_seg_size = mmc->max_req_size;
2163: mmc->ocr_avail = 0;
2164: mmc->ocr_avail |= MMC_VDD_165_195;
2165: mmc->ocr_avail |= MMC_VDD_20_21;
2166: mmc->ocr_avail |= MMC_VDD_21_22;
2167: mmc->ocr_avail |= MMC_VDD_22_23;
2168: mmc->ocr_avail |= MMC_VDD_23_24;
2169: mmc->ocr_avail |= MMC_VDD_24_25;
2170: mmc->ocr_avail |= MMC_VDD_25_26;
2171: mmc->ocr_avail |= MMC_VDD_26_27;
2172: mmc->ocr_avail |= MMC_VDD_27_28;
2173: mmc->ocr_avail |= MMC_VDD_28_29;
2174: mmc->ocr_avail |= MMC_VDD_29_30;
2175: mmc->ocr_avail |= MMC_VDD_30_31;
2176: mmc->ocr_avail |= MMC_VDD_31_32;
2177: mmc->ocr_avail |= MMC_VDD_32_33;
2178: mmc->ocr_avail |= MMC_VDD_33_34;
2179: mmc->ocr_avail |= MMC_VDD_34_35;
2180: mmc->ocr_avail |= MMC_VDD_35_36;
2181: mmc->ops = &vub300_mmc_ops;
2182: vub300 = mmc_priv(mmc);
2183: vub300->mmc = mmc;
2184: vub300->card_powered = 0;
2185: vub300->bus_width = 0;
2186: vub300->cmnd.head.block_size[0] = 0x00;
2187: vub300->cmnd.head.block_size[1] = 0x00;
2188: vub300->app_spec = 0;
2189: mutex_init(&vub300->cmd_mutex);
2190: mutex_init(&vub300->irq_mutex);
2191: vub300->command_out_urb = command_out_urb;
2192: vub300->command_res_urb = command_res_urb;
2193: vub300->usb_timed_out = 0;
2194: vub300->dynamic_register_count = 0;
2195:
2196: for (i = 0; i < ARRAY_SIZE(vub300->fn); i++) {
2197: vub300->fn[i].offload_point = 0;
2198: vub300->fn[i].offload_count = 0;
2199: }
2200:
2201: vub300->total_offload_count = 0;
2202: vub300->irq_enabled = 0;
2203: vub300->irq_disabled = 0;
2204: vub300->irqs_queued = 0;
2205:
2206: for (i = 0; i < ARRAY_SIZE(vub300->sdio_register); i++)
2207: vub300->sdio_register[i++].activate = 0;
2208:
2209: vub300->udev = udev;
2210: vub300->interface = interface;
2211: vub300->cmnd_res_ep = 0;
2212: vub300->cmnd_out_ep = 0;
2213: vub300->data_inp_ep = 0;
2214: vub300->data_out_ep = 0;
2215:
2216: for (i = 0; i < ARRAY_SIZE(vub300->fbs); i++)
2217: vub300->fbs[i] = 512;
2218:
2219: /*
2220: * set up the endpoint information
2221: *
2222: * use the first pair of bulk-in and bulk-out
2223: * endpoints for Command/Response+Interrupt
2224: *
2225: * use the second pair of bulk-in and bulk-out
2226: * endpoints for Data In/Out
2227: */
2228: vub300->large_usb_packets = 0;
2229: iface_desc = interface->cur_altsetting;
2230: for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
2231: struct usb_endpoint_descriptor *endpoint =
2232: &iface_desc->endpoint[i].desc;
2233: dev_info(&vub300->udev->dev,
2234: "vub300 testing %s EndPoint(%d) %02X\n",
2235: usb_endpoint_is_bulk_in(endpoint) ? "BULK IN" :
2236: usb_endpoint_is_bulk_out(endpoint) ? "BULK OUT" :
2237: "UNKNOWN", i, endpoint->bEndpointAddress);
2238: if (endpoint->wMaxPacketSize > 64)
2239: vub300->large_usb_packets = 1;
2240: if (usb_endpoint_is_bulk_in(endpoint)) {
2241: if (!vub300->cmnd_res_ep) {
2242: vub300->cmnd_res_ep =
2243: endpoint->bEndpointAddress;
2244: } else if (!vub300->data_inp_ep) {
2245: vub300->data_inp_ep =
2246: endpoint->bEndpointAddress;
2247: } else {
2248: dev_warn(&vub300->udev->dev,
2249: "ignoring"
2250: " unexpected bulk_in endpoint");
2251: }
2252: } else if (usb_endpoint_is_bulk_out(endpoint)) {
2253: if (!vub300->cmnd_out_ep) {
2254: vub300->cmnd_out_ep =
2255: endpoint->bEndpointAddress;
2256: } else if (!vub300->data_out_ep) {
2257: vub300->data_out_ep =
2258: endpoint->bEndpointAddress;
2259: } else {
2260: dev_warn(&vub300->udev->dev,
2261: "ignoring"
2262: " unexpected bulk_out endpoint");
2263: }
2264: } else {
2265: dev_warn(&vub300->udev->dev,
2266: "vub300 ignoring EndPoint(%d) %02X", i,
2267: endpoint->bEndpointAddress);
2268: }
2269: }
2270: if (vub300->cmnd_res_ep && vub300->cmnd_out_ep &&
2271: vub300->data_inp_ep && vub300->data_out_ep) {
2272: dev_info(&vub300->udev->dev,
2273: "vub300 %s packets"
2274: " using EndPoints %02X %02X %02X %02X\n",
2275: vub300->large_usb_packets ? "LARGE" : "SMALL",
2276: vub300->cmnd_out_ep, vub300->cmnd_res_ep,
2277: vub300->data_out_ep, vub300->data_inp_ep);
2278: /* we have the expected EndPoints */
2279: } else {
2280: dev_err(&vub300->udev->dev,
2281: "Could not find two sets of bulk-in/out endpoint pairs\n");
2282: retval = -EINVAL;
2283: goto err_free_host;
2284: }
2285: retval =
2286: usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
2287: GET_HC_INF0,
2288: USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2289: 0x0000, 0x0000, &vub300->hc_info,
2290: sizeof(vub300->hc_info), 1000);
2291: if (retval < 0)
2292: goto err_free_host;
2293: retval =
2294: usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0),
2295: SET_ROM_WAIT_STATES,
2296: USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2297: firmware_rom_wait_states, 0x0000, NULL, 0, 1000);
2298: if (retval < 0)
2299: goto err_free_host;
2300: dev_info(&vub300->udev->dev,
2301: "operating_mode = %s %s %d MHz %s %d byte USB packets\n",
2302: (mmc->caps & MMC_CAP_SDIO_IRQ) ? "IRQs" : "POLL",
2303: (mmc->caps & MMC_CAP_4_BIT_DATA) ? "4-bit" : "1-bit",
2304: mmc->f_max / 1000000,
2305: pad_input_to_usb_pkt ? "padding input data to" : "with",
2306: vub300->large_usb_packets ? 512 : 64);
2307: retval =
2308: usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
2309: GET_SYSTEM_PORT_STATUS,
2310: USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2311: 0x0000, 0x0000, &vub300->system_port_status,
2312: sizeof(vub300->system_port_status), 1000);
2313: if (retval < 0) {
2314: goto err_free_host;
2315: } else if (sizeof(vub300->system_port_status) == retval) {
2316: vub300->card_present =
2317: (0x0001 & vub300->system_port_status.port_flags) ? 1 : 0;
2318: vub300->read_only =
2319: (0x0010 & vub300->system_port_status.port_flags) ? 1 : 0;
2320: } else {
2321: retval = -EINVAL;
2322: goto err_free_host;
2323: }
2324: usb_set_intfdata(interface, vub300);
2325: INIT_DELAYED_WORK(&vub300->pollwork, vub300_pollwork_thread);
2326: INIT_WORK(&vub300->cmndwork, vub300_cmndwork_thread);
2327: INIT_WORK(&vub300->deadwork, vub300_deadwork_thread);
2328: kref_init(&vub300->kref);
2329: timer_setup(&vub300->sg_transfer_timer, vub300_sg_timed_out, 0);
2330: kref_get(&vub300->kref);
2331: timer_setup(&vub300->inactivity_timer,
2332: vub300_inactivity_timer_expired, 0);
2333: vub300->inactivity_timer.expires = jiffies + HZ;
2334: add_timer(&vub300->inactivity_timer);
2335: if (vub300->card_present)
2336: dev_info(&vub300->udev->dev,
2337: "USB vub300 remote SDIO host controller[%d]"
2338: "connected with SD/SDIO card inserted\n",
2339: interface_to_InterfaceNumber(interface));
2340: else
2341: dev_info(&vub300->udev->dev,
2342: "USB vub300 remote SDIO host controller[%d]"
2343: "connected with no SD/SDIO card inserted\n",
2344: interface_to_InterfaceNumber(interface));
2345: retval = mmc_add_host(mmc);
2346: if (retval)
2347: goto err_stop_io;
2348:
2349: return 0;
2350:
2351: err_stop_io:
2352: vub300->interface = NULL;
2353: kref_put(&vub300->kref, vub300_delete);
2354:
2355: return retval;
2356:
2357: err_free_host:
2358: mmc_free_host(mmc);
2359: /*
2360: * and hence also frees vub300
2361: * which is contained at the end of struct mmc
2362: */
2363: err_free_res_urb:
2364: usb_free_urb(command_res_urb);
2365: err_free_out_urb:
2366: usb_free_urb(command_out_urb);
2367: err_put_udev:
2368: usb_put_dev(udev);
2369:
2370: return retval;
2371: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 118/4 |
2026/09/07 15:27 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 41620
output: 45
thoughts: 1278
Thoughts: **My Thought Process on Endpoint and Control Request Handling**
When I examined the provided code snippets, my primary focus was on understanding how the system identifies and utilizes USB endpoints, and how it orchestrates communication via control requests. My goal was to confirm that the provided reproducer accurately reflects the expected behavior.
First, I analyzed the `for` loop iterating through interface descriptors and extracting endpoint information. The logic clearly indicates that the system anticipates exactly two bulk IN endpoints and two bulk OUT endpoints. It systematically checks for bulk IN endpoints and assigns them to `vub300->cmnd_res_ep` and then `vub300->data_inp_ep`. Similarly, for bulk OUT endpoints, it assigns them to `vub300->cmnd_out_ep` and `vub300->data_out_ep`. This sequential assignment is crucial for establishing distinct communication channels for commands, responses, and data transfer.
Next, I turned my attention to the reproducer's endpoint definitions. I meticulously reviewed each line:
* `7, 5, 0x81, 2, 0, 2, 0,`
* `7, 5, 0x02, 2, 0, 2, 0,`
* `7, 5, 0x83, 2, 0, 2, 0,`
* `7, 5, 0x04, 2, 0, 2, 0,`
I broke down each entry, recognizing the standard USB endpoint descriptor format. The `0x81` and `0x83` clearly represent IN endpoints, and `0x02` and `0x04` represent OUT endpoints. The `2` in the descriptor signifies that these are bulk endpoints, and the `0x0200` (implied by the `2` and `0` for `wMaxPacketSize`) confirms a maximum packet size of 512 bytes, which is standard. This precisely matches the expected two IN and two OUT bulk endpoints. I felt a sense of satisfaction as this alignment confirmed the reproducer's correctness at the endpoint level.
My investigation then shifted to the control requests. I looked at the `usb_control_msg` calls within the `vub300_probe` context. I identified the `GET_HC_INF0` request, noting its value `1` and its direction as IN (indicated by `usb_rcvctrlpipe`). I also observed the `SET_ROM_WAIT_STATES` request, identifying its value `16` and its direction as OUT (indicated by `usb_sndctrlpipe`). Finally, the `GET_SYSTEM_PORT_STATUS` request, with value `0` and direction IN, was also noted.
Comparing these with the handler logic in the reproducer, I saw a perfect match.
* The `0xC0` (VENDOR IN) `bRequestType` combined with `bRequest == 1` correctly handled `GET_HC_INF0`. The provided `data` `uint8_t data[4] = {4, 0, 0, 1};` and the length adjustment based on `req->wLength` are also consistent with expected behavior for such a request.
* The `0xC0` (VENDOR IN) `bRequestType` with `bRequest == 0` correctly handled `GET_SYSTEM_PORT_STATUS`. The generated `data` `uint8_t data[15] = {15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};` and the logic to suppress `mmc_add_host` probing by setting `port_flags = 0` are insightful. The `done = 1` flag also signifies the completion of the probing sequence, which is consistent.
* The `0x40` (VENDOR OUT) `bRequestType` with `bRequest == 16` correctly handled `SET_ROM_WAIT_STATES`. The fact that `io->length = 0` indicates no data payload for this specific command, which is a common pattern.
Overall, my examination led me to conclude that the reproducer's implementation of both USB endpoints and control request handling is remarkably accurate and directly aligns with the expected functionality described in the C code. This level of precision in the reproducer is a strong indicator that it's well-suited for its intended purpose. Now, my next step is to look at `vub300_disconnect` to understand the cleanup and teardown process.
|
| 119/4 |
2026/09/07 15:28 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_disconnect]
Results: map[SourceCode:2373: static void vub300_disconnect(struct usb_interface *interface)
2374: { /* NOT irq */
2375: struct vub300_mmc_host *vub300 = usb_get_intfdata(interface);
2376: if (!vub300 || !vub300->mmc) {
2377: return;
2378: } else {
2379: struct mmc_host *mmc = vub300->mmc;
2380: if (!vub300->mmc) {
2381: return;
2382: } else {
2383: int ifnum = interface_to_InterfaceNumber(interface);
2384: usb_set_intfdata(interface, NULL);
2385: /* prevent more I/O from starting */
2386: vub300->interface = NULL;
2387: mmc_remove_host(mmc);
2388: kref_put(&vub300->kref, vub300_delete);
2389: pr_info("USB vub300 remote SDIO host controller[%d]"
2390: " now disconnected", ifnum);
2391: return;
2392: }
2393: }
2394: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 120/4 |
2026/09/07 15:28 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 43329
output: 50
thoughts: 98
Thoughts: **My Internal Monologue on `vub300_disconnect` and its Aftermath**
Right, let's dissect this `vub300_disconnect` function and what it *really* leaves behind. My primary task here is to understand the lifecycle and dependencies, particularly around that `inactivity_timer`.
So, the `vub300_disconnect` function itself performs a few key actions. First, it systematically nullifies the host's interface pointer, setting `vub300->interface = NULL;`. This, in essence, severs the primary communication link. Immediately following that, it orchestrates the removal of the MMC host itself via `mmc_remove_host(mmc);`. This is a critical step for proper cleanup and resource deallocation within the MMC subsystem.
Then, there's the reference counting. The `kref_put(&vub300->kref, vub300_delete);` call is absolutely central to the object's ultimate demise. It decrements the reference count of the `vub300` structure, and when that count finally hits zero, it triggers the `vub300_delete` function, which I expect will be the final deallocator for the `vub300` structure itself.
Now, here's the crucial point, the detail that requires careful consideration: `vub300_disconnect` *does not* explicitly delete the `inactivity_timer`. This is a deliberate omission, not an oversight. The timer is *not* immediately canceled or destroyed within the disconnect logic. Instead, its fate is tied to its own expiration.
What this implies is that the `inactivity_timer` is still scheduled and will continue to run its course. When it eventually expires – either due to its programmed timeout or some other event that causes it to fire – it will invoke its callback function: `vub300_inactivity_timer_expired`. This separate handler is where the timer's specific logic resides and is executed *after* the `vub300_disconnect` function has completed its immediate tasks and potentially even after the `vub300` structure's reference count has been decremented. The implication here is that `vub300_inactivity_timer_expired` must be designed to gracefully handle a situation where the `vub300` structure might be in a partially deallocated or inconsistent state, or it relies on the `vub300_delete` cleanup to have already happened before it's called. This is a significant design consideration that I need to keep front of mind when analyzing any downstream behavior or potential race conditions.
|
| 121/4 |
2026/09/07 15:28 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_inactivity_timer_expired]
Results: map[SourceCode: 742: static void vub300_inactivity_timer_expired(struct timer_list *t)
743: { /* softirq */
744: struct vub300_mmc_host *vub300 = timer_container_of(vub300, t,
745: inactivity_timer);
746: if (!vub300->interface) {
747: kref_put(&vub300->kref, vub300_delete);
748: } else if (vub300->cmd) {
749: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
750: } else {
751: vub300_queue_dead_work(vub300);
752: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
753: }
754: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 122/4 |
2026/09/07 15:28 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 43765
output: 45
thoughts: 72
Thoughts: **My Internal Monologue on Resource Deallocation**
Alright, let's trace this. I've just checked and it seems that the `interface` member of `vub300` is not set. In this specific scenario, my understanding is that I need to invoke `kref_put(&vub300->kref, vub300_delete);`. The significance of this call, as I see it, is that it will decrement the reference count for `vub300`. Crucially, this decrement will result in the final reference being released, given that `vub300_disconnect` has already handled its own reference. Once this last reference is dropped, the kernel's reference counting mechanism will then automatically trigger the `vub300_delete` function, which is designed to perform the actual cleanup and deallocation of the `vub300` structure.
|
| 123/4 |
2026/09/07 15:28 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_delete]
Results: map[SourceCode: 369: static void vub300_delete(struct kref *kref)
370: { /* kref callback - softirq */
371: struct vub300_mmc_host *vub300 = kref_to_vub300_mmc_host(kref);
372: struct mmc_host *mmc = vub300->mmc;
373:
374: usb_free_urb(vub300->command_out_urb);
375: vub300->command_out_urb = NULL;
376: usb_free_urb(vub300->command_res_urb);
377: vub300->command_res_urb = NULL;
378: usb_put_dev(vub300->udev);
379: mmc_free_host(mmc);
380: /*
381: * and hence also frees vub300
382: * which is contained at the end of struct mmc
383: */
384: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 124/4 |
2026/09/07 15:28 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 44206
output: 2091
thoughts: 2170
Thoughts: **My Journey Through a Kernel Bug: From Call Stack to Reproducer**
I've been digging into a rather peculiar kernel bug, and it all started when I saw `mmc_free_host(mmc)` being called. My immediate thought was to trace its execution path. I followed it down through `device_release`, then to `mmc_host_classdev_release`, and finally to `wakeup_source_unregister`, which in turn calls `synchronize_srcu`. It was at this point that the context of the operation became clear: it was happening within a `softirq` context. This is a critical detail, as it's precisely this context that triggers the bug I'm investigating.
My next step was to confirm if my understanding of the problem was sound and if I could reliably reproduce it. I spent some time scrutinizing the provided reproducer code. I can confidently say that it looks solid; it's well-structured and appears to hit the problematic code path directly.
Given that the reproducer seems robust, my plan is straightforward: I will output the reproducer. It's the most effective way to share the scenario and allow others to examine and potentially fix this issue.
The core of the bug, as I see it, lies in the interaction of `mmc_free_host` with the `softirq` context. When `mmc_free_host` is invoked, it initiates a chain of calls that ultimately involve `synchronize_srcu` within a `softirq`. This combination is where the kernel trips up. The provided C code effectively simulates the necessary conditions for this to occur. It opens the `/dev/raw-gadget` device, initializes it as a USB raw gadget, and then proceeds to simulate USB enumeration. Crucially, it manipulates the responses to control requests to prevent the `mmc_add_host` from probing too early. After simulating a USB disconnect by closing the file descriptor, it introduces a deliberate delay, allowing the kernel's inactivity timers to expire. This sequence of events, I believe, leads to the `mmc_free_host` being called in the problematic `softirq` context, thereby triggering the bug.
|
| 125/4 |
2026/09/07 15:28 |
tool |
set-results |
0m
Args: map[IsProbe:false RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
#define USB_RAW_IOCTL_RUN _IO('U', 1)
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
struct usb_raw_event {
uint32_t type;
uint32_t length;
uint8_t data[0];
};
struct usb_raw_ep_io {
uint16_t ep;
uint16_t flags;
uint32_t length;
uint8_t data[0];
};
struct usb_ctrlrequest {
uint8_t bRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} __attribute__((packed));
int main() {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
printf("[+] open /dev/raw-gadget successful.\n");
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
if (ioctl(fd, USB_RAW_IOCTL_INIT, &init) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_INIT successful.\n");
if (ioctl(fd, USB_RAW_IOCTL_RUN, 0) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_RUN: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_RUN successful.\n");
int done = 0;
while (!done) {
struct usb_raw_event *event = malloc(sizeof(*event) + 1024);
event->type = 0;
event->length = 1024;
if (ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_EVENT_FETCH: %s\n", strerror(errno));
free(event);
break;
}
if (event->type == 2) { // USB_RAW_EVENT_CONTROL
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)event->data;
struct usb_raw_ep_io *io = malloc(sizeof(*io) + 1024);
io->ep = 0;
io->flags = 0;
io->length = 0;
int handled = 0;
if (req->bRequestType == 0x80 && req->bRequest == 6) { // GET_DESCRIPTOR
if ((req->wValue >> 8) == 1) { // DEVICE
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
} else if ((req->wValue >> 8) == 2) { // CONFIG
uint8_t desc[] = {
9, 2, 46, 0, 1, 1, 0, 0x80, 50,
9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0,
7, 5, 0x81, 2, 0, 2, 0,
7, 5, 0x02, 2, 0, 2, 0,
7, 5, 0x83, 2, 0, 2, 0,
7, 5, 0x04, 2, 0, 2, 0,
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
}
} else if (req->bRequestType == 0xC0) { // VENDOR IN
if (req->bRequest == 1) { // GET_HC_INF0
uint8_t data[4] = {4, 0, 0, 1};
io->length = req->wLength < 4 ? req->wLength : 4;
memcpy(io->data, data, io->length);
handled = 1;
} else if (req->bRequest == 0) { // GET_SYSTEM_PORT_STATUS
// port_flags = 0 (card_present = 0) to avoid mmc_add_host probing
uint8_t data[15] = {15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
io->length = req->wLength < 15 ? req->wLength : 15;
memcpy(io->data, data, io->length);
handled = 1;
done = 1; // Last request in vub300_probe
}
} else if (req->bRequestType == 0x40) { // VENDOR OUT
if (req->bRequest == 16) { // SET_ROM_WAIT_STATES
io->length = 0;
handled = 1;
}
} else if (req->bRequestType == 0x00 && req->bRequest == 9) { // SET_CONFIGURATION
io->length = 0;
handled = 1;
} else {
// ACK other standard requests (e.g. SET_ADDRESS)
io->length = 0;
handled = 1;
}
if (handled) {
if (req->bRequestType & 0x80) {
ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
free(io);
}
free(event);
}
printf("[+] USB enumeration completed.\n");
// Give vub300_probe a moment to finish mmc_add_host
usleep(200000);
// Close fd to simulate USB disconnect
close(fd);
printf("[+] Gadget closed, simulating disconnect.\n");
// Wait for the inactivity_timer to expire (it is set to jiffies + HZ)
sleep(2);
printf("[+] Done.\n");
return 0;
}
]
Results: map[IsProbe:false RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
#define USB_RAW_IOCTL_RUN _IO('U', 1)
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
struct usb_raw_event {
uint32_t type;
uint32_t length;
uint8_t data[0];
};
struct usb_raw_ep_io {
uint16_t ep;
uint16_t flags;
uint32_t length;
uint8_t data[0];
};
struct usb_ctrlrequest {
uint8_t bRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} __attribute__((packed));
int main() {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
printf("[+] open /dev/raw-gadget successful.\n");
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
if (ioctl(fd, USB_RAW_IOCTL_INIT, &init) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_INIT successful.\n");
if (ioctl(fd, USB_RAW_IOCTL_RUN, 0) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_RUN: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_RUN successful.\n");
int done = 0;
while (!done) {
struct usb_raw_event *event = malloc(sizeof(*event) + 1024);
event->type = 0;
event->length = 1024;
if (ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_EVENT_FETCH: %s\n", strerror(errno));
free(event);
break;
}
if (event->type == 2) { // USB_RAW_EVENT_CONTROL
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)event->data;
struct usb_raw_ep_io *io = malloc(sizeof(*io) + 1024);
io->ep = 0;
io->flags = 0;
io->length = 0;
int handled = 0;
if (req->bRequestType == 0x80 && req->bRequest == 6) { // GET_DESCRIPTOR
if ((req->wValue >> 8) == 1) { // DEVICE
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
} else if ((req->wValue >> 8) == 2) { // CONFIG
uint8_t desc[] = {
9, 2, 46, 0, 1, 1, 0, 0x80, 50,
9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0,
7, 5, 0x81, 2, 0, 2, 0,
7, 5, 0x02, 2, 0, 2, 0,
7, 5, 0x83, 2, 0, 2, 0,
7, 5, 0x04, 2, 0, 2, 0,
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
}
} else if (req->bRequestType == 0xC0) { // VENDOR IN
if (req->bRequest == 1) { // GET_HC_INF0
uint8_t data[4] = {4, 0, 0, 1};
io->length = req->wLength < 4 ? req->wLength : 4;
memcpy(io->data, data, io->length);
handled = 1;
} else if (req->bRequest == 0) { // GET_SYSTEM_PORT_STATUS
// port_flags = 0 (card_present = 0) to avoid mmc_add_host probing
uint8_t data[15] = {15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
io->length = req->wLength < 15 ? req->wLength : 15;
memcpy(io->data, data, io->length);
handled = 1;
done = 1; // Last request in vub300_probe
}
} else if (req->bRequestType == 0x40) { // VENDOR OUT
if (req->bRequest == 16) { // SET_ROM_WAIT_STATES
io->length = 0;
handled = 1;
}
} else if (req->bRequestType == 0x00 && req->bRequest == 9) { // SET_CONFIGURATION
io->length = 0;
handled = 1;
} else {
// ACK other standard requests (e.g. SET_ADDRESS)
io->length = 0;
handled = 1;
}
if (handled) {
if (req->bRequestType & 0x80) {
ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
free(io);
}
free(event);
}
printf("[+] USB enumeration completed.\n");
// Give vub300_probe a moment to finish mmc_add_host
usleep(200000);
// Close fd to simulate USB disconnect
close(fd);
printf("[+] Gadget closed, simulating disconnect.\n");
// Wait for the inactivity_timer to expire (it is set to jiffies + HZ)
sleep(2);
printf("[+] Done.\n");
return 0;
}
]
|
| 126/3 |
2026/09/07 15:28 |
loop |
|
0m
|
| 127/4 |
2026/09/07 15:28 |
iteration |
0 |
0m
|
| 128/5 |
2026/09/07 15:28 |
action |
merge-repro-c |
0m
Results: map[CurrentCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
#define USB_RAW_IOCTL_RUN _IO('U', 1)
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
struct usb_raw_event {
uint32_t type;
uint32_t length;
uint8_t data[0];
};
struct usb_raw_ep_io {
uint16_t ep;
uint16_t flags;
uint32_t length;
uint8_t data[0];
};
struct usb_ctrlrequest {
uint8_t bRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} __attribute__((packed));
int main() {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
printf("[+] open /dev/raw-gadget successful.\n");
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
if (ioctl(fd, USB_RAW_IOCTL_INIT, &init) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_INIT successful.\n");
if (ioctl(fd, USB_RAW_IOCTL_RUN, 0) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_RUN: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_RUN successful.\n");
int done = 0;
while (!done) {
struct usb_raw_event *event = malloc(sizeof(*event) + 1024);
event->type = 0;
event->length = 1024;
if (ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_EVENT_FETCH: %s\n", strerror(errno));
free(event);
break;
}
if (event->type == 2) { // USB_RAW_EVENT_CONTROL
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)event->data;
struct usb_raw_ep_io *io = malloc(sizeof(*io) + 1024);
io->ep = 0;
io->flags = 0;
io->length = 0;
int handled = 0;
if (req->bRequestType == 0x80 && req->bRequest == 6) { // GET_DESCRIPTOR
if ((req->wValue >> 8) == 1) { // DEVICE
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
} else if ((req->wValue >> 8) == 2) { // CONFIG
uint8_t desc[] = {
9, 2, 46, 0, 1, 1, 0, 0x80, 50,
9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0,
7, 5, 0x81, 2, 0, 2, 0,
7, 5, 0x02, 2, 0, 2, 0,
7, 5, 0x83, 2, 0, 2, 0,
7, 5, 0x04, 2, 0, 2, 0,
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
}
} else if (req->bRequestType == 0xC0) { // VENDOR IN
if (req->bRequest == 1) { // GET_HC_INF0
uint8_t data[4] = {4, 0, 0, 1};
io->length = req->wLength < 4 ? req->wLength : 4;
memcpy(io->data, data, io->length);
handled = 1;
} else if (req->bRequest == 0) { // GET_SYSTEM_PORT_STATUS
// port_flags = 0 (card_present = 0) to avoid mmc_add_host probing
uint8_t data[15] = {15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
io->length = req->wLength < 15 ? req->wLength : 15;
memcpy(io->data, data, io->length);
handled = 1;
done = 1; // Last request in vub300_probe
}
} else if (req->bRequestType == 0x40) { // VENDOR OUT
if (req->bRequest == 16) { // SET_ROM_WAIT_STATES
io->length = 0;
handled = 1;
}
} else if (req->bRequestType == 0x00 && req->bRequest == 9) { // SET_CONFIGURATION
io->length = 0;
handled = 1;
} else {
// ACK other standard requests (e.g. SET_ADDRESS)
io->length = 0;
handled = 1;
}
if (handled) {
if (req->bRequestType & 0x80) {
ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
free(io);
}
free(event);
}
printf("[+] USB enumeration completed.\n");
// Give vub300_probe a moment to finish mmc_add_host
usleep(200000);
// Close fd to simulate USB disconnect
close(fd);
printf("[+] Gadget closed, simulating disconnect.\n");
// Wait for the inactivity_timer to expire (it is set to jiffies + HZ)
sleep(2);
printf("[+] Done.\n");
return 0;
}
]
|
| 129/5 |
2026/09/07 15:28 |
action |
compile-c-prog |
0m
Results: map[CompilerError: FormattedReproC:#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
#define USB_RAW_IOCTL_RUN _IO('U', 1)
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
struct usb_raw_event {
uint32_t type;
uint32_t length;
uint8_t data[0];
};
struct usb_raw_ep_io {
uint16_t ep;
uint16_t flags;
uint32_t length;
uint8_t data[0];
};
struct usb_ctrlrequest {
uint8_t bRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} __attribute__((packed));
int main() {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
printf("[+] open /dev/raw-gadget successful.\n");
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
if (ioctl(fd, USB_RAW_IOCTL_INIT, &init) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_INIT successful.\n");
if (ioctl(fd, USB_RAW_IOCTL_RUN, 0) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_RUN: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_RUN successful.\n");
int done = 0;
while (!done) {
struct usb_raw_event *event = malloc(sizeof(*event) + 1024);
event->type = 0;
event->length = 1024;
if (ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_EVENT_FETCH: %s\n", strerror(errno));
free(event);
break;
}
if (event->type == 2) { // USB_RAW_EVENT_CONTROL
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)event->data;
struct usb_raw_ep_io *io = malloc(sizeof(*io) + 1024);
io->ep = 0;
io->flags = 0;
io->length = 0;
int handled = 0;
if (req->bRequestType == 0x80 && req->bRequest == 6) { // GET_DESCRIPTOR
if ((req->wValue >> 8) == 1) { // DEVICE
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
} else if ((req->wValue >> 8) == 2) { // CONFIG
uint8_t desc[] = {
9, 2, 46, 0, 1, 1, 0, 0x80, 50,
9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0,
7, 5, 0x81, 2, 0, 2, 0,
7, 5, 0x02, 2, 0, 2, 0,
7, 5, 0x83, 2, 0, 2, 0,
7, 5, 0x04, 2, 0, 2, 0,
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
}
} else if (req->bRequestType == 0xC0) { // VENDOR IN
if (req->bRequest == 1) { // GET_HC_INF0
uint8_t data[4] = {4, 0, 0, 1};
io->length = req->wLength < 4 ? req->wLength : 4;
memcpy(io->data, data, io->length);
handled = 1;
} else if (req->bRequest == 0) { // GET_SYSTEM_PORT_STATUS
// port_flags = 0 (card_present = 0) to avoid mmc_add_host probing
uint8_t data[15] = {15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
io->length = req->wLength < 15 ? req->wLength : 15;
memcpy(io->data, data, io->length);
handled = 1;
done = 1; // Last request in vub300_probe
}
} else if (req->bRequestType == 0x40) { // VENDOR OUT
if (req->bRequest == 16) { // SET_ROM_WAIT_STATES
io->length = 0;
handled = 1;
}
} else if (req->bRequestType == 0x00 && req->bRequest == 9) { // SET_CONFIGURATION
io->length = 0;
handled = 1;
} else {
// ACK other standard requests (e.g. SET_ADDRESS)
io->length = 0;
handled = 1;
}
if (handled) {
if (req->bRequestType & 0x80) {
ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
free(io);
}
free(event);
}
printf("[+] USB enumeration completed.\n");
// Give vub300_probe a moment to finish mmc_add_host
usleep(200000);
// Close fd to simulate USB disconnect
close(fd);
printf("[+] Gadget closed, simulating disconnect.\n");
// Wait for the inactivity_timer to expire (it is set to jiffies + HZ)
sleep(2);
printf("[+] Done.\n");
return 0;
}
]
|
| 130/5 |
2026/09/07 15:28 |
action |
If |
0m
Args:
|
| 131/3 |
2026/09/07 15:28 |
action |
run-c-repro |
1m
Results: map[CandidateBugTitle:BUG: sleeping function called from invalid context in mmc_free_host CandidateCrashReport:BUG: sleeping function called from invalid context at kernel/workqueue.c:4561
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 0, name: swapper/1
preempt_count: 101, expected: 0
RCU nest depth: 0, expected: 0
locks held by swapper/1/0: 1, last CPU#1:
#0: ffffc90000a18cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 1 UID: 0 PID: 0 Comm: swapper/1 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:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x36a/0x4c0 kernel/sched/core.c:9234
__cancel_work_sync+0x6d/0x110 kernel/workqueue.c:4561
mmc_free_host+0x19/0x30 drivers/mmc/core/host.c:700
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:64
Code: 9c a2 02 c3 cc cc cc cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 66 90 0f 00 2d b3 37 24 00 fb f4 <e9> cc 03 03 00 cc cc cc cc cc cc cc cc cc cc cc cc 90 90 90 90 90
RSP: 0018:ffffc900001a7e40 EFLAGS: 00000246
RAX: 000000000003e04d RBX: ffffffff819a5f6c RCX: 8000000000000001
RDX: 0000000000000001 RSI: ffffffff8e3b7134 RDI: ffffffff8c540080
RBP: ffffc900001a7f10 R08: ffff88827be33a1b R09: 1ffff1104f7c6743
R10: dffffc0000000000 R11: ffffed104f7c6744 R12: 0000000000000000
R13: 1ffff1103008f000 R14: 1ffff92000034fd0 R15: dffffc0000000000
arch_safe_halt arch/x86/kernel/process.c:767 [inline]
default_idle+0x9/0x20 arch/x86/kernel/process.c:768
default_idle_call+0x72/0xb0 kernel/sched/idle.c:122
cpuidle_idle_call kernel/sched/idle.c:199 [inline]
do_idle+0x1cc/0x540 kernel/sched/idle.c:355
cpu_startup_entry+0x43/0x60 kernel/sched/idle.c:454
start_secondary+0x101/0x110 arch/x86/kernel/smpboot.c:312
common_startup_64+0x13e/0x157
</TASK>
ODEBUG: object ffffc90000a18a80 is NOT on stack ffffc900001a0000, but annotated.
------------[ cut here ]------------
1
WARNING: lib/debugobjects.c:672 at debug_object_is_on_stack lib/debugobjects.c:672 [inline], CPU#1: swapper/1/0
WARNING: lib/debugobjects.c:672 at lookup_object_or_alloc lib/debugobjects.c:705 [inline], CPU#1: swapper/1/0
WARNING: lib/debugobjects.c:672 at __debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798, CPU#1: swapper/1/0
Modules linked in:
CPU: 1 UID: 0 PID: 0 Comm: swapper/1 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
RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:672 [inline]
RIP: 0010:lookup_object_or_alloc lib/debugobjects.c:705 [inline]
RIP: 0010:__debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798
Code: cc cc cc 41 ff c7 44 89 3d c9 79 f7 15 48 c7 c1 80 0a 54 8c 48 c7 c7 e0 0a 54 8c 84 c0 48 0f 45 f9 48 89 de e8 8d 95 45 fc 90 <0f> 0b 90 e9 c0 fe ff ff e8 4f 1c 00 00 8b 05 a1 f7 79 0a 3b 05 9f
RSP: 0018:ffffc90000a189b8 EFLAGS: 00010046
RAX: 0000000000000050 RBX: ffffc90000a18a80 RCX: 14c412d005b96700
RDX: 0000000000000100 RSI: 0000000000000100 RDI: 0000000000000000
RBP: ffff888180478020 R08: 0000000000000100 R09: 1ffff920001430e4
R10: dffffc0000000000 R11: fffff520001430e5 R12: ffff88810f22d478
R13: ffff88810d414a80 R14: dffffc0000000000 R15: 0000000000000001
FS: 0000000000000000(0000) GS:ffff8882e8473000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f414538af5e CR3: 00000001f8ede000 CR4: 0000000000352ef0
Call Trace:
<IRQ>
__synchronize_srcu+0x1d5/0x2f0 kernel/rcu/srcutree.c:1475
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:64
Code: 9c a2 02 c3 cc cc cc cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 66 90 0f 00 2d b3 37 24 00 fb f4 <e9> cc 03 03 00 cc cc cc cc cc cc cc cc cc cc cc cc 90 90 90 90 90
RSP: 0018:ffffc900001a7e40 EFLAGS: 00000246
RAX: 000000000003e04d RBX: ffffffff819a5f6c RCX: 8000000000000001
RDX: 0000000000000001 RSI: ffffffff8e3b7134 RDI: ffffffff8c540080
RBP: ffffc900001a7f10 R08: ffff88827be33a1b R09: 1ffff1104f7c6743
R10: dffffc0000000000 R11: ffffed104f7c6744 R12: 0000000000000000
R13: 1ffff1103008f000 R14: 1ffff92000034fd0 R15: dffffc0000000000
arch_safe_halt arch/x86/kernel/process.c:767 [inline]
default_idle+0x9/0x20 arch/x86/kernel/process.c:768
default_idle_call+0x72/0xb0 kernel/sched/idle.c:122
cpuidle_idle_call kernel/sched/idle.c:199 [inline]
do_idle+0x1cc/0x540 kernel/sched/idle.c:355
cpu_startup_entry+0x43/0x60 kernel/sched/idle.c:454
start_secondary+0x101/0x110 arch/x86/kernel/smpboot.c:312
common_startup_64+0x13e/0x157
</TASK>
----------------
Code disassembly (best guess):
0: 9c pushf
1: a2 02 c3 cc cc cc cc movabs %al,0xccccccccccccc302
8: cc cc
a: cc int3
b: 90 nop
c: 90 nop
d: 90 nop
e: 90 nop
f: 90 nop
10: 90 nop
11: 90 nop
12: 90 nop
13: 90 nop
14: 90 nop
15: 90 nop
16: 90 nop
17: 90 nop
18: 90 nop
19: 90 nop
1a: 90 nop
1b: f3 0f 1e fa endbr64
1f: 66 90 xchg %ax,%ax
21: 0f 00 2d b3 37 24 00 verw 0x2437b3(%rip) # 0x2437db
28: fb sti
29: f4 hlt
* 2a: e9 cc 03 03 00 jmp 0x303fb <-- trapping instruction
2f: cc int3
30: cc int3
31: cc int3
32: cc int3
33: cc int3
34: cc int3
35: cc int3
36: cc int3
37: cc int3
38: cc int3
39: cc int3
3a: cc int3
3b: 90 nop
3c: 90 nop
3d: 90 nop
3e: 90 nop
3f: 90 nop
CandidateReproduced:true ConsoleOutput:[ 63.959402][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 63.959479][ T33] audit: type=1400 audit(1788794997.875:201): avc: denied { transition } for pid=5831 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
[ 63.961033][ T33] audit: type=1400 audit(1788794997.875:202): avc: denied { noatsecure } for pid=5831 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.961057][ T33] audit: type=1400 audit(1788794997.875:203): avc: denied { rlimitinh } for pid=5831 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.961072][ T33] audit: type=1400 audit(1788794997.875:204): avc: denied { siginh } for pid=5831 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 67.218391][ T33] audit: type=1400 audit(1788795001.135:205): avc: denied { write } for pid=5837 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
[ 67.269242][ T33] audit: type=1400 audit(1788795001.185:206): avc: denied { write } for pid=5840 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
[ 67.360946][ T33] audit: type=1400 audit(1788795001.285:207): avc: denied { write } for pid=5843 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
[ 67.416533][ T33] audit: type=1400 audit(1788795001.335:208): avc: denied { write } for pid=5846 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
[ 67.869610][ T33] audit: type=1400 audit(1788795001.785:209): avc: denied { write } for pid=5853 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
[ 67.916954][ T33] audit: type=1400 audit(1788795001.835:210): avc: denied { write } for pid=5856 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]:15414' (ED25519) to the list of known hosts.
[ 68.390990][ T5398] usb 1-1: new high-speed USB device number 2 using dummy_hcd
[ 68.541978][ T5398] usb 1-1: New USB device found, idVendor=0424, idProduct=012c, bcdDevice= 1.00
[ 68.547358][ T5398] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 68.557497][ T5398] usb 1-1: probing VID:PID(0424:012C)
[ 68.560950][ T5398] usb 1-1: vub300 testing BULK IN EndPoint(0) 81
[ 68.563065][ T5398] usb 1-1: vub300 testing BULK OUT EndPoint(1) 02
[ 68.565155][ T5398] usb 1-1: vub300 testing BULK IN EndPoint(2) 83
[ 68.567243][ T5398] usb 1-1: vub300 testing BULK OUT EndPoint(3) 04
[ 68.569341][ T5398] usb 1-1: vub300 LARGE packets using EndPoints 02 81 04 83
[ 68.574391][ T5398] usb 1-1: operating_mode = IRQs 4-bit 48 MHz with 512 byte USB packets
[ 68.577618][ T5398] usb 1-1: USB vub300 remote SDIO host controller[0]connected with no SD/SDIO card inserted
[ 68.977641][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 68.977733][ T33] audit: type=1400 audit(1788795002.895:221): 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
[ 69.404056][ T5398] usb 1-1: SET_CLOCK_SPEED 200kHz failed with retval=-71
[ 69.423772][ T5738] usb 1-1: SET_CLOCK_SPEED 200kHz failed with retval=-71
[ 69.432149][ T5738] usb 1-1: SET_CLOCK_SPEED 200kHz failed with retval=-71
[ 69.436126][ T5738] usb 1-1: SET_CLOCK_SPEED 200kHz failed with retval=-71
[ 69.439651][ T5398] usb 1-1: USB disconnect, device number 2
[ 69.488414][ T33] audit: type=1400 audit(1788795003.405:222): avc: denied { write } for pid=5889 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
[ 69.528510][ T33] audit: type=1400 audit(1788795003.445:223): avc: denied { write } for pid=5892 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
[+] open /dev/raw-gadget successful.
[+] USB_RAW_IOCTL_INIT successful.
[+] USB_RAW_IOCTL_RUN successful.
[+] USB enumeration completed.
[+] Gadget closed, simulating disconnect.
[+] Done.
[ 70.118092][ T5398] USB vub300 remote SDIO host controller[0] now disconnected
[ 71.663659][ T1379] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.663741][ T1379] ieee802154 phy1 wpan1: encryption failed: -22
[ 76.783478][ T25] cfg80211: failed to load regulatory.db
OtherCrashReports:<nil> StraceOutput: TestError:]
|
| 132/3 |
2026/09/07 15:30 |
action |
truncate-log |
0m
Results: map[TruncatedConsoleOutput:[ 63.959402][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 63.959479][ T33] audit: type=1400 audit(1788794997.875:201): avc: denied { transition } for pid=5831 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
[ 63.961033][ T33] audit: type=1400 audit(1788794997.875:202): avc: denied { noatsecure } for pid=5831 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.961057][ T33] audit: type=1400 audit(1788794997.875:203): avc: denied { rlimitinh } for pid=5831 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.961072][ T33] audit: type=1400 audit(1788794997.875:204): avc: denied { siginh } for pid=5831 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 67.218391][ T33] audit: type=1400 audit(1788795001.135:205): avc: denied { write } for pid=5837 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
[ 67.269242][ T33] audit: type=1400 audit(1788795001.185:206): avc: denied { write } for pid=5840 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
[ 67.360946][ T33] audit: type=1400 audit(1788795001.285:207): avc: denied { write } for pid=5843 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
[ 67.416533][ T33] audit: type=1400 audit(1788795001.335:208): avc: denied { write } for pid=5846 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
[ 67.869610][ T33] audit: type=1400 audit(1788795001.785:209): avc: denied { write } for pid=5853 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
[ 67.916954][ T33] audit: type=1400 audit(1788795001.835:210): avc: denied { write } for pid=5856 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]:15414' (ED25519) to the list of known hosts.
[ 68.390990][ T5398] usb 1-1: new high-speed USB device number 2 using dummy_hcd
[ 68.541978][ T5398] usb 1-1: New USB device found, idVendor=0424, idProduct=012c, bcdDevice= 1.00
[ 68.547358][ T5398] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 68.557497][ T5398] usb 1-1: probing VID:PID(0424:012C)
[ 68.560950][ T5398] usb 1-1: vub300 testing BULK IN EndPoint(0) 81
[ 68.563065][ T5398] usb 1-1: vub300 testing BULK OUT EndPoint(1) 02
[ 68.565155][ T5398] usb 1-1: vub300 testing BULK IN EndPoint(2) 83
[ 68.567243][ T5398] usb 1-1: vub300 testing BULK OUT EndPoint(3) 04
[ 68.569341][ T5398] usb 1-1: vub300 LARGE packets using EndPoints 02 81 04 83
[ 68.574391][ T5398] usb 1-1: operating_mode = IRQs 4-bit 48 MHz with 512 byte USB packets
[ 68.577618][ T5398] usb 1-1: USB vub300 remote SDIO host controller[0]connected with no SD/SDIO card inserted
[ 68.977641][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 68.977733][ T33] audit: type=1400 audit(1788795002.895:221): 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
[ 69.404056][ T5398] usb 1-1: SET_CLOCK_SPEED 200kHz failed with retval=-71
[ 69.423772][ T5738] usb 1-1: SET_CLOCK_SPEED 200kHz failed with retval=-71
[ 69.432149][ T5738] usb 1-1: SET_CLOCK_SPEED 200kHz failed with retval=-71
[ 69.436126][ T5738] usb 1-1: SET_CLOCK_SPEED 200kHz failed with retval=-71
[ 69.439651][ T5398] usb 1-1: USB disconnect, device number 2
[ 69.488414][ T33] audit: type=1400 audit(1788795003.405:222): avc: denied { write } for pid=5889 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
[ 69.528510][ T33] audit: type=1400 audit(1788795003.445:223): avc: denied { write } for pid=5892 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
[+] open /dev/raw-gadget successful.
[+] USB_RAW_IOCTL_INIT successful.
[+] USB_RAW_IOCTL_RUN successful.
[+] USB enumeration completed.
[+] Gadget closed, simulating disconnect.
[+] Done.
[ 70.118092][ T5398] USB vub300 remote SDIO host controller[0] now disconnected
[ 71.663659][ T1379] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.663741][ T1379] ieee802154 phy1 wpan1: encryption failed: -22
[ 76.783478][ T25] cfg80211: failed to load regulatory.db
TruncatedCrashReport:BUG: sleeping function called from invalid context at kernel/workqueue.c:4561
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 0, name: swapper/1
preempt_count: 101, expected: 0
RCU nest depth: 0, expected: 0
locks held by swapper/1/0: 1, last CPU#1:
#0: ffffc90000a18cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 1 UID: 0 PID: 0 Comm: swapper/1 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:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x36a/0x4c0 kernel/sched/core.c:9234
__cancel_work_sync+0x6d/0x110 kernel/workqueue.c:4561
mmc_free_host+0x19/0x30 drivers/mmc/core/host.c:700
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:64
Code: 9c a2 02 c3 cc cc cc cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 66 90 0f 00 2d b3 37 24 00 fb f4 <e9> cc 03 03 00 cc cc cc cc cc cc cc cc cc cc cc cc 90 90 90 90 90
RSP: 0018:ffffc900001a7e40 EFLAGS: 00000246
RAX: 000000000003e04d RBX: ffffffff819a5f6c RCX: 8000000000000001
RDX: 0000000000000001 RSI: ffffffff8e3b7134 RDI: ffffffff8c540080
RBP: ffffc900001a7f10 R08: ffff88827be33a1b R09: 1ffff1104f7c6743
R10: dffffc0000000000 R11: ffffed104f7c6744 R12: 0000000000000000
R13: 1ffff1103008f000 R14: 1ffff92000034fd0 R15: dffffc0000000000
arch_safe_halt arch/x86/kernel/process.c:767 [inline]
default_idle+0x9/0x20 arch/x86/kernel/process.c:768
default_idle_call+0x72/0xb0 kernel/sched/idle.c:122
cpuidle_idle_call kernel/sched/idle.c:199 [inline]
do_idle+0x1cc/0x540 kernel/sched/idle.c:355
cpu_startup_entry+0x43/0x60 kernel/sched/idle.c:454
start_secondary+0x101/0x110 arch/x86/kernel/smpboot.c:312
common_startup_64+0x13e/0x157
</TASK>
ODEBUG: object ffffc90000a18a80 is NOT on stack ffffc900001a0000, but annotated.
------------[ cut here ]------------
1
WARNING: lib/debugobjects.c:672 at debug_object_is_on_stack lib/debugobjects.c:672 [inline], CPU#1: swapper/1/0
WARNING: lib/debugobjects.c:672 at lookup_object_or_alloc lib/debugobjects.c:705 [inline], CPU#1: swapper/1/0
WARNING: lib/debugobjects.c:672 at __debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798, CPU#1: swapper/1/0
Modules linked in:
CPU: 1 UID: 0 PID: 0 Comm: swapper/1 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
RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:672 [inline]
RIP: 0010:lookup_object_or_alloc lib/debugobjects.c:705 [inline]
RIP: 0010:__debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798
Code: cc cc cc 41 ff c7 44 89 3d c9 79 f7 15 48 c7 c1 80 0a 54 8c 48 c7 c7 e0 0a 54 8c 84 c0 48 0f 45 f9 48 89 de e8 8d 95 45 fc 90 <0f> 0b 90 e9 c0 fe ff ff e8 4f 1c 00 00 8b 05 a1 f7 79 0a 3b 05 9f
RSP: 0018:ffffc90000a189b8 EFLAGS: 00010046
RAX: 0000000000000050 RBX: ffffc90000a18a80 RCX: 14c412d005b96700
RDX: 0000000000000100 RSI: 0000000000000100 RDI: 0000000000000000
RBP: ffff888180478020 R08: 0000000000000100 R09: 1ffff920001430e4
R10: dffffc0000000000 R11: fffff520001430e5 R12: ffff88810f22d478
R13: ffff88810d414a80 R14: dffffc0000000000 R15: 0000000000000001
FS: 0000000000000000(0000) GS:ffff8882e8473000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f414538af5e CR3: 00000001f8ede000 CR4: 0000000000352ef0
Call Trace:
<IRQ>
__synchronize_srcu+0x1d5/0x2f0 kernel/rcu/srcutree.c:1475
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:64
Code: 9c a2 02 c3 cc cc cc cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 66 90 0f 00 2d b3 37 24 00 fb f4 <e9> cc 03 03 00 cc cc cc cc cc cc cc cc cc cc cc cc 90 90 90 90 90
RSP: 0018:ffffc900001a7e40 EFLAGS: 00000246
RAX: 000000000003e04d RBX: ffffffff819a5f6c RCX: 8000000000000001
RDX: 0000000000000001 RSI: ffffffff8e3b7134 RDI: ffffffff8c540080
RBP: ffffc900001a7f10 R08: ffff88827be33a1b R09: 1ffff1104f7c6743
R10: dffffc0000000000 R11: ffffed104f7c6744 R12: 0000000000000000
R13: 1ffff1103008f000 R14: 1ffff92000034fd0 R15: dffffc0000000000
arch_safe_halt arch/x86/kernel/process.c:767 [inline]
default_idle+0x9/0x20 arch/x86/kernel/process.c:768
default_idle_call+0x72/0xb0 kernel/sched/idle.c:122
cpuidle_idle_call kernel/sched/idle.c:199 [inline]
do_idle+0x1cc/0x540 kernel/sched/idle.c:355
cpu_startup_entry+0x43/0x60 kernel/sched/idle.c:454
start_secondary+0x101/0x110 arch/x86/kernel/smpboot.c:312
common_startup_64+0x13e/0x157
</TASK>
----------------
Code disassembly (best guess):
0: 9c pushf
1: a2 02 c3 cc cc cc cc movabs %al,0xccccccccccccc302
8: cc cc
a: cc int3
b: 90 nop
c: 90 nop
d: 90 nop
e: 90 nop
f: 90 nop
10: 90 nop
11: 90 nop
12: 90 nop
13: 90 nop
14: 90 nop
15: 90 nop
16: 90 nop
17: 90 nop
18: 90 nop
19: 90 nop
1a: 90 nop
1b: f3 0f 1e fa endbr64
1f: 66 90 xchg %ax,%ax
21: 0f 00 2d b3 37 24 00 verw 0x2437b3(%rip) # 0x2437db
28: fb sti
29: f4 hlt
* 2a: e9 cc 03 03 00 jmp 0x303fb <-- trapping instruction
2f: cc int3
30: cc int3
31: cc int3
32: cc int3
33: cc int3
34: cc int3
35: cc int3
36: cc int3
37: cc int3
38: cc int3
39: cc int3
3a: cc int3
3b: 90 nop
3c: 90 nop
3d: 90 nop
3e: 90 nop
3f: 90 nop
TruncatedStraceOutput:]
|
| 133/3 |
2026/09/07 15:30 |
agent |
repro-oracle |
1m
Model:
Results: map[Feedback:The reproduced crash `BUG: sleeping function called from invalid context at kernel/workqueue.c:4561` is the exact same underlying bug as the original `WARNING: suspicious RCU usage in wakeup_source_unregister`.
In both cases, the bug is caused by `mmc_free_host()` being called from an atomic context (the timer callback `vub300_inactivity_timer_expired`).
The call chain is:
`call_timer_fn` -> `vub300_inactivity_timer_expired` -> `kref_put` -> `vub300_delete` -> `mmc_free_host`.
(Note: `vub300_inactivity_timer_expired` and `vub300_delete` are missing from the stack traces due to tail-call optimization).
`mmc_free_host()` performs operations that can sleep:
1. `cancel_delayed_work_sync(&host->detect);`
2. `put_device(&host->class_dev);` (which eventually calls `wakeup_source_unregister` and `synchronize_srcu`).
The original crash was triggered during the second step (`put_device` -> ... -> `wakeup_source_unregister`), while the reproduced crash was triggered during the first step (`cancel_delayed_work_sync` -> `__cancel_work_sync` -> `might_sleep()`). The difference in the crash signature is simply because `cancel_delayed_work_sync` is called before `put_device` in `mmc_free_host()`, so the `might_sleep()` check in the workqueue code catches the invalid context first in the current kernel version.
Both crashes represent the same root cause: freeing the MMC host from a timer callback. 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: WARNING: suspicious RCU usage in wakeup_source_unregister
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
=============================
WARNING: suspicious RCU usage
syzkaller #0 Tainted: G W L
-----------------------------
kernel/rcu/srcutree.c:1468 Illegal synchronize_srcu() in same-type SRCU (or in RCU) read-side critical section!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
locks held by syz-executor/5675: 5, last CPU#0:
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1542 [inline]
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm+0x10f/0x480 kernel/fork.c:1595
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:562 [inline]
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: dup_mmap+0x195/0x1dc0 mm/mmap.c:1716
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: mmap_write_lock_nested include/linux/mmap_lock.h:552 [inline]
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: dup_mmap+0x221/0x1dc0 mm/mmap.c:1723
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: __pte_offset_map+0x29/0x240 mm/pgtable-generic.c:290
#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
stack backtrace:
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
Call Trace:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
lockdep_rcu_suspicious+0x140/0x1d0 kernel/locking/lockdep.c:6938
__synchronize_srcu+0x157/0x2f0 kernel/rcu/srcutree.c:1464
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
BUG: sleeping function called from invalid context at kernel/rcu/srcutree.c:1472
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 5675, name: syz-executor
preempt_count: 101, expected: 0
RCU nest depth: 1, expected: 0
locks held by syz-executor/5675: 5, last CPU#0:
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1542 [inline]
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm+0x10f/0x480 kernel/fork.c:1595
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:562 [inline]
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: dup_mmap+0x195/0x1dc0 mm/mmap.c:1716
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: mmap_write_lock_nested include/linux/mmap_lock.h:552 [inline]
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: dup_mmap+0x221/0x1dc0 mm/mmap.c:1723
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: __pte_offset_map+0x29/0x240 mm/pgtable-generic.c:290
#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
Preemption disabled at:
[<ffffffff81336576>] preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
Call Trace:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x36a/0x4c0 kernel/sched/core.c:9234
__synchronize_srcu+0x1a1/0x2f0 kernel/rcu/srcutree.c:1472
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
ODEBUG: object ffffc90000007a80 is NOT on stack ffffc90004320000, but annotated.
------------[ cut here ]------------
1
WARNING: lib/debugobjects.c:672 at debug_object_is_on_stack lib/debugobjects.c:672 [inline], CPU#0: syz-executor/5675
WARNING: lib/debugobjects.c:672 at lookup_object_or_alloc lib/debugobjects.c:705 [inline], CPU#0: syz-executor/5675
WARNING: lib/debugobjects.c:672 at __debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798, CPU#0: syz-executor/5675
Modules linked in:
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor 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/24/2026
RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:672 [inline]
RIP: 0010:lookup_object_or_alloc lib/debugobjects.c:705 [inline]
RIP: 0010:__debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798
Code: cc cc cc 41 ff c7 44 89 3d c9 75 e8 15 48 c7 c1 80 9d 6d 8c 48 c7 c7 e0 9d 6d 8c 84 c0 48 0f 45 f9 48 89 de e8 4d fa 3d fc 90 <0f> 0b 90 e9 c0 fe ff ff e8 4f 1c 00 00 8b 05 a1 cd 6e 0a 3b 05 9f
RSP: 0018:ffffc900000079b8 EFLAGS: 00010046
RAX: 0000000000000050 RBX: ffffc90000007a80 RCX: 0978036a12caea00
RDX: 0000000000000100 RSI: 0000000000000100 RDI: 0000000000000000
RBP: ffff88803588dde0 R08: 0000000000000100 R09: 0000000000080000
R10: 0000000000008000 R11: ffffffff8ec362b8 R12: 1ffff92000000f4c
R13: ffff888021b995e8 R14: dffffc0000000000 R15: 0000000000000001
FS: 000055558fe74500(0000) GS:ffff888124cd9000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fdafb3556c8 CR3: 00000000640ca000 CR4: 00000000003526f0
Call Trace:
<IRQ>
__synchronize_srcu+0x1d5/0x2f0 kernel/rcu/srcutree.c:1475
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
----------------
Code disassembly (best guess), 1 bytes skipped:
0: 00 00 add %al,(%rax)
2: 41 c7 84 24 20 0e 00 movl $0x0,0xe20(%r12)
9: 00 00 00 00 00
e: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
13: 49 83 c4 48 add $0x48,%r12
17: 4c 89 e7 mov %r12,%rdi
1a: e8 f7 ed 50 0a call 0xa50ee16
1f: e8 d2 00 3a 00 call 0x3a00f6
24: fb sti
25: 4c 8b 65 c8 mov -0x38(%rbp),%r12
* 29: 49 8d bc 24 10 17 00 lea 0x1710(%r12),%rdi <-- trapping instruction
30: 00
31: 48 89 f8 mov %rdi,%rax
34: 48 c1 e8 03 shr $0x3,%rax
38: 42 0f b6 04 30 movzbl (%rax,%r14,1),%eax
3d: 84 c0 test %al,%al
IsProbe: false
Reproduced: true
Console Output: [ 63.959402][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 63.959479][ T33] audit: type=1400 audit(1788794997.875:201): avc: denied { transition } for pid=5831 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
[ 63.961033][ T33] audit: type=1400 audit(1788794997.875:202): avc: denied { noatsecure } for pid=5831 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.961057][ T33] audit: type=1400 audit(1788794997.875:203): avc: denied { rlimitinh } for pid=5831 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.961072][ T33] audit: type=1400 audit(1788794997.875:204): avc: denied { siginh } for pid=5831 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 67.218391][ T33] audit: type=1400 audit(1788795001.135:205): avc: denied { write } for pid=5837 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
[ 67.269242][ T33] audit: type=1400 audit(1788795001.185:206): avc: denied { write } for pid=5840 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
[ 67.360946][ T33] audit: type=1400 audit(1788795001.285:207): avc: denied { write } for pid=5843 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
[ 67.416533][ T33] audit: type=1400 audit(1788795001.335:208): avc: denied { write } for pid=5846 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
[ 67.869610][ T33] audit: type=1400 audit(1788795001.785:209): avc: denied { write } for pid=5853 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
[ 67.916954][ T33] audit: type=1400 audit(1788795001.835:210): avc: denied { write } for pid=5856 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]:15414' (ED25519) to the list of known hosts.
[ 68.390990][ T5398] usb 1-1: new high-speed USB device number 2 using dummy_hcd
[ 68.541978][ T5398] usb 1-1: New USB device found, idVendor=0424, idProduct=012c, bcdDevice= 1.00
[ 68.547358][ T5398] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 68.557497][ T5398] usb 1-1: probing VID:PID(0424:012C)
[ 68.560950][ T5398] usb 1-1: vub300 testing BULK IN EndPoint(0) 81
[ 68.563065][ T5398] usb 1-1: vub300 testing BULK OUT EndPoint(1) 02
[ 68.565155][ T5398] usb 1-1: vub300 testing BULK IN EndPoint(2) 83
[ 68.567243][ T5398] usb 1-1: vub300 testing BULK OUT EndPoint(3) 04
[ 68.569341][ T5398] usb 1-1: vub300 LARGE packets using EndPoints 02 81 04 83
[ 68.574391][ T5398] usb 1-1: operating_mode = IRQs 4-bit 48 MHz with 512 byte USB packets
[ 68.577618][ T5398] usb 1-1: USB vub300 remote SDIO host controller[0]connected with no SD/SDIO card inserted
[ 68.977641][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 68.977733][ T33] audit: type=1400 audit(1788795002.895:221): 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
[ 69.404056][ T5398] usb 1-1: SET_CLOCK_SPEED 200kHz failed with retval=-71
[ 69.423772][ T5738] usb 1-1: SET_CLOCK_SPEED 200kHz failed with retval=-71
[ 69.432149][ T5738] usb 1-1: SET_CLOCK_SPEED 200kHz failed with retval=-71
[ 69.436126][ T5738] usb 1-1: SET_CLOCK_SPEED 200kHz failed with retval=-71
[ 69.439651][ T5398] usb 1-1: USB disconnect, device number 2
[ 69.488414][ T33] audit: type=1400 audit(1788795003.405:222): avc: denied { write } for pid=5889 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
[ 69.528510][ T33] audit: type=1400 audit(1788795003.445:223): avc: denied { write } for pid=5892 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
[+] open /dev/raw-gadget successful.
[+] USB_RAW_IOCTL_INIT successful.
[+] USB_RAW_IOCTL_RUN successful.
[+] USB enumeration completed.
[+] Gadget closed, simulating disconnect.
[+] Done.
[ 70.118092][ T5398] USB vub300 remote SDIO host controller[0] now disconnected
[ 71.663659][ T1379] ieee802154 phy0 wpan0: encryption failed: -22
[ 71.663741][ T1379] ieee802154 phy1 wpan1: encryption failed: -22
[ 76.783478][ T25] cfg80211: failed to load regulatory.db
Strace Output:
Crash Report: BUG: sleeping function called from invalid context at kernel/workqueue.c:4561
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 0, name: swapper/1
preempt_count: 101, expected: 0
RCU nest depth: 0, expected: 0
locks held by swapper/1/0: 1, last CPU#1:
#0: ffffc90000a18cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 1 UID: 0 PID: 0 Comm: swapper/1 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:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x36a/0x4c0 kernel/sched/core.c:9234
__cancel_work_sync+0x6d/0x110 kernel/workqueue.c:4561
mmc_free_host+0x19/0x30 drivers/mmc/core/host.c:700
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:64
Code: 9c a2 02 c3 cc cc cc cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 66 90 0f 00 2d b3 37 24 00 fb f4 <e9> cc 03 03 00 cc cc cc cc cc cc cc cc cc cc cc cc 90 90 90 90 90
RSP: 0018:ffffc900001a7e40 EFLAGS: 00000246
RAX: 000000000003e04d RBX: ffffffff819a5f6c RCX: 8000000000000001
RDX: 0000000000000001 RSI: ffffffff8e3b7134 RDI: ffffffff8c540080
RBP: ffffc900001a7f10 R08: ffff88827be33a1b R09: 1ffff1104f7c6743
R10: dffffc0000000000 R11: ffffed104f7c6744 R12: 0000000000000000
R13: 1ffff1103008f000 R14: 1ffff92000034fd0 R15: dffffc0000000000
arch_safe_halt arch/x86/kernel/process.c:767 [inline]
default_idle+0x9/0x20 arch/x86/kernel/process.c:768
default_idle_call+0x72/0xb0 kernel/sched/idle.c:122
cpuidle_idle_call kernel/sched/idle.c:199 [inline]
do_idle+0x1cc/0x540 kernel/sched/idle.c:355
cpu_startup_entry+0x43/0x60 kernel/sched/idle.c:454
start_secondary+0x101/0x110 arch/x86/kernel/smpboot.c:312
common_startup_64+0x13e/0x157
</TASK>
ODEBUG: object ffffc90000a18a80 is NOT on stack ffffc900001a0000, but annotated.
------------[ cut here ]------------
1
WARNING: lib/debugobjects.c:672 at debug_object_is_on_stack lib/debugobjects.c:672 [inline], CPU#1: swapper/1/0
WARNING: lib/debugobjects.c:672 at lookup_object_or_alloc lib/debugobjects.c:705 [inline], CPU#1: swapper/1/0
WARNING: lib/debugobjects.c:672 at __debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798, CPU#1: swapper/1/0
Modules linked in:
CPU: 1 UID: 0 PID: 0 Comm: swapper/1 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
RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:672 [inline]
RIP: 0010:lookup_object_or_alloc lib/debugobjects.c:705 [inline]
RIP: 0010:__debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798
Code: cc cc cc 41 ff c7 44 89 3d c9 79 f7 15 48 c7 c1 80 0a 54 8c 48 c7 c7 e0 0a 54 8c 84 c0 48 0f 45 f9 48 89 de e8 8d 95 45 fc 90 <0f> 0b 90 e9 c0 fe ff ff e8 4f 1c 00 00 8b 05 a1 f7 79 0a 3b 05 9f
RSP: 0018:ffffc90000a189b8 EFLAGS: 00010046
RAX: 0000000000000050 RBX: ffffc90000a18a80 RCX: 14c412d005b96700
RDX: 0000000000000100 RSI: 0000000000000100 RDI: 0000000000000000
RBP: ffff888180478020 R08: 0000000000000100 R09: 1ffff920001430e4
R10: dffffc0000000000 R11: fffff520001430e5 R12: ffff88810f22d478
R13: ffff88810d414a80 R14: dffffc0000000000 R15: 0000000000000001
FS: 0000000000000000(0000) GS:ffff8882e8473000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f414538af5e CR3: 00000001f8ede000 CR4: 0000000000352ef0
Call Trace:
<IRQ>
__synchronize_srcu+0x1d5/0x2f0 kernel/rcu/srcutree.c:1475
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:64
Code: 9c a2 02 c3 cc cc cc cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 66 90 0f 00 2d b3 37 24 00 fb f4 <e9> cc 03 03 00 cc cc cc cc cc cc cc cc cc cc cc cc 90 90 90 90 90
RSP: 0018:ffffc900001a7e40 EFLAGS: 00000246
RAX: 000000000003e04d RBX: ffffffff819a5f6c RCX: 8000000000000001
RDX: 0000000000000001 RSI: ffffffff8e3b7134 RDI: ffffffff8c540080
RBP: ffffc900001a7f10 R08: ffff88827be33a1b R09: 1ffff1104f7c6743
R10: dffffc0000000000 R11: ffffed104f7c6744 R12: 0000000000000000
R13: 1ffff1103008f000 R14: 1ffff92000034fd0 R15: dffffc0000000000
arch_safe_halt arch/x86/kernel/process.c:767 [inline]
default_idle+0x9/0x20 arch/x86/kernel/process.c:768
default_idle_call+0x72/0xb0 kernel/sched/idle.c:122
cpuidle_idle_call kernel/sched/idle.c:199 [inline]
do_idle+0x1cc/0x540 kernel/sched/idle.c:355
cpu_startup_entry+0x43/0x60 kernel/sched/idle.c:454
start_secondary+0x101/0x110 arch/x86/kernel/smpboot.c:312
common_startup_64+0x13e/0x157
</TASK>
----------------
Code disassembly (best guess):
0: 9c pushf
1: a2 02 c3 cc cc cc cc movabs %al,0xccccccccccccc302
8: cc cc
a: cc int3
b: 90 nop
c: 90 nop
d: 90 nop
e: 90 nop
f: 90 nop
10: 90 nop
11: 90 nop
12: 90 nop
13: 90 nop
14: 90 nop
15: 90 nop
16: 90 nop
17: 90 nop
18: 90 nop
19: 90 nop
1a: 90 nop
1b: f3 0f 1e fa endbr64
1f: 66 90 xchg %ax,%ax
21: 0f 00 2d b3 37 24 00 verw 0x2437b3(%rip) # 0x2437db
28: fb sti
29: f4 hlt
* 2a: e9 cc 03 03 00 jmp 0x303fb <-- trapping instruction
2f: cc int3
30: cc int3
31: cc int3
32: cc int3
33: cc int3
34: cc int3
35: cc int3
36: cc int3
37: cc int3
38: cc int3
39: cc int3
3a: cc int3
3b: 90 nop
3c: 90 nop
3d: 90 nop
3e: 90 nop
3f: 90 nop
|
| 134/4 |
2026/09/07 15:30 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 20429
output: 40
thoughts: 1502
Thoughts: **Analysis of Reproduced Kernel Bug and its Relation to the Original Issue**
My primary objective was to analyze the results of running a generated program designed to reproduce a specific kernel bug. The initial bug description pointed to `WARNING: suspicious RCU usage in wakeup_source_unregister`. However, the subsequent crash reports present a more nuanced picture, and my thought process has been to meticulously dissect these reports and reconcile them.
Initially, I observed the crash report showing `BUG: sleeping function called from invalid context at kernel/workqueue.c:4561`, with a call trace that included `__cancel_work_sync`, `mmc_free_host`, and `call_timer_fn`. This seemed distinct from the original `wakeup_source_unregister` RCU warning.
Then, I revisited the original bug description and its associated crash report. This one clearly showed `__synchronize_srcu`, `wakeup_source_remove`, `wakeup_source_unregister`, `mmc_host_classdev_release`, and ultimately `call_timer_fn`. This confirmed the presence of RCU-related issues.
The confusion arose when comparing the reproduced crash's call stack with the original. I questioned whether `mmc_free_host` was indeed called directly from `call_timer_fn` in the reproduced scenario. I then carefully examined the reproduced crash report again.
A critical realization dawned: the reproduced crash *also* contains elements of the original problem. It shows `BUG: sleeping function called from invalid context at kernel/workqueue.c:4561`, with `__cancel_work_sync` and `mmc_free_host` leading to `call_timer_fn`. However, when I look closer, the *same* reproduced crash report *also* contains the RCU-related functions like `__synchronize_srcu` and `wakeup_source_unregister`, along with `mmc_host_classdev_release` and the subsequent object cleanup path ending in `call_timer_fn`.
This led me to understand that the reproduced crash *did* trigger the same fundamental path as the original issue. The apparent difference was simply the point of *immediate* panic or the most prominent function leading to the `BUG_ON`. It appears that `mmc_free_host` and `mmc_host_classdev_release` are both invoked within the context initiated by `call_timer_fn`. It's highly probable that `mmc_free_host` is called by the timer, and this function, in turn, might call `put_device`, which then leads to the invocation of `mmc_host_classdev_release`. To verify this specific call flow, my next step is to consult the source code for `mmc_free_host` in `drivers/mmc/core/host.c` using `codesearch-definition-source`. This will provide definitive clarity on the execution path and the relationship between these functions.
|
| 135/4 |
2026/09/07 15:30 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/core/host.c Name:mmc_free_host]
Results: map[SourceCode: 692: /**
693: * mmc_free_host - free the host structure
694: * @host: mmc host
695: *
696: * Free the host once all references to it have been dropped.
697: */
698: void mmc_free_host(struct mmc_host *host)
699: {
700: cancel_delayed_work_sync(&host->detect);
701: mmc_pwrseq_free(host);
702: put_device(&host->class_dev);
703: }
SourceFile:drivers/mmc/core/host.c]
|
| 136/4 |
2026/09/07 15:30 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 22157
output: 50
thoughts: 352
Thoughts: **My Thought Process Regarding the MMC Host Freeing Issue**
My analysis of this situation has focused on tracing the execution path that leads to the kernel panics observed. It's clear to me that the core problem lies in the improper invocation of `mmc_free_host` from an atomic context, specifically a timer callback.
I've observed that `mmc_free_host` performs two critical operations: it calls `cancel_delayed_work_sync(&host->detect)` and then `put_device(&host->class_dev)`. The initial bug, a "suspicious RCU usage in wakeup_source_unregister," occurred during the `put_device` call. However, the *reproduced* bug, a more severe "BUG: sleeping function called from invalid context at kernel/workqueue.c," is happening within `cancel_delayed_work_sync`.
My understanding is that both of these issues stem from the same root cause: `mmc_free_host` is being called from within a timer callback, which operates in an atomic context (softirq). This is problematic because both `cancel_delayed_work_sync` and `wakeup_source_unregister` (which is called by `put_device`) can potentially sleep. Attempting to sleep from an atomic context is a strict no-no in the kernel and leads to the observed deadlocks and bugs.
To further pinpoint the source of this problematic call, I've examined the provided stack trace from the original bug report:
```
#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
```
This trace clearly indicates that the timer in question is `vub300->inactivity_timer`. My next logical step, therefore, is to investigate the corresponding timer callback function, likely named something like `vub300_inactivity_timer_cb` or similar, within the `drivers/mmc/host/vub300.c` source file. This is where I expect to find the direct invocation of `mmc_free_host` that is triggering these kernel failures.
|
| 137/4 |
2026/09/07 15:30 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_inactivity_timer_cb]
Results: map[SourceCode: SourceFile:]
|
| 138/4 |
2026/09/07 15:30 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 22564
output: 38
thoughts: 28
Thoughts: **My Thought Process:**
My primary objective here is to delve into the implementation details of the inactivity timer within the `vub300.c` driver, specifically focusing on how it's managed in the MMC host controller. To achieve this, I'll be performing a targeted search within the `drivers/mmc/host/vub300.c` file for the term `inactivity_timer`. I anticipate this search will lead me directly to the relevant code sections where this timer is initialized, started, stopped, and potentially reset, providing me with insights into its operational logic and its role in the overall functionality of the vub300 MMC host driver.
|
| 139/4 |
2026/09/07 15:30 |
tool |
grepper |
0m
Args: map[Expression:inactivity_timer PathPrefix:drivers/mmc/host/vub300.c]
Results: map[Output:drivers/mmc/host/vub300.c=296=struct vub300_mmc_host {
--
drivers/mmc/host/vub300.c-345- struct usb_sg_request sg_request;
drivers/mmc/host/vub300.c:346: struct timer_list inactivity_timer;
drivers/mmc/host/vub300.c-347- struct work_struct deadwork;
--
drivers/mmc/host/vub300.c=655=static void __do_poll(struct vub300_mmc_host *vub300)
--
drivers/mmc/host/vub300.c-658- unsigned long commretval;
drivers/mmc/host/vub300.c:659: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-660- init_completion(&vub300->irqpoll_complete);
--
drivers/mmc/host/vub300.c=678=static void vub300_pollwork_thread(struct work_struct *work)
--
drivers/mmc/host/vub300.c-697- mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c:698: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-699- mutex_unlock(&vub300->irq_mutex);
--
drivers/mmc/host/vub300.c=709=static void vub300_deadwork_thread(struct work_struct *work)
--
drivers/mmc/host/vub300.c-736- }
drivers/mmc/host/vub300.c:737: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-738- mutex_unlock(&vub300->cmd_mutex);
--
drivers/mmc/host/vub300.c-741-
drivers/mmc/host/vub300.c:742:static void vub300_inactivity_timer_expired(struct timer_list *t)
drivers/mmc/host/vub300.c-743-{ /* softirq */
drivers/mmc/host/vub300.c-744- struct vub300_mmc_host *vub300 = timer_container_of(vub300, t,
drivers/mmc/host/vub300.c:745: inactivity_timer);
drivers/mmc/host/vub300.c-746- if (!vub300->interface) {
--
drivers/mmc/host/vub300.c-748- } else if (vub300->cmd) {
drivers/mmc/host/vub300.c:749: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-750- } else {
drivers/mmc/host/vub300.c-751- vub300_queue_dead_work(vub300);
drivers/mmc/host/vub300.c:752: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-753- }
--
drivers/mmc/host/vub300.c=1908=static void vub300_mmc_request(struct mmc_host *mmc, struct mmc_request *req)
--
drivers/mmc/host/vub300.c-1939- mutex_lock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:1940: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-1941- /*
--
drivers/mmc/host/vub300.c=2092=static int vub300_probe(struct usb_interface *interface,
--
drivers/mmc/host/vub300.c-2330- kref_get(&vub300->kref);
drivers/mmc/host/vub300.c:2331: timer_setup(&vub300->inactivity_timer,
drivers/mmc/host/vub300.c:2332: vub300_inactivity_timer_expired, 0);
drivers/mmc/host/vub300.c:2333: vub300->inactivity_timer.expires = jiffies + HZ;
drivers/mmc/host/vub300.c:2334: add_timer(&vub300->inactivity_timer);
drivers/mmc/host/vub300.c-2335- if (vub300->card_present)
]
|
| 140/4 |
2026/09/07 15:30 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 24045
output: 50
thoughts: 21
Thoughts: **My Thought Process on `vub300_inactivity_timer_expired`**
Alright, so when I see `vub300_inactivity_timer_expired`, I immediately recognize this as the specific callback function that gets invoked when the inactivity timer associated with `vub300` has reached its limit and expired. This isn't just a generic timer event; it's tied directly to a particular component or entity, `vub300`, and its designated inactivity period. My internal logic flags this as a critical point where I need to initiate whatever defined actions are meant to occur when this timeout condition is met. Essentially, this is the trigger for the "what happens when `vub300` is idle for too long" sequence.
|
| 141/4 |
2026/09/07 15:30 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_inactivity_timer_expired]
Results: map[SourceCode: 742: static void vub300_inactivity_timer_expired(struct timer_list *t)
743: { /* softirq */
744: struct vub300_mmc_host *vub300 = timer_container_of(vub300, t,
745: inactivity_timer);
746: if (!vub300->interface) {
747: kref_put(&vub300->kref, vub300_delete);
748: } else if (vub300->cmd) {
749: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
750: } else {
751: vub300_queue_dead_work(vub300);
752: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
753: }
754: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 142/4 |
2026/09/07 15:30 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 24404
output: 45
thoughts: 64
Thoughts: **My Thought Process**
Alright, so I'm looking at the `vub300_inactivity_timer_expired` function, and I see this conditional logic: if the `vub300->interface` pointer is null, it proceeds to call `kref_put(&vub300->kref, vub300_delete);`.
My immediate thought is to understand what happens when `kref_put` reaches zero and triggers the `vub300_delete` callback. I need to trace the execution flow and see precisely what `vub300_delete` does in this specific scenario, particularly when the interface is absent. This will help me confirm the expected cleanup behavior and ensure no resources are leaked or left in an inconsistent state.
|
| 143/4 |
2026/09/07 15:31 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_delete]
Results: map[SourceCode: 369: static void vub300_delete(struct kref *kref)
370: { /* kref callback - softirq */
371: struct vub300_mmc_host *vub300 = kref_to_vub300_mmc_host(kref);
372: struct mmc_host *mmc = vub300->mmc;
373:
374: usb_free_urb(vub300->command_out_urb);
375: vub300->command_out_urb = NULL;
376: usb_free_urb(vub300->command_res_urb);
377: vub300->command_res_urb = NULL;
378: usb_put_dev(vub300->udev);
379: mmc_free_host(mmc);
380: /*
381: * and hence also frees vub300
382: * which is contained at the end of struct mmc
383: */
384: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 144/4 |
2026/09/07 15:31 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 24837
output: 36
thoughts: 645
Thoughts: **The Root Cause of the Sleeping Function in Invalid Context Bug**
Ah, I've finally pieced it together. It all boils down to the fact that `vub300_delete` is calling `mmc_free_host(mmc)`. Now, `mmc_free_host` itself is problematic because it invokes `cancel_delayed_work_sync` and `put_device`, both of which are capable of sleeping. The critical issue here is that `vub300_delete` is being invoked from `vub300_inactivity_timer_expired`, which, as a timer callback, operates within a softirq or atomic context. This is the fundamental flaw, the exact bug.
Looking back at the original bug report, it was a `WARNING: suspicious RCU usage in wakeup_source_unregister`. This warning was a consequence of the call chain: `mmc_free_host` -> `put_device` -> `device_release` -> `mmc_classdev_release` -> `wakeup_source_unregister` -> `wakeup_source_remove` -> `__synchronize_srcu`.
However, the crash I've managed to reproduce presents itself as a `BUG: sleeping function called from invalid context at kernel/workqueue.c:4561`. This particular crash is triggered by `mmc_free_host` -> `cancel_delayed_work_sync`.
Both issues stem from the same underlying problem: `mmc_free_host` being called from within `vub300_delete`, which in turn is called from `vub300_inactivity_timer_expired` (a timer callback). The reason the reproduced crash has a different signature is simply because of the order of operations within `mmc_free_host`. Let me just double-check that:
```c
void mmc_free_host(struct mmc_host *host)
{
cancel_delayed_work_sync(&host->detect); // <-- This one is called first
mmc_pwrseq_free(host);
put_device(&host->class_dev);
}
```
Indeed, `cancel_delayed_work_sync` is executed *before* `put_device`. Now, if `CONFIG_DEBUG_ATOMIC_SLEEP` is enabled, this immediate call to `cancel_delayed_work_sync` will inevitably trigger the `BUG: sleeping function called from invalid context` because it internally calls `__might_resched`.
This brings me to a question: why did the original bug report surface as an RCU issue in `wakeup_source_unregister` and not a sleeping function in invalid context bug from `cancel_delayed_work_sync`? It's possible that in the kernel version where the original report was filed, `cancel_delayed_work_sync` wasn't yet present in `mmc_free_host`, or `CONFIG_DEBUG_ATOMIC_SLEEP` wasn't active, or perhaps `host->detect` was already cancelled.
However, even if `cancel_delayed_work_sync` might not technically sleep if the work isn't pending, the crucial point is that `__might_resched` is called unconditionally within `__cancel_work_sync`. I should really dig into `__cancel_work_sync` in `kernel/workqueue.c` for a definitive understanding.
|
| 145/4 |
2026/09/07 15:31 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/workqueue.c Name:__cancel_work_sync]
Results: map[SourceCode:4552: static bool __cancel_work_sync(struct work_struct *work, u32 cflags)
4553: {
4554: bool ret;
4555:
4556: ret = __cancel_work(work, cflags | WORK_CANCEL_DISABLE);
4557:
4558: if (*work_data_bits(work) & WORK_OFFQ_BH)
4559: WARN_ON_ONCE(in_hardirq());
4560: else
4561: might_sleep();
4562:
4563: /*
4564: * Skip __flush_work() during early boot when we know that @work isn't
4565: * executing. This allows canceling during early boot.
4566: */
4567: if (wq_online)
4568: __flush_work(work, true);
4569:
4570: if (!(cflags & WORK_CANCEL_DISABLE))
4571: enable_work(work);
4572:
4573: return ret;
4574: }
SourceFile:kernel/workqueue.c]
|
| 146/4 |
2026/09/07 15:31 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 25835
output: 421
thoughts: 2092
Thoughts: **My Thought Process on the `mmc_free_host` Crash Equivalence**
It's fascinating how different crash signatures can point to the exact same underlying bug. My initial thought was about the `might_sleep()` call within `__cancel_work_sync` being triggered unconditionally unless `WORK_OFFQ_BH` is set. This immediately made me consider `CONFIG_DEBUG_ATOMIC_SLEEP` as a potential catch-all.
However, the original bug report provided crucial context: it explicitly stated `in_atomic(): 1` and `irqs_disabled(): 0`, along with `CONFIG_DEBUG_ATOMIC_SLEEP` being enabled. This raised a perplexing question: why didn't `CONFIG_DEBUG_ATOMIC_SLEEP` trigger the bug in `cancel_delayed_work_sync` during the *original* crash investigation?
Digging deeper into the original bug report revealed not just one, but *two* distinct crashes: a `WARNING: suspicious RCU usage in wakeup_source_unregister` and a `BUG: sleeping function called from invalid context at kernel/rcu/srcutree.c:1472`. Both of these pointed to `__synchronize_srcu` being involved, which is called indirectly from `mmc_host_classdev_release` and subsequently from `put_device`.
This led me to hypothesize about the exact state of the kernel at the time of the original bug report. Perhaps `mmc_free_host` in that older version didn't include `cancel_delayed_work_sync`, or the call to `put_device` was the only path leading to a sleeping function. I would have normally checked the kernel version or the history of `mmc_free_host` to confirm this.
Regardless of the specifics of the older kernel, the core issue remained the same: `mmc_free_host` was being invoked from an atomic context. In the original bug report, this occurred when `mmc_free_host` was called from `vub300_delete`, which in turn was triggered by the timer callback `vub300_inactivity_timer_expired`. The reproduced crash confirmed this path.
The key difference in the *manifestation* of the bug became clear when I compared the reproduction trace with the original one. The reproduced crash pointed to `__cancel_work_sync` (called from `mmc_free_host`), while the original pointed to `__synchronize_srcu` (also called from `mmc_free_host`, but via `put_device`). This difference is simply a matter of execution order within `mmc_free_host`. `cancel_delayed_work_sync` is called *before* `put_device`. Therefore, in the current kernel version where `cancel_delayed_work_sync` is present, the `might_sleep()` check within `__cancel_work_sync` is encountered first, leading to the `BUG: sleeping function called from invalid context` in `kernel/workqueue.c`.
A critical piece of the puzzle fell into place when I examined the stack traces themselves. The absence of `vub300_delete` and `vub300_inactivity_timer_expired` from *both* traces was initially puzzling. However, by considering function inlining and, more importantly, tail-call optimization (TCO), the picture became crystal clear. Since `mmc_free_host` is the last call in `vub300_delete`, and `vub300_delete` is called as the `release` function in `kref_put` (which itself can be inlined), TCO would effectively replace the calling function's stack frame with that of the called function. This explains why the intermediate functions disappear from the stack trace in both scenarios.
Therefore, the equivalence is not just strong, it's 100% solid. The reproduced crash, while showing a different specific function trigger (`__cancel_work_sync` vs. `__synchronize_srcu`), is fundamentally the same bug: `mmc_free_host` being invoked from an atomic timer callback. The difference in the crash signature is a direct consequence of the order of operations within `mmc_free_host` and the kernel's debugging capabilities. I'm confident in setting `TitleMatches` to true and explaining this intricate relationship in the feedback.
|
| 147/4 |
2026/09/07 15:31 |
tool |
set-results |
0m
Args: map[Feedback:The reproduced crash `BUG: sleeping function called from invalid context at kernel/workqueue.c:4561` is the exact same underlying bug as the original `WARNING: suspicious RCU usage in wakeup_source_unregister`.
In both cases, the bug is caused by `mmc_free_host()` being called from an atomic context (the timer callback `vub300_inactivity_timer_expired`).
The call chain is:
`call_timer_fn` -> `vub300_inactivity_timer_expired` -> `kref_put` -> `vub300_delete` -> `mmc_free_host`.
(Note: `vub300_inactivity_timer_expired` and `vub300_delete` are missing from the stack traces due to tail-call optimization).
`mmc_free_host()` performs operations that can sleep:
1. `cancel_delayed_work_sync(&host->detect);`
2. `put_device(&host->class_dev);` (which eventually calls `wakeup_source_unregister` and `synchronize_srcu`).
The original crash was triggered during the second step (`put_device` -> ... -> `wakeup_source_unregister`), while the reproduced crash was triggered during the first step (`cancel_delayed_work_sync` -> `__cancel_work_sync` -> `might_sleep()`). The difference in the crash signature is simply because `cancel_delayed_work_sync` is called before `put_device` in `mmc_free_host()`, so the `might_sleep()` check in the workqueue code catches the invalid context first in the current kernel version.
Both crashes represent the same root cause: freeing the MMC host from a timer callback. ProbePassed:false TerminalError: TitleMatches:true]
Results: map[Feedback:The reproduced crash `BUG: sleeping function called from invalid context at kernel/workqueue.c:4561` is the exact same underlying bug as the original `WARNING: suspicious RCU usage in wakeup_source_unregister`.
In both cases, the bug is caused by `mmc_free_host()` being called from an atomic context (the timer callback `vub300_inactivity_timer_expired`).
The call chain is:
`call_timer_fn` -> `vub300_inactivity_timer_expired` -> `kref_put` -> `vub300_delete` -> `mmc_free_host`.
(Note: `vub300_inactivity_timer_expired` and `vub300_delete` are missing from the stack traces due to tail-call optimization).
`mmc_free_host()` performs operations that can sleep:
1. `cancel_delayed_work_sync(&host->detect);`
2. `put_device(&host->class_dev);` (which eventually calls `wakeup_source_unregister` and `synchronize_srcu`).
The original crash was triggered during the second step (`put_device` -> ... -> `wakeup_source_unregister`), while the reproduced crash was triggered during the first step (`cancel_delayed_work_sync` -> `__cancel_work_sync` -> `might_sleep()`). The difference in the crash signature is simply because `cancel_delayed_work_sync` is called before `put_device` in `mmc_free_host()`, so the `might_sleep()` check in the workqueue code catches the invalid context first in the current kernel version.
Both crashes represent the same root cause: freeing the MMC host from a timer callback. ProbePassed:false TerminalError: TitleMatches:true]
|
| 148/3 |
2026/09/07 15:31 |
action |
loop-controller |
0m
Results: map[CapabilitiesVerified:true ContinueSignal: EquivalenceAnalysis:The reproduced crash `BUG: sleeping function called from invalid context at kernel/workqueue.c:4561` is the exact same underlying bug as the original `WARNING: suspicious RCU usage in wakeup_source_unregister`.
In both cases, the bug is caused by `mmc_free_host()` being called from an atomic context (the timer callback `vub300_inactivity_timer_expired`).
The call chain is:
`call_timer_fn` -> `vub300_inactivity_timer_expired` -> `kref_put` -> `vub300_delete` -> `mmc_free_host`.
(Note: `vub300_inactivity_timer_expired` and `vub300_delete` are missing from the stack traces due to tail-call optimization).
`mmc_free_host()` performs operations that can sleep:
1. `cancel_delayed_work_sync(&host->detect);`
2. `put_device(&host->class_dev);` (which eventually calls `wakeup_source_unregister` and `synchronize_srcu`).
The original crash was triggered during the second step (`put_device` -> ... -> `wakeup_source_unregister`), while the reproduced crash was triggered during the first step (`cancel_delayed_work_sync` -> `__cancel_work_sync` -> `might_sleep()`). The difference in the crash signature is simply because `cancel_delayed_work_sync` is called before `put_device` in `mmc_free_host()`, so the `might_sleep()` check in the workqueue code catches the invalid context first in the current kernel version.
Both crashes represent the same root cause: freeing the MMC host from a timer callback. OracleFeedback:The reproduced crash `BUG: sleeping function called from invalid context at kernel/workqueue.c:4561` is the exact same underlying bug as the original `WARNING: suspicious RCU usage in wakeup_source_unregister`.
In both cases, the bug is caused by `mmc_free_host()` being called from an atomic context (the timer callback `vub300_inactivity_timer_expired`).
The call chain is:
`call_timer_fn` -> `vub300_inactivity_timer_expired` -> `kref_put` -> `vub300_delete` -> `mmc_free_host`.
(Note: `vub300_inactivity_timer_expired` and `vub300_delete` are missing from the stack traces due to tail-call optimization).
`mmc_free_host()` performs operations that can sleep:
1. `cancel_delayed_work_sync(&host->detect);`
2. `put_device(&host->class_dev);` (which eventually calls `wakeup_source_unregister` and `synchronize_srcu`).
The original crash was triggered during the second step (`put_device` -> ... -> `wakeup_source_unregister`), while the reproduced crash was triggered during the first step (`cancel_delayed_work_sync` -> `__cancel_work_sync` -> `might_sleep()`). The difference in the crash signature is simply because `cancel_delayed_work_sync` is called before `put_device` in `mmc_free_host()`, so the `might_sleep()` check in the workqueue code catches the invalid context first in the current kernel version.
Both crashes represent the same root cause: freeing the MMC host from a timer callback. ReproC:#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
#define USB_RAW_IOCTL_RUN _IO('U', 1)
#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
struct usb_raw_init {
uint8_t driver_name[128];
uint8_t device_name[128];
uint8_t speed;
};
struct usb_raw_event {
uint32_t type;
uint32_t length;
uint8_t data[0];
};
struct usb_raw_ep_io {
uint16_t ep;
uint16_t flags;
uint32_t length;
uint8_t data[0];
};
struct usb_ctrlrequest {
uint8_t bRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} __attribute__((packed));
int main() {
int fd = open("/dev/raw-gadget", O_RDWR);
if (fd < 0) {
printf("[-] Failed to open /dev/raw-gadget: %s\n", strerror(errno));
exit(1);
}
printf("[+] open /dev/raw-gadget successful.\n");
struct usb_raw_init init = {
.driver_name = "dummy_udc",
.device_name = "dummy_udc.0",
.speed = 3, // USB_SPEED_HIGH
};
if (ioctl(fd, USB_RAW_IOCTL_INIT, &init) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_INIT: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_INIT successful.\n");
if (ioctl(fd, USB_RAW_IOCTL_RUN, 0) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_RUN: %s\n", strerror(errno));
exit(1);
}
printf("[+] USB_RAW_IOCTL_RUN successful.\n");
int done = 0;
while (!done) {
struct usb_raw_event *event = malloc(sizeof(*event) + 1024);
event->type = 0;
event->length = 1024;
if (ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event) < 0) {
printf("[-] Failed to USB_RAW_IOCTL_EVENT_FETCH: %s\n", strerror(errno));
free(event);
break;
}
if (event->type == 2) { // USB_RAW_EVENT_CONTROL
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)event->data;
struct usb_raw_ep_io *io = malloc(sizeof(*io) + 1024);
io->ep = 0;
io->flags = 0;
io->length = 0;
int handled = 0;
if (req->bRequestType == 0x80 && req->bRequest == 6) { // GET_DESCRIPTOR
if ((req->wValue >> 8) == 1) { // DEVICE
uint8_t desc[] = {
18, 1, 0x00, 0x02, 0, 0, 0, 64,
0x24, 0x04, 0x2C, 0x01, 0x00, 0x01, 0, 0, 0, 1
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
} else if ((req->wValue >> 8) == 2) { // CONFIG
uint8_t desc[] = {
9, 2, 46, 0, 1, 1, 0, 0x80, 50,
9, 4, 0, 0, 4, 0xff, 0xff, 0xff, 0,
7, 5, 0x81, 2, 0, 2, 0,
7, 5, 0x02, 2, 0, 2, 0,
7, 5, 0x83, 2, 0, 2, 0,
7, 5, 0x04, 2, 0, 2, 0,
};
io->length = req->wLength < sizeof(desc) ? req->wLength : sizeof(desc);
memcpy(io->data, desc, io->length);
handled = 1;
}
} else if (req->bRequestType == 0xC0) { // VENDOR IN
if (req->bRequest == 1) { // GET_HC_INF0
uint8_t data[4] = {4, 0, 0, 1};
io->length = req->wLength < 4 ? req->wLength : 4;
memcpy(io->data, data, io->length);
handled = 1;
} else if (req->bRequest == 0) { // GET_SYSTEM_PORT_STATUS
// port_flags = 0 (card_present = 0) to avoid mmc_add_host probing
uint8_t data[15] = {15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
io->length = req->wLength < 15 ? req->wLength : 15;
memcpy(io->data, data, io->length);
handled = 1;
done = 1; // Last request in vub300_probe
}
} else if (req->bRequestType == 0x40) { // VENDOR OUT
if (req->bRequest == 16) { // SET_ROM_WAIT_STATES
io->length = 0;
handled = 1;
}
} else if (req->bRequestType == 0x00 && req->bRequest == 9) { // SET_CONFIGURATION
io->length = 0;
handled = 1;
} else {
// ACK other standard requests (e.g. SET_ADDRESS)
io->length = 0;
handled = 1;
}
if (handled) {
if (req->bRequestType & 0x80) {
ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
} else {
ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
free(io);
}
free(event);
}
printf("[+] USB enumeration completed.\n");
// Give vub300_probe a moment to finish mmc_add_host
usleep(200000);
// Close fd to simulate USB disconnect
close(fd);
printf("[+] Gadget closed, simulating disconnect.\n");
// Wait for the inactivity_timer to expire (it is set to jiffies + HZ)
sleep(2);
printf("[+] Done.\n");
return 0;
}
Reproduced:true ReproducedBugTitle:BUG: sleeping function called from invalid context in mmc_free_host ReproducedCrashReport:BUG: sleeping function called from invalid context at kernel/workqueue.c:4561
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 0, name: swapper/1
preempt_count: 101, expected: 0
RCU nest depth: 0, expected: 0
locks held by swapper/1/0: 1, last CPU#1:
#0: ffffc90000a18cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 1 UID: 0 PID: 0 Comm: swapper/1 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:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x36a/0x4c0 kernel/sched/core.c:9234
__cancel_work_sync+0x6d/0x110 kernel/workqueue.c:4561
mmc_free_host+0x19/0x30 drivers/mmc/core/host.c:700
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:64
Code: 9c a2 02 c3 cc cc cc cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 66 90 0f 00 2d b3 37 24 00 fb f4 <e9> cc 03 03 00 cc cc cc cc cc cc cc cc cc cc cc cc 90 90 90 90 90
RSP: 0018:ffffc900001a7e40 EFLAGS: 00000246
RAX: 000000000003e04d RBX: ffffffff819a5f6c RCX: 8000000000000001
RDX: 0000000000000001 RSI: ffffffff8e3b7134 RDI: ffffffff8c540080
RBP: ffffc900001a7f10 R08: ffff88827be33a1b R09: 1ffff1104f7c6743
R10: dffffc0000000000 R11: ffffed104f7c6744 R12: 0000000000000000
R13: 1ffff1103008f000 R14: 1ffff92000034fd0 R15: dffffc0000000000
arch_safe_halt arch/x86/kernel/process.c:767 [inline]
default_idle+0x9/0x20 arch/x86/kernel/process.c:768
default_idle_call+0x72/0xb0 kernel/sched/idle.c:122
cpuidle_idle_call kernel/sched/idle.c:199 [inline]
do_idle+0x1cc/0x540 kernel/sched/idle.c:355
cpu_startup_entry+0x43/0x60 kernel/sched/idle.c:454
start_secondary+0x101/0x110 arch/x86/kernel/smpboot.c:312
common_startup_64+0x13e/0x157
</TASK>
ODEBUG: object ffffc90000a18a80 is NOT on stack ffffc900001a0000, but annotated.
------------[ cut here ]------------
1
WARNING: lib/debugobjects.c:672 at debug_object_is_on_stack lib/debugobjects.c:672 [inline], CPU#1: swapper/1/0
WARNING: lib/debugobjects.c:672 at lookup_object_or_alloc lib/debugobjects.c:705 [inline], CPU#1: swapper/1/0
WARNING: lib/debugobjects.c:672 at __debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798, CPU#1: swapper/1/0
Modules linked in:
CPU: 1 UID: 0 PID: 0 Comm: swapper/1 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
RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:672 [inline]
RIP: 0010:lookup_object_or_alloc lib/debugobjects.c:705 [inline]
RIP: 0010:__debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798
Code: cc cc cc 41 ff c7 44 89 3d c9 79 f7 15 48 c7 c1 80 0a 54 8c 48 c7 c7 e0 0a 54 8c 84 c0 48 0f 45 f9 48 89 de e8 8d 95 45 fc 90 <0f> 0b 90 e9 c0 fe ff ff e8 4f 1c 00 00 8b 05 a1 f7 79 0a 3b 05 9f
RSP: 0018:ffffc90000a189b8 EFLAGS: 00010046
RAX: 0000000000000050 RBX: ffffc90000a18a80 RCX: 14c412d005b96700
RDX: 0000000000000100 RSI: 0000000000000100 RDI: 0000000000000000
RBP: ffff888180478020 R08: 0000000000000100 R09: 1ffff920001430e4
R10: dffffc0000000000 R11: fffff520001430e5 R12: ffff88810f22d478
R13: ffff88810d414a80 R14: dffffc0000000000 R15: 0000000000000001
FS: 0000000000000000(0000) GS:ffff8882e8473000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f414538af5e CR3: 00000001f8ede000 CR4: 0000000000352ef0
Call Trace:
<IRQ>
__synchronize_srcu+0x1d5/0x2f0 kernel/rcu/srcutree.c:1475
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:64
Code: 9c a2 02 c3 cc cc cc cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 66 90 0f 00 2d b3 37 24 00 fb f4 <e9> cc 03 03 00 cc cc cc cc cc cc cc cc cc cc cc cc 90 90 90 90 90
RSP: 0018:ffffc900001a7e40 EFLAGS: 00000246
RAX: 000000000003e04d RBX: ffffffff819a5f6c RCX: 8000000000000001
RDX: 0000000000000001 RSI: ffffffff8e3b7134 RDI: ffffffff8c540080
RBP: ffffc900001a7f10 R08: ffff88827be33a1b R09: 1ffff1104f7c6743
R10: dffffc0000000000 R11: ffffed104f7c6744 R12: 0000000000000000
R13: 1ffff1103008f000 R14: 1ffff92000034fd0 R15: dffffc0000000000
arch_safe_halt arch/x86/kernel/process.c:767 [inline]
default_idle+0x9/0x20 arch/x86/kernel/process.c:768
default_idle_call+0x72/0xb0 kernel/sched/idle.c:122
cpuidle_idle_call kernel/sched/idle.c:199 [inline]
do_idle+0x1cc/0x540 kernel/sched/idle.c:355
cpu_startup_entry+0x43/0x60 kernel/sched/idle.c:454
start_secondary+0x101/0x110 arch/x86/kernel/smpboot.c:312
common_startup_64+0x13e/0x157
</TASK>
----------------
Code disassembly (best guess):
0: 9c pushf
1: a2 02 c3 cc cc cc cc movabs %al,0xccccccccccccc302
8: cc cc
a: cc int3
b: 90 nop
c: 90 nop
d: 90 nop
e: 90 nop
f: 90 nop
10: 90 nop
11: 90 nop
12: 90 nop
13: 90 nop
14: 90 nop
15: 90 nop
16: 90 nop
17: 90 nop
18: 90 nop
19: 90 nop
1a: 90 nop
1b: f3 0f 1e fa endbr64
1f: 66 90 xchg %ax,%ax
21: 0f 00 2d b3 37 24 00 verw 0x2437b3(%rip) # 0x2437db
28: fb sti
29: f4 hlt
* 2a: e9 cc 03 03 00 jmp 0x303fb <-- trapping instruction
2f: cc int3
30: cc int3
31: cc int3
32: cc int3
33: cc int3
34: cc int3
35: cc int3
36: cc int3
37: cc int3
38: cc int3
39: cc int3
3a: cc int3
3b: 90 nop
3c: 90 nop
3d: 90 nop
3e: 90 nop
3f: 90 nop
]
|
| 149/1 |
2026/09/07 15:31 |
action |
save-repro-c |
0m
Results:
|