| 0/0 |
2026/07/21 19:51 |
flow |
assessment-security |
32m
Results: map[DenialOfService:false Explanation:**Bug Analysis:**
The bug is a race condition in the `cm109` USB driver's state machine that leads
to submitting an already active URB (USB Request Block), which triggers a
`WARN_ONCE` in the USB core.
The `cm109` driver uses two URBs to communicate with the USB phone device:
1. `urb_irq`: An IN interrupt URB to receive key presses.
2. `urb_ctl`: An OUT control URB to send commands (like toggling the buzzer or
scanning the next key column).
Normally, the driver alternates between these two URBs in a polling loop: when
`urb_irq` completes, its callback (`cm109_urb_irq_callback`) calls
`cm109_submit_ctl` to submit `urb_ctl`. When `urb_ctl` completes, its callback
(`cm109_urb_ctl_callback`) submits `urb_irq`.
However, the buzzer can be toggled asynchronously via input events (e.g.,
`SND_BELL`). When this happens, `cm109_toggle_buzzer_async` is called. If
`urb_ctl` is not currently active (`dev->ctl_urb_pending == 0`), it immediately
submits `urb_ctl`.
If this asynchronous submission happens while `urb_irq` is active, `urb_ctl`
becomes active concurrently. Then, when `urb_irq` completes,
`cm109_urb_irq_callback` unconditionally calls `cm109_submit_ctl`, which
unconditionally submits `urb_ctl` again without checking if it is already
active. This triggers the warning in `usb_submit_urb`: `URB ... submitted while
active`.
**Security Impact:**
* **Exploitable:** **No.** The `usb_submit_urb` function safely detects that the
URB is already active (by checking if `urb->hcpriv` is not NULL), prints a
`WARN_ONCE`, and returns `-EBUSY`. It does not corrupt any memory, cause a
double-free, or lead to a use-after-free. The driver's state machine also
recovers gracefully and continues to function normally.
* **Denial of Service:** **No.** The warning is a `WARN_ONCE` and does not halt
the kernel in production builds. It does not cause deadlocks, hangs, or resource
leaks.
* **Accessible From Unprivileged Processes / User Namespaces:** **Yes.** An
unprivileged user can trigger the buzzer by writing the BEL character (`\a`) to
their console (e.g., `/dev/tty1`), which invokes `kd_mksound` and broadcasts a
`SND_BELL` event to the input subsystem.
* **Peripheral Trigger:** **Yes.** It requires a physical CM109 USB device (or a
malicious device emulating it) to be plugged into the system. Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/07/21 19:51 |
action |
syz-repro-to-c-repro |
0m
Results: map[SimplifiedCRepro:// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/usb/ch9.h>
static unsigned long long procid;
static void sleep_ms(uint64_t ms)
{
usleep(ms * 1000);
}
#define MAX_FDS 30
#define USB_MAX_IFACE_NUM 4
#define USB_MAX_EP_NUM 32
#define USB_MAX_FDS 6
struct usb_endpoint_index {
struct usb_endpoint_descriptor desc;
int handle;
};
struct usb_iface_index {
struct usb_interface_descriptor* iface;
uint8_t bInterfaceNumber;
uint8_t bAlternateSetting;
uint8_t bInterfaceClass;
struct usb_endpoint_index eps[USB_MAX_EP_NUM];
int eps_num;
};
struct usb_device_index {
struct usb_device_descriptor* dev;
struct usb_config_descriptor* config;
uint8_t bDeviceClass;
uint8_t bMaxPower;
int config_length;
struct usb_iface_index ifaces[USB_MAX_IFACE_NUM];
int ifaces_num;
int iface_cur;
};
struct usb_info {
int fd;
struct usb_device_index index;
};
static struct usb_info usb_devices[USB_MAX_FDS];
static struct usb_device_index* lookup_usb_index(int fd)
{
for (int i = 0; i < USB_MAX_FDS; i++) {
if (__atomic_load_n(&usb_devices[i].fd, __ATOMIC_ACQUIRE) == fd)
return &usb_devices[i].index;
}
return NULL;
}
static int usb_devices_num;
static bool parse_usb_descriptor(const char* buffer, size_t length, struct usb_device_index* index)
{
if (length < sizeof(*index->dev) + sizeof(*index->config))
return false;
memset(index, 0, sizeof(*index));
index->dev = (struct usb_device_descriptor*)buffer;
index->config = (struct usb_config_descriptor*)(buffer + sizeof(*index->dev));
index->bDeviceClass = index->dev->bDeviceClass;
index->bMaxPower = index->config->bMaxPower;
index->config_length = length - sizeof(*index->dev);
index->iface_cur = -1;
size_t offset = 0;
while (true) {
if (offset + 1 >= length)
break;
uint8_t desc_length = buffer[offset];
uint8_t desc_type = buffer[offset + 1];
if (desc_length <= 2)
break;
if (offset + desc_length > length)
break;
if (desc_type == USB_DT_INTERFACE && index->ifaces_num < USB_MAX_IFACE_NUM) {
struct usb_interface_descriptor* iface = (struct usb_interface_descriptor*)(buffer + offset);
index->ifaces[index->ifaces_num].iface = iface;
index->ifaces[index->ifaces_num].bInterfaceNumber = iface->bInterfaceNumber;
index->ifaces[index->ifaces_num].bAlternateSetting = iface->bAlternateSetting;
index->ifaces[index->ifaces_num].bInterfaceClass = iface->bInterfaceClass;
index->ifaces_num++;
}
if (desc_type == USB_DT_ENDPOINT && index->ifaces_num > 0) {
struct usb_iface_index* iface = &index->ifaces[index->ifaces_num - 1];
if (iface->eps_num < USB_MAX_EP_NUM) {
memcpy(&iface->eps[iface->eps_num].desc, buffer + offset, sizeof(iface->eps[iface->eps_num].desc));
iface->eps_num++;
}
}
offset += desc_length;
}
return true;
}
static struct usb_device_index* add_usb_index(int fd, const char* dev, size_t dev_len)
{
int i = __atomic_fetch_add(&usb_devices_num, 1, __ATOMIC_RELAXED);
if (i >= USB_MAX_FDS)
return NULL;
if (!parse_usb_descriptor(dev, dev_len, &usb_devices[i].index))
return NULL;
__atomic_store_n(&usb_devices[i].fd, fd, __ATOMIC_RELEASE);
return &usb_devices[i].index;
}
struct vusb_connect_string_descriptor {
uint32_t len;
char* str;
} __attribute__((packed));
struct vusb_connect_descriptors {
uint32_t qual_len;
char* qual;
uint32_t bos_len;
char* bos;
uint32_t strs_len;
struct vusb_connect_string_descriptor strs[0];
} __attribute__((packed));
static const char default_string[] = {
8, USB_DT_STRING,
's', 0, 'y', 0, 'z', 0
};
static const char default_lang_id[] = {
4, USB_DT_STRING,
0x09, 0x04
};
static bool lookup_connect_response_in(int fd, const struct vusb_connect_descriptors* descs,
const struct usb_ctrlrequest* ctrl,
struct usb_qualifier_descriptor* qual,
char** response_data, uint32_t* response_length)
{
struct usb_device_index* index = lookup_usb_index(fd);
uint8_t str_idx;
if (!index)
return false;
switch (ctrl->bRequestType & USB_TYPE_MASK) {
case USB_TYPE_STANDARD:
switch (ctrl->bRequest) {
case USB_REQ_GET_DESCRIPTOR:
switch (ctrl->wValue >> 8) {
case USB_DT_DEVICE:
*response_data = (char*)index->dev;
*response_length = sizeof(*index->dev);
return true;
case USB_DT_CONFIG:
*response_data = (char*)index->config;
*response_length = index->config_length;
return true;
case USB_DT_STRING:
str_idx = (uint8_t)ctrl->wValue;
if (descs && str_idx < descs->strs_len) {
*response_data = descs->strs[str_idx].str;
*response_length = descs->strs[str_idx].len;
return true;
}
if (str_idx == 0) {
*response_data = (char*)&default_lang_id[0];
*response_length = default_lang_id[0];
return true;
}
*response_data = (char*)&default_string[0];
*response_length = default_string[0];
return true;
case USB_DT_BOS:
*response_data = descs->bos;
*response_length = descs->bos_len;
return true;
case USB_DT_DEVICE_QUALIFIER:
if (!descs->qual) {
qual->bLength = sizeof(*qual);
qual->bDescriptorType = USB_DT_DEVICE_QUALIFIER;
qual->bcdUSB = index->dev->bcdUSB;
qual->bDeviceClass = index->dev->bDeviceClass;
qual->bDeviceSubClass = index->dev->bDeviceSubClass;
qual->bDeviceProtocol = index->dev->bDeviceProtocol;
qual->bMaxPacketSize0 = index->dev->bMaxPacketSize0;
qual->bNumConfigurations = index->dev->bNumConfigurations;
qual->bRESERVED = 0;
*response_data = (char*)qual;
*response_length = sizeof(*qual);
return true;
}
*response_data = descs->qual;
*response_length = descs->qual_len;
return true;
default:
break;
}
break;
default:
break;
}
break;
default:
break;
}
return false;
}
typedef bool (*lookup_connect_out_response_t)(int fd, const struct vusb_connect_descriptors* descs,
const struct usb_ctrlrequest* ctrl, bool* done);
static bool lookup_connect_response_out_generic(int fd, const struct vusb_connect_descriptors* descs,
const struct usb_ctrlrequest* ctrl, bool* done)
{
switch (ctrl->bRequestType & USB_TYPE_MASK) {
case USB_TYPE_STANDARD:
switch (ctrl->bRequest) {
case USB_REQ_SET_CONFIGURATION:
*done = true;
return true;
default:
break;
}
break;
}
return false;
}
#define UDC_NAME_LENGTH_MAX 128
struct usb_raw_init {
__u8 driver_name[UDC_NAME_LENGTH_MAX];
__u8 device_name[UDC_NAME_LENGTH_MAX];
__u8 speed;
};
enum usb_raw_event_type {
USB_RAW_EVENT_INVALID = 0,
USB_RAW_EVENT_CONNECT = 1,
USB_RAW_EVENT_CONTROL = 2,
};
struct usb_raw_event {
__u32 type;
__u32 length;
__u8 data[0];
};
struct usb_raw_ep_io {
__u16 ep;
__u16 flags;
__u32 length;
__u8 data[0];
};
#define USB_RAW_EPS_NUM_MAX 30
#define USB_RAW_EP_NAME_MAX 16
#define USB_RAW_EP_ADDR_ANY 0xff
struct usb_raw_ep_caps {
__u32 type_control : 1;
__u32 type_iso : 1;
__u32 type_bulk : 1;
__u32 type_int : 1;
__u32 dir_in : 1;
__u32 dir_out : 1;
};
struct usb_raw_ep_limits {
__u16 maxpacket_limit;
__u16 max_streams;
__u32 reserved;
};
struct usb_raw_ep_info {
__u8 name[USB_RAW_EP_NAME_MAX];
__u32 addr;
struct usb_raw_ep_caps caps;
struct usb_raw_ep_limits limits;
};
struct usb_raw_eps_info {
struct usb_raw_ep_info eps[USB_RAW_EPS_NUM_MAX];
};
#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_EP_ENABLE _IOW('U', 5, struct usb_endpoint_descriptor)
#define USB_RAW_IOCTL_EP_DISABLE _IOW('U', 6, __u32)
#define USB_RAW_IOCTL_EP_WRITE _IOW('U', 7, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP_READ _IOWR('U', 8, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_CONFIGURE _IO('U', 9)
#define USB_RAW_IOCTL_VBUS_DRAW _IOW('U', 10, __u32)
#define USB_RAW_IOCTL_EPS_INFO _IOR('U', 11, struct usb_raw_eps_info)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
#define USB_RAW_IOCTL_EP_SET_HALT _IOW('U', 13, __u32)
#define USB_RAW_IOCTL_EP_CLEAR_HALT _IOW('U', 14, __u32)
#define USB_RAW_IOCTL_EP_SET_WEDGE _IOW('U', 15, __u32)
static int usb_raw_open()
{
return open("/dev/raw-gadget", O_RDWR);
}
static int usb_raw_init(int fd, uint32_t speed, const char* driver, const char* device)
{
struct usb_raw_init arg;
strncpy((char*)&arg.driver_name[0], driver, sizeof(arg.driver_name));
strncpy((char*)&arg.device_name[0], device, sizeof(arg.device_name));
arg.speed = speed;
return ioctl(fd, USB_RAW_IOCTL_INIT, &arg);
}
static int usb_raw_run(int fd)
{
return ioctl(fd, USB_RAW_IOCTL_RUN, 0);
}
static int usb_raw_configure(int fd)
{
return ioctl(fd, USB_RAW_IOCTL_CONFIGURE, 0);
}
static int usb_raw_vbus_draw(int fd, uint32_t power)
{
return ioctl(fd, USB_RAW_IOCTL_VBUS_DRAW, power);
}
static int usb_raw_ep0_write(int fd, struct usb_raw_ep_io* io)
{
return ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
}
static int usb_raw_ep0_read(int fd, struct usb_raw_ep_io* io)
{
return ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
static int usb_raw_event_fetch(int fd, struct usb_raw_event* event)
{
return ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event);
}
static int usb_raw_ep_enable(int fd, struct usb_endpoint_descriptor* desc)
{
return ioctl(fd, USB_RAW_IOCTL_EP_ENABLE, desc);
}
static int usb_raw_ep_disable(int fd, int ep)
{
return ioctl(fd, USB_RAW_IOCTL_EP_DISABLE, ep);
}
static int usb_raw_ep0_stall(int fd)
{
return ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
#define USB_MAX_PACKET_SIZE 4096
struct usb_raw_control_event {
struct usb_raw_event inner;
struct usb_ctrlrequest ctrl;
char data[USB_MAX_PACKET_SIZE];
};
struct usb_raw_ep_io_data {
struct usb_raw_ep_io inner;
char data[USB_MAX_PACKET_SIZE];
};
static void set_interface(int fd, int n)
{
struct usb_device_index* index = lookup_usb_index(fd);
if (!index)
return;
if (index->iface_cur >= 0 && index->iface_cur < index->ifaces_num) {
for (int ep = 0; ep < index->ifaces[index->iface_cur].eps_num; ep++) {
int rv = usb_raw_ep_disable(fd, index->ifaces[index->iface_cur].eps[ep].handle);
if (rv < 0) {
} else {
}
}
}
if (n >= 0 && n < index->ifaces_num) {
for (int ep = 0; ep < index->ifaces[n].eps_num; ep++) {
int rv = usb_raw_ep_enable(fd, &index->ifaces[n].eps[ep].desc);
if (rv < 0) {
} else {
index->ifaces[n].eps[ep].handle = rv;
}
}
index->iface_cur = n;
}
}
static int configure_device(int fd)
{
struct usb_device_index* index = lookup_usb_index(fd);
if (!index)
return -1;
int rv = usb_raw_vbus_draw(fd, index->bMaxPower);
if (rv < 0) {
return rv;
}
rv = usb_raw_configure(fd);
if (rv < 0) {
return rv;
}
set_interface(fd, 0);
return 0;
}
static volatile long syz_usb_connect_impl(uint64_t speed, uint64_t dev_len, const char* dev,
const struct vusb_connect_descriptors* descs,
lookup_connect_out_response_t lookup_connect_response_out)
{
if (!dev) {
return -1;
}
int fd = usb_raw_open();
if (fd < 0) {
return fd;
}
if (fd >= MAX_FDS) {
close(fd);
return -1;
}
struct usb_device_index* index = add_usb_index(fd, dev, dev_len);
if (!index) {
return -1;
}
char device[32];
sprintf(&device[0], "dummy_udc.%llu", procid);
int rv = usb_raw_init(fd, speed, "dummy_udc", &device[0]);
if (rv < 0) {
return rv;
}
rv = usb_raw_run(fd);
if (rv < 0) {
return rv;
}
bool done = false;
while (!done) {
struct usb_raw_control_event event;
event.inner.type = 0;
event.inner.length = sizeof(event.ctrl);
rv = usb_raw_event_fetch(fd, (struct usb_raw_event*)&event);
if (rv < 0) {
return rv;
}
if (event.inner.type != USB_RAW_EVENT_CONTROL)
continue;
char* response_data = NULL;
uint32_t response_length = 0;
struct usb_qualifier_descriptor qual;
if (event.ctrl.bRequestType & USB_DIR_IN) {
if (!lookup_connect_response_in(fd, descs, &event.ctrl, &qual, &response_data, &response_length)) {
usb_raw_ep0_stall(fd);
continue;
}
} else {
if (!lookup_connect_response_out(fd, descs, &event.ctrl, &done)) {
usb_raw_ep0_stall(fd);
continue;
}
response_data = NULL;
response_length = event.ctrl.wLength;
}
if ((event.ctrl.bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD &&
event.ctrl.bRequest == USB_REQ_SET_CONFIGURATION) {
rv = configure_device(fd);
if (rv < 0) {
return rv;
}
}
struct usb_raw_ep_io_data response;
response.inner.ep = 0;
response.inner.flags = 0;
if (response_length > sizeof(response.data))
response_length = 0;
if (event.ctrl.wLength < response_length)
response_length = event.ctrl.wLength;
response.inner.length = response_length;
if (response_data)
memcpy(&response.data[0], response_data, response_length);
else
memset(&response.data[0], 0, response_length);
if (event.ctrl.bRequestType & USB_DIR_IN) {
rv = usb_raw_ep0_write(fd, (struct usb_raw_ep_io*)&response);
} else {
rv = usb_raw_ep0_read(fd, (struct usb_raw_ep_io*)&response);
}
if (rv < 0) {
return rv;
}
}
sleep_ms(200);
return fd;
}
static volatile long syz_usb_connect(volatile long a0, volatile long a1, volatile long a2, volatile long a3)
{
uint64_t speed = a0;
uint64_t dev_len = a1;
const char* dev = (const char*)a2;
const struct vusb_connect_descriptors* descs = (const struct vusb_connect_descriptors*)a3;
return syz_usb_connect_impl(speed, dev_len, dev, descs, &lookup_connect_response_out_generic);
}
static long syz_open_dev(volatile long a0, volatile long a1, volatile long a2)
{
if (a0 == 0xc || a0 == 0xb) {
char buf[128];
sprintf(buf, "/dev/%s/%d:%d", a0 == 0xc ? "char" : "block", (uint8_t)a1, (uint8_t)a2);
return open(buf, O_RDWR, 0);
} else {
unsigned long nb = a1;
char buf[1024];
char* hash;
strncpy(buf, (char*)a0, sizeof(buf) - 1);
buf[sizeof(buf) - 1] = 0;
while ((hash = strchr(buf, '#'))) {
*hash = '0' + (char)(nb % 10);
nb /= 10;
}
return open(buf, a2 & ~O_CREAT, 0);
}
}
uint64_t r[1] = {0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
const char* reason;
(void)reason;
intptr_t res = 0;
if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {}
// syz_usb_connect arguments: [
// speed: usb_device_speed = 0x5 (8 bytes)
// dev_len: len = 0x2d (8 bytes)
// dev: ptr[inout, array[ANYUNION]] {
// array[ANYUNION] {
// union ANYUNION {
// ANYBLOB: buffer: {12 01 00 00 75 16 b7 10 8c 0d 0e 00 8f 8e 00 18 03 01 09 02 1b 00 01 00 00 00 00 09 04 08 00 01 03 00 00 00 09 05} (length 0x26)
// }
// union ANYUNION {
// ANYBLOB: buffer: {8f cf d0 7a d0 88 28 f2 7b 6e a5 ef 0a} (length 0xd)
// }
// }
// }
// conn_descs: nil
// ]
// returns fd_usb
memcpy((void*)0x200000000040, "... [truncated large byte array] ...", 38);
memcpy((void*)0x200000000066, "\x8f\xcf\xd0\x7a\xd0\x88\x28\xf2\x7b\x6e\xa5\xef\x0a", 13);
syz_usb_connect(/*speed=USB_SPEED_SUPER*/5, /*dev_len=*/0x2d, /*dev=*/0x200000000040, /*conn_descs=*/0);
// syz_open_dev$tty1 arguments: [
// dev: const = 0xc (8 bytes)
// major: const = 0x4 (8 bytes)
// minor: intptr = 0x1 (8 bytes)
// ]
// returns fd_tty
res = -1;
res = syz_open_dev(/*dev=*/0xc, /*major=*/4, /*minor=*/1);
if (res != -1)
r[0] = res;
// write$UHID_INPUT arguments: [
// fd: fd_uhid (resource)
// data: ptr[in, uhid_req[UHID_INPUT, uhid_input_req]] {
// uhid_req[UHID_INPUT, uhid_input_req] {
// type: const = 0xfc (4 bytes)
// data: uhid_input_req {
// data: buffer: {a2 33 68 48 14 9e 51 6d 4b 5e 07 18 87 f7 0e 09 d0 38 e7 ff 7f c6 e5 53 9b 0d 50 0a 8b 08 9b 3f 38 35 63 03 08 90 e0 87 9b 0a 71 c6 e7 0a 9b 33 4a 95 9b 66 9a 24 2f 0a 0a f3 98 8f 7e f3 19 52 01 00 ff e8 d1 78 70 8c 52 3c 92 1b 1b 3e 31 07 0d 07 73 09 0a cd 3b 78 13 0d aa 61 d8 e8 04 00 3e 00 58 02 b7 7f 07 22 72 27 b7 ba 67 e0 e7 86 57 a6 f5 c2 a8 74 e6 2a 9c cd c0 d3 1a 0c 9f 31 8c 0d a1 99 3b d1 60 e2 33 df 4a 62 17 9c 6f 30 e0 65 cd 5b 91 cd 0a e1 93 97 37 35 b3 6d 5b 1b 63 dd 1c 00 30 5d 3f 46 63 5e b0 16 d5 b1 dd a9 8e 2d 74 9b e7 bd 1d f1 fb 3b 23 1f dc db 50 75 a9 aa a1 b4 69 c3 09 00 00 00 00 00 00 00 75 27 1b 28 63 29 d1 69 93 42 88 fd 78 9a a3 7d 6e 98 b2 24 fd 44 b6 5b 31 33 4f fc 55 cc 82 cd 3a c3 2e cd b0 8c ed 6f 90 81 b4 dd 0d 8b 38 f3 cd 44 98 be e8 00 49 08 41 bd b1 14 f6 b7 63 83 70 9d 8f 5c 55 43 2a 90 9f da 03 9a ec 54 a1 23 6e 80 f6 a8 ab ad ea 76 62 49 6b dd bb 42 be 6b fb 2f 17 95 9d 1f 41 6e 56 c7 1b 19 31 87 02 62 f5 e8 01 11 92 42 ca 02 6b fc 82 1e 7e 7d af 24 51 13 8e 64 5b b8 0c 61 76 69 31 4e 2f be 70 de 98 ec 76 a9 e4 0d ad 47 f3 6f d9 f7 d0 d4 2a 4b 5f 11 85 cc dc f1 6f f4 62 95 d8 a0 fa 17 71 3c 58 02 63 09 33 a9 a3 4a f6 74 f3 f3 9f e2 34 91 23 7c 08 82 2d ec 11 09 11 e8 93 d0 a8 c4 f6 77 74 7a bc 36 09 34 b8 29 10 ff 85 bf d9 95 08 3b ba 29 87 a6 73 99 ea c4 27 d1 45 d5 46 a4 0b 9f 6f f1 4a c4 88 ec 13 0f b3 85 0a 27 af 95 44 ae 15 a7 e4 54 de a0 59 18 b4 12 43 51 3f 00 00 00 00 00 00 00 0a 36 21 c5 6c ea 8d 20 fa 91 1a 0c 41 db 6e be 8c ac 64 f1 76 79 14 1d 54 b3 4b bc 99 03 f1 d4 ab 96 62 03 86 1b 5b 15 a8 41 f2 b5 75 a8 bd 0d 78 24 8e be 4d 9a 80 00 26 95 10 4f 67 4c 24 31 dc a1 41 fa e2 69 ca b7 0e 9a 66 f3 c3 a9 a6 3e 96 39 e1 f5 9c 0e de 26 c6 b5 d7 4b 07 8a 5e 15 c3 16 34 e5 ae 09 8c e9 ee 70 77 1a aa 18 11 9a 86 7e 10 88 33 49 75 e9 f7 34 83 b6 a6 2f a6 78 ca 14 ff d9 f9 db 2a 78 69 d8 58 64 05 65 26 f8 89 af 43 a6 05 60 80 57 22 86 52 24 49 df 46 6c 63 2b 35 70 24 3f 98 9c ce 7c d9 f4 65 e4 1e 61 0c 20 d8 04 21 d6 53 a5 52 00 00 00 82 13 b7 04 c7 fb 08 2f f2 75 90 67 8e f9 f1 90 ba e9 79 09 50 70 41 d8 60 42 0c 56 64 b2 79 21 b1 4d c1 db 88 92 fd 32 d0 ad 7b c9 46 81 35 91 ad 8d ef f4 b0 5f 60 ce a0 da 77 10 ac 00 00 00 00 00 00 80 00 be a3 7c e0 d0 d4 aa 20 2f 92 8d 28 38 1a ab 14 4a 5d 42 9a 04 a6 a2 b8 3c 70 68 ae 94 9e d0 6e 28 8e 81 0b ac 9c 76 60 00 25 e1 9c 90 7f 8e a2 e2 01 00 00 00 82 71 a1 f5 f8 52 8f 22 7e 79 c1 38 9d bd ff fe 49 2f 21 57 9d 2c 15 b8 c7 0c db 1c 33 2d 86 d8 73 41 43 27 50 86 1e c2 bc 34 51 ed ca 19 4b 22 1c fe c4 60 3d 27 6b ba a1 df a6 d4 fb 8a 48 a7 6e af c9 a9 a0 27 0e 4c 10 d6 4c d5 a6 24 27 26 4f 23 77 fe 76 3c 43 47 08 33 ac 96 c4 5f 35 7c bb ab a8 f1 b1 fd cc 7c bb 61 a7 cd b9 74 4e d7 f9 12 9a ed e2 be 21 cc fd c4 e9 13 4f 86 84 b3 a4 f3 54 da 9a 79 5e 96 33 4e 20 7d ff 70 f1 98 80 37 b2 ed 3a af 57 5c 0b 88 d8 f1 46 68 40 78 41 6d 59 fd ee 53 25 92 89 74 d1 2d ad 99 da c4 4c 3f 00 08 04 70 96 a4 40 02 be bc 24 20 ae d9 2f a9 b6 57 8b 47 79 41 5d 4a c0 1b 75 d5 49 5c 11 80 45 65 1c f4 1c 2f c4 8b 77 8e fa 5e a5 67 77 47 43 0a f4 16 2b 98 7b 80 c3 e0 01 cd 34 e5 c9 2f 76 cc 4c 24 ee b8 bc 4e 9a c2 ae d9 e5 38 03 ed 0c a4 ae 3a 97 37 d2 14 06 00 05 ea 6f 17 83 e2 87 b3 be e9 6e 3a 72 6e af e2 fd fa a7 8d 1f 48 c1 3b 64 df 07 84 77 54 b8 40 0d aa a6 9b f5 c8 f4 35 0a ea e9 ca 12 07 e7 82 83 cd 0b 20 ce b3 60 c7 e6 58 82 81 63 e2 d2 5c 4a a3 48 56 1f 92 7e 88 f6 3a a7 0e 73 a5 e6 9b 3d f3 49 59 03 f0 65 72 e1 e0 07 fa 55 a2 99 9f 59 6d 06 73 12 f5 77 9e 8d bf dc f3 42 71 38 f3 d4 44 d2 63 9a 10 47 7f 9b ec 4b 0b bb 6e 3c 04 be 68 98 1f 39 22 03 dd 0e e3 ef 47 8e 16 da cf c5 e3 e0 3c f7 ab 8e 39 02 f1 b0 ff 03 4e f6 55 b2 53 ca 50 93 83 81 5b 1b 6f c6 52 2d 4e 4f dc 11 a4 8c f4 2d 48 60 46 75 fd e2 b9 4c f0 05 00 a2 69 08 91 ab f8 ab 9c 01 50 73 01 4d 9e 08 d4 33 8b 87 80 bd ec d4 36 cf 05 41 35 9b af ff a4 52 37 f1 04 b9 62 10 40 3b 2d e9 ef ed 49 6f 27 30 d5 6b d0 68 ed 21 1c f8 47 53 5e de cb 7b 37 3f 78 b0 95 b6 84 41 a3 4c b5 16 82 a8 ae 4d 24 ad 04 65 f3 92 7f 88 9b 81 30 5c 03 8e 79 a7 96 2f b3 85 a8 82 e8 02 0f 06 c4 c2 ba 1d d5 ca c7 c1 88 76 da 86 5d 25 87 34 dd 73 58 3d f2 92 89 24 48 03 9e f7 99 cf 06 30 be cd cc e0 45 79 b5 56 1d c8 25 ab 82 98 27 94 5e 02 0c 1f 67 ee 61 5f eb 62 43 37 8e 06 10 06 0f 02 cc a4 e9 1b 2f 00 1e db 3d 78 fb 4b 55 66 8d da 93 ae c9 2a 5d e2 03 71 7a a4 9c 2d 28 4a cf ab e2 62 fc cf cb b2 b7 5a 21 83 c4 6e b6 5c a8 10 4e 1b 4d a7 fb b7 7a b2 fc 04 3a ea d8 7c 32 ab 87 5e e7 c2 e7 b7 01 9c 98 2c d3 b4 3e ae b1 a5 fb 13 5c 0c 7d ce e8 fe 65 16 a3 28 03 2f 88 c0 42 89 18 24 65 9e 9e 94 26 5c 80 3b 35 ee 5f 83 a2 b2 10 52 01 06 b8 a3 58 b5 0a b7 a1 fa 89 af 9c 25 1f e5 29 4b 3d 18 02 d5 67 6d 95 f1 60 ec 97 b1 ad 94 87 2c b2 04 46 42 c3 7b 4a 6c c6 c0 4e ff c1 67 2d b7 e4 b6 8d 78 7d 9a 7a 50 8a e5 4b 3c d7 36 9d de 50 e8 c7 7d 95 a3 d3 61 c0 40 ba bb 17 16 07 ca ac 2a 35 59 ad 4f 75 46 5f 49 c0 d0 ae 37 16 db 6e 00 cb 11 db 4a 5f ad e2 a5 7c 10 23 8e 20 4a 67 73 7c 3b 42 aa e5 01 b2 0f 76 94 a0 0f 16 e2 d0 17 40 35 a2 c2 26 56 dc 29 88 0a ce bd be 8d db d7 5c 2f 99 8d 8a c2 df ad 2b a3 a5 04 76 7b 6b 45 a4 59 57 f2 4d 75 8e d0 24 b3 84 9c d9 c3 0e 23 ef 4d f5 c8 96 44 f4 8b b5 36 f7 94 5b 59 d7 bc dd ff 75 44 13 d1 35 27 3e a8 e7 5f 22 f2 16 c6 b9 99 0a e7 18 06 f2 c0 0b 40 25 c4 8b 75 c0 f7 3c db 9a 7b 8f a3 67 b5 00 28 06 7e 7f 16 f4 dd 56 9d 46 2f 4f 19 ea cd b3 ed 70 ee eb b4 48 3f 8f d7 77 d4 43 e8 b4 04 27 db 6f e2 90 68 c0 ca 3d 24 14 44 2e 8f 3a 15 47 04 b0 e5 1b c6 64 a1 37 b2 6b e7 19 f4 f7 c9 a5 67 8a 67 4d fc 95 df 80 b9 ce 37 5d d6 49 c8 c7 04 e5 09 bd 88 c8 e6 3d 8c 7d d6 70 71 11 5c 89 82 ba 46 af 4d 6a dc c9 f6 8a 75 b9 39 7b 03 51 53 fa f4 63 66 e7 20 5d d8 d6 f3 75 25 c1 a0 e9 46 10 dd 94 32 3f 6c 15 d0 85 19 71 49 bf d6 65 55 48 cf d9 c5 2c 97 11 93 7f 79 ab b1 a1 24 f1 21 04 65 48 3c d3 b2 d7 83 78 cf b8 5e d8 2e 7d a0 f6 eb 6d 27 9f 2a e4 55 92 5d 0f 6f 1b a5 71 eb a2 81 f2 a6 54 fb 39 dd ff 3b 48 45 39 ff 15 8e 7c 54 19 e0 37 f3 e3 ad 03 8f 22 11 f1 03 31 95 56 3c 7f 93 cd 54 b9 09 4f 22 6e 78 32 71 e1 e5 a2 a2 c1 07 12 ea b6 25 d6 49 31 cd 4f fe 67 38 d9 7b 9b 5e f8 28 ee 9f b0 59 fc 01 af 0e 79 c1 e1 4b 1d 25 98 8c 69 a3 99 56 7c 1f 93 76 8f 79 71 d3 14 88 b8 65 8a 20 87 8b 7c 1d d7 ba 02 fc 42 93 9d de 3d 4a 33 39 a6 5d 50 7d c5 9c 51 09 7b 40 51 77 05 da 56 e9 eb f0 af a5 32 82 bf 86 db b5 8c 54 80 69 ff 6e b9 5a ad e7 cc 66 d7 bb ef 72 47 79 ca 1f 73 1b 33 46 ff 17 70 50 37 3d 79 ff 7b 3e 7f 9b c0 c1 b4 b2 66 a8 87 8b 90 ba aa 03 9d 3e 3b 63 97 9a c3 df 6e 6f 48 59 af d5 02 38 c7 54 7a 39 b6 08 10 93 80 44 ae 18 5d 2b a3 e0 0a 4e 73 67 68 64 ae 09 0d 81 ea ee 5e e6 cf 1d 0a b3 78 dd 4d d8 91 e9 37 c2 ea 54 10 e0 51 30 05 00 00 00 00 00 00 00 39 11 fa b9 64 c2 71 55 00 27 69 7b 52 16 06 87 46 16 02 f8 8d f1 65 d8 84 b3 6e c2 b6 c2 5a 2f 33 c7 15 68 7e 9d 4a fb 88 43 dd 01 4e 5c 5a d8 fe 99 57 54 bd 9c f3 2f ce 1e 31 91 9c 4b 20 82 fb 0a 30 b9 de ae 84 be d4 b2 80 45 63 40 73 08 c5 8c 89 d9 e9 9c 81 76 91 77 e6 d5 94 f8 8a 4f ac fd 4c 73 5a 20 30 7c 73 7a fa 2d 60 39 94 73 29 6b 83 1d bd 93 3d 93 99 4b a3 06 42 79 b1 0e a0 c5 83 3f 41 f1 57 ea 23 02 99 3d be 43 3b 1a a3 a3 76 6d 54 39 02 04 84 f4 11 3c 4c 85 94 65 c3 b4 15 c3 43 2f 81 db 87 19 53 9d 5b f3 72 aa ae a1 cc 43 a6 c5 cb e5 97 58 bf ee 29 16 58 0d ac 4b 00 8e 59 5f 43 74 91 d8 7a be d0 2c ef cd 9d b5 3d 94 d0 2d ae e6 79 18 e5 d6 78 74 63 37 3b 4b 87 c9 05 00 00 00 2f 78 09 95 9b c0 48 85 06 13 d1 7c a5 10 55 f2 f4 16 a4 4f e1 80 d2 d5 0c 31 2c ca 7c b1 4a 2b dc 33 1f 57 a9 81 71 39 a2 06 fc 76 95 72 27 ff ff 2d e2 0a 4b 8e 37 37 fb b4 29 13 77 7c 06 37 6f 79 9e ba 36 7e 21 f9 4c a5 98 70 5f 5d cb 76 7d 6f 09 00 d6 b0 f6 09 5e 53 c4 c4 23 4d 0c 1f be 43 4f 6a b8 f4 3c 00 13 ee 93 b8 39 46 ee 77 59 e8 9d 7b dd 1a 32 d7 b3 11 71 1b 75 7f e4 3c 06 d2 1a 35 81 0d 8f e9 8b 27 fa ea 8a a1 2b c8 71 6e ef c5 c9 7c 45 ac 33 ee ec 96 4c 52 14 bc 3a 93 59 bd ea 1c cc ab 94 f1 5e 36 31 9c b3 4e bc ac ed b8 2c 2e d3 de 5a 8a 8f 00 11 e8 f7 4e 82 d7 f9 60 93 53 0e 76 69 28 39 d7 96 19 39 ad fd ee ea ff 19 d1 1e fc af b6 d5 46 fe f2 71 e8 9d 6c c2 38 9e 81 ff 58 ce fc ce 3f bf 46 25 a7 e7 de 40 e4 2e 07 b3 44 49 e1 5e 06 5c c7 34 00 02 00 00 00 00 00 00 f2 88 a4 51 0d e0 3d ab 19 d2 62 85 ed a8 91 56 d5 0d d3 85 a6 03 33 ba 5b bf 5d 77 cd 70 07 ad 15 19 ad 54 70 de 3d d6 d6 08 0c af cc f8 a9 74 06 bb 6b 68 a1 f0 c4 54 98 20 a7 3c 88 0f 47 5f 73 2a e0 03 98 e8 bd 1f 41 08 b7 80 7f b3 3b 72 68 5e c3 7a 2d 3f 76 64 13 a6 04 59 51 62 46 e5 a1 d9 98 a2 01 7a ef 09 48 a6 8c f2 55 31 5a b8 0d d3 49 e8 91 ae f5 95 dc 4d 47 0e 8a c3 2a 30 8e 15 fc 37 d0 6a ea c2 89 c0 52 3f 48 3e 1f f7 40 8c 60 87 f1 ab 65 2f 2e f9 1d 4f 2b 01 98 7b 0f 46 da 03 4e 08 00 00 00 7e e8 10 1a 39 34 c5 4e 24 b4 8e c0 27 5e 2d 06 87 dc 74 6b 08 27 cb f6 52 f4 06 c6 b9 5f 27 22 e5 8c 05 f7 52 ce 21 26 59 6e 1c d7 65 5b 90 48 01 78 4c 41 6b 22 f7 3d 32 46 78 e2 72 4f 43 f1 fe 68 7c 7e 8a 60 c2 8b 82 b6 52 83 41 b6 48 cd d5 6f ed 7c dc bb 15 75 91 2d 5e cd 36 de a3 bc a0 b7 42 7d 83 92 c6 28 94 55 e8 f8 d2 ab 22 42 72 92 51 ae 03 3a 9e 02 21 0e 62 df 05 46 a7 4b 33 3a 1c 48 f9 5f d5 4a cb 57 41 25 9e 8c 54 88 ef ee e3 27 41 5c c1 94 51 43 2c 6f 14 c2 76 93 10 2a 3c d8 48 57 cd 65 86 fc 5c a9 a9 3e b0 14 5f ac 06 62 ff 86 10 7f 99 8a 8e f7 df 8a a1 40 46 c5 5b 03 d3 d4 7f 88 a8 d6 0f 77 74 a2 ee 08 75 88 97 fb 41 1a 94 b3 c2 fc 5d 5f 0d b4 2c 04 56 ec 01 5f 08 e5 24 7d 33 ae 2d 35 60 3f f8 45 4c 16 f8 34 28 56 93 51 25 10 2b b7 84 ed 71 48 b6 ce 43 1b 63 ee 35 6b 0c 78 5f 2f 47 b9 0e 29 38 9f 22 fc 5b 59 a7 0e fa ea 2b d4 01 95 af 44 86 22 0d 70 2e 30 bf c4 3c 10 ec 23 ea 62 83 99 4a 7d de 4d cb 61 fe a6 b6 51 fb 1d 62 45 8d 07 41 a1 28 30 05 2f cc 46 0d b0 43 af e5 25 62 9b 40 d7 ce e4 58 e4 cb 5e 93 0e d6 24 80 6c 43 a0 06 e3 93 3e d0 7c 2b 80 81 c1 28 ad 27 06 f4 82 61 ff 07 00 00 00 00 00 00 61 3b c1 8f 5a 38 d4 42 76 8a f3 80 41 ef e0 3d 15 2e f9 5f f5 69 e7 6d b2 39 1f 45 09 d7 f3 39 d9 2f db 4a 89 36 49 49 da 39 80 00 00 00 00 00 00 00 d8 0a 4f e6 54 57 83 76 e5 99 af f3 56 5b 1d 53 1f 30 91 2b 99 45 03 0b 81 ea 99 35 fd 46 ed b4 4a 78 f6 15 25 54 90 a4 b6 21 50 1f 2a 9e 4d 24 62 4c 4d ac 92 74 11 8c 67 58 4f 5d 37 47 55 53 4d 7f 68 f6 79 c4 ff 51 6a 9c 86 1a 0e 7e 65 86 8f cb 2b f1 cb 9a ea 4e 05 df 72 27 9f db 0d 2b 9e 93 5c 5a f3 cf 47 4b ed 79 df c2 48 c1 f5 ae a4 b8 b3 2c 5d 29 5e 57 07 9d 0f e6 62 a4 6b 7f 71 cd 47 74 4d b8 6c 50 b7 04 c9 71 d9 02 95 c7 b2 c7 43 9a 2d 78 cc fa 79 b5 fc 2b ff 6b bf 84 02 62 bf 89 39 4b 3e 06 91 95 32 64 d2 70 0c 83 8f a2 c7 b3 42 52 60 f5 95 00 00 00 00 00 4c a7 c1 2f 45 85 8d 62 84 ca 62 70 d6 b2 f0 e5 8f de d8 a7 b4 a3 02 a9 7b c6 41 df 07 72 0b a2 b2 6b bf cc 80 7c a0 ab b1 b4 43 22 26 9c 21 c5 ec 68 cb 06 8e a8 80 67 d9 05 ea 91 7b b0 3e ef da eb de ab f2 d0 dc e8 09 97 c9 15 c8 94 9d e9 92 58 7c 2c b5 fe 36 d7 d3 e5 db 21 b0 94 b8 b7 79 40 b5 f0 77 22 e4 7a 08 d3 67 e5 f8 4c 96 ec 66 4b 72 93 4b 99 b3 10 9a f6 5d 77 e8 6a bd 68 59 cd df 4b ba e1 f0 93 04 62 df 15 fd db c4 85 62 ea 35 11 a8 06 5e f0 28 cf 12 f1 4d cf 6e be cd 8d 88 48 36 17 4f af 1a a6 09 e5 f1 ee 11 62 df a1 3b dc 1f a7 cf aa db a8 5c 72 e9 75 8f 03 a7 55 d0 be 53 f8 d2 a1 df b1 c6 8c c1 64 b0 a0 78 0d 97 1a 96 ea 2c 4d 4c a0 39 8c 22 35 98 0a 93 07 b3 d5 bd 3b 01 fa ff d0 a5 db ed 28 81 a9 70 0a f5 61 ac 8c 6b 00 00 00 00 00 00 00 f9 6f 06 81 7f b9 03 72 9a 7d b6 ff 95 76 97 c9 ed e7 88 5d 94 ff b0 96 9b e0 da f6 0a f9 31 09 eb 1d ee 72 e4 36 3f 51 af 62 af 6f b2 a6 df 3b ec 89 82 2a 7a 0b 67 80 58 fa 3f ef 86 fa ec 21 6e b6 99 21 62 f8 dc bf 71 9c 14 8c d2 f9 c5 5f 49 01 20 3a 9a 8a 2c 3e 90 f3 94 3d bc 10 36 0a 1a 49 70 0d 1d fb f6 6d 69 f6 fb af 50 6c 8b cc e8 bb 0d 87 2a 02 23 89 26 40 7a 4e dd d5 d0 fc 5a 75 2f 90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x1000)
// size: len = 0x1000 (2 bytes)
// }
// }
// }
// len: len = 0x1006 (8 bytes)
// ]
*(uint32_t*)0x200000002080 = 0xfc;
memcpy((void*)0x200000002084, "... [truncated large byte array] ...", 4096);
*(uint16_t*)0x200000003084 = 0x1000;
syscall(__NR_write, /*fd=*/r[0], /*data=*/0x200000002080ul, /*len=*/0x1006ul);
return 0;
}
]
|
| 2/1 |
2026/07/21 19:51 |
action |
kernel-checkouter |
1m
Results: map[KernelSrc:/app/workdir/cache/src/26766716579cdcff13b5e3416aa2d1ff891e8337]
|
| 3/1 |
2026/07/21 19:53 |
action |
kernel-builder |
17m
Results: map[KernelObj:/app/workdir/cache/build/f8a628c752ebc7bff60482a8688df256d2cc50bc]
|
| 4/1 |
2026/07/21 20:10 |
action |
codesearch-prepare |
10m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/07/21 20:21 |
agent |
expert |
2m
Model:
Results: map[DenialOfService:false Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
Instruction: You are an experienced Linux kernel security engineer. Your task is to analyze given kernel bug report
and determine its security impact based on the following dimensions.
Use the provided tools to examine the source code, check for capability checks (e.g., capable(), ns_capable()),
and understand the nature of the bug. Analyze the given kernel build and configuration.
You can check the kernel config by grepping ".config" file; you can check kernel cmdline by grepping
".config" file for "CONFIG_CMDLINE=". Assume sysctl parameters have default values.
But analyze for the corresponding production build w/o debugging tools enabled (like KASAN, KMSAN, UBSAN).
Try different strategies when analyzing the bug:
- think of ways in which the vulnerable code is unreachable
- or the other way around: try to come up with different ideas of how an unprivileged user can reach the bug
If still unsure err on the side of the bug being non-exploitable/not-accessible.
In the final reply, provide a reasoning for your assessment.
Analysis dimensions:
* Exploitable:
Determine if the bug can result in memory corruption, elevated privileges, or an information leak.
Memory safety issues are almost always exploitable (KASAN or UBSAN reports for use-after-free, out-of-bounds;
refcounting issues, corrupted lists, etc). When kernel is crashing on a completely wild pointer access
(e.g. user-space address, or non-canonical address, but not on NULL or address corresponding to KASAN shadow
for NULL address), including both data accesses and control transfers, that also usually implies possibility
of exploitation. Such reports usually say "unable to handle kernel paging request".
Uses of uninitialized values detected by KMSAN may be exploitable b/c attacker frequently can affect uninit
values with spraying techniques. However, for these exploitability depends on how exactly the uninit value
is used in the code, and what it affects.
Information leaks are exploitable on their own and should be classified as such. A bug that copies kernel
memory contents to userspace (e.g. an out-of-bounds read whose result is returned to the caller, or
uninitialized stack/heap bytes written to a user buffer) is exploitable: it can reveal kernel pointer
values and defeat KASLR, expose sensitive data such as cryptographic keys or other processes' memory, and
serves as a necessary building block in most modern kernel privilege-escalation exploit chains. Do not classify
an information leak as non-exploitable solely because it does not directly cause a memory write or control-flow
hijack; the leak itself is the exploit primitive.
Think of what happens after the bug is triggered. Some bugs cause kernel panic and halt execution,
they are harder to exploit. For example, BUG reports halts the kernel. However, WARNING reports don't halt
execution in production builds. Debug bug detection tools (like KASAN, KMSAN, KCSAN, UBSAN) are also not enabled
in production builds, so attacker can freely exploit these bugs w/o being detected by these tools.
If you see an integer overflow, think how the overflowed value used later (if it's used as allocation size,
or an array index). If you see an out-of-bounds read, think if it's followed by an out-of-bounds write as well.
Some KCSAN data-races may be exploitable by skilled attackers as well. Think what data structures got corrupted
as the result of data races and how. However, note that kernel has lots of "benign" data races that don't lead
to any runtime misbehavior at all.
* Denial Of Service:
Determine if the bug can result in denial-of-service. Most bugs can, since they cause system crash,
hangs, deadlocks, or resource leaks. This is mostly applicable to WARNING bugs that won't cause system crash
in production. For these think what will be consequences of the violation of the kernel assumptions flagged
by the WARNING. In some cases the unexpected condition is also properly handled by the normal control flow
(e.g. with "if (WARN_ON(...))"), these won't cause denial-of-service. If the condition is not handled,
then it may or may not cause denial-of-service.
* Accessible From Unprivileged Processes:
Determine if the bug can be reached from a typical (non-root) user process that does NOT have any special capabilities
(like CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON) or access to device nodes restricted to root.
Assume that unprivileged_bpf_disabled=1, that is eBPF loading is not accessible. However, cBPF (classical BPF)
is still accessible to non-root processes.
Assume that user namespaces are not accessible, that is, the process cannot get the mentioned capabilities even
within a new user namespace (checked by ns_capable() function in the kernel sources).
* Accessible From User Namespaces:
Determine if the bug can be reached within a user-namespace where the process has all capabilities
(including CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON). Such capabilities are checked with ns_capable()
function in the kernel sources.
* VM Guest Trigger:
Determine if the bug can be triggered from the context of a typical KVM guest (e.g., set up by a QEMU VMM).
Consider accesses to standard Linux host paravirtualized features (virtio-blk, virtio-net, etc.),
and handling of VM exits in the KVM code.
* VM Host Trigger in The Confidential Computing Context:
Determine if the bug can be triggered in a confidential computing guest kernel from the context of a KVM host.
Consider access to standard Linux guest paravirtualized features (virtio-blk, virtio-net, etc.).
* Ethernet Network Trigger:
Determine if the bug can be triggered by processing ingress network Ethernet traffic, either directly (network stack)
or via drivers exposed to network data.
* Other Remote Trigger:
Determine if the bug can be triggered by processing remote traffic other than Ethernet (Wifi, Bluetooth, NFC, etc).
* Peripheral Trigger:
Determine if the bug can be triggered via an untrusted peripheral device that can be physically plugged
into a system, such as a USB device or a niche hardware driver handling external hardware inputs.
This is particularly important for mobile and desktop environments where users can plug in unknown devices.
* Malicious Filesystem Trigger:
Determine if the bug can be triggered by the kernel mounting and parsing a malicious filesystem image.
This is highly critical for Desktop and Mobile environments where external media or downloaded images
might be auto-mounted.
Don't make assumptions about the kernel source code (it may be different from what you assume it is).
Extensively use the provided code access tools (codesearch-*, git-*, grepper, etc)
to examine the actual source code, and confirm any assumptions.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt:
The kernel bug report is:
------------[ cut here ]------------
URB ffff88802bec5e00 submitted while active
WARNING: drivers/usb/core/urb.c:379 at usb_submit_urb+0x79/0x18b0 drivers/usb/core/urb.c:379, CPU#0: syz.1.696/7407
Modules linked in:
CPU: 0 UID: 0 PID: 7407 Comm: syz.1.696 Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/25/2026
RIP: 0010:usb_submit_urb+0x7c/0x18b0 drivers/usb/core/urb.c:379
Code: 4c 89 f0 48 c1 e8 03 80 3c 28 00 74 08 4c 89 f7 e8 f9 92 4d fb 49 83 3e 00 74 40 e8 0e 3c e1 fa 48 8d 3d 87 f1 f8 08 48 89 de <67> 48 0f b9 3a b8 f0 ff ff ff eb 11 e8 f3 3b e1 fa eb 05 e8 ec 3b
RSP: 0018:ffffc900054ff3f8 EFLAGS: 00010293
RAX: ffffffff86e467a2 RBX: ffff88802bec5e00 RCX: ffff88803151be80
RDX: 0000000000000000 RSI: ffff88802bec5e00 RDI: ffffffff8fdd5930
RBP: dffffc0000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: ffffffff8e3c3880 R12: 1ffff1100b9e9d0a
R13: dffffc0000000000 R14: ffff88802bec5e08 R15: 0000000000000820
FS: 00007f395df0e6c0(0000) GS:ffff8881259f2000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f29938eb580 CR3: 0000000040c08000 CR4: 00000000003526f0
Call Trace:
<TASK>
cm109_submit_buzz_toggle drivers/input/misc/cm109.c:351 [inline]
cm109_toggle_buzzer_async drivers/input/misc/cm109.c:484 [inline]
cm109_input_ev+0x1d1/0x3b0 drivers/input/misc/cm109.c:615
input_event_dispose+0x80/0x6b0 drivers/input/input.c:322
input_inject_event+0x1fa/0x310 drivers/input/input.c:424
kd_sound_helper+0x101/0x210 drivers/tty/vt/keyboard.c:257
input_handler_for_each_handle+0x101/0x1c0 drivers/input/input.c:2540
kd_mksound+0x96/0x130 drivers/tty/vt/keyboard.c:281
handle_ascii drivers/tty/vt/vt.c:2382 [inline]
do_con_trol drivers/tty/vt/vt.c:2699 [inline]
do_con_write+0x2f5a/0x5540 drivers/tty/vt/vt.c:3325
con_write+0x31/0x2e0 drivers/tty/vt/vt.c:3661
process_output_block drivers/tty/n_tty.c:557 [inline]
n_tty_write+0xd4f/0x11e0 drivers/tty/n_tty.c:2366
iterate_tty_write drivers/tty/tty_io.c:1006 [inline]
file_tty_write+0x50b/0x980 drivers/tty/tty_io.c:1081
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x61e/0xbb0 fs/read_write.c:687
ksys_write+0x156/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x17b/0x530 arch/x86/entry/syscall_64.c:85
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f395e8ade99
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f395df0e028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f395eb35fa0 RCX: 00007f395e8ade99
RDX: 0000000000001006 RSI: 0000200000002080 RDI: 0000000000000004
RBP: 00007f395e943eaf R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f395eb36038 R14: 00007f395eb35fa0 R15: 00007fff65968248
</TASK>
----------------
Code disassembly (best guess):
0: 4c 89 f0 mov %r14,%rax
3: 48 c1 e8 03 shr $0x3,%rax
7: 80 3c 28 00 cmpb $0x0,(%rax,%rbp,1)
b: 74 08 je 0x15
d: 4c 89 f7 mov %r14,%rdi
10: e8 f9 92 4d fb call 0xfb4d930e
15: 49 83 3e 00 cmpq $0x0,(%r14)
19: 74 40 je 0x5b
1b: e8 0e 3c e1 fa call 0xfae13c2e
20: 48 8d 3d 87 f1 f8 08 lea 0x8f8f187(%rip),%rdi # 0x8f8f1ae
27: 48 89 de mov %rbx,%rsi
* 2a: 67 48 0f b9 3a ud1 (%edx),%rdi <-- trapping instruction
2f: b8 f0 ff ff ff mov $0xfffffff0,%eax
34: eb 11 jmp 0x47
36: e8 f3 3b e1 fa call 0xfae13c2e
3b: eb 05 jmp 0x42
3d: e8 .byte 0xe8
3e: ec in (%dx),%al
3f: 3b .byte 0x3b
It is reproducible with the followint program.
Keep in mind that it may lack the precise threading, sandboxing, and some arguments of a working reproducer.
But it should give an idea of the involved syscalls.
// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/usb/ch9.h>
static unsigned long long procid;
static void sleep_ms(uint64_t ms)
{
usleep(ms * 1000);
}
#define MAX_FDS 30
#define USB_MAX_IFACE_NUM 4
#define USB_MAX_EP_NUM 32
#define USB_MAX_FDS 6
struct usb_endpoint_index {
struct usb_endpoint_descriptor desc;
int handle;
};
struct usb_iface_index {
struct usb_interface_descriptor* iface;
uint8_t bInterfaceNumber;
uint8_t bAlternateSetting;
uint8_t bInterfaceClass;
struct usb_endpoint_index eps[USB_MAX_EP_NUM];
int eps_num;
};
struct usb_device_index {
struct usb_device_descriptor* dev;
struct usb_config_descriptor* config;
uint8_t bDeviceClass;
uint8_t bMaxPower;
int config_length;
struct usb_iface_index ifaces[USB_MAX_IFACE_NUM];
int ifaces_num;
int iface_cur;
};
struct usb_info {
int fd;
struct usb_device_index index;
};
static struct usb_info usb_devices[USB_MAX_FDS];
static struct usb_device_index* lookup_usb_index(int fd)
{
for (int i = 0; i < USB_MAX_FDS; i++) {
if (__atomic_load_n(&usb_devices[i].fd, __ATOMIC_ACQUIRE) == fd)
return &usb_devices[i].index;
}
return NULL;
}
static int usb_devices_num;
static bool parse_usb_descriptor(const char* buffer, size_t length, struct usb_device_index* index)
{
if (length < sizeof(*index->dev) + sizeof(*index->config))
return false;
memset(index, 0, sizeof(*index));
index->dev = (struct usb_device_descriptor*)buffer;
index->config = (struct usb_config_descriptor*)(buffer + sizeof(*index->dev));
index->bDeviceClass = index->dev->bDeviceClass;
index->bMaxPower = index->config->bMaxPower;
index->config_length = length - sizeof(*index->dev);
index->iface_cur = -1;
size_t offset = 0;
while (true) {
if (offset + 1 >= length)
break;
uint8_t desc_length = buffer[offset];
uint8_t desc_type = buffer[offset + 1];
if (desc_length <= 2)
break;
if (offset + desc_length > length)
break;
if (desc_type == USB_DT_INTERFACE && index->ifaces_num < USB_MAX_IFACE_NUM) {
struct usb_interface_descriptor* iface = (struct usb_interface_descriptor*)(buffer + offset);
index->ifaces[index->ifaces_num].iface = iface;
index->ifaces[index->ifaces_num].bInterfaceNumber = iface->bInterfaceNumber;
index->ifaces[index->ifaces_num].bAlternateSetting = iface->bAlternateSetting;
index->ifaces[index->ifaces_num].bInterfaceClass = iface->bInterfaceClass;
index->ifaces_num++;
}
if (desc_type == USB_DT_ENDPOINT && index->ifaces_num > 0) {
struct usb_iface_index* iface = &index->ifaces[index->ifaces_num - 1];
if (iface->eps_num < USB_MAX_EP_NUM) {
memcpy(&iface->eps[iface->eps_num].desc, buffer + offset, sizeof(iface->eps[iface->eps_num].desc));
iface->eps_num++;
}
}
offset += desc_length;
}
return true;
}
static struct usb_device_index* add_usb_index(int fd, const char* dev, size_t dev_len)
{
int i = __atomic_fetch_add(&usb_devices_num, 1, __ATOMIC_RELAXED);
if (i >= USB_MAX_FDS)
return NULL;
if (!parse_usb_descriptor(dev, dev_len, &usb_devices[i].index))
return NULL;
__atomic_store_n(&usb_devices[i].fd, fd, __ATOMIC_RELEASE);
return &usb_devices[i].index;
}
struct vusb_connect_string_descriptor {
uint32_t len;
char* str;
} __attribute__((packed));
struct vusb_connect_descriptors {
uint32_t qual_len;
char* qual;
uint32_t bos_len;
char* bos;
uint32_t strs_len;
struct vusb_connect_string_descriptor strs[0];
} __attribute__((packed));
static const char default_string[] = {
8, USB_DT_STRING,
's', 0, 'y', 0, 'z', 0
};
static const char default_lang_id[] = {
4, USB_DT_STRING,
0x09, 0x04
};
static bool lookup_connect_response_in(int fd, const struct vusb_connect_descriptors* descs,
const struct usb_ctrlrequest* ctrl,
struct usb_qualifier_descriptor* qual,
char** response_data, uint32_t* response_length)
{
struct usb_device_index* index = lookup_usb_index(fd);
uint8_t str_idx;
if (!index)
return false;
switch (ctrl->bRequestType & USB_TYPE_MASK) {
case USB_TYPE_STANDARD:
switch (ctrl->bRequest) {
case USB_REQ_GET_DESCRIPTOR:
switch (ctrl->wValue >> 8) {
case USB_DT_DEVICE:
*response_data = (char*)index->dev;
*response_length = sizeof(*index->dev);
return true;
case USB_DT_CONFIG:
*response_data = (char*)index->config;
*response_length = index->config_length;
return true;
case USB_DT_STRING:
str_idx = (uint8_t)ctrl->wValue;
if (descs && str_idx < descs->strs_len) {
*response_data = descs->strs[str_idx].str;
*response_length = descs->strs[str_idx].len;
return true;
}
if (str_idx == 0) {
*response_data = (char*)&default_lang_id[0];
*response_length = default_lang_id[0];
return true;
}
*response_data = (char*)&default_string[0];
*response_length = default_string[0];
return true;
case USB_DT_BOS:
*response_data = descs->bos;
*response_length = descs->bos_len;
return true;
case USB_DT_DEVICE_QUALIFIER:
if (!descs->qual) {
qual->bLength = sizeof(*qual);
qual->bDescriptorType = USB_DT_DEVICE_QUALIFIER;
qual->bcdUSB = index->dev->bcdUSB;
qual->bDeviceClass = index->dev->bDeviceClass;
qual->bDeviceSubClass = index->dev->bDeviceSubClass;
qual->bDeviceProtocol = index->dev->bDeviceProtocol;
qual->bMaxPacketSize0 = index->dev->bMaxPacketSize0;
qual->bNumConfigurations = index->dev->bNumConfigurations;
qual->bRESERVED = 0;
*response_data = (char*)qual;
*response_length = sizeof(*qual);
return true;
}
*response_data = descs->qual;
*response_length = descs->qual_len;
return true;
default:
break;
}
break;
default:
break;
}
break;
default:
break;
}
return false;
}
typedef bool (*lookup_connect_out_response_t)(int fd, const struct vusb_connect_descriptors* descs,
const struct usb_ctrlrequest* ctrl, bool* done);
static bool lookup_connect_response_out_generic(int fd, const struct vusb_connect_descriptors* descs,
const struct usb_ctrlrequest* ctrl, bool* done)
{
switch (ctrl->bRequestType & USB_TYPE_MASK) {
case USB_TYPE_STANDARD:
switch (ctrl->bRequest) {
case USB_REQ_SET_CONFIGURATION:
*done = true;
return true;
default:
break;
}
break;
}
return false;
}
#define UDC_NAME_LENGTH_MAX 128
struct usb_raw_init {
__u8 driver_name[UDC_NAME_LENGTH_MAX];
__u8 device_name[UDC_NAME_LENGTH_MAX];
__u8 speed;
};
enum usb_raw_event_type {
USB_RAW_EVENT_INVALID = 0,
USB_RAW_EVENT_CONNECT = 1,
USB_RAW_EVENT_CONTROL = 2,
};
struct usb_raw_event {
__u32 type;
__u32 length;
__u8 data[0];
};
struct usb_raw_ep_io {
__u16 ep;
__u16 flags;
__u32 length;
__u8 data[0];
};
#define USB_RAW_EPS_NUM_MAX 30
#define USB_RAW_EP_NAME_MAX 16
#define USB_RAW_EP_ADDR_ANY 0xff
struct usb_raw_ep_caps {
__u32 type_control : 1;
__u32 type_iso : 1;
__u32 type_bulk : 1;
__u32 type_int : 1;
__u32 dir_in : 1;
__u32 dir_out : 1;
};
struct usb_raw_ep_limits {
__u16 maxpacket_limit;
__u16 max_streams;
__u32 reserved;
};
struct usb_raw_ep_info {
__u8 name[USB_RAW_EP_NAME_MAX];
__u32 addr;
struct usb_raw_ep_caps caps;
struct usb_raw_ep_limits limits;
};
struct usb_raw_eps_info {
struct usb_raw_ep_info eps[USB_RAW_EPS_NUM_MAX];
};
#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_EP_ENABLE _IOW('U', 5, struct usb_endpoint_descriptor)
#define USB_RAW_IOCTL_EP_DISABLE _IOW('U', 6, __u32)
#define USB_RAW_IOCTL_EP_WRITE _IOW('U', 7, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_EP_READ _IOWR('U', 8, struct usb_raw_ep_io)
#define USB_RAW_IOCTL_CONFIGURE _IO('U', 9)
#define USB_RAW_IOCTL_VBUS_DRAW _IOW('U', 10, __u32)
#define USB_RAW_IOCTL_EPS_INFO _IOR('U', 11, struct usb_raw_eps_info)
#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
#define USB_RAW_IOCTL_EP_SET_HALT _IOW('U', 13, __u32)
#define USB_RAW_IOCTL_EP_CLEAR_HALT _IOW('U', 14, __u32)
#define USB_RAW_IOCTL_EP_SET_WEDGE _IOW('U', 15, __u32)
static int usb_raw_open()
{
return open("/dev/raw-gadget", O_RDWR);
}
static int usb_raw_init(int fd, uint32_t speed, const char* driver, const char* device)
{
struct usb_raw_init arg;
strncpy((char*)&arg.driver_name[0], driver, sizeof(arg.driver_name));
strncpy((char*)&arg.device_name[0], device, sizeof(arg.device_name));
arg.speed = speed;
return ioctl(fd, USB_RAW_IOCTL_INIT, &arg);
}
static int usb_raw_run(int fd)
{
return ioctl(fd, USB_RAW_IOCTL_RUN, 0);
}
static int usb_raw_configure(int fd)
{
return ioctl(fd, USB_RAW_IOCTL_CONFIGURE, 0);
}
static int usb_raw_vbus_draw(int fd, uint32_t power)
{
return ioctl(fd, USB_RAW_IOCTL_VBUS_DRAW, power);
}
static int usb_raw_ep0_write(int fd, struct usb_raw_ep_io* io)
{
return ioctl(fd, USB_RAW_IOCTL_EP0_WRITE, io);
}
static int usb_raw_ep0_read(int fd, struct usb_raw_ep_io* io)
{
return ioctl(fd, USB_RAW_IOCTL_EP0_READ, io);
}
static int usb_raw_event_fetch(int fd, struct usb_raw_event* event)
{
return ioctl(fd, USB_RAW_IOCTL_EVENT_FETCH, event);
}
static int usb_raw_ep_enable(int fd, struct usb_endpoint_descriptor* desc)
{
return ioctl(fd, USB_RAW_IOCTL_EP_ENABLE, desc);
}
static int usb_raw_ep_disable(int fd, int ep)
{
return ioctl(fd, USB_RAW_IOCTL_EP_DISABLE, ep);
}
static int usb_raw_ep0_stall(int fd)
{
return ioctl(fd, USB_RAW_IOCTL_EP0_STALL, 0);
}
#define USB_MAX_PACKET_SIZE 4096
struct usb_raw_control_event {
struct usb_raw_event inner;
struct usb_ctrlrequest ctrl;
char data[USB_MAX_PACKET_SIZE];
};
struct usb_raw_ep_io_data {
struct usb_raw_ep_io inner;
char data[USB_MAX_PACKET_SIZE];
};
static void set_interface(int fd, int n)
{
struct usb_device_index* index = lookup_usb_index(fd);
if (!index)
return;
if (index->iface_cur >= 0 && index->iface_cur < index->ifaces_num) {
for (int ep = 0; ep < index->ifaces[index->iface_cur].eps_num; ep++) {
int rv = usb_raw_ep_disable(fd, index->ifaces[index->iface_cur].eps[ep].handle);
if (rv < 0) {
} else {
}
}
}
if (n >= 0 && n < index->ifaces_num) {
for (int ep = 0; ep < index->ifaces[n].eps_num; ep++) {
int rv = usb_raw_ep_enable(fd, &index->ifaces[n].eps[ep].desc);
if (rv < 0) {
} else {
index->ifaces[n].eps[ep].handle = rv;
}
}
index->iface_cur = n;
}
}
static int configure_device(int fd)
{
struct usb_device_index* index = lookup_usb_index(fd);
if (!index)
return -1;
int rv = usb_raw_vbus_draw(fd, index->bMaxPower);
if (rv < 0) {
return rv;
}
rv = usb_raw_configure(fd);
if (rv < 0) {
return rv;
}
set_interface(fd, 0);
return 0;
}
static volatile long syz_usb_connect_impl(uint64_t speed, uint64_t dev_len, const char* dev,
const struct vusb_connect_descriptors* descs,
lookup_connect_out_response_t lookup_connect_response_out)
{
if (!dev) {
return -1;
}
int fd = usb_raw_open();
if (fd < 0) {
return fd;
}
if (fd >= MAX_FDS) {
close(fd);
return -1;
}
struct usb_device_index* index = add_usb_index(fd, dev, dev_len);
if (!index) {
return -1;
}
char device[32];
sprintf(&device[0], "dummy_udc.%llu", procid);
int rv = usb_raw_init(fd, speed, "dummy_udc", &device[0]);
if (rv < 0) {
return rv;
}
rv = usb_raw_run(fd);
if (rv < 0) {
return rv;
}
bool done = false;
while (!done) {
struct usb_raw_control_event event;
event.inner.type = 0;
event.inner.length = sizeof(event.ctrl);
rv = usb_raw_event_fetch(fd, (struct usb_raw_event*)&event);
if (rv < 0) {
return rv;
}
if (event.inner.type != USB_RAW_EVENT_CONTROL)
continue;
char* response_data = NULL;
uint32_t response_length = 0;
struct usb_qualifier_descriptor qual;
if (event.ctrl.bRequestType & USB_DIR_IN) {
if (!lookup_connect_response_in(fd, descs, &event.ctrl, &qual, &response_data, &response_length)) {
usb_raw_ep0_stall(fd);
continue;
}
} else {
if (!lookup_connect_response_out(fd, descs, &event.ctrl, &done)) {
usb_raw_ep0_stall(fd);
continue;
}
response_data = NULL;
response_length = event.ctrl.wLength;
}
if ((event.ctrl.bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD &&
event.ctrl.bRequest == USB_REQ_SET_CONFIGURATION) {
rv = configure_device(fd);
if (rv < 0) {
return rv;
}
}
struct usb_raw_ep_io_data response;
response.inner.ep = 0;
response.inner.flags = 0;
if (response_length > sizeof(response.data))
response_length = 0;
if (event.ctrl.wLength < response_length)
response_length = event.ctrl.wLength;
response.inner.length = response_length;
if (response_data)
memcpy(&response.data[0], response_data, response_length);
else
memset(&response.data[0], 0, response_length);
if (event.ctrl.bRequestType & USB_DIR_IN) {
rv = usb_raw_ep0_write(fd, (struct usb_raw_ep_io*)&response);
} else {
rv = usb_raw_ep0_read(fd, (struct usb_raw_ep_io*)&response);
}
if (rv < 0) {
return rv;
}
}
sleep_ms(200);
return fd;
}
static volatile long syz_usb_connect(volatile long a0, volatile long a1, volatile long a2, volatile long a3)
{
uint64_t speed = a0;
uint64_t dev_len = a1;
const char* dev = (const char*)a2;
const struct vusb_connect_descriptors* descs = (const struct vusb_connect_descriptors*)a3;
return syz_usb_connect_impl(speed, dev_len, dev, descs, &lookup_connect_response_out_generic);
}
static long syz_open_dev(volatile long a0, volatile long a1, volatile long a2)
{
if (a0 == 0xc || a0 == 0xb) {
char buf[128];
sprintf(buf, "/dev/%s/%d:%d", a0 == 0xc ? "char" : "block", (uint8_t)a1, (uint8_t)a2);
return open(buf, O_RDWR, 0);
} else {
unsigned long nb = a1;
char buf[1024];
char* hash;
strncpy(buf, (char*)a0, sizeof(buf) - 1);
buf[sizeof(buf) - 1] = 0;
while ((hash = strchr(buf, '#'))) {
*hash = '0' + (char)(nb % 10);
nb /= 10;
}
return open(buf, a2 & ~O_CREAT, 0);
}
}
uint64_t r[1] = {0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
const char* reason;
(void)reason;
intptr_t res = 0;
if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {}
// syz_usb_connect arguments: [
// speed: usb_device_speed = 0x5 (8 bytes)
// dev_len: len = 0x2d (8 bytes)
// dev: ptr[inout, array[ANYUNION]] {
// array[ANYUNION] {
// union ANYUNION {
// ANYBLOB: buffer: {12 01 00 00 75 16 b7 10 8c 0d 0e 00 8f 8e 00 18 03 01 09 02 1b 00 01 00 00 00 00 09 04 08 00 01 03 00 00 00 09 05} (length 0x26)
// }
// union ANYUNION {
// ANYBLOB: buffer: {8f cf d0 7a d0 88 28 f2 7b 6e a5 ef 0a} (length 0xd)
// }
// }
// }
// conn_descs: nil
// ]
// returns fd_usb
memcpy((void*)0x200000000040, "... [truncated large byte array] ...", 38);
memcpy((void*)0x200000000066, "\x8f\xcf\xd0\x7a\xd0\x88\x28\xf2\x7b\x6e\xa5\xef\x0a", 13);
syz_usb_connect(/*speed=USB_SPEED_SUPER*/5, /*dev_len=*/0x2d, /*dev=*/0x200000000040, /*conn_descs=*/0);
// syz_open_dev$tty1 arguments: [
// dev: const = 0xc (8 bytes)
// major: const = 0x4 (8 bytes)
// minor: intptr = 0x1 (8 bytes)
// ]
// returns fd_tty
res = -1;
res = syz_open_dev(/*dev=*/0xc, /*major=*/4, /*minor=*/1);
if (res != -1)
r[0] = res;
// write$UHID_INPUT arguments: [
// fd: fd_uhid (resource)
// data: ptr[in, uhid_req[UHID_INPUT, uhid_input_req]] {
// uhid_req[UHID_INPUT, uhid_input_req] {
// type: const = 0xfc (4 bytes)
// data: uhid_input_req {
// data: buffer: {a2 33 68 48 14 9e 51 6d 4b 5e 07 18 87 f7 0e 09 d0 38 e7 ff 7f c6 e5 53 9b 0d 50 0a 8b 08 9b 3f 38 35 63 03 08 90 e0 87 9b 0a 71 c6 e7 0a 9b 33 4a 95 9b 66 9a 24 2f 0a 0a f3 98 8f 7e f3 19 52 01 00 ff e8 d1 78 70 8c 52 3c 92 1b 1b 3e 31 07 0d 07 73 09 0a cd 3b 78 13 0d aa 61 d8 e8 04 00 3e 00 58 02 b7 7f 07 22 72 27 b7 ba 67 e0 e7 86 57 a6 f5 c2 a8 74 e6 2a 9c cd c0 d3 1a 0c 9f 31 8c 0d a1 99 3b d1 60 e2 33 df 4a 62 17 9c 6f 30 e0 65 cd 5b 91 cd 0a e1 93 97 37 35 b3 6d 5b 1b 63 dd 1c 00 30 5d 3f 46 63 5e b0 16 d5 b1 dd a9 8e 2d 74 9b e7 bd 1d f1 fb 3b 23 1f dc db 50 75 a9 aa a1 b4 69 c3 09 00 00 00 00 00 00 00 75 27 1b 28 63 29 d1 69 93 42 88 fd 78 9a a3 7d 6e 98 b2 24 fd 44 b6 5b 31 33 4f fc 55 cc 82 cd 3a c3 2e cd b0 8c ed 6f 90 81 b4 dd 0d 8b 38 f3 cd 44 98 be e8 00 49 08 41 bd b1 14 f6 b7 63 83 70 9d 8f 5c 55 43 2a 90 9f da 03 9a ec 54 a1 23 6e 80 f6 a8 ab ad ea 76 62 49 6b dd bb 42 be 6b fb 2f 17 95 9d 1f 41 6e 56 c7 1b 19 31 87 02 62 f5 e8 01 11 92 42 ca 02 6b fc 82 1e 7e 7d af 24 51 13 8e 64 5b b8 0c 61 76 69 31 4e 2f be 70 de 98 ec 76 a9 e4 0d ad 47 f3 6f d9 f7 d0 d4 2a 4b 5f 11 85 cc dc f1 6f f4 62 95 d8 a0 fa 17 71 3c 58 02 63 09 33 a9 a3 4a f6 74 f3 f3 9f e2 34 91 23 7c 08 82 2d ec 11 09 11 e8 93 d0 a8 c4 f6 77 74 7a bc 36 09 34 b8 29 10 ff 85 bf d9 95 08 3b ba 29 87 a6 73 99 ea c4 27 d1 45 d5 46 a4 0b 9f 6f f1 4a c4 88 ec 13 0f b3 85 0a 27 af 95 44 ae 15 a7 e4 54 de a0 59 18 b4 12 43 51 3f 00 00 00 00 00 00 00 0a 36 21 c5 6c ea 8d 20 fa 91 1a 0c 41 db 6e be 8c ac 64 f1 76 79 14 1d 54 b3 4b bc 99 03 f1 d4 ab 96 62 03 86 1b 5b 15 a8 41 f2 b5 75 a8 bd 0d 78 24 8e be 4d 9a 80 00 26 95 10 4f 67 4c 24 31 dc a1 41 fa e2 69 ca b7 0e 9a 66 f3 c3 a9 a6 3e 96 39 e1 f5 9c 0e de 26 c6 b5 d7 4b 07 8a 5e 15 c3 16 34 e5 ae 09 8c e9 ee 70 77 1a aa 18 11 9a 86 7e 10 88 33 49 75 e9 f7 34 83 b6 a6 2f a6 78 ca 14 ff d9 f9 db 2a 78 69 d8 58 64 05 65 26 f8 89 af 43 a6 05 60 80 57 22 86 52 24 49 df 46 6c 63 2b 35 70 24 3f 98 9c ce 7c d9 f4 65 e4 1e 61 0c 20 d8 04 21 d6 53 a5 52 00 00 00 82 13 b7 04 c7 fb 08 2f f2 75 90 67 8e f9 f1 90 ba e9 79 09 50 70 41 d8 60 42 0c 56 64 b2 79 21 b1 4d c1 db 88 92 fd 32 d0 ad 7b c9 46 81 35 91 ad 8d ef f4 b0 5f 60 ce a0 da 77 10 ac 00 00 00 00 00 00 80 00 be a3 7c e0 d0 d4 aa 20 2f 92 8d 28 38 1a ab 14 4a 5d 42 9a 04 a6 a2 b8 3c 70 68 ae 94 9e d0 6e 28 8e 81 0b ac 9c 76 60 00 25 e1 9c 90 7f 8e a2 e2 01 00 00 00 82 71 a1 f5 f8 52 8f 22 7e 79 c1 38 9d bd ff fe 49 2f 21 57 9d 2c 15 b8 c7 0c db 1c 33 2d 86 d8 73 41 43 27 50 86 1e c2 bc 34 51 ed ca 19 4b 22 1c fe c4 60 3d 27 6b ba a1 df a6 d4 fb 8a 48 a7 6e af c9 a9 a0 27 0e 4c 10 d6 4c d5 a6 24 27 26 4f 23 77 fe 76 3c 43 47 08 33 ac 96 c4 5f 35 7c bb ab a8 f1 b1 fd cc 7c bb 61 a7 cd b9 74 4e d7 f9 12 9a ed e2 be 21 cc fd c4 e9 13 4f 86 84 b3 a4 f3 54 da 9a 79 5e 96 33 4e 20 7d ff 70 f1 98 80 37 b2 ed 3a af 57 5c 0b 88 d8 f1 46 68 40 78 41 6d 59 fd ee 53 25 92 89 74 d1 2d ad 99 da c4 4c 3f 00 08 04 70 96 a4 40 02 be bc 24 20 ae d9 2f a9 b6 57 8b 47 79 41 5d 4a c0 1b 75 d5 49 5c 11 80 45 65 1c f4 1c 2f c4 8b 77 8e fa 5e a5 67 77 47 43 0a f4 16 2b 98 7b 80 c3 e0 01 cd 34 e5 c9 2f 76 cc 4c 24 ee b8 bc 4e 9a c2 ae d9 e5 38 03 ed 0c a4 ae 3a 97 37 d2 14 06 00 05 ea 6f 17 83 e2 87 b3 be e9 6e 3a 72 6e af e2 fd fa a7 8d 1f 48 c1 3b 64 df 07 84 77 54 b8 40 0d aa a6 9b f5 c8 f4 35 0a ea e9 ca 12 07 e7 82 83 cd 0b 20 ce b3 60 c7 e6 58 82 81 63 e2 d2 5c 4a a3 48 56 1f 92 7e 88 f6 3a a7 0e 73 a5 e6 9b 3d f3 49 59 03 f0 65 72 e1 e0 07 fa 55 a2 99 9f 59 6d 06 73 12 f5 77 9e 8d bf dc f3 42 71 38 f3 d4 44 d2 63 9a 10 47 7f 9b ec 4b 0b bb 6e 3c 04 be 68 98 1f 39 22 03 dd 0e e3 ef 47 8e 16 da cf c5 e3 e0 3c f7 ab 8e 39 02 f1 b0 ff 03 4e f6 55 b2 53 ca 50 93 83 81 5b 1b 6f c6 52 2d 4e 4f dc 11 a4 8c f4 2d 48 60 46 75 fd e2 b9 4c f0 05 00 a2 69 08 91 ab f8 ab 9c 01 50 73 01 4d 9e 08 d4 33 8b 87 80 bd ec d4 36 cf 05 41 35 9b af ff a4 52 37 f1 04 b9 62 10 40 3b 2d e9 ef ed 49 6f 27 30 d5 6b d0 68 ed 21 1c f8 47 53 5e de cb 7b 37 3f 78 b0 95 b6 84 41 a3 4c b5 16 82 a8 ae 4d 24 ad 04 65 f3 92 7f 88 9b 81 30 5c 03 8e 79 a7 96 2f b3 85 a8 82 e8 02 0f 06 c4 c2 ba 1d d5 ca c7 c1 88 76 da 86 5d 25 87 34 dd 73 58 3d f2 92 89 24 48 03 9e f7 99 cf 06 30 be cd cc e0 45 79 b5 56 1d c8 25 ab 82 98 27 94 5e 02 0c 1f 67 ee 61 5f eb 62 43 37 8e 06 10 06 0f 02 cc a4 e9 1b 2f 00 1e db 3d 78 fb 4b 55 66 8d da 93 ae c9 2a 5d e2 03 71 7a a4 9c 2d 28 4a cf ab e2 62 fc cf cb b2 b7 5a 21 83 c4 6e b6 5c a8 10 4e 1b 4d a7 fb b7 7a b2 fc 04 3a ea d8 7c 32 ab 87 5e e7 c2 e7 b7 01 9c 98 2c d3 b4 3e ae b1 a5 fb 13 5c 0c 7d ce e8 fe 65 16 a3 28 03 2f 88 c0 42 89 18 24 65 9e 9e 94 26 5c 80 3b 35 ee 5f 83 a2 b2 10 52 01 06 b8 a3 58 b5 0a b7 a1 fa 89 af 9c 25 1f e5 29 4b 3d 18 02 d5 67 6d 95 f1 60 ec 97 b1 ad 94 87 2c b2 04 46 42 c3 7b 4a 6c c6 c0 4e ff c1 67 2d b7 e4 b6 8d 78 7d 9a 7a 50 8a e5 4b 3c d7 36 9d de 50 e8 c7 7d 95 a3 d3 61 c0 40 ba bb 17 16 07 ca ac 2a 35 59 ad 4f 75 46 5f 49 c0 d0 ae 37 16 db 6e 00 cb 11 db 4a 5f ad e2 a5 7c 10 23 8e 20 4a 67 73 7c 3b 42 aa e5 01 b2 0f 76 94 a0 0f 16 e2 d0 17 40 35 a2 c2 26 56 dc 29 88 0a ce bd be 8d db d7 5c 2f 99 8d 8a c2 df ad 2b a3 a5 04 76 7b 6b 45 a4 59 57 f2 4d 75 8e d0 24 b3 84 9c d9 c3 0e 23 ef 4d f5 c8 96 44 f4 8b b5 36 f7 94 5b 59 d7 bc dd ff 75 44 13 d1 35 27 3e a8 e7 5f 22 f2 16 c6 b9 99 0a e7 18 06 f2 c0 0b 40 25 c4 8b 75 c0 f7 3c db 9a 7b 8f a3 67 b5 00 28 06 7e 7f 16 f4 dd 56 9d 46 2f 4f 19 ea cd b3 ed 70 ee eb b4 48 3f 8f d7 77 d4 43 e8 b4 04 27 db 6f e2 90 68 c0 ca 3d 24 14 44 2e 8f 3a 15 47 04 b0 e5 1b c6 64 a1 37 b2 6b e7 19 f4 f7 c9 a5 67 8a 67 4d fc 95 df 80 b9 ce 37 5d d6 49 c8 c7 04 e5 09 bd 88 c8 e6 3d 8c 7d d6 70 71 11 5c 89 82 ba 46 af 4d 6a dc c9 f6 8a 75 b9 39 7b 03 51 53 fa f4 63 66 e7 20 5d d8 d6 f3 75 25 c1 a0 e9 46 10 dd 94 32 3f 6c 15 d0 85 19 71 49 bf d6 65 55 48 cf d9 c5 2c 97 11 93 7f 79 ab b1 a1 24 f1 21 04 65 48 3c d3 b2 d7 83 78 cf b8 5e d8 2e 7d a0 f6 eb 6d 27 9f 2a e4 55 92 5d 0f 6f 1b a5 71 eb a2 81 f2 a6 54 fb 39 dd ff 3b 48 45 39 ff 15 8e 7c 54 19 e0 37 f3 e3 ad 03 8f 22 11 f1 03 31 95 56 3c 7f 93 cd 54 b9 09 4f 22 6e 78 32 71 e1 e5 a2 a2 c1 07 12 ea b6 25 d6 49 31 cd 4f fe 67 38 d9 7b 9b 5e f8 28 ee 9f b0 59 fc 01 af 0e 79 c1 e1 4b 1d 25 98 8c 69 a3 99 56 7c 1f 93 76 8f 79 71 d3 14 88 b8 65 8a 20 87 8b 7c 1d d7 ba 02 fc 42 93 9d de 3d 4a 33 39 a6 5d 50 7d c5 9c 51 09 7b 40 51 77 05 da 56 e9 eb f0 af a5 32 82 bf 86 db b5 8c 54 80 69 ff 6e b9 5a ad e7 cc 66 d7 bb ef 72 47 79 ca 1f 73 1b 33 46 ff 17 70 50 37 3d 79 ff 7b 3e 7f 9b c0 c1 b4 b2 66 a8 87 8b 90 ba aa 03 9d 3e 3b 63 97 9a c3 df 6e 6f 48 59 af d5 02 38 c7 54 7a 39 b6 08 10 93 80 44 ae 18 5d 2b a3 e0 0a 4e 73 67 68 64 ae 09 0d 81 ea ee 5e e6 cf 1d 0a b3 78 dd 4d d8 91 e9 37 c2 ea 54 10 e0 51 30 05 00 00 00 00 00 00 00 39 11 fa b9 64 c2 71 55 00 27 69 7b 52 16 06 87 46 16 02 f8 8d f1 65 d8 84 b3 6e c2 b6 c2 5a 2f 33 c7 15 68 7e 9d 4a fb 88 43 dd 01 4e 5c 5a d8 fe 99 57 54 bd 9c f3 2f ce 1e 31 91 9c 4b 20 82 fb 0a 30 b9 de ae 84 be d4 b2 80 45 63 40 73 08 c5 8c 89 d9 e9 9c 81 76 91 77 e6 d5 94 f8 8a 4f ac fd 4c 73 5a 20 30 7c 73 7a fa 2d 60 39 94 73 29 6b 83 1d bd 93 3d 93 99 4b a3 06 42 79 b1 0e a0 c5 83 3f 41 f1 57 ea 23 02 99 3d be 43 3b 1a a3 a3 76 6d 54 39 02 04 84 f4 11 3c 4c 85 94 65 c3 b4 15 c3 43 2f 81 db 87 19 53 9d 5b f3 72 aa ae a1 cc 43 a6 c5 cb e5 97 58 bf ee 29 16 58 0d ac 4b 00 8e 59 5f 43 74 91 d8 7a be d0 2c ef cd 9d b5 3d 94 d0 2d ae e6 79 18 e5 d6 78 74 63 37 3b 4b 87 c9 05 00 00 00 2f 78 09 95 9b c0 48 85 06 13 d1 7c a5 10 55 f2 f4 16 a4 4f e1 80 d2 d5 0c 31 2c ca 7c b1 4a 2b dc 33 1f 57 a9 81 71 39 a2 06 fc 76 95 72 27 ff ff 2d e2 0a 4b 8e 37 37 fb b4 29 13 77 7c 06 37 6f 79 9e ba 36 7e 21 f9 4c a5 98 70 5f 5d cb 76 7d 6f 09 00 d6 b0 f6 09 5e 53 c4 c4 23 4d 0c 1f be 43 4f 6a b8 f4 3c 00 13 ee 93 b8 39 46 ee 77 59 e8 9d 7b dd 1a 32 d7 b3 11 71 1b 75 7f e4 3c 06 d2 1a 35 81 0d 8f e9 8b 27 fa ea 8a a1 2b c8 71 6e ef c5 c9 7c 45 ac 33 ee ec 96 4c 52 14 bc 3a 93 59 bd ea 1c cc ab 94 f1 5e 36 31 9c b3 4e bc ac ed b8 2c 2e d3 de 5a 8a 8f 00 11 e8 f7 4e 82 d7 f9 60 93 53 0e 76 69 28 39 d7 96 19 39 ad fd ee ea ff 19 d1 1e fc af b6 d5 46 fe f2 71 e8 9d 6c c2 38 9e 81 ff 58 ce fc ce 3f bf 46 25 a7 e7 de 40 e4 2e 07 b3 44 49 e1 5e 06 5c c7 34 00 02 00 00 00 00 00 00 f2 88 a4 51 0d e0 3d ab 19 d2 62 85 ed a8 91 56 d5 0d d3 85 a6 03 33 ba 5b bf 5d 77 cd 70 07 ad 15 19 ad 54 70 de 3d d6 d6 08 0c af cc f8 a9 74 06 bb 6b 68 a1 f0 c4 54 98 20 a7 3c 88 0f 47 5f 73 2a e0 03 98 e8 bd 1f 41 08 b7 80 7f b3 3b 72 68 5e c3 7a 2d 3f 76 64 13 a6 04 59 51 62 46 e5 a1 d9 98 a2 01 7a ef 09 48 a6 8c f2 55 31 5a b8 0d d3 49 e8 91 ae f5 95 dc 4d 47 0e 8a c3 2a 30 8e 15 fc 37 d0 6a ea c2 89 c0 52 3f 48 3e 1f f7 40 8c 60 87 f1 ab 65 2f 2e f9 1d 4f 2b 01 98 7b 0f 46 da 03 4e 08 00 00 00 7e e8 10 1a 39 34 c5 4e 24 b4 8e c0 27 5e 2d 06 87 dc 74 6b 08 27 cb f6 52 f4 06 c6 b9 5f 27 22 e5 8c 05 f7 52 ce 21 26 59 6e 1c d7 65 5b 90 48 01 78 4c 41 6b 22 f7 3d 32 46 78 e2 72 4f 43 f1 fe 68 7c 7e 8a 60 c2 8b 82 b6 52 83 41 b6 48 cd d5 6f ed 7c dc bb 15 75 91 2d 5e cd 36 de a3 bc a0 b7 42 7d 83 92 c6 28 94 55 e8 f8 d2 ab 22 42 72 92 51 ae 03 3a 9e 02 21 0e 62 df 05 46 a7 4b 33 3a 1c 48 f9 5f d5 4a cb 57 41 25 9e 8c 54 88 ef ee e3 27 41 5c c1 94 51 43 2c 6f 14 c2 76 93 10 2a 3c d8 48 57 cd 65 86 fc 5c a9 a9 3e b0 14 5f ac 06 62 ff 86 10 7f 99 8a 8e f7 df 8a a1 40 46 c5 5b 03 d3 d4 7f 88 a8 d6 0f 77 74 a2 ee 08 75 88 97 fb 41 1a 94 b3 c2 fc 5d 5f 0d b4 2c 04 56 ec 01 5f 08 e5 24 7d 33 ae 2d 35 60 3f f8 45 4c 16 f8 34 28 56 93 51 25 10 2b b7 84 ed 71 48 b6 ce 43 1b 63 ee 35 6b 0c 78 5f 2f 47 b9 0e 29 38 9f 22 fc 5b 59 a7 0e fa ea 2b d4 01 95 af 44 86 22 0d 70 2e 30 bf c4 3c 10 ec 23 ea 62 83 99 4a 7d de 4d cb 61 fe a6 b6 51 fb 1d 62 45 8d 07 41 a1 28 30 05 2f cc 46 0d b0 43 af e5 25 62 9b 40 d7 ce e4 58 e4 cb 5e 93 0e d6 24 80 6c 43 a0 06 e3 93 3e d0 7c 2b 80 81 c1 28 ad 27 06 f4 82 61 ff 07 00 00 00 00 00 00 61 3b c1 8f 5a 38 d4 42 76 8a f3 80 41 ef e0 3d 15 2e f9 5f f5 69 e7 6d b2 39 1f 45 09 d7 f3 39 d9 2f db 4a 89 36 49 49 da 39 80 00 00 00 00 00 00 00 d8 0a 4f e6 54 57 83 76 e5 99 af f3 56 5b 1d 53 1f 30 91 2b 99 45 03 0b 81 ea 99 35 fd 46 ed b4 4a 78 f6 15 25 54 90 a4 b6 21 50 1f 2a 9e 4d 24 62 4c 4d ac 92 74 11 8c 67 58 4f 5d 37 47 55 53 4d 7f 68 f6 79 c4 ff 51 6a 9c 86 1a 0e 7e 65 86 8f cb 2b f1 cb 9a ea 4e 05 df 72 27 9f db 0d 2b 9e 93 5c 5a f3 cf 47 4b ed 79 df c2 48 c1 f5 ae a4 b8 b3 2c 5d 29 5e 57 07 9d 0f e6 62 a4 6b 7f 71 cd 47 74 4d b8 6c 50 b7 04 c9 71 d9 02 95 c7 b2 c7 43 9a 2d 78 cc fa 79 b5 fc 2b ff 6b bf 84 02 62 bf 89 39 4b 3e 06 91 95 32 64 d2 70 0c 83 8f a2 c7 b3 42 52 60 f5 95 00 00 00 00 00 4c a7 c1 2f 45 85 8d 62 84 ca 62 70 d6 b2 f0 e5 8f de d8 a7 b4 a3 02 a9 7b c6 41 df 07 72 0b a2 b2 6b bf cc 80 7c a0 ab b1 b4 43 22 26 9c 21 c5 ec 68 cb 06 8e a8 80 67 d9 05 ea 91 7b b0 3e ef da eb de ab f2 d0 dc e8 09 97 c9 15 c8 94 9d e9 92 58 7c 2c b5 fe 36 d7 d3 e5 db 21 b0 94 b8 b7 79 40 b5 f0 77 22 e4 7a 08 d3 67 e5 f8 4c 96 ec 66 4b 72 93 4b 99 b3 10 9a f6 5d 77 e8 6a bd 68 59 cd df 4b ba e1 f0 93 04 62 df 15 fd db c4 85 62 ea 35 11 a8 06 5e f0 28 cf 12 f1 4d cf 6e be cd 8d 88 48 36 17 4f af 1a a6 09 e5 f1 ee 11 62 df a1 3b dc 1f a7 cf aa db a8 5c 72 e9 75 8f 03 a7 55 d0 be 53 f8 d2 a1 df b1 c6 8c c1 64 b0 a0 78 0d 97 1a 96 ea 2c 4d 4c a0 39 8c 22 35 98 0a 93 07 b3 d5 bd 3b 01 fa ff d0 a5 db ed 28 81 a9 70 0a f5 61 ac 8c 6b 00 00 00 00 00 00 00 f9 6f 06 81 7f b9 03 72 9a 7d b6 ff 95 76 97 c9 ed e7 88 5d 94 ff b0 96 9b e0 da f6 0a f9 31 09 eb 1d ee 72 e4 36 3f 51 af 62 af 6f b2 a6 df 3b ec 89 82 2a 7a 0b 67 80 58 fa 3f ef 86 fa ec 21 6e b6 99 21 62 f8 dc bf 71 9c 14 8c d2 f9 c5 5f 49 01 20 3a 9a 8a 2c 3e 90 f3 94 3d bc 10 36 0a 1a 49 70 0d 1d fb f6 6d 69 f6 fb af 50 6c 8b cc e8 bb 0d 87 2a 02 23 89 26 40 7a 4e dd d5 d0 fc 5a 75 2f 90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x1000)
// size: len = 0x1000 (2 bytes)
// }
// }
// }
// len: len = 0x1006 (8 bytes)
// ]
*(uint32_t*)0x200000002080 = 0xfc;
memcpy((void*)0x200000002084, "... [truncated large byte array] ...", 4096);
*(uint16_t*)0x200000003084 = 0x1000;
syscall(__NR_write, /*fd=*/r[0], /*data=*/0x200000002080ul, /*len=*/0x1006ul);
return 0;
}
Reply: **Bug Analysis:**
The bug is a race condition in the `cm109` USB driver's state machine that leads to submitting an already active URB (USB Request Block), which triggers a `WARN_ONCE` in the USB core.
The `cm109` driver uses two URBs to communicate with the USB phone device:
1. `urb_irq`: An IN interrupt URB to receive key presses.
2. `urb_ctl`: An OUT control URB to send commands (like toggling the buzzer or scanning the next key column).
Normally, the driver alternates between these two URBs in a polling loop: when `urb_irq` completes, its callback (`cm109_urb_irq_callback`) calls `cm109_submit_ctl` to submit `urb_ctl`. When `urb_ctl` completes, its callback (`cm109_urb_ctl_callback`) submits `urb_irq`.
However, the buzzer can be toggled asynchronously via input events (e.g., `SND_BELL`). When this happens, `cm109_toggle_buzzer_async` is called. If `urb_ctl` is not currently active (`dev->ctl_urb_pending == 0`), it immediately submits `urb_ctl`.
If this asynchronous submission happens while `urb_irq` is active, `urb_ctl` becomes active concurrently. Then, when `urb_irq` completes, `cm109_urb_irq_callback` unconditionally calls `cm109_submit_ctl`, which unconditionally submits `urb_ctl` again without checking if it is already active. This triggers the warning in `usb_submit_urb`: `URB ... submitted while active`.
**Security Impact:**
* **Exploitable:** **No.** The `usb_submit_urb` function safely detects that the URB is already active (by checking if `urb->hcpriv` is not NULL), prints a `WARN_ONCE`, and returns `-EBUSY`. It does not corrupt any memory, cause a double-free, or lead to a use-after-free. The driver's state machine also recovers gracefully and continues to function normally.
* **Denial of Service:** **No.** The warning is a `WARN_ONCE` and does not halt the kernel in production builds. It does not cause deadlocks, hangs, or resource leaks.
* **Accessible From Unprivileged Processes / User Namespaces:** **Yes.** An unprivileged user can trigger the buzzer by writing the BEL character (`\a`) to their console (e.g., `/dev/tty1`), which invokes `kd_mksound` and broadcasts a `SND_BELL` event to the input subsystem.
* **Peripheral Trigger:** **Yes.** It requires a physical CM109 USB device (or a malicious device emulating it) to be plugged into the system.
|
| 6/2 |
2026/07/21 20:21 |
llm |
expert |
0m
Model:
Tokens:
input: 25664
output: 46
thoughts: 856
Thoughts: **Analyzing a Syzkaller Bug Report: URB Submission Issue**
Okay, so I've got this syzkaller report, and the error message immediately grabs my attention: "URB ffff88802bec5e00 submitted while active." Classic URB problem. The warning points directly to `usb_submit_urb` in `drivers/usb/core/urb.c`. I need to figure out the sequence of events that leads to this.
Looking at the call trace, it's pretty clear that this isn't a straightforward USB issue. It's triggered by a write to a tty deviceβlikely something like `/dev/tty1`. That write, in turn, seems to be causing a sound or beep, as indicated by the `kd_mksound` function. The key here is that this sound then results in an input event being injected (`SND_TONE` or `SND_BELL`) into the input subsystem.
This injected input event is then handled by the `cm109` driver (`cm109_input_ev`). Specifically, it seems like the event is instructing the `cm109` driver to toggle a buzzer asynchronously via `cm109_toggle_buzzer_async`. This is where the URB submission happens, specifically in `cm109_submit_buzz_toggle`, and, critically, where the warning arises. The warning is, of course, that an already active URB is being resubmitted.
My gut feeling is that we have a race condition or incorrect state management within the `cm109` driver. Perhaps a prior submission isn't being properly completed or cancelled before the next write occurs through the tty and results in another attempt to submit the URB. This means my next step is to drill down into the `drivers/input/misc/cm109.c` code to understand how this buzzer toggling is implemented, and where it might be going wrong.
|
| 7/2 |
2026/07/21 20:21 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/input/misc/cm109.c Name:cm109_submit_buzz_toggle]
Results: map[SourceCode: 342: static void cm109_submit_buzz_toggle(struct cm109_dev *dev)
343: {
344: int error;
345:
346: if (dev->buzzer_state)
347: dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
348: else
349: dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
350:
351: error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC);
352: if (error)
353: dev_err(&dev->intf->dev,
354: "%s: usb_submit_urb (urb_ctl) failed %d\n",
355: __func__, error);
356: }
SourceFile:drivers/input/misc/cm109.c]
|
| 8/2 |
2026/07/21 20:21 |
llm |
expert |
0m
Model:
Tokens:
input: 27264
output: 47
thoughts: 29
Thoughts: Okay, here's my interpretation of those thoughts, crafted with the expectation that I'm discussing this with a fellow expert:
**Delving into `cm109_toggle_buzzer_async` and `cm109_input_ev`**
Alright, let's dissect these two. My initial thought is to consider the relationship between the asynchronous buzzer toggle function, `cm109_toggle_buzzer_async`, and the input event handling, represented by `cm109_input_ev`. I'm immediately curious about how these two interact within the broader context of the system. Are we talking about a simple notification system, or is there a more complex feedback loop?
I'm thinking about the potential for race conditions or synchronization issues. Does `cm109_input_ev` potentially trigger a buzzer toggle, or are they related in a more indirect way, perhaps through a shared state? What are the implications if an input event rapidly triggers multiple calls to `cm109_toggle_buzzer_async`? I need to analyze how we're handling any queuing or debouncing within those modules.
Essentially, I'm trying to get a clear picture of the triggering mechanisms and what's happening on the input side that might necessitate a response from the buzzer. How is the async nature of the toggle function managed? Are we using a task scheduler, interrupts, or something else entirely? A deeper dive into the surrounding code will be needed to truly understand the control and data flow.
|
| 9/2 |
2026/07/21 20:21 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/input/misc/cm109.c Name:cm109_toggle_buzzer_async]
Results: map[SourceCode: 475: static void cm109_toggle_buzzer_async(struct cm109_dev *dev)
476: {
477: guard(spinlock_irqsave)(&dev->ctl_submit_lock);
478:
479: if (dev->ctl_urb_pending) {
480: /* URB completion will resubmit */
481: dev->buzzer_pending = 1;
482: } else {
483: dev->ctl_urb_pending = 1;
484: cm109_submit_buzz_toggle(dev);
485: }
486: }
SourceFile:drivers/input/misc/cm109.c]
|
| 10/2 |
2026/07/21 20:21 |
llm |
expert |
0m
Model:
Tokens:
input: 27878
output: 52
thoughts: 163
Thoughts: **Analyzing the Control URB and Buzzer Toggle**
Okay, let me break this down. My initial thought is that `cm109_toggle_buzzer_async` sets `dev->ctl_urb_pending` to 1 and then calls `cm109_submit_buzz_toggle(dev)`. If `dev->ctl_urb_pending` is already 1, it just sets `dev->buzzer_pending` to 1. So, it looks like `dev->ctl_submit_lock` is likely the mutex protecting `ctl_urb_pending`.
Now, the puzzling part. Why would we even *consider* the case where the URB is active if `dev->ctl_urb_pending` is 0? That just doesn't make sense on the surface. We are supposed to track the URB state with this flag.
This is where I need to dig deeper. I'm thinking, perhaps `ctl_urb_pending` gets cleared *before* the URB completion actually occurs. That would create a window. Another possibility is that `ctl_urb_pending` isn't initialized correctly at some point, leading to an incorrect state. Or, the most concerning, there's another code path that's submitting `dev->urb_ctl` without setting the proper flag. I'm going to have to trace the state of `ctl_urb_pending` and how `dev->urb_ctl` is submitted to figure out what's really happening.
|
| 11/2 |
2026/07/21 20:21 |
tool |
codesearch-find-references |
0m
Error:
Args: map[ContextFile:drivers/input/misc/cm109.c IncludeSnippetLines:0 Name:urb_ctl SourceTreePrefix:]
Results: map[References:<nil> TruncatedOutput:false]
|
| 12/2 |
2026/07/21 20:21 |
llm |
expert |
0m
Model:
Tokens:
input: 28434
output: 59
thoughts: 20
Thoughts: Here's my understanding of the thought process, summarized as you requested:
**Deconstructing `urb_ctl`**
Okay, so I'm looking at something and immediately recognize `urb_ctl`. My mind automatically jumps to the likely context within a USB driver; this sounds like something related to USB request blocks. I'm now pretty sure that `urb_ctl` is a field, it's defined within `struct cm109_dev`. It's a structure commonly used in these sorts of drivers, so that narrows down its purpose. Now I'm mentally filing this away, recognizing the connection, and probably considering how this particular `urb_ctl` field relates to other fields and functions within the `cm109_dev` structure and driver code. I'll need to remember that relationship when I start debugging the USB requests.
|
| 13/2 |
2026/07/21 20:21 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:drivers/input/misc/cm109.c IncludeSnippetLines:2 Name:cm109_dev::urb_ctl SourceTreePrefix:]
Results: map[References:[map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_input_open SourceFile:drivers/input/misc/cm109.c SourceLine:566 SourceSnippet: 564:
565: dev->ctl_urb_pending = 1;
566: error = usb_submit_urb(dev->urb_ctl, GFP_KERNEL);
567: if (!error) {
568: dev->open = 1;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_stop_traffic SourceFile:drivers/input/misc/cm109.c SourceLine:518 SourceSnippet: 516: smp_wmb();
517:
518: usb_kill_urb(dev->urb_ctl);
519: usb_kill_urb(dev->urb_irq);
520:
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_submit_buzz_toggle SourceFile:drivers/input/misc/cm109.c SourceLine:351 SourceSnippet: 349: dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
350:
351: error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC);
352: if (error)
353: dev_err(&dev->intf->dev,
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_submit_ctl SourceFile:drivers/input/misc/cm109.c SourceLine:380 SourceSnippet: 378: dev->ctl_urb_pending = 1;
379:
380: error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC);
381: if (error)
382: dev_err(&dev->intf->dev,
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_usb_cleanup SourceFile:drivers/input/misc/cm109.c SourceLine:664 SourceSnippet: 662:
663: usb_free_urb(dev->urb_irq); /* parameter validation in core/urb */
664: usb_free_urb(dev->urb_ctl); /* parameter validation in core/urb */
665: kfree(dev);
666: }
] map[ReferenceKind:writes ReferencingEntityKind:function ReferencingEntityName:cm109_usb_probe SourceFile:drivers/input/misc/cm109.c SourceLine:733 SourceSnippet: 731: goto err_out;
732:
733: dev->urb_ctl = usb_alloc_urb(0, GFP_KERNEL);
734: if (!dev->urb_ctl)
735: goto err_out;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_usb_probe SourceFile:drivers/input/misc/cm109.c SourceLine:734 SourceSnippet: 732:
733: dev->urb_ctl = usb_alloc_urb(0, GFP_KERNEL);
734: if (!dev->urb_ctl)
735: goto err_out;
736:
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_usb_probe SourceFile:drivers/input/misc/cm109.c SourceLine:760 SourceSnippet: 758: dev->ctl_req->wLength = cpu_to_le16(USB_PKT_LEN);
759:
760: usb_fill_control_urb(dev->urb_ctl, udev, usb_sndctrlpipe(udev, 0),
761: (void *)dev->ctl_req, dev->ctl_data, USB_PKT_LEN,
762: cm109_urb_ctl_callback, dev);
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_usb_probe SourceFile:drivers/input/misc/cm109.c SourceLine:763 SourceSnippet: 761: (void *)dev->ctl_req, dev->ctl_data, USB_PKT_LEN,
762: cm109_urb_ctl_callback, dev);
763: dev->urb_ctl->transfer_dma = dev->ctl_dma;
764: dev->urb_ctl->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
765: dev->urb_ctl->dev = udev;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_usb_probe SourceFile:drivers/input/misc/cm109.c SourceLine:764 SourceSnippet: 762: cm109_urb_ctl_callback, dev);
763: dev->urb_ctl->transfer_dma = dev->ctl_dma;
764: dev->urb_ctl->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
765: dev->urb_ctl->dev = udev;
766:
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_usb_probe SourceFile:drivers/input/misc/cm109.c SourceLine:765 SourceSnippet: 763: dev->urb_ctl->transfer_dma = dev->ctl_dma;
764: dev->urb_ctl->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
765: dev->urb_ctl->dev = udev;
766:
767: /* find out the physical bus location */
]] TruncatedOutput:false]
|
| 14/2 |
2026/07/21 20:21 |
llm |
expert |
0m
Model:
Tokens:
input: 30378
output: 46
thoughts: 27
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience:
**Analyzing Control Path Functions: `cm109_urb_ctl_callback` and `cm109_submit_ctl`**
Alright, let's dive in. My initial thought process is to zero in on those two key functions: `cm109_urb_ctl_callback` and `cm109_submit_ctl`. I'm immediately interested in how they interrelate within the larger control transfer framework. My gut tells me that `cm109_submit_ctl` probably handles the actual submission of the URB (USB Request Block) β that's a given, right? - while `cm109_urb_ctl_callback` is the crucial callback function that receives the results of the control transfer.
My mind is already starting to piece together the likely control flow. `cm109_submit_ctl` likely populates the URB with the necessary setup data, direction, length, and potentially any data payload if it's a data-out or data-in transfer, then hands it off to the USB stack. Then, the callback is the important part - I need to ensure that the code correctly handles success, errors, timeouts, etc., in `cm109_urb_ctl_callback`. What error codes are being checked? Are there appropriate retries for transient errors? Is the completion handler thread-safe and interrupt-safe? Are there race conditions that could arise if there are multiple pending requests or different states from these two functions?
I'm also curious about the locking mechanism used around these functions. Are mutexes, spinlocks, or atomic operations used? What are the potential consequences of contention or priority inversion? It is vital that data is only accessible to one function at a time. The interaction between hardware and software is critical, and these control transfer functions are clearly the interface to the underlying USB hardware. I want to look for potential performance bottlenecks.
From the function names, I'm inferring this might be a control endpoint implementation. Is this interrupt driven or polled? The interrupt-driven approach would be common for control endpoints and would use a callback for the result of a transfer. Any issues here would show up in interrupt latency.
Basically, I want to confirm that the URB submission is correct, that the callback handler properly interprets the results and takes the appropriate actions. I will focus on the most important parts: exception handling, error codes, and thread safety. My goal is to quickly understand the control path and determine whether there are any obvious areas for improvement or potential vulnerabilities.
|
| 15/2 |
2026/07/21 20:21 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/input/misc/cm109.c Name:cm109_urb_ctl_callback]
Results: map[SourceCode: 434: static void cm109_urb_ctl_callback(struct urb *urb)
435: {
436: struct cm109_dev *dev = urb->context;
437: const int status = urb->status;
438: int error;
439:
440: dev_dbg(&dev->intf->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n",
441: dev->ctl_data->byte[0],
442: dev->ctl_data->byte[1],
443: dev->ctl_data->byte[2],
444: dev->ctl_data->byte[3]);
445:
446: if (status) {
447: if (status == -ESHUTDOWN)
448: return;
449: dev_err_ratelimited(&dev->intf->dev, "%s: urb status %d\n",
450: __func__, status);
451: }
452:
453: guard(spinlock_irqsave)(&dev->ctl_submit_lock);
454:
455: dev->ctl_urb_pending = 0;
456:
457: if (unlikely(dev->shutdown))
458: return;
459:
460: if (dev->buzzer_pending || status) {
461: dev->buzzer_pending = 0;
462: dev->ctl_urb_pending = 1;
463: cm109_submit_buzz_toggle(dev);
464: } else if (likely(!dev->irq_urb_pending)) {
465: /* ask for key data */
466: dev->irq_urb_pending = 1;
467: error = usb_submit_urb(dev->urb_irq, GFP_ATOMIC);
468: if (error)
469: dev_err(&dev->intf->dev,
470: "%s: usb_submit_urb (urb_irq) failed %d\n",
471: __func__, error);
472: }
473: }
SourceFile:drivers/input/misc/cm109.c]
|
| 16/2 |
2026/07/21 20:21 |
llm |
expert |
0m
Model:
Tokens:
input: 31681
output: 44
thoughts: 275
Thoughts: **Analyzing the Control URB and Buzzer Toggle Logic**
Okay, so `cm109_urb_ctl_callback` is designed to handle the completion of a control URB, and it starts by clearing `dev->ctl_urb_pending`. Then, here's where it gets interesting: if the `dev->buzzer_pending` flag is set, it *re*-sets `dev->ctl_urb_pending` to 1 and calls `cm109_submit_buzz_toggle(dev)`. That looks like a pretty standard setup, clearing a flag then submitting a request.
But hold on a second... what happens if `cm109_submit_buzz_toggle(dev)` fails? Let's say `usb_submit_urb` in that function errors out. The crucial bit here is that `dev->ctl_urb_pending` *remains* set to 1! My brain is already starting to flag this.
So, next time `cm109_toggle_buzzer_async` is invoked, it sees that `dev->ctl_urb_pending` is already 1, and it just sets `dev->buzzer_pending = 1` and returns. And that seems correct, since the device isn't available for more requests, in this state.
But hang on, let me think through the implications of that failed submit. If `usb_submit_urb` fails, the URB is *not* actually active on the bus. This means that having `dev->ctl_urb_pending` set to 1 is actually misleading. It's not a true indication that an active URB is pending, but at least, it prevents submitting a second URB while the first failed. It's not the worst behavior, but it could lead to incorrect states. It's really just a way to block submissions. It doesn't cause any "URB submitted while active" conditions, which is good.
Okay, let's just make sure that `cm109_submit_buzz_toggle` isn't called from anywhere else. Let me check the call sites of `cm109_submit_ctl`.
|
| 17/2 |
2026/07/21 20:21 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/input/misc/cm109.c Name:cm109_submit_ctl]
Results: map[SourceCode: 358: static void cm109_submit_ctl(struct cm109_dev *dev)
359: {
360: int error;
361:
362: guard(spinlock_irqsave)(&dev->ctl_submit_lock);
363:
364: dev->irq_urb_pending = 0;
365:
366: if (unlikely(dev->shutdown))
367: return;
368:
369: if (dev->buzzer_state)
370: dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
371: else
372: dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
373:
374: dev->ctl_data->byte[HID_OR1] = dev->keybit;
375: dev->ctl_data->byte[HID_OR2] = dev->keybit;
376:
377: dev->buzzer_pending = 0;
378: dev->ctl_urb_pending = 1;
379:
380: error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC);
381: if (error)
382: dev_err(&dev->intf->dev,
383: "%s: usb_submit_urb (urb_ctl) failed %d\n",
384: __func__, error);
385: }
SourceFile:drivers/input/misc/cm109.c]
|
| 18/2 |
2026/07/21 20:21 |
llm |
expert |
0m
Model:
Tokens:
input: 32929
output: 57
thoughts: 14
Thoughts: Here's my thought process, summarized as you requested:
**Tracking Down `cm109_submit_ctl`**
Okay, so the question on my mind right now is: Where is `cm109_submit_ctl` actually *being* called in this system? I need to understand its context and how it's being used. Is it part of a larger process? Is it triggered by user input, a cron job, or some other event? Understanding its call points is absolutely critical. I need to trace its execution path. I will need to look through the codebase to pinpoint the exact locations where this function is invoked. Knowing the different locations this method is called from will help me understand its context and identify how the method interacts with other parts of the application.
|
| 19/2 |
2026/07/21 20:22 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:drivers/input/misc/cm109.c IncludeSnippetLines:2 Name:cm109_submit_ctl SourceTreePrefix:]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:cm109_urb_irq_callback SourceFile:drivers/input/misc/cm109.c SourceLine:431 SourceSnippet: 429:
430: out:
431: cm109_submit_ctl(dev);
432: }
]] TruncatedOutput:false]
|
| 20/2 |
2026/07/21 20:22 |
llm |
expert |
0m
Model:
Tokens:
input: 33291
output: 47
thoughts: 629
Thoughts: **Analyzing a Potential Race Condition in the cm109 Driver**
Okay, here's what's bothering me. I'm looking at how the `cm109` driver handles its URBs, specifically the control URB (`urb_ctl`) and the interrupt URB (`urb_irq`). It seems like there's a potential race condition here.
My train of thought goes like this: `cm109_urb_irq_callback` calls `cm109_submit_ctl(dev)`. That function, `cm109_submit_ctl`, unconditionally sets `dev->ctl_urb_pending = 1` and then submits the `dev->urb_ctl` using `usb_submit_urb()`. The problem is, it doesn't check if `dev->ctl_urb_pending` is already set! It just overwrites it and resubmits, regardless.
Now, let's play this out. What if `dev->ctl_urb_pending` *was* already 1 when `cm109_submit_ctl` gets called? Then we'd be trying to submit an already-active URB, which is a big no-no. So how could this happen?
Let's look at the flow. `cm109_urb_ctl_callback` submits `dev->urb_irq` when appropriate. The completion of `dev->urb_irq` triggers `cm109_urb_irq_callback`. During the time `dev->urb_irq` is active, `dev->ctl_urb_pending` is 0.
But wait a minute! What if `cm109_toggle_buzzer_async` is called *while* `dev->urb_irq` is still active? That's the crux of the issue. Let's trace that scenario:
1. `cm109_urb_ctl_callback` finishes, sets `dev->irq_urb_pending = 1` and submits `dev->urb_irq`. `dev->ctl_urb_pending` is 0.
2. `cm109_toggle_buzzer_async` is then called. It takes a `ctl_submit_lock`. It checks `dev->ctl_urb_pending` which is still 0. It sets `dev->ctl_urb_pending = 1` and calls `cm109_submit_buzz_toggle(dev)`. `cm109_submit_buzz_toggle` submits `dev->urb_ctl`. Now the `dev->urb_ctl` is actively processing.
3. Then, `cm109_urb_irq_callback` is called, because `dev->urb_irq` completes. This calls `cm109_submit_ctl(dev)`. This function also takes the `ctl_submit_lock`. It sets `dev->ctl_urb_pending = 1` *again* and calls `usb_submit_urb(dev->urb_ctl)`. But the `dev->urb_ctl` is ALREADY active from step 2! This will result in an "URB submitted while active" error.
So, it's clear the design is flawed and this is a classic race condition scenario. I need to verify that this is indeed happening in practice. I'll need to instrument the code and reproduce this to make sure. I also need to think about how to fix this: perhaps an atomic check on the `dev->ctl_urb_pending` flag and appropriate locking is needed within `cm109_submit_ctl`.
|
| 21/2 |
2026/07/21 20:22 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/input/misc/cm109.c Name:cm109_urb_irq_callback]
Results: map[SourceCode: 387: /*
388: * IRQ handler
389: */
390: static void cm109_urb_irq_callback(struct urb *urb)
391: {
392: struct cm109_dev *dev = urb->context;
393: const int status = urb->status;
394:
395: dev_dbg(&dev->intf->dev, "### URB IRQ: [0x%02x 0x%02x 0x%02x 0x%02x] keybit=0x%02x\n",
396: dev->irq_data->byte[0],
397: dev->irq_data->byte[1],
398: dev->irq_data->byte[2],
399: dev->irq_data->byte[3],
400: dev->keybit);
401:
402: if (status) {
403: if (status == -ESHUTDOWN)
404: return;
405: dev_err_ratelimited(&dev->intf->dev, "%s: urb status %d\n",
406: __func__, status);
407: goto out;
408: }
409:
410: /* Special keys */
411: cm109_report_special(dev);
412:
413: /* Scan key column */
414: if (dev->keybit == 0xf) {
415:
416: /* Any changes ? */
417: if ((dev->gpi & 0xf0) == (dev->irq_data->byte[HID_IR1] & 0xf0))
418: goto out;
419:
420: dev->gpi = dev->irq_data->byte[HID_IR1] & 0xf0;
421: dev->keybit = 0x1;
422: } else {
423: report_key(dev, dev->keymap[dev->irq_data->byte[HID_IR1]]);
424:
425: dev->keybit <<= 1;
426: if (dev->keybit > 0x8)
427: dev->keybit = 0xf;
428: }
429:
430: out:
431: cm109_submit_ctl(dev);
432: }
SourceFile:drivers/input/misc/cm109.c]
|
| 22/2 |
2026/07/21 20:22 |
llm |
expert |
0m
Model:
Tokens:
input: 35506
output: 38
thoughts: 826
Thoughts: **Analyzing the CM109 Control URB Submission**
Okay, so `cm109_urb_irq_callback` is calling `cm109_submit_ctl` unconditionally. And `cm109_submit_ctl` is *also* unconditionally submitting `dev->urb_ctl`, which is starting to look suspicious. Aha, but `cm109_submit_ctl` does take the `ctl_submit_lock`, so there's *some* protection there.
The code unconditionally submits the control URB. If the device is shutting down, it returns. It sets the buzzer state within the URB data as part of the submission, updates `dev->keybit` values in the data, and marks the URB as pending. Then it submits the URB. The problem is, if `dev->ctl_urb_pending` is already 1, it means the `dev->urb_ctl` is active. Submitting an active URB causes the warning we're seeing: `URB ffff88802bec5e00 submitted while active`.
My initial thought was that `cm109_submit_ctl` *should* check `dev->ctl_urb_pending`, but the more I think about it, the more I'm leaning in the other direction. It appears the intent is to continually resubmit the control URB for key scanning. So, if `dev->ctl_urb_pending` is already 1, it's *supposed* to be active. I do wonder if setting `dev->buzzer_pending = 1` would make sense, but it does seem like there's a good reason to submit it.
The main purpose of `cm109_submit_ctl` seems to be to submit the control URB for the next key column scan. If `dev->ctl_urb_pending` is already 1, the URB is active, likely due to `cm109_toggle_buzzer_async`, which will call this function. So, when that control URB completes, `cm109_urb_ctl_callback` *should* be called. `cm109_urb_ctl_callback` checks `dev->buzzer_pending`. If it's 0, it submits `dev->urb_irq`. Therefore, if `cm109_submit_ctl` simply skips submitting `dev->urb_ctl` when `dev->ctl_urb_pending == 1`, `cm109_urb_ctl_callback` will eventually resubmit `dev->urb_irq`, and the loop continues.
I had a moment of concern, since `cm109_submit_ctl` updates `dev->ctl_data->byte[HID_OR1]` and `HID_OR2` with `dev->keybit`. If the control URB is already active, the new `keybit` values won't be used until the *next* submission, but that's alright because the next time the values will get updated. It seems this is acceptable behavior.
So, the issue is not a functional one, but one that is spitting out a warning. The warning is from the kernel, in `usb_submit_urb`, regarding submitting the URB while active.
The question now becomes: is this warning exploitable? It is worth investigating what this warning is about.
|
| 23/2 |
2026/07/21 20:22 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/usb/core/urb.c Name:usb_submit_urb]
Results: map[SourceCode: 230: /**
231: * usb_submit_urb - issue an asynchronous transfer request for an endpoint
232: * @urb: pointer to the urb describing the request
233: * @mem_flags: the type of memory to allocate, see kmalloc() for a list
234: * of valid options for this.
235: *
236: * This submits a transfer request, and transfers control of the URB
237: * describing that request to the USB subsystem. Request completion will
238: * be indicated later, asynchronously, by calling the completion handler.
239: * The three types of completion are success, error, and unlink
240: * (a software-induced fault, also called "request cancellation").
241: *
242: * URBs may be submitted in interrupt context.
243: *
244: * The caller must have correctly initialized the URB before submitting
245: * it. Functions such as usb_fill_bulk_urb() and usb_fill_control_urb() are
246: * available to ensure that most fields are correctly initialized, for
247: * the particular kind of transfer, although they will not initialize
248: * any transfer flags.
249: *
250: * If the submission is successful, the complete() callback from the URB
251: * will be called exactly once, when the USB core and Host Controller Driver
252: * (HCD) are finished with the URB. When the completion function is called,
253: * control of the URB is returned to the device driver which issued the
254: * request. The completion handler may then immediately free or reuse that
255: * URB.
256: *
257: * With few exceptions, USB device drivers should never access URB fields
258: * provided by usbcore or the HCD until its complete() is called.
259: * The exceptions relate to periodic transfer scheduling. For both
260: * interrupt and isochronous urbs, as part of successful URB submission
261: * urb->interval is modified to reflect the actual transfer period used
262: * (normally some power of two units). And for isochronous urbs,
263: * urb->start_frame is modified to reflect when the URB's transfers were
264: * scheduled to start.
265: *
266: * Not all isochronous transfer scheduling policies will work, but most
267: * host controller drivers should easily handle ISO queues going from now
268: * until 10-200 msec into the future. Drivers should try to keep at
269: * least one or two msec of data in the queue; many controllers require
270: * that new transfers start at least 1 msec in the future when they are
271: * added. If the driver is unable to keep up and the queue empties out,
272: * the behavior for new submissions is governed by the URB_ISO_ASAP flag.
273: * If the flag is set, or if the queue is idle, then the URB is always
274: * assigned to the first available (and not yet expired) slot in the
275: * endpoint's schedule. If the flag is not set and the queue is active
276: * then the URB is always assigned to the next slot in the schedule
277: * following the end of the endpoint's previous URB, even if that slot is
278: * in the past. When a packet is assigned in this way to a slot that has
279: * already expired, the packet is not transmitted and the corresponding
280: * usb_iso_packet_descriptor's status field will return -EXDEV. If this
281: * would happen to all the packets in the URB, submission fails with a
282: * -EXDEV error code.
283: *
284: * For control endpoints, the synchronous usb_control_msg() call is
285: * often used (in non-interrupt context) instead of this call.
286: * That is often used through convenience wrappers, for the requests
287: * that are standardized in the USB 2.0 specification. For bulk
288: * endpoints, a synchronous usb_bulk_msg() call is available.
289: *
290: * Return:
291: * 0 on successful submissions. A negative error number otherwise.
292: *
293: * Request Queuing:
294: *
295: * URBs may be submitted to endpoints before previous ones complete, to
296: * minimize the impact of interrupt latencies and system overhead on data
297: * throughput. With that queuing policy, an endpoint's queue would never
298: * be empty. This is required for continuous isochronous data streams,
299: * and may also be required for some kinds of interrupt transfers. Such
300: * queuing also maximizes bandwidth utilization by letting USB controllers
301: * start work on later requests before driver software has finished the
302: * completion processing for earlier (successful) requests.
303: *
304: * As of Linux 2.6, all USB endpoint transfer queues support depths greater
305: * than one. This was previously a HCD-specific behavior, except for ISO
306: * transfers. Non-isochronous endpoint queues are inactive during cleanup
307: * after faults (transfer errors or cancellation).
308: *
309: * Reserved Bandwidth Transfers:
310: *
311: * Periodic transfers (interrupt or isochronous) are performed repeatedly,
312: * using the interval specified in the urb. Submitting the first urb to
313: * the endpoint reserves the bandwidth necessary to make those transfers.
314: * If the USB subsystem can't allocate sufficient bandwidth to perform
315: * the periodic request, submitting such a periodic request should fail.
316: *
317: * For devices under xHCI, the bandwidth is reserved at configuration time, or
318: * when the alt setting is selected. If there is not enough bus bandwidth, the
319: * configuration/alt setting request will fail. Therefore, submissions to
320: * periodic endpoints on devices under xHCI should never fail due to bandwidth
321: * constraints.
322: *
323: * Device drivers must explicitly request that repetition, by ensuring that
324: * some URB is always on the endpoint's queue (except possibly for short
325: * periods during completion callbacks). When there is no longer an urb
326: * queued, the endpoint's bandwidth reservation is canceled. This means
327: * drivers can use their completion handlers to ensure they keep bandwidth
328: * they need, by reinitializing and resubmitting the just-completed urb
329: * until the driver longer needs that periodic bandwidth.
330: *
331: * Memory Flags:
332: *
333: * The general rules for how to decide which mem_flags to use
334: * are the same as for kmalloc. There are four
335: * different possible values; GFP_KERNEL, GFP_NOFS, GFP_NOIO and
336: * GFP_ATOMIC.
337: *
338: * GFP_NOFS is not ever used, as it has not been implemented yet.
339: *
340: * GFP_ATOMIC is used when
341: * (a) you are inside a completion handler, an interrupt, bottom half,
342: * tasklet or timer, or
343: * (b) you are holding a spinlock or rwlock (does not apply to
344: * semaphores), or
345: * (c) current->state != TASK_RUNNING, this is the case only after
346: * you've changed it.
347: *
348: * GFP_NOIO is used in the block io path and error handling of storage
349: * devices.
350: *
351: * All other situations use GFP_KERNEL.
352: *
353: * Some more specific rules for mem_flags can be inferred, such as
354: * (1) start_xmit, timeout, and receive methods of network drivers must
355: * use GFP_ATOMIC (they are called with a spinlock held);
356: * (2) queuecommand methods of scsi drivers must use GFP_ATOMIC (also
357: * called with a spinlock held);
358: * (3) If you use a kernel thread with a network driver you must use
359: * GFP_NOIO, unless (b) or (c) apply;
360: * (4) after you have done a down() you can use GFP_KERNEL, unless (b) or (c)
361: * apply or your are in a storage driver's block io path;
362: * (5) USB probe and disconnect can use GFP_KERNEL unless (b) or (c) apply; and
363: * (6) changing firmware on a running storage or net device uses
364: * GFP_NOIO, unless b) or c) apply
365: *
366: */
367: int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
368: {
369: int xfertype, max;
370: struct usb_device *dev;
371: struct usb_host_endpoint *ep;
372: int is_out;
373: unsigned int allowed;
374: bool is_eusb2_isoch_double;
375:
376: if (!urb || !urb->complete)
377: return -EINVAL;
378: if (urb->hcpriv) {
379: WARN_ONCE(1, "URB %p submitted while active\n", urb);
380: return -EBUSY;
381: }
382:
383: dev = urb->dev;
384: if ((!dev) || (dev->state < USB_STATE_UNAUTHENTICATED))
385: return -ENODEV;
386:
387: /* For now, get the endpoint from the pipe. Eventually drivers
388: * will be required to set urb->ep directly and we will eliminate
389: * urb->pipe.
390: */
391: ep = usb_pipe_endpoint(dev, urb->pipe);
392: if (!ep)
393: return -ENOENT;
394:
395: urb->ep = ep;
396: urb->status = -EINPROGRESS;
397: urb->actual_length = 0;
398:
399: /* Lots of sanity checks, so HCDs can rely on clean data
400: * and don't need to duplicate tests
401: */
402: xfertype = usb_endpoint_type(&ep->desc);
403: if (xfertype == USB_ENDPOINT_XFER_CONTROL) {
404: struct usb_ctrlrequest *setup =
405: (struct usb_ctrlrequest *) urb->setup_packet;
406:
407: if (!setup)
408: return -ENOEXEC;
409: is_out = !(setup->bRequestType & USB_DIR_IN) ||
410: !setup->wLength;
411: dev_WARN_ONCE(&dev->dev, (usb_pipeout(urb->pipe) != is_out),
412: "BOGUS control dir, pipe %x doesn't match bRequestType %x\n",
413: urb->pipe, setup->bRequestType);
414: if (le16_to_cpu(setup->wLength) != urb->transfer_buffer_length) {
415: dev_dbg(&dev->dev, "BOGUS control len %d doesn't match transfer length %d\n",
416: le16_to_cpu(setup->wLength),
417: urb->transfer_buffer_length);
418: return -EBADR;
419: }
420: } else {
421: is_out = usb_endpoint_dir_out(&ep->desc);
422: }
423:
424: /* Clear the internal flags and cache the direction for later use */
425: urb->transfer_flags &= ~(URB_DIR_MASK | URB_DMA_MAP_SINGLE |
426: URB_DMA_MAP_PAGE | URB_DMA_MAP_SG | URB_MAP_LOCAL |
427: URB_SETUP_MAP_SINGLE | URB_SETUP_MAP_LOCAL |
428: URB_DMA_SG_COMBINED);
429: urb->transfer_flags |= (is_out ? URB_DIR_OUT : URB_DIR_IN);
430: kmsan_handle_urb(urb, is_out);
431:
432: if (xfertype != USB_ENDPOINT_XFER_CONTROL &&
433: dev->state < USB_STATE_CONFIGURED)
434: return -ENODEV;
435:
436: max = usb_endpoint_maxp(&ep->desc);
437: is_eusb2_isoch_double = usb_endpoint_is_hs_isoc_double(dev, ep);
438: if (!max && !is_eusb2_isoch_double) {
439: dev_dbg(&dev->dev,
440: "bogus endpoint ep%d%s in %s (bad maxpacket %d)\n",
441: usb_endpoint_num(&ep->desc), is_out ? "out" : "in",
442: __func__, max);
443: return -EMSGSIZE;
444: }
445:
446: /* periodic transfers limit size per frame/uframe,
447: * but drivers only control those sizes for ISO.
448: * while we're checking, initialize return status.
449: */
450: if (xfertype == USB_ENDPOINT_XFER_ISOC) {
451: int n, len;
452:
453: /* SuperSpeed isoc endpoints have up to 16 bursts of up to
454: * 3 packets each
455: */
456: if (dev->speed >= USB_SPEED_SUPER) {
457: int burst = 1 + ep->ss_ep_comp.bMaxBurst;
458: int mult = USB_SS_MULT(ep->ss_ep_comp.bmAttributes);
459: max *= burst;
460: max *= mult;
461: }
462:
463: if (dev->speed == USB_SPEED_SUPER_PLUS &&
464: USB_SS_SSP_ISOC_COMP(ep->ss_ep_comp.bmAttributes)) {
465: struct usb_ssp_isoc_ep_comp_descriptor *isoc_ep_comp;
466:
467: isoc_ep_comp = &ep->ssp_isoc_ep_comp;
468: max = le32_to_cpu(isoc_ep_comp->dwBytesPerInterval);
469: }
470:
471: /* High speed, 1-3 packets/uframe, max 6 for eUSB2 double bw */
472: if (dev->speed == USB_SPEED_HIGH) {
473: if (is_eusb2_isoch_double)
474: max = le32_to_cpu(ep->eusb2_isoc_ep_comp.dwBytesPerInterval);
475: else
476: max *= usb_endpoint_maxp_mult(&ep->desc);
477: }
478:
479: if (urb->number_of_packets <= 0)
480: return -EINVAL;
481: for (n = 0; n < urb->number_of_packets; n++) {
482: len = urb->iso_frame_desc[n].length;
483: if (len < 0 || len > max)
484: return -EMSGSIZE;
485: urb->iso_frame_desc[n].status = -EXDEV;
486: urb->iso_frame_desc[n].actual_length = 0;
487: }
488: } else if (urb->num_sgs && !urb->dev->bus->no_sg_constraint) {
489: struct scatterlist *sg;
490: int i;
491:
492: for_each_sg(urb->sg, sg, urb->num_sgs - 1, i)
493: if (sg->length % max)
494: return -EINVAL;
495: }
496:
497: /* the I/O buffer must be mapped/unmapped, except when length=0 */
498: if (urb->transfer_buffer_length > INT_MAX)
499: return -EMSGSIZE;
500:
501: /*
502: * stuff that drivers shouldn't do, but which shouldn't
503: * cause problems in HCDs if they get it wrong.
504: */
505:
506: /* Check that the pipe's type matches the endpoint's type */
507: if (usb_pipe_type_check(urb->dev, urb->pipe))
508: dev_warn_once(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n",
509: usb_pipetype(urb->pipe), pipetypes[xfertype]);
510:
511: /* Check against a simple/standard policy */
512: allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | URB_DIR_MASK |
513: URB_FREE_BUFFER);
514: switch (xfertype) {
515: case USB_ENDPOINT_XFER_BULK:
516: case USB_ENDPOINT_XFER_INT:
517: if (is_out)
518: allowed |= URB_ZERO_PACKET;
519: fallthrough;
520: default: /* all non-iso endpoints */
521: if (!is_out)
522: allowed |= URB_SHORT_NOT_OK;
523: break;
524: case USB_ENDPOINT_XFER_ISOC:
525: allowed |= URB_ISO_ASAP;
526: break;
527: }
528: allowed &= urb->transfer_flags;
529:
530: /* warn if submitter gave bogus flags */
531: if (allowed != urb->transfer_flags)
532: dev_WARN(&dev->dev, "BOGUS urb flags, %x --> %x\n",
533: urb->transfer_flags, allowed);
534:
535: /*
536: * Force periodic transfer intervals to be legal values that are
537: * a power of two (so HCDs don't need to).
538: *
539: * FIXME want bus->{intr,iso}_sched_horizon values here. Each HC
540: * supports different values... this uses EHCI/UHCI defaults (and
541: * EHCI can use smaller non-default values).
542: */
543: switch (xfertype) {
544: case USB_ENDPOINT_XFER_ISOC:
545: case USB_ENDPOINT_XFER_INT:
546: /* too small? */
547: if (urb->interval <= 0)
548: return -EINVAL;
549:
550: /* too big? */
551: switch (dev->speed) {
552: case USB_SPEED_SUPER_PLUS:
553: case USB_SPEED_SUPER: /* units are 125us */
554: /* Handle up to 2^(16-1) microframes */
555: if (urb->interval > (1 << 15))
556: return -EINVAL;
557: max = 1 << 15;
558: break;
559: case USB_SPEED_HIGH: /* units are microframes */
560: /* NOTE usb handles 2^15 */
561: if (urb->interval > (1024 * 8))
562: urb->interval = 1024 * 8;
563: max = 1024 * 8;
564: break;
565: case USB_SPEED_FULL: /* units are frames/msec */
566: case USB_SPEED_LOW:
567: if (xfertype == USB_ENDPOINT_XFER_INT) {
568: if (urb->interval > 255)
569: return -EINVAL;
570: /* NOTE ohci only handles up to 32 */
571: max = 128;
572: } else {
573: if (urb->interval > 1024)
574: urb->interval = 1024;
575: /* NOTE usb and ohci handle up to 2^15 */
576: max = 1024;
577: }
578: break;
579: default:
580: return -EINVAL;
581: }
582: /* Round down to a power of 2, no more than max */
583: urb->interval = min(max, 1 << ilog2(urb->interval));
584: }
585:
586: return usb_hcd_submit_urb(urb, mem_flags);
587: }
SourceFile:drivers/usb/core/urb.c]
|
| 24/2 |
2026/07/21 20:22 |
llm |
expert |
0m
Model:
Tokens:
input: 43337
output: 38
thoughts: 903
Thoughts: **Analyzing the URB Submission Error**
Okay, so I'm looking at this warning within the `usb_submit_urb` function. It flags a potential issue: submitting a URB (`urb`) that's already active. The code snippet, `if (urb->hcpriv) { WARN_ONCE(1, "URB %p submitted while active\n", urb); return -EBUSY; }`, highlights this condition. The immediate consequence is a `-EBUSY` error returned to the caller.
My first thought is, is there any actual harm? The code itself seems benign. It doesn't corrupt memory; it merely returns an error. The calling function, `cm109_submit_ctl`, logs the error via `dev_err` and returns. No apparent memory corruption, no resource leaks, and the warning is `WARN_ONCE`, meaning it only triggers once, so no denial of service. The prompt mentioned something about `panic_on_warn`. If that were set, then it *could* crash, but the text specifically calls out that this case, where the error is explicitly handled, is safe.
So, it seems safe, it is properly handled, no denial of service.
To be extra sure, I'm checking the broader implications. The fact that `usb_submit_urb` returns -EBUSY means `dev->ctl_urb_pending` *remains* at 1. But, when the URB eventually *does* complete, `cm109_urb_ctl_callback` will be called, and it *will* set `dev->ctl_urb_pending = 0`. Then, depending on `dev->buzzer_pending`, either `cm109_submit_buzz_toggle` or `dev->urb_irq` will be submitted. So, the state machine appears to recover gracefully. There's no deadlock, no memory leak, and no use-after-free scenario that I can see.
However, the reproducer used by syzkaller suggests this is being triggered by an unprivileged process. It plugs in a fake USB device, and then writes to `/dev/tty1`. Can an unprivileged process trigger this? Usually, `/dev/tty1` is owned by root, but the user logged into the console might have write access. However, given that this is a driver for things like Kensington phones, it's registering an input device, and the buzzer is likely triggered by `SND_TONE` or `SND_BELL` input events, not the URB being triggered directly. These are triggered through writing to `/dev/input/eventX` if you have access (typically through root or the `input` group). The reproducer does it by writing to the console. Writing the BEL character (`\a`) translates into a `SND_BELL` event sent to input devices. So, an unprivileged user can write to their *own* tty (e.g., `/dev/pts/0`) and potentially trigger this. I'd need to look at `kd_mksound` to be absolutely sure, but that's the likely attack vector.
|
| 25/2 |
2026/07/21 20:22 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/tty/vt/keyboard.c Name:kd_mksound]
Results: map[SourceCode: 277: void kd_mksound(unsigned int hz, unsigned int ticks)
278: {
279: timer_delete_sync(&kd_mksound_timer);
280:
281: input_handler_for_each_handle(&kbd_handler, &hz, kd_sound_helper);
282:
283: if (hz && ticks)
284: mod_timer(&kd_mksound_timer, jiffies + ticks);
285: }
SourceFile:drivers/tty/vt/keyboard.c]
|
| 26/2 |
2026/07/21 20:22 |
llm |
expert |
0m
Model:
Tokens:
input: 45128
output: 59
thoughts: 500
Thoughts: **Analyzing Potential Vulnerabilities**
Okay, so I'm looking at this `kd_mksound` function call within `drivers/tty/vt/vt.c`. It's triggered by console output, specifically from `do_con_trol`. A user writing to a virtual terminal, like `/dev/ttyX`, can initiate this. And yeah, an unprivileged user can write to a virtual terminal if they own it, like when they're logged in. But, the original concern seems to be that this trigger is just a `WARN_ONCE`, which is handled correctly. So, that's not a denial-of-service or exploitable. That's good.
Wait a second, though... is there *another* issue lurking around here? Let me circle back to `cm109_submit_ctl`. I need to re-examine that code block, specifically this section...
```c
static void cm109_submit_ctl(struct cm109_dev *dev)
{
// ... (irrelevant code omitted for brevity) ...
if (dev->buzzer_state)
dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
else
dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
dev->ctl_data->byte[HID_OR1] = dev->keybit;
dev->ctl_data->byte[HID_OR2] = dev->keybit;
// ... (irrelevant code omitted for brevity) ...
error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC);
// ... (irrelevant code omitted for brevity) ...
}
```
Okay, so if `dev->ctl_urb_pending` is *already* set to 1, meaning an URB is active, then `cm109_submit_ctl` is going to modify `dev->ctl_data->byte[...]` while the USB Request Block (URB) is potentially still processing. That seems⦠problematic. The critical question here is whether `dev->ctl_data` is the actual transfer buffer of `dev->urb_ctl`. If it is, then we potentially have a race condition or a data corruption vulnerability. I need to confirm that to see if this is an issue.
|
| 27/2 |
2026/07/21 20:22 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:drivers/input/misc/cm109.c IncludeSnippetLines:2 Name:cm109_dev::ctl_data SourceTreePrefix:]
Results: map[References:[map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_input_open SourceFile:drivers/input/misc/cm109.c SourceLine:560 SourceSnippet: 558:
559: /* issue INIT */
560: dev->ctl_data->byte[HID_OR0] = HID_OR_GPO_BUZ_SPDIF;
561: dev->ctl_data->byte[HID_OR1] = dev->keybit;
562: dev->ctl_data->byte[HID_OR2] = dev->keybit;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_input_open SourceFile:drivers/input/misc/cm109.c SourceLine:561 SourceSnippet: 559: /* issue INIT */
560: dev->ctl_data->byte[HID_OR0] = HID_OR_GPO_BUZ_SPDIF;
561: dev->ctl_data->byte[HID_OR1] = dev->keybit;
562: dev->ctl_data->byte[HID_OR2] = dev->keybit;
563: dev->ctl_data->byte[HID_OR3] = 0x00;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_input_open SourceFile:drivers/input/misc/cm109.c SourceLine:562 SourceSnippet: 560: dev->ctl_data->byte[HID_OR0] = HID_OR_GPO_BUZ_SPDIF;
561: dev->ctl_data->byte[HID_OR1] = dev->keybit;
562: dev->ctl_data->byte[HID_OR2] = dev->keybit;
563: dev->ctl_data->byte[HID_OR3] = 0x00;
564:
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_input_open SourceFile:drivers/input/misc/cm109.c SourceLine:563 SourceSnippet: 561: dev->ctl_data->byte[HID_OR1] = dev->keybit;
562: dev->ctl_data->byte[HID_OR2] = dev->keybit;
563: dev->ctl_data->byte[HID_OR3] = 0x00;
564:
565: dev->ctl_urb_pending = 1;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_submit_buzz_toggle SourceFile:drivers/input/misc/cm109.c SourceLine:347 SourceSnippet: 345:
346: if (dev->buzzer_state)
347: dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
348: else
349: dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_submit_buzz_toggle SourceFile:drivers/input/misc/cm109.c SourceLine:349 SourceSnippet: 347: dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
348: else
349: dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
350:
351: error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC);
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_submit_ctl SourceFile:drivers/input/misc/cm109.c SourceLine:370 SourceSnippet: 368:
369: if (dev->buzzer_state)
370: dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
371: else
372: dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_submit_ctl SourceFile:drivers/input/misc/cm109.c SourceLine:372 SourceSnippet: 370: dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
371: else
372: dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
373:
374: dev->ctl_data->byte[HID_OR1] = dev->keybit;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_submit_ctl SourceFile:drivers/input/misc/cm109.c SourceLine:374 SourceSnippet: 372: dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
373:
374: dev->ctl_data->byte[HID_OR1] = dev->keybit;
375: dev->ctl_data->byte[HID_OR2] = dev->keybit;
376:
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_submit_ctl SourceFile:drivers/input/misc/cm109.c SourceLine:375 SourceSnippet: 373:
374: dev->ctl_data->byte[HID_OR1] = dev->keybit;
375: dev->ctl_data->byte[HID_OR2] = dev->keybit;
376:
377: dev->buzzer_pending = 0;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_toggle_buzzer_sync SourceFile:drivers/input/misc/cm109.c SourceLine:493 SourceSnippet: 491:
492: if (on)
493: dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
494: else
495: dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_toggle_buzzer_sync SourceFile:drivers/input/misc/cm109.c SourceLine:495 SourceSnippet: 493: dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
494: else
495: dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
496:
497: error = usb_control_msg(dev->udev,
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_toggle_buzzer_sync SourceFile:drivers/input/misc/cm109.c SourceLine:503 SourceSnippet: 501: le16_to_cpu(dev->ctl_req->wValue),
502: le16_to_cpu(dev->ctl_req->wIndex),
503: dev->ctl_data,
504: USB_PKT_LEN, USB_CTRL_SET_TIMEOUT);
505: if (error < 0 && error != -EINTR)
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_urb_ctl_callback SourceFile:drivers/input/misc/cm109.c SourceLine:440 SourceSnippet: 438: int error;
439:
440: dev_dbg(&dev->intf->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n",
441: dev->ctl_data->byte[0],
442: dev->ctl_data->byte[1],
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_urb_ctl_callback SourceFile:drivers/input/misc/cm109.c SourceLine:440 SourceSnippet: 438: int error;
439:
440: dev_dbg(&dev->intf->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n",
441: dev->ctl_data->byte[0],
442: dev->ctl_data->byte[1],
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_urb_ctl_callback SourceFile:drivers/input/misc/cm109.c SourceLine:440 SourceSnippet: 438: int error;
439:
440: dev_dbg(&dev->intf->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n",
441: dev->ctl_data->byte[0],
442: dev->ctl_data->byte[1],
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_urb_ctl_callback SourceFile:drivers/input/misc/cm109.c SourceLine:440 SourceSnippet: 438: int error;
439:
440: dev_dbg(&dev->intf->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n",
441: dev->ctl_data->byte[0],
442: dev->ctl_data->byte[1],
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_usb_cleanup SourceFile:drivers/input/misc/cm109.c SourceLine:660 SourceSnippet: 658: {
659: kfree(dev->ctl_req);
660: usb_free_coherent(dev->udev, USB_PKT_LEN, dev->ctl_data, dev->ctl_dma);
661: usb_free_coherent(dev->udev, USB_PKT_LEN, dev->irq_data, dev->irq_dma);
662:
] map[ReferenceKind:writes ReferencingEntityKind:function ReferencingEntityName:cm109_usb_probe SourceFile:drivers/input/misc/cm109.c SourceLine:719 SourceSnippet: 717: goto err_out;
718:
719: dev->ctl_data = usb_alloc_coherent(udev, USB_PKT_LEN,
720: GFP_KERNEL, &dev->ctl_dma);
721: if (!dev->ctl_data)
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_usb_probe SourceFile:drivers/input/misc/cm109.c SourceLine:721 SourceSnippet: 719: dev->ctl_data = usb_alloc_coherent(udev, USB_PKT_LEN,
720: GFP_KERNEL, &dev->ctl_dma);
721: if (!dev->ctl_data)
722: goto err_out;
723:
] map[ReferenceKind:reads ReferencingEntityKind:function ReferencingEntityName:cm109_usb_probe SourceFile:drivers/input/misc/cm109.c SourceLine:761 SourceSnippet: 759:
760: usb_fill_control_urb(dev->urb_ctl, udev, usb_sndctrlpipe(udev, 0),
761: (void *)dev->ctl_req, dev->ctl_data, USB_PKT_LEN,
762: cm109_urb_ctl_callback, dev);
763: dev->urb_ctl->transfer_dma = dev->ctl_dma;
]] TruncatedOutput:false]
|
| 28/2 |
2026/07/21 20:22 |
llm |
expert |
0m
Model:
Tokens:
input: 49653
output: 66
thoughts: 7232
Thoughts: **Analysis of the CM109 USB Driver Code**
Alright, after meticulously tracing through this CM109 USB driver code, here's the rundown of my assessment. The primary issue boils down to a potential race condition and a subsequent warning within the `usb_submit_urb` function. It looks like the driver's state machine can be tripped up, resulting in a spurious submission of a Control URB (`urb_ctl`) that's already active.
Here's the scenario: the `dev->ctl_data` buffer, which is crucial for data transfer to the USB device (a phone, in this case), gets modified by `cm109_submit_ctl`. The `cm109_toggle_buzzer_async` function is the primary culprit. If this function is called when the Interrupt URB (`urb_irq`), which constantly polls the device, is active, then the Control URB can be submitted. The most likely scenario that triggers this, is an unprivileged user writing an "alert" character to `/dev/tty1`, for example, to sound the buzzer. After the buzzer is triggered, an event from the keypad may occur, causing `urb_irq` to complete.
The problem lies when `cm109_urb_irq_callback` calls `cm109_submit_ctl` *while* the buzzer is active and the Control URB is already pending. `usb_submit_urb` detects that `urb->hcpriv` is set, and it returns `-EBUSY` and triggers a `WARN_ONCE`.
However, the state machine is designed to recover in the case of `-EBUSY` because the callback will eventually be called, and the polling loop continues. So, although it triggers a warning, it's not a crash. The most significant consequence is that the device may experience a brief state where the buzzer doesn't sound right away, or the keypad scan might be temporarily corrupted.
Critically, and this is where it gets interesting, it's *not* exploitable in a security context. It does *not* lead to kernel memory corruption, information leaks, or a Denial of Service (DoS) vulnerability (unless `panic_on_warn` is set). The worst that happens is the driver prints a warning message and the device state is temporarily unstable. This means an unprivileged user with console access, or the device plugged in, can trigger this bug.
I've also double-checked all the synchronization points. This means the lock `ctl_submit_lock` works well enough. The use of a spinlock to protect `dev->ctl_submit_lock` ensures that `cm109_toggle_buzzer_async` and `cm109_submit_ctl` can't run concurrently, which eliminates any chances of data races or use-after-free conditions on the URB data. `dev->keybit` is simply a state variable used for keypad scanning and, by itself, is not vulnerable to exploitation.
|
| 29/2 |
2026/07/21 20:23 |
tool |
set-results |
0m
Args: map[DenialOfService:false Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
Results: map[DenialOfService:false Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
|
| 30/2 |
2026/07/21 20:23 |
llm |
expert |
0m
Model:
Tokens:
input: 57657
output: 633
thoughts: 591
Thoughts: **My Analysis of the CM109 Driver Bug**
Okay, the results are in. Time to solidify my findings in the final response.
Essentially, it boils down to a race condition in the `cm109` driver's state machine, leading to the problematic resubmission of an already active URB. Specifically, the `cm109` driver uses two URBs: `urb_irq` for receiving key presses and `urb_ctl` for sending commands, like controlling the buzzer or scanning keys. The intended flow is pretty straightforward: `urb_irq` completes, its callback (`cm109_urb_irq_callback`) submits `urb_ctl`, and vice-versa with `urb_ctl` completing and its callback (`cm109_urb_ctl_callback`) submitting `urb_irq`.
However, the trouble starts with asynchronous buzzer toggling. When a `SND_BELL` event comes in β say from writing a BEL character to a terminal β `cm109_toggle_buzzer_async` is triggered. This function immediately submits `urb_ctl` if it's *not* already active. Now hereβs the rub: if `urb_irq` is currently active at *that* precise moment, `urb_ctl` *becomes* active, so we have two active URBs. Then, the `urb_irq` completes, its callback, `cm109_urb_irq_callback` calls `cm109_submit_ctl` unconditionally, submitting `urb_ctl` again, without checking if itβs active, this leads to the crash.
This double submission triggers the `WARN_ONCE` in `usb_submit_urb`, specifically the "URB ffff... submitted while active" warning.
Now, from an impact perspective, this isn't a showstopper, thankfully:
* **Exploitable?** No, because `usb_submit_urb` has good defenses. It detects the active URB and issues an error with a busy flag instead of any memory corruption or other nefarious behavior. The driver state machine is robust enough to handle the error.
* **Denial of Service?** Not in a meaningful way. The `WARN_ONCE` won't halt the kernel in production, and I donβt see any deadlocks or resource leaks.
* **Unprivileged/User Namespace?** Yes, the event can be triggered by an unprivileged user sending a bell character to the device and I see this as an access through `/dev/tty1`.
* **Peripheral Trigger?** Yes, it requires a physical CM109 USB device, or a faked one, to be connected.
Alright, I have the full picture now. I'm ready to write a succinct and effective response.
|
| 31/1 |
2026/07/21 20:24 |
action |
format-explanation |
0m
Results: map[Explanation:**Bug Analysis:**
The bug is a race condition in the `cm109` USB driver's state machine that leads
to submitting an already active URB (USB Request Block), which triggers a
`WARN_ONCE` in the USB core.
The `cm109` driver uses two URBs to communicate with the USB phone device:
1. `urb_irq`: An IN interrupt URB to receive key presses.
2. `urb_ctl`: An OUT control URB to send commands (like toggling the buzzer or
scanning the next key column).
Normally, the driver alternates between these two URBs in a polling loop: when
`urb_irq` completes, its callback (`cm109_urb_irq_callback`) calls
`cm109_submit_ctl` to submit `urb_ctl`. When `urb_ctl` completes, its callback
(`cm109_urb_ctl_callback`) submits `urb_irq`.
However, the buzzer can be toggled asynchronously via input events (e.g.,
`SND_BELL`). When this happens, `cm109_toggle_buzzer_async` is called. If
`urb_ctl` is not currently active (`dev->ctl_urb_pending == 0`), it immediately
submits `urb_ctl`.
If this asynchronous submission happens while `urb_irq` is active, `urb_ctl`
becomes active concurrently. Then, when `urb_irq` completes,
`cm109_urb_irq_callback` unconditionally calls `cm109_submit_ctl`, which
unconditionally submits `urb_ctl` again without checking if it is already
active. This triggers the warning in `usb_submit_urb`: `URB ... submitted while
active`.
**Security Impact:**
* **Exploitable:** **No.** The `usb_submit_urb` function safely detects that the
URB is already active (by checking if `urb->hcpriv` is not NULL), prints a
`WARN_ONCE`, and returns `-EBUSY`. It does not corrupt any memory, cause a
double-free, or lead to a use-after-free. The driver's state machine also
recovers gracefully and continues to function normally.
* **Denial of Service:** **No.** The warning is a `WARN_ONCE` and does not halt
the kernel in production builds. It does not cause deadlocks, hangs, or resource
leaks.
* **Accessible From Unprivileged Processes / User Namespaces:** **Yes.** An
unprivileged user can trigger the buzzer by writing the BEL character (`\a`) to
their console (e.g., `/dev/tty1`), which invokes `kd_mksound` and broadcasts a
`SND_BELL` event to the input subsystem.
* **Peripheral Trigger:** **Yes.** It requires a physical CM109 USB device (or a
malicious device emulating it) to be plugged into the system.]
|