| 0/0 |
2026/08/20 00:00 |
flow |
assessment-security |
58m
Results: map[DenialOfService:false Explanation:Based on the analysis of the provided bug report and the kernel source code,
here is the assessment of the bug's security impact:
### Bug Mechanism
The bug is a shift-out-of-bounds (Undefined Behavior) in the ATM subsystem,
specifically in `__vcc_connect` and `find_ci` within `net/atm/common.c`.
It is triggered when a user attempts to `bind()` an ATM socket to a device
managed by the USB ATM framework (`drivers/usb/atm/usbatm.c`). During the
initialization of a USB ATM device, the framework sets the device's VPI and VCI
bit ranges to `ATM_CI_MAX`:
```c
atm_dev->ci_range.vpi_bits = ATM_CI_MAX;
atm_dev->ci_range.vci_bits = ATM_CI_MAX;
```
`ATM_CI_MAX` is defined as `-1` in `include/uapi/linux/atmdev.h`.
Later, when `bind()` is called, the kernel validates the requested VPI/VCI
values using a bitwise shift:
```c
if ((vpi != ATM_VPI_UNSPEC && vpi != ATM_VPI_ANY &&
vpi >> dev->ci_range.vpi_bits) || ...
```
Because `vpi_bits` is `-1`, the expression evaluates to `vpi >> -1` (and
similarly `1 << -1` in `find_ci`). Shifting by a negative exponent is undefined
behavior in C, which is correctly caught by the Undefined Behavior Sanitizer
(UBSAN).
### Security Impact
**Exploitable: False**
**Denial of Service: False**
While this is undefined behavior in C, on all major hardware architectures (x86,
ARM, PowerPC, RISC-V, etc.), the CPU simply masks the shift count (e.g., by 31
or 63). For example, on x86, `vpi >> -1` becomes `vpi >> 31`. This does not
cause a hardware trap, CPU exception, or kernel panic.
The result of this masked shift is just used in a boolean condition. It leads to
a logical flaw where the kernel fails to properly restrict the maximum VPI/VCI
values or fails to auto-assign a free VPI/VCI (`-EADDRINUSE`). However, these
values are merely used as identifiers and are not used to index arrays or
allocate memory. Therefore, it does not lead to memory corruption, out-of-bounds
memory accesses, or information leaks. In a production kernel where UBSAN is
disabled, this bug is completely benign and has no security implications.
**Accessible From Unprivileged Processes: True**
**Accessible From User Namespaces: True**
An unprivileged user can create an `AF_ATMPVC` socket and call `bind()`. The
kernel only requires `CAP_NET_BIND_SERVICE` if the requested VCI is less than
`ATM_NOT_RSV_VCI` (32). Binding to a VCI $\ge$ 32 is entirely unprivileged.
**Peripheral Trigger: True**
To reach this specific code path, an ATM device that sets `vpi_bits = -1` must
be present. In the Linux kernel, only the `usbatm` framework does this.
Therefore, the bug can be triggered if a malicious or legitimate USB ATM modem
is physically plugged into the system (as simulated by the `syz_usb_connect`
call in the reproducer). Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:true UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/08/20 00:00 |
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_ep_write(int fd, struct usb_raw_ep_io* io)
{
return ioctl(fd, USB_RAW_IOCTL_EP_WRITE, io);
}
static int usb_raw_ep_read(int fd, struct usb_raw_ep_io* io)
{
return ioctl(fd, USB_RAW_IOCTL_EP_READ, io);
}
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);
}
static int lookup_endpoint(int fd, uint8_t bEndpointAddress)
{
struct usb_device_index* index = lookup_usb_index(fd);
if (!index)
return -1;
if (index->iface_cur < 0)
return -1;
for (int ep = 0; ep < index->ifaces[index->iface_cur].eps_num; ep++)
if (index->ifaces[index->iface_cur].eps[ep].desc.bEndpointAddress == bEndpointAddress)
return index->ifaces[index->iface_cur].eps[ep].handle;
return -1;
}
#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 volatile long syz_usb_ep_write(volatile long a0, volatile long a1, volatile long a2, volatile long a3)
{
int fd = a0;
uint8_t ep = a1;
uint32_t len = a2;
char* data = (char*)a3;
int ep_handle = lookup_endpoint(fd, ep);
if (ep_handle < 0) {
return -1;
}
struct usb_raw_ep_io_data io_data;
io_data.inner.ep = ep_handle;
io_data.inner.flags = 0;
if (len > sizeof(io_data.data))
len = sizeof(io_data.data);
io_data.inner.length = len;
memcpy(&io_data.data[0], data, len);
int rv = usb_raw_ep_write(fd, (struct usb_raw_ep_io*)&io_data);
if (rv < 0) {
return rv;
}
sleep_ms(200);
return 0;
}
static volatile long syz_usb_ep_read(volatile long a0, volatile long a1, volatile long a2, volatile long a3)
{
int fd = a0;
uint8_t ep = a1;
uint32_t len = a2;
char* data = (char*)a3;
int ep_handle = lookup_endpoint(fd, ep);
if (ep_handle < 0) {
return -1;
}
struct usb_raw_ep_io_data io_data;
io_data.inner.ep = ep_handle;
io_data.inner.flags = 0;
if (len > sizeof(io_data.data))
len = sizeof(io_data.data);
io_data.inner.length = len;
int rv = usb_raw_ep_read(fd, (struct usb_raw_ep_io*)&io_data);
if (rv < 0) {
return rv;
}
memcpy(&data[0], &io_data.data[0], io_data.inner.length);
sleep_ms(200);
return 0;
}
uint64_t r[2] = {0xffffffffffffffff, 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 = 0x3 (8 bytes)
// dev_len: len = 0x40 (8 bytes)
// dev: ptr[inout, array[ANYUNION]] {
// array[ANYUNION] {
// union ANYUNION {
// ANYBLOB: buffer: {12 01 00 02 00 00 00 40 72 05 fe ca 00 01 00 00 00 01 09 02 2e 00 01 01 00 80 fa 09 04 00 00 04 ff 00 00 00 07 05 01 02 00 02 00 07 05 81 02 00 02 00 07 05 02 02 00 02 00 07 05 82 02 00 02} (length 0x3f)
// }
// }
// }
// conn_descs: nil
// ]
// returns fd_usb
memcpy((void*)0x200000000000, "... [truncated large byte array] ...", 63);
res = -1;
res = syz_usb_connect(/*speed=USB_SPEED_HIGH*/3, /*dev_len=*/0x40, /*dev=*/0x200000000000, /*conn_descs=*/0);
if (res != -1)
r[0] = res;
// syz_usb_ep_read arguments: [
// fd: fd_usb (resource)
// ep: int8 = 0x1 (1 bytes)
// len: len = 0x0 (8 bytes)
// data: nil
// ]
syz_usb_ep_read(/*fd=*/r[0], /*ep=*/1, /*len=*/0, /*data=*/0);
// syz_usb_ep_write arguments: [
// fd: fd_usb (resource)
// ep: int8 = 0x81 (1 bytes)
// len: len = 0x40 (8 bytes)
// data: ptr[in, buffer] {
// buffer: {91 01 00 00 00 11 22 33 44 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 0x40)
// }
// ]
memcpy((void*)0x200000000300, "... [truncated large byte array] ...", 64);
syz_usb_ep_write(/*fd=*/r[0], /*ep=*/0x81, /*len=*/0x40, /*data=*/0x200000000300);
// setns arguments: [
// fd: fd_namespace (resource)
// type: ns_type = 0x0 (8 bytes)
// ]
syscall(__NR_setns, /*fd=*/0xc9, /*type=*/0ul);
// socket arguments: [
// domain: socket_domain = 0x8 (8 bytes)
// type: socket_type = 0x2 (8 bytes)
// proto: int32 = 0x0 (4 bytes)
// ]
// returns sock
res = syscall(__NR_socket, /*domain=AF_ATMPVC*/8ul, /*type=SOCK_DGRAM*/2ul, /*proto=*/0);
if (res != -1)
r[1] = res;
// setsockopt arguments: [
// fd: sock (resource)
// level: int32 = 0x108 (4 bytes)
// optname: int32 = 0x42020054 (4 bytes)
// optval: ptr[in, buffer] {
// buffer: {01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00} (length 0x54)
// }
// optlen: len = 0x54 (8 bytes)
// ]
memcpy((void*)0x200000000000, "... [truncated large byte array] ...", 84);
syscall(__NR_setsockopt, /*fd=*/r[1], /*level=*/0x108, /*optname=*/0x42020054, /*optval=*/0x200000000000ul, /*optlen=*/0x54ul);
// bind arguments: [
// fd: sock (resource)
// addr: ptr[in, sockaddr_storage] {
// union sockaddr_storage {
// generic: sockaddr_storage_generic {
// sa_family: socket_domain = 0x8 (2 bytes)
// sa_data: buffer: {00 00 ff ff 01 00 fe ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 0x7e)
// }
// }
// }
// addrlen: len = 0xc (8 bytes)
// ]
*(uint16_t*)0x200000000100 = 8;
memcpy((void*)0x200000000102, "... [truncated large byte array] ...", 126);
syscall(__NR_bind, /*fd=*/r[1], /*addr=*/0x200000000100ul, /*addrlen=*/0xcul);
return 0;
}
]
|
| 2/1 |
2026/08/20 00:00 |
action |
kernel-checkouter |
0m
Results: map[KernelSrc:/app/workdir/cache/src/e9cd96c099aac719e9ecf0353eca7c0eaa3d0f48]
|
| 3/1 |
2026/08/20 00:00 |
action |
kernel-builder |
31m
Results: map[KernelObj:/app/workdir/cache/build/e23715fe4a23b3b0bfd2383f7c91cb47167030eb]
|
| 4/1 |
2026/08/20 00:31 |
action |
codesearch-prepare |
22m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/08/20 00:54 |
agent |
expert |
4m
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 ]------------
UBSAN: shift-out-of-bounds in net/atm/common.c:381:10
shift exponent -1 is negative
CPU: 0 UID: 0 PID: 6073 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
ubsan_epilogue+0xa/0x30 lib/ubsan.c:233
__ubsan_handle_shift_out_of_bounds+0x279/0x2a0 lib/ubsan.c:494
__vcc_connect net/atm/common.c:381 [inline]
vcc_connect.cold+0xe0/0x123 net/atm/common.c:498
pvc_bind+0x33f/0x460 net/atm/pvc.c:52
__sys_bind_socket net/socket.c:1945 [inline]
__sys_bind_socket net/socket.c:1937 [inline]
__sys_bind+0x1a9/0x260 net/socket.c:1976
__do_sys_bind net/socket.c:1981 [inline]
__se_sys_bind net/socket.c:1979 [inline]
__x64_sys_bind+0x72/0xb0 net/socket.c:1979
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f6a3099e0d9
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:00007fff44bcea08 EFLAGS: 00000246 ORIG_RAX: 0000000000000031
RAX: ffffffffffffffda RBX: 00007f6a30c25fa0 RCX: 00007f6a3099e0d9
RDX: 000000000000000c RSI: 0000200000000100 RDI: 0000000000000004
RBP: 00007f6a30a35024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f6a30c25fac R14: 00007f6a30c25fa0 R15: 00007f6a30c25fa0
</TASK>
---[ end trace ]---
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_ep_write(int fd, struct usb_raw_ep_io* io)
{
return ioctl(fd, USB_RAW_IOCTL_EP_WRITE, io);
}
static int usb_raw_ep_read(int fd, struct usb_raw_ep_io* io)
{
return ioctl(fd, USB_RAW_IOCTL_EP_READ, io);
}
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);
}
static int lookup_endpoint(int fd, uint8_t bEndpointAddress)
{
struct usb_device_index* index = lookup_usb_index(fd);
if (!index)
return -1;
if (index->iface_cur < 0)
return -1;
for (int ep = 0; ep < index->ifaces[index->iface_cur].eps_num; ep++)
if (index->ifaces[index->iface_cur].eps[ep].desc.bEndpointAddress == bEndpointAddress)
return index->ifaces[index->iface_cur].eps[ep].handle;
return -1;
}
#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 volatile long syz_usb_ep_write(volatile long a0, volatile long a1, volatile long a2, volatile long a3)
{
int fd = a0;
uint8_t ep = a1;
uint32_t len = a2;
char* data = (char*)a3;
int ep_handle = lookup_endpoint(fd, ep);
if (ep_handle < 0) {
return -1;
}
struct usb_raw_ep_io_data io_data;
io_data.inner.ep = ep_handle;
io_data.inner.flags = 0;
if (len > sizeof(io_data.data))
len = sizeof(io_data.data);
io_data.inner.length = len;
memcpy(&io_data.data[0], data, len);
int rv = usb_raw_ep_write(fd, (struct usb_raw_ep_io*)&io_data);
if (rv < 0) {
return rv;
}
sleep_ms(200);
return 0;
}
static volatile long syz_usb_ep_read(volatile long a0, volatile long a1, volatile long a2, volatile long a3)
{
int fd = a0;
uint8_t ep = a1;
uint32_t len = a2;
char* data = (char*)a3;
int ep_handle = lookup_endpoint(fd, ep);
if (ep_handle < 0) {
return -1;
}
struct usb_raw_ep_io_data io_data;
io_data.inner.ep = ep_handle;
io_data.inner.flags = 0;
if (len > sizeof(io_data.data))
len = sizeof(io_data.data);
io_data.inner.length = len;
int rv = usb_raw_ep_read(fd, (struct usb_raw_ep_io*)&io_data);
if (rv < 0) {
return rv;
}
memcpy(&data[0], &io_data.data[0], io_data.inner.length);
sleep_ms(200);
return 0;
}
uint64_t r[2] = {0xffffffffffffffff, 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 = 0x3 (8 bytes)
// dev_len: len = 0x40 (8 bytes)
// dev: ptr[inout, array[ANYUNION]] {
// array[ANYUNION] {
// union ANYUNION {
// ANYBLOB: buffer: {12 01 00 02 00 00 00 40 72 05 fe ca 00 01 00 00 00 01 09 02 2e 00 01 01 00 80 fa 09 04 00 00 04 ff 00 00 00 07 05 01 02 00 02 00 07 05 81 02 00 02 00 07 05 02 02 00 02 00 07 05 82 02 00 02} (length 0x3f)
// }
// }
// }
// conn_descs: nil
// ]
// returns fd_usb
memcpy((void*)0x200000000000, "... [truncated large byte array] ...", 63);
res = -1;
res = syz_usb_connect(/*speed=USB_SPEED_HIGH*/3, /*dev_len=*/0x40, /*dev=*/0x200000000000, /*conn_descs=*/0);
if (res != -1)
r[0] = res;
// syz_usb_ep_read arguments: [
// fd: fd_usb (resource)
// ep: int8 = 0x1 (1 bytes)
// len: len = 0x0 (8 bytes)
// data: nil
// ]
syz_usb_ep_read(/*fd=*/r[0], /*ep=*/1, /*len=*/0, /*data=*/0);
// syz_usb_ep_write arguments: [
// fd: fd_usb (resource)
// ep: int8 = 0x81 (1 bytes)
// len: len = 0x40 (8 bytes)
// data: ptr[in, buffer] {
// buffer: {91 01 00 00 00 11 22 33 44 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 0x40)
// }
// ]
memcpy((void*)0x200000000300, "... [truncated large byte array] ...", 64);
syz_usb_ep_write(/*fd=*/r[0], /*ep=*/0x81, /*len=*/0x40, /*data=*/0x200000000300);
// setns arguments: [
// fd: fd_namespace (resource)
// type: ns_type = 0x0 (8 bytes)
// ]
syscall(__NR_setns, /*fd=*/0xc9, /*type=*/0ul);
// socket arguments: [
// domain: socket_domain = 0x8 (8 bytes)
// type: socket_type = 0x2 (8 bytes)
// proto: int32 = 0x0 (4 bytes)
// ]
// returns sock
res = syscall(__NR_socket, /*domain=AF_ATMPVC*/8ul, /*type=SOCK_DGRAM*/2ul, /*proto=*/0);
if (res != -1)
r[1] = res;
// setsockopt arguments: [
// fd: sock (resource)
// level: int32 = 0x108 (4 bytes)
// optname: int32 = 0x42020054 (4 bytes)
// optval: ptr[in, buffer] {
// buffer: {01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00} (length 0x54)
// }
// optlen: len = 0x54 (8 bytes)
// ]
memcpy((void*)0x200000000000, "... [truncated large byte array] ...", 84);
syscall(__NR_setsockopt, /*fd=*/r[1], /*level=*/0x108, /*optname=*/0x42020054, /*optval=*/0x200000000000ul, /*optlen=*/0x54ul);
// bind arguments: [
// fd: sock (resource)
// addr: ptr[in, sockaddr_storage] {
// union sockaddr_storage {
// generic: sockaddr_storage_generic {
// sa_family: socket_domain = 0x8 (2 bytes)
// sa_data: buffer: {00 00 ff ff 01 00 fe ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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 0x7e)
// }
// }
// }
// addrlen: len = 0xc (8 bytes)
// ]
*(uint16_t*)0x200000000100 = 8;
memcpy((void*)0x200000000102, "... [truncated large byte array] ...", 126);
syscall(__NR_bind, /*fd=*/r[1], /*addr=*/0x200000000100ul, /*addrlen=*/0xcul);
return 0;
}
Reply: Based on the analysis of the provided bug report and the kernel source code, here is the assessment of the bug's security impact:
### Bug Mechanism
The bug is a shift-out-of-bounds (Undefined Behavior) in the ATM subsystem, specifically in `__vcc_connect` and `find_ci` within `net/atm/common.c`.
It is triggered when a user attempts to `bind()` an ATM socket to a device managed by the USB ATM framework (`drivers/usb/atm/usbatm.c`). During the initialization of a USB ATM device, the framework sets the device's VPI and VCI bit ranges to `ATM_CI_MAX`:
```c
atm_dev->ci_range.vpi_bits = ATM_CI_MAX;
atm_dev->ci_range.vci_bits = ATM_CI_MAX;
```
`ATM_CI_MAX` is defined as `-1` in `include/uapi/linux/atmdev.h`.
Later, when `bind()` is called, the kernel validates the requested VPI/VCI values using a bitwise shift:
```c
if ((vpi != ATM_VPI_UNSPEC && vpi != ATM_VPI_ANY &&
vpi >> dev->ci_range.vpi_bits) || ...
```
Because `vpi_bits` is `-1`, the expression evaluates to `vpi >> -1` (and similarly `1 << -1` in `find_ci`). Shifting by a negative exponent is undefined behavior in C, which is correctly caught by the Undefined Behavior Sanitizer (UBSAN).
### Security Impact
**Exploitable: False**
**Denial of Service: False**
While this is undefined behavior in C, on all major hardware architectures (x86, ARM, PowerPC, RISC-V, etc.), the CPU simply masks the shift count (e.g., by 31 or 63). For example, on x86, `vpi >> -1` becomes `vpi >> 31`. This does not cause a hardware trap, CPU exception, or kernel panic.
The result of this masked shift is just used in a boolean condition. It leads to a logical flaw where the kernel fails to properly restrict the maximum VPI/VCI values or fails to auto-assign a free VPI/VCI (`-EADDRINUSE`). However, these values are merely used as identifiers and are not used to index arrays or allocate memory. Therefore, it does not lead to memory corruption, out-of-bounds memory accesses, or information leaks. In a production kernel where UBSAN is disabled, this bug is completely benign and has no security implications.
**Accessible From Unprivileged Processes: True**
**Accessible From User Namespaces: True**
An unprivileged user can create an `AF_ATMPVC` socket and call `bind()`. The kernel only requires `CAP_NET_BIND_SERVICE` if the requested VCI is less than `ATM_NOT_RSV_VCI` (32). Binding to a VCI $\ge$ 32 is entirely unprivileged.
**Peripheral Trigger: True**
To reach this specific code path, an ATM device that sets `vpi_bits = -1` must be present. In the Linux kernel, only the `usbatm` framework does this. Therefore, the bug can be triggered if a malicious or legitimate USB ATM modem is physically plugged into the system (as simulated by the `syz_usb_connect` call in the reproducer).
|
| 6/2 |
2026/08/20 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 15770
output: 35
thoughts: 238
Thoughts: **Analyzing a UBSAN Shift-Out-of-Bounds Error**
Okay, here's what I'm seeing. UBSAN has flagged a shift-out-of-bounds error in `net/atm/common.c` at line 381. The report specifically calls out a negative shift exponent, which is a classic recipe for disaster. Let's dig in a bit.
The backtrace shows the culprit is probably originating from `__vcc_connect` which is called inline, and then flows up through `vcc_connect.cold`, `pvc_bind`, and eventually culminating in the `bind` system call. This suggests the issue is somewhere in the ATM virtual circuit connection setup. I need to examine the context around that line 381 in `net/atm/common.c`. I'll need to understand how these bit shifts are being used within `__vcc_connect` and figure out what's leading to a negative shift amount. This is likely an off-by-one or data validation error during the construction of some bitmask or flag. It's time to get into the code.
|
| 7/2 |
2026/08/20 00:54 |
tool |
read-file |
0m
Args: map[File:net/atm/common.c FirstLine:360 LineCount:50]
Results: map[Contents: 360: c++;
361: if (c >= 1 << vcc->dev->ci_range.vci_bits)
362: c = ATM_NOT_RSV_VCI;
363: }
364: if ((c == ATM_NOT_RSV_VCI || *vci != ATM_VCI_ANY) &&
365: *vpi == ATM_VPI_ANY) {
366: p++;
367: if (p >= 1 << vcc->dev->ci_range.vpi_bits)
368: p = 0;
369: }
370: } while (old_p != p || old_c != c);
371: return -EADDRINUSE;
372: }
373:
374: static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, short vpi,
375: int vci)
376: {
377: struct sock *sk = sk_atm(vcc);
378: int error;
379:
380: if ((vpi != ATM_VPI_UNSPEC && vpi != ATM_VPI_ANY &&
381: vpi >> dev->ci_range.vpi_bits) || (vci != ATM_VCI_UNSPEC &&
382: vci != ATM_VCI_ANY && vci >> dev->ci_range.vci_bits))
383: return -EINVAL;
384: if (vci > 0 && vci < ATM_NOT_RSV_VCI && !capable(CAP_NET_BIND_SERVICE))
385: return -EPERM;
386: error = -ENODEV;
387: if (!try_module_get(dev->ops->owner))
388: return error;
389: vcc->dev = dev;
390: write_lock_irq(&vcc_sklist_lock);
391: if (test_bit(ATM_DF_REMOVED, &dev->flags) ||
392: (error = find_ci(vcc, &vpi, &vci))) {
393: write_unlock_irq(&vcc_sklist_lock);
394: goto fail_module_put;
395: }
396: vcc->vpi = vpi;
397: vcc->vci = vci;
398: __vcc_insert_socket(sk);
399: write_unlock_irq(&vcc_sklist_lock);
400: switch (vcc->qos.aal) {
401: case ATM_AAL0:
402: error = atm_init_aal0(vcc);
403: vcc->stats = &dev->stats.aal0;
404: break;
405: case ATM_NO_AAL:
406: /* ATM_AAL5 is also used in the "0 for default" case */
407: vcc->qos.aal = ATM_AAL5;
408: fallthrough;
409: case ATM_AAL5:
]
|
| 8/2 |
2026/08/20 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 17185
output: 21
thoughts: 106
Thoughts: **Debugging a Tricky Shift Operation**
Okay, so the error message is clear: "shift exponent -1 is negative." That narrows it down considerably. My immediate thought is, the issue is happening on line 381, either with `vpi >> dev->ci_range.vpi_bits` or `vci >> dev->ci_range.vci_bits`. I know a negative shift exponent is a big red flag in bitwise operations. It *has* to mean that either `dev->ci_range.vpi_bits` or `dev->ci_range.vci_bits` is being evaluated as -1. The system doesn't *like* that, and rightly so. Time to go back and cross-check the definition of `struct atm_dev` and `ci_range` to see where this could possibly be coming from. Gotta trace back through the data structures and see how those bit fields are being initialized or modified. This should be interesting.
|
| 9/2 |
2026/08/20 00:54 |
tool |
codesearch-struct-layout |
0m
Args:
Results: map[Fields:[map[Name:ops OffsetBits:0 SizeBits:64] map[Name:type OffsetBits:64 SizeBits:64] map[Name:number OffsetBits:128 SizeBits:32] map[Name:dev_data OffsetBits:192 SizeBits:64] map[Name:phy_data OffsetBits:256 SizeBits:64] map[Name:flags OffsetBits:320 SizeBits:64] map[Name:esi OffsetBits:384 SizeBits:48] map[Name:ci_range OffsetBits:432 SizeBits:16] map[Name:stats OffsetBits:448 SizeBits:480] map[Name:signal OffsetBits:928 SizeBits:8] map[Name:link_rate OffsetBits:960 SizeBits:32] map[Name:refcnt OffsetBits:992 SizeBits:32] map[Name:proc_entry OffsetBits:1024 SizeBits:64] map[Name:proc_name OffsetBits:1088 SizeBits:64] map[Name:class_dev OffsetBits:1152 SizeBits:9792] map[Name:dev_list OffsetBits:10944 SizeBits:128]]]
|
| 10/2 |
2026/08/20 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 17861
output: 21
thoughts: 11
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Checking `ci_range` Type**
Alright, let's just make sure we're on the same page. Before diving too deep into the analysis, I need to confirm the fundamental data type of this `ci_range` variable. I need to know exactly how it's structured. Is it a list of tuples? A NumPy array? Perhaps a custom object with specific attributes? Understanding the underlying data structure is absolutely crucial for any meaningful manipulation or interpretation downstream. This basic check will prevent wasting time chasing assumptions that are incorrect. I also anticipate it will impact how any functions I call handle this variable.
|
| 11/2 |
2026/08/20 00:54 |
tool |
codesearch-definition-source |
0m
Args:
Results: map[SourceCode: 108: struct atm_dev {
109: const struct atmdev_ops *ops; /* device operations; NULL if unused */
110: const char *type; /* device type name */
111: int number; /* device index */
112: void *dev_data; /* per-device data */
113: void *phy_data; /* private PHY data */
114: unsigned long flags; /* device flags (ATM_DF_*) */
115: unsigned char esi[ESI_LEN]; /* ESI ("MAC" addr) */
116: struct atm_cirange ci_range; /* VPI/VCI range */
117: struct k_atm_dev_stats stats; /* statistics */
118: char signal; /* signal status (ATM_PHY_SIG_*) */
119: int link_rate; /* link rate (default: OC3) */
120: refcount_t refcnt; /* reference count */
121: #ifdef CONFIG_PROC_FS
122: struct proc_dir_entry *proc_entry; /* proc entry */
123: char *proc_name; /* proc entry name */
124: #endif
125: struct device class_dev; /* sysfs device */
126: struct list_head dev_list; /* linkage */
127: };
SourceFile:include/linux/atmdev.h]
|
| 12/2 |
2026/08/20 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 18454
output: 22
thoughts: 11
Thoughts: Here's a summary of my thought process, as if I were considering the given code:
**Checking `struct atm_cirange`**
Okay, time to dive into `struct atm_cirange`. I need to refresh my memory on what this structure is all about in the context of ATM. Given my experience, I'm already visualizing how it relates to connection identifiers, potentially the range of Virtual Path Identifiers (VPIs) and Virtual Channel Identifiers (VCIs) being allocated, or perhaps some quality of service (QoS) parameter configurations within a particular ATM network interface or signaling message. I'm assuming, of course, that this is related to some ATM adaptation layer, maybe AAL5 or AAL0, or something else. I want to quickly evaluate its fields; are they standard or are there customizations involved? Are there any obvious potential issues like improper alignment or data type size mismatches that might cause problems down the line? I need to look for any potential for integer overflows, especially if it's related to range definitions. I'll need to check how it's used in the code, what functions utilize this structure. Specifically, I'm thinking about the ATM signaling protocol and the role that this structure might play in ATM connection management. What specific aspects of ATM operation does this structure touch upon? This seems important, so let's start digging deeper.
|
| 13/2 |
2026/08/20 00:54 |
tool |
codesearch-definition-source |
0m
Args:
Results: map[SourceCode: 147: struct atm_cirange {
148: signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */
149: signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */
150: };
SourceFile:include/uapi/linux/atmdev.h]
|
| 14/2 |
2026/08/20 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 18897
output: 21
thoughts: 88
Thoughts: **My Analysis of a Potential Bit-Shifting Vulnerability**
Okay, so I'm looking at this code and immediately something jumps out at me. We're dealing with `vpi_bits` and `vci_bits`, and they can apparently be set to `ATM_CI_MAX`. Now, `ATM_CI_MAX` is defined as -1, which is a red flag. The issue arises when we get to this line: `vpi >> dev->ci_range.vpi_bits`. If `dev->ci_range.vpi_bits` (which can be derived from the previously mentioned `vpi_bits`) is -1, we're performing a right bit-shift by a *negative* amount, specifically `vpi >> -1`. That's a classic shift-out-of-bounds scenario, which could lead to all sorts of unexpected behavior, memory corruption, or even a denial-of-service, depending on the compiler's behavior in this undefined scenario. My next step is definitely to double-check that `ATM_CI_MAX` definition. We need to confirm that negative value and how it propagates to the right-shift operation.
|
| 15/2 |
2026/08/20 00:54 |
tool |
grepper |
0m
Args: map[Expression:#define ATM_CI_MAX]
Results: map[Output:include/uapi/linux/atmdev.h=138=struct atm_iobuf {
--
include/uapi/linux/atmdev.h-144-
include/uapi/linux/atmdev.h:145:#define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */
include/uapi/linux/atmdev.h-146-
]
|
| 16/2 |
2026/08/20 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 19368
output: 20
thoughts: 512
Thoughts: **Analyzing a Potential USB ATM Driver Bug**
Okay, so `ATM_CI_MAX` is -1. That's immediately interesting. If either `vpi_bits` or `vci_bits` somehow gets set to that value, then any shift operation involving it is going to be invalid, leading to who knows what kind of problems. I need to figure out how `ci_range` is being initialized; that's the key.
Right, the reproducer uses `syz_usb_connect`. Hmm, that suggests a USB device. The reproducer also mentions ATM, so that means we're dealing with ATM devices over USB. Devices like `usbatm`, `cxacru`, `ueagle-atm`, or `speedtch` come to mind. I need to verify this assumption.
Let's dig into the reproducer's USB device descriptor. I need to look at things like `bDeviceClass`, `bDeviceSubClass`, and `bDeviceProtocol` to determine the exact device.
Okay, let's see how the reproducer actually sets up the device.
The reproducer shows:
```c
// syz_usb_connect arguments: [
// speed: usb_device_speed = 0x3 (8 bytes)
// dev_len: len = 0x40 (8 bytes)
// dev: ptr[inout, array[ANYUNION]] {
// array[ANYUNION] {
// union ANYUNION {
// ANYBLOB: buffer: {12 01 00 02 00 00 00 40 72 05 fe ca 00 01 00 00 00 01 09 02 2e 00 01 01 00 80 fa 09 04 00 00 04 ff 00 00 00 07 05 01 02 00 02 00 07 05 81 02 00 02 00 07 05 02 02 00 02 00 07 05 82 02 00 02} (length 0x3f)
// }
// }
// }
```
That `72 05 fe ca` sequence is the vendor/product ID: `0x0572` and `0xcafe`, respectively. Now I need to check the drivers that are registered for this particular vendor and product. That's where I'll find out whether my initial hypothesis about this being an ATM device is correct, and I can start to understand the relevant code path and how `ci_range` is being set.
|
| 17/2 |
2026/08/20 00:55 |
tool |
grepper |
0m
Args:
Results: map[Output:drivers/gpu/drm/amd/include/asic_reg/dce/dce_12_0_offset.h-3577-#define mmDCP0_GRPH_SURFACE_ADDRESS_HIGH_INUSE_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dce/dce_12_0_offset.h:3578:#define mmDCP0_GRPH_COMPRESS_SURFACE_ADDRESS 0x0572
drivers/gpu/drm/amd/include/asic_reg/dce/dce_12_0_offset.h-3579-#define mmDCP0_GRPH_COMPRESS_SURFACE_ADDRESS_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_2_0_0_offset.h-1981-#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_2_0_0_offset.h:1982:#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_2_0_0_offset.h-1983-#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_2_1_0_offset.h-1943-#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_2_1_0_offset.h:1944:#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_2_1_0_offset.h-1945-#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_0_0_offset.h-1903-#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_0_0_offset.h:1904:#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_0_0_offset.h-1905-#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_0_1_offset.h-1895-#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_0_1_offset.h:1896:#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_0_1_offset.h-1897-#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_0_2_offset.h-1875-#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_0_2_offset.h:1876:#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_0_2_offset.h-1877-#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_0_3_offset.h-1672-#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_0_3_offset.h:1673:#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_0_3_offset.h-1674-#define mmDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_2_offset.h-2300-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_2_offset.h:2301:#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_2_offset.h-2302-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_4_offset.h-3215-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_4_offset.h:3216:#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_4_offset.h-3217-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_5_offset.h-2059-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_5_offset.h:2060:#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_5_offset.h-2061-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_6_offset.h-2520-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_6_offset.h:2521:#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_6_offset.h-2522-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_2_0_offset.h-1879-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_2_0_offset.h:1880:#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_2_0_offset.h-1881-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_2_1_offset.h-1879-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_2_1_offset.h:1880:#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_2_1_offset.h-1881-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_5_0_offset.h-2999-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_5_0_offset.h:3000:#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_5_0_offset.h-3001-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_5_1_offset.h-2978-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_5_1_offset.h:2979:#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_5_1_offset.h-2980-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_6_0_offset.h-2091-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_6_0_offset.h:2092:#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_6_0_offset.h-2093-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_1_0_offset.h-1895-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_1_0_offset.h:1896:#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_1_0_offset.h-1897-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_1_0_offset.h-6803-#define regMPCC_MCM1_MPCC_MCM_1DLUT_RAMB_START_BASE_CNTL_G_BASE_IDX 3
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_1_0_offset.h:6804:#define regMPCC_MCM1_MPCC_MCM_1DLUT_RAMB_START_BASE_CNTL_R 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_1_0_offset.h-6805-#define regMPCC_MCM1_MPCC_MCM_1DLUT_RAMB_START_BASE_CNTL_R_BASE_IDX 3
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_0_offset.h-4534-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_0_offset.h:4535:#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_0_offset.h-4536-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_0_offset.h-16123-#define regMPCC_MCM1_MPCC_MCM_1DLUT_RAMB_START_BASE_CNTL_G_BASE_IDX 3
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_0_offset.h:16124:#define regMPCC_MCM1_MPCC_MCM_1DLUT_RAMB_START_BASE_CNTL_R 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_0_offset.h-16125-#define regMPCC_MCM1_MPCC_MCM_1DLUT_RAMB_START_BASE_CNTL_R_BASE_IDX 3
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_1_offset.h-2490-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_HI32_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_1_offset.h:2491:#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_1_offset.h-2492-#define regDCN_VM_CONTEXT3_PAGE_TABLE_START_ADDR_LO32_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_1_offset.h-7722-#define regMPCC_MCM1_MPCC_MCM_1DLUT_RAMB_START_BASE_CNTL_G_BASE_IDX 3
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_1_offset.h:7723:#define regMPCC_MCM1_MPCC_MCM_1DLUT_RAMB_START_BASE_CNTL_R 0x0572
drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_1_offset.h-7724-#define regMPCC_MCM1_MPCC_MCM_1DLUT_RAMB_START_BASE_CNTL_R_BASE_IDX 3
--
drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_3_0_offset.h-12046-#define mmSDMA3_RLC0_MIDCMD_DATA1_BASE_IDX 2
drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_3_0_offset.h:12047:#define mmSDMA3_RLC0_MIDCMD_DATA2 0x0572
drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_3_0_offset.h-12048-#define mmSDMA3_RLC0_MIDCMD_DATA2_BASE_IDX 2
--
drivers/gpu/drm/amd/include/asic_reg/gmc/gmc_6_0_d.h-1253-#define mmVM_INVALIDATE_RESPONSE 0x051F
drivers/gpu/drm/amd/include/asic_reg/gmc/gmc_6_0_d.h:1254:#define mmVM_L2_BANK_SELECT_MASKA 0x0572
drivers/gpu/drm/amd/include/asic_reg/gmc/gmc_6_0_d.h-1255-#define mmVM_L2_BANK_SELECT_MASKB 0x0573
--
drivers/gpu/drm/amd/include/asic_reg/mmhub/mmhub_4_1_0_offset.h-907-#define regMMVM_CONTEXT13_CNTL_BASE_IDX 0
drivers/gpu/drm/amd/include/asic_reg/mmhub/mmhub_4_1_0_offset.h:908:#define regMMVM_CONTEXT14_CNTL 0x0572
drivers/gpu/drm/amd/include/asic_reg/mmhub/mmhub_4_1_0_offset.h-909-#define regMMVM_CONTEXT14_CNTL_BASE_IDX 0
--
drivers/gpu/drm/amd/include/asic_reg/mmhub/mmhub_9_4_1_offset.h-2475-#define mmMMEA2_ADDRDEC0_COL_SEL_LO_CS01_BASE_IDX 1
drivers/gpu/drm/amd/include/asic_reg/mmhub/mmhub_9_4_1_offset.h:2476:#define mmMMEA2_ADDRDEC0_COL_SEL_LO_CS23 0x0572
drivers/gpu/drm/amd/include/asic_reg/mmhub/mmhub_9_4_1_offset.h-2477-#define mmMMEA2_ADDRDEC0_COL_SEL_LO_CS23_BASE_IDX 1
--
drivers/gpu/drm/amd/include/asic_reg/vcn/vcn_4_0_3_offset.h-1362-#define regMMSCH_GPUIOV_ACTIVE_FCNS_0_BASE_IDX 1
drivers/gpu/drm/amd/include/asic_reg/vcn/vcn_4_0_3_offset.h:1363:#define regMMSCH_GPUIOV_ACTIVE_FCN_ID_0 0x0572
drivers/gpu/drm/amd/include/asic_reg/vcn/vcn_4_0_3_offset.h-1364-#define regMMSCH_GPUIOV_ACTIVE_FCN_ID_0_BASE_IDX 1
--
drivers/hid/hid-debug.c=39=static const struct hid_usage_entry hid_usage_table[] = {
--
drivers/hid/hid-debug.c-1943- { 0x20, 0x0571, "DataFieldGenericReportItemPositionIndex" },
drivers/hid/hid-debug.c:1944: { 0x20, 0x0572, "DataFieldGenericFirmwareVARTYPE" },
drivers/hid/hid-debug.c-1945- { 0x20, 0x0573, "DataFieldGenericUnitofMeasure" },
--
drivers/media/platform/renesas/rcar-csi2.c=1358=static int rcsi2_d_phy_setting_v4h(struct rcar_csi2 *priv, int mbps)
--
drivers/media/platform/renesas/rcar-csi2.c-1479- 0x0504, 0x050c, 0x0514, 0x051c, 0x0523, 0x0529, 0x0530, 0x053a,
drivers/media/platform/renesas/rcar-csi2.c:1480: 0x0545, 0x054a, 0x0550, 0x055a, 0x0565, 0x0569, 0x0572, 0x057a,
drivers/media/platform/renesas/rcar-csi2.c-1481- 0x0585, 0x0589, 0x0590, 0x059a, 0x05a4, 0x05ac, 0x05b4, 0x05bc,
--
drivers/media/platform/renesas/rcar-vin/rcar-dma.c=194=static const struct vin_coeff vin_coeff_set[] = {
--
drivers/media/platform/renesas/rcar-vin/rcar-dma.c-370- 0x3f305c62, 0x3f2fc818, 0x0612689d,
drivers/media/platform/renesas/rcar-vin/rcar-dma.c:371: 0x3f508069, 0x3f3fc011, 0x05728496,
drivers/media/platform/renesas/rcar-vin/rcar-dma.c-372- 0x3f80a072, 0x3f4fc00a, 0x04d28c90,
--
drivers/media/platform/renesas/rcar-vin/rcar-dma.c-380- 0x3f607061, 0x3f1fd41d, 0x06024c97,
drivers/media/platform/renesas/rcar-vin/rcar-dma.c:381: 0x3f909068, 0x3f2fcc16, 0x05726490,
drivers/media/platform/renesas/rcar-vin/rcar-dma.c-382- 0x3fc0b070, 0x3f3fc80f, 0x04f26c8a,
--
drivers/media/platform/ti/vpe/sc_coeff.h=28=static const u16 scaler_hs_coeffs[13][SC_NUM_PHASES * 2 * SC_H_NUM_TAPS] = {
--
drivers/media/platform/ti/vpe/sc_coeff.h-446- 0x004C, 0x1F30, 0x00C9, 0x0584, 0x0321, 0x1F20, 0x1FF6,
drivers/media/platform/ti/vpe/sc_coeff.h:447: 0x004E, 0x1F39, 0x00A4, 0x0572, 0x034D, 0x1F2A, 0x1FEC,
drivers/media/platform/ti/vpe/sc_coeff.h-448- 0x004F, 0x1F43, 0x0080, 0x055E, 0x037A, 0x1F34, 0x1FE2,
--
drivers/media/platform/ti/vpe/sc_coeff.h-462- 0x1FE2, 0x1F34, 0x037A, 0x055E, 0x0080, 0x1F43, 0x004F,
drivers/media/platform/ti/vpe/sc_coeff.h:463: 0x1FEC, 0x1F2A, 0x034D, 0x0572, 0x00A4, 0x1F39, 0x004E,
drivers/media/platform/ti/vpe/sc_coeff.h-464- 0x1FF6, 0x1F20, 0x0321, 0x0584, 0x00C9, 0x1F30, 0x004C,
--
drivers/media/platform/ti/vpe/sc_coeff.h-479- 0x004C, 0x1F30, 0x00C9, 0x0584, 0x0321, 0x1F20, 0x1FF6,
drivers/media/platform/ti/vpe/sc_coeff.h:480: 0x004E, 0x1F39, 0x00A4, 0x0572, 0x034D, 0x1F2A, 0x1FEC,
drivers/media/platform/ti/vpe/sc_coeff.h-481- 0x004F, 0x1F43, 0x0080, 0x055E, 0x037A, 0x1F34, 0x1FE2,
--
drivers/media/platform/ti/vpe/sc_coeff.h-495- 0x1FE2, 0x1F34, 0x037A, 0x055E, 0x0080, 0x1F43, 0x004F,
drivers/media/platform/ti/vpe/sc_coeff.h:496: 0x1FEC, 0x1F2A, 0x034D, 0x0572, 0x00A4, 0x1F39, 0x004E,
drivers/media/platform/ti/vpe/sc_coeff.h-497- 0x1FF6, 0x1F20, 0x0321, 0x0584, 0x00C9, 0x1F30, 0x004C,
--
drivers/media/rc/mceusb.c-162-#define VENDOR_TIVO 0x105a
drivers/media/rc/mceusb.c:163:#define VENDOR_CONEXANT 0x0572
drivers/media/rc/mceusb.c-164-#define VENDOR_TWISTEDMELON 0x2596
--
drivers/media/usb/cx231xx/cx231xx-cards.c=994=struct usb_device_id cx231xx_id_table[] = {
--
drivers/media/usb/cx231xx/cx231xx-cards.c-998- .driver_info = CX231XX_BOARD_PV_XCAPTURE_USB},
drivers/media/usb/cx231xx/cx231xx-cards.c:999: {USB_DEVICE(0x0572, 0x5A3C),
drivers/media/usb/cx231xx/cx231xx-cards.c-1000- .driver_info = CX231XX_BOARD_UNKNOWN},
drivers/media/usb/cx231xx/cx231xx-cards.c:1001: {USB_DEVICE(0x0572, 0x58A2),
drivers/media/usb/cx231xx/cx231xx-cards.c-1002- .driver_info = CX231XX_BOARD_CNXT_CARRAERA},
drivers/media/usb/cx231xx/cx231xx-cards.c:1003: {USB_DEVICE(0x0572, 0x58A1),
drivers/media/usb/cx231xx/cx231xx-cards.c-1004- .driver_info = CX231XX_BOARD_CNXT_SHELBY},
drivers/media/usb/cx231xx/cx231xx-cards.c:1005: {USB_DEVICE(0x0572, 0x58A4),
drivers/media/usb/cx231xx/cx231xx-cards.c-1006- .driver_info = CX231XX_BOARD_CNXT_RDE_253S},
drivers/media/usb/cx231xx/cx231xx-cards.c:1007: {USB_DEVICE(0x0572, 0x58A5),
drivers/media/usb/cx231xx/cx231xx-cards.c-1008- .driver_info = CX231XX_BOARD_CNXT_RDU_253S},
drivers/media/usb/cx231xx/cx231xx-cards.c:1009: {USB_DEVICE(0x0572, 0x58A6),
drivers/media/usb/cx231xx/cx231xx-cards.c-1010- .driver_info = CX231XX_BOARD_CNXT_VIDEO_GRABBER},
drivers/media/usb/cx231xx/cx231xx-cards.c:1011: {USB_DEVICE(0x0572, 0x589E),
drivers/media/usb/cx231xx/cx231xx-cards.c-1012- .driver_info = CX231XX_BOARD_CNXT_RDE_250},
drivers/media/usb/cx231xx/cx231xx-cards.c:1013: {USB_DEVICE(0x0572, 0x58A0),
drivers/media/usb/cx231xx/cx231xx-cards.c-1014- .driver_info = CX231XX_BOARD_CNXT_RDU_250},
--
drivers/media/usb/dvb-usb-v2/dvbsky.c=759=static const struct usb_device_id dvbsky_id_table[] = {
drivers/media/usb/dvb-usb-v2/dvbsky.c:760: { DVB_USB_DEVICE(0x0572, 0x6831,
drivers/media/usb/dvb-usb-v2/dvbsky.c-761- &dvbsky_s960_props, "DVBSky S960/S860", RC_MAP_DVBSKY) },
drivers/media/usb/dvb-usb-v2/dvbsky.c:762: { DVB_USB_DEVICE(0x0572, 0x960c,
drivers/media/usb/dvb-usb-v2/dvbsky.c-763- &dvbsky_s960c_props, "DVBSky S960CI", RC_MAP_DVBSKY) },
drivers/media/usb/dvb-usb-v2/dvbsky.c:764: { DVB_USB_DEVICE(0x0572, 0x680c,
drivers/media/usb/dvb-usb-v2/dvbsky.c-765- &dvbsky_t680c_props, "DVBSky T680CI", RC_MAP_DVBSKY) },
drivers/media/usb/dvb-usb-v2/dvbsky.c:766: { DVB_USB_DEVICE(0x0572, 0x0320,
drivers/media/usb/dvb-usb-v2/dvbsky.c-767- &dvbsky_t330_props, "DVBSky T330", RC_MAP_DVBSKY) },
--
drivers/media/usb/gspca/conex.c=927=static const struct usb_device_id device_table[] = {
drivers/media/usb/gspca/conex.c:928: {USB_DEVICE(0x0572, 0x0041)},
drivers/media/usb/gspca/conex.c-929- {}
--
drivers/net/ethernet/broadcom/tg3.h-169-#define CHIPREV_ID_5719_A0 0x05719000
drivers/net/ethernet/broadcom/tg3.h:170:#define CHIPREV_ID_5720_A0 0x05720000
drivers/net/ethernet/broadcom/tg3.h-171-#define CHIPREV_ID_5762_A0 0x05762000
--
drivers/net/usb/cx82310_eth.c=352=static const struct usb_device_id products[] = {
drivers/net/usb/cx82310_eth.c-353- {
drivers/net/usb/cx82310_eth.c:354: USB_DEVICE_CLASS(0x0572, 0xcb01, 0xff, 0, 0),
drivers/net/usb/cx82310_eth.c-355- .driver_info = (unsigned long) &cx82310_info
--
drivers/net/wireless/intersil/p54/p54usb.c=43=static const struct usb_device_id p54u_table[] = {
--
drivers/net/wireless/intersil/p54/p54usb.c-79- {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */
drivers/net/wireless/intersil/p54/p54usb.c:80: {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */
drivers/net/wireless/intersil/p54/p54usb.c:81: {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */
drivers/net/wireless/intersil/p54/p54usb.c-82- {USB_DEVICE(0x06a9, 0x000e)}, /* Westell 802.11g USB (A90-211WG-01) */
--
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/reg.h-292-#define REG_TSFTR 0x0560
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/reg.h:293:#define REG_CTWND 0x0572
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/reg.h-294-#define REG_PSTIMER 0x0580
--
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c=413=static const u16 deskew_fine_mem[] = {
--
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c-424- 0x0545, 0x054a, 0x0550, 0x055a,
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c:425: 0x0565, 0x0569, 0x0572, 0x057a,
drivers/staging/media/ipu7/ipu7-isys-csi-phy.c-426- 0x0585, 0x0589, 0x0590, 0x059a,
--
drivers/usb/atm/cxacru.c=1285=static const struct usb_device_id cxacru_usb_ids[] = {
drivers/usb/atm/cxacru.c-1286- { /* V = Conexant P = ADSL modem (Euphrates project) */
drivers/usb/atm/cxacru.c:1287: USB_DEVICE(0x0572, 0xcafe), .driver_info = (unsigned long) &cxacru_cafe
drivers/usb/atm/cxacru.c-1288- },
drivers/usb/atm/cxacru.c-1289- { /* V = Conexant P = ADSL modem (Hasbani project) */
drivers/usb/atm/cxacru.c:1290: USB_DEVICE(0x0572, 0xcb00), .driver_info = (unsigned long) &cxacru_cb00
drivers/usb/atm/cxacru.c-1291- },
drivers/usb/atm/cxacru.c-1292- { /* V = Conexant P = ADSL modem */
drivers/usb/atm/cxacru.c:1293: USB_DEVICE(0x0572, 0xcb01), .driver_info = (unsigned long) &cxacru_cb00
drivers/usb/atm/cxacru.c-1294- },
drivers/usb/atm/cxacru.c-1295- { /* V = Conexant P = ADSL modem (Well PTI-800) */
drivers/usb/atm/cxacru.c:1296: USB_DEVICE(0x0572, 0xcb02), .driver_info = (unsigned long) &cxacru_cb00
drivers/usb/atm/cxacru.c-1297- },
drivers/usb/atm/cxacru.c-1298- { /* V = Conexant P = ADSL modem */
drivers/usb/atm/cxacru.c:1299: USB_DEVICE(0x0572, 0xcb06), .driver_info = (unsigned long) &cxacru_cb00
drivers/usb/atm/cxacru.c-1300- },
drivers/usb/atm/cxacru.c-1301- { /* V = Conexant P = ADSL modem (ZTE ZXDSL 852) */
drivers/usb/atm/cxacru.c:1302: USB_DEVICE(0x0572, 0xcb07), .driver_info = (unsigned long) &cxacru_cb00
drivers/usb/atm/cxacru.c-1303- },
--
drivers/usb/class/cdc-acm.c=1763=static const struct usb_device_id acm_ids[] = {
--
drivers/usb/class/cdc-acm.c-1830- },
drivers/usb/class/cdc-acm.c:1831: { USB_DEVICE(0x0572, 0x1321), /* Conexant USB MODEM CX93010 */
drivers/usb/class/cdc-acm.c-1832- .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
drivers/usb/class/cdc-acm.c-1833- },
drivers/usb/class/cdc-acm.c:1834: { USB_DEVICE(0x0572, 0x1324), /* Conexant USB MODEM RD02-D400 */
drivers/usb/class/cdc-acm.c-1835- .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
drivers/usb/class/cdc-acm.c-1836- },
drivers/usb/class/cdc-acm.c:1837: { USB_DEVICE(0x0572, 0x1328), /* Shiro / Aztech USB MODEM UM-3100 */
drivers/usb/class/cdc-acm.c-1838- .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
drivers/usb/class/cdc-acm.c-1839- },
drivers/usb/class/cdc-acm.c:1840: { USB_DEVICE(0x0572, 0x1349), /* Hiro (Conexant) USB MODEM H50228 */
drivers/usb/class/cdc-acm.c-1841- .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
--
drivers/usb/class/cdc-acm.c-1872-
drivers/usb/class/cdc-acm.c:1873: { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */
drivers/usb/class/cdc-acm.c-1874- .driver_info = NO_UNION_NORMAL, /* union descriptor misplaced on
--
drivers/usb/class/cdc-acm.c-1879- },
drivers/usb/class/cdc-acm.c:1880: { USB_DEVICE(0x0572, 0x1340), /* Conexant CX93010-2x UCMxx */
drivers/usb/class/cdc-acm.c-1881- .driver_info = NO_UNION_NORMAL,
--
fs/hfsplus/tables.c=15=u16 hfsplus_case_fold_table[] = {
--
fs/hfsplus/tables.c-209- 0x0568, 0x0569, 0x056A, 0x056B, 0x056C, 0x056D, 0x056E, 0x056F,
fs/hfsplus/tables.c:210: /* 4 */ 0x0570, 0x0571, 0x0572, 0x0573, 0x0574, 0x0575, 0x0576, 0x0577,
fs/hfsplus/tables.c-211- 0x0578, 0x0579, 0x057A, 0x057B, 0x057C, 0x057D, 0x057E, 0x057F,
--
fs/hfsplus/tables.c-215- 0x0568, 0x0569, 0x056A, 0x056B, 0x056C, 0x056D, 0x056E, 0x056F,
fs/hfsplus/tables.c:216: /* 7 */ 0x0570, 0x0571, 0x0572, 0x0573, 0x0574, 0x0575, 0x0576, 0x0577,
fs/hfsplus/tables.c-217- 0x0578, 0x0579, 0x057A, 0x057B, 0x057C, 0x057D, 0x057E, 0x057F,
--
fs/hfsplus/tables.c=1072=u16 hfsplus_compose_table[] = {
--
fs/hfsplus/tables.c-1082- 0x05b9, 0x050e, 0x05bc, 0x0512, 0x05bf, 0x0540, 0x05c1, 0x0548,
fs/hfsplus/tables.c:1083: 0x05c2, 0x054c, 0x093c, 0x0550, 0x09bc, 0x0568, 0x09be, 0x0572,
fs/hfsplus/tables.c-1084- 0x09d7, 0x0576, 0x0a3c, 0x057a, 0x0b3c, 0x0586, 0x0b3e, 0x058e,
--
include/media/dvb-usb-ids.h-37-#define USB_VID_COMPRO_UNK 0x145f
include/media/dvb-usb-ids.h:38:#define USB_VID_CONEXANT 0x0572
include/media/dvb-usb-ids.h-39-#define USB_VID_CYPRESS 0x04b4
--
sound/usb/quirks.c=2201=static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
--
sound/usb/quirks.c-2276- QUIRK_FLAG_GET_SAMPLE_RATE),
sound/usb/quirks.c:2277: DEVICE_FLG(0x0572, 0x1b08, /* Conexant Systems (Rockwell), Inc. */
sound/usb/quirks.c-2278- QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE),
sound/usb/quirks.c:2279: DEVICE_FLG(0x0572, 0x1b09, /* Conexant Systems (Rockwell), Inc. */
sound/usb/quirks.c-2280- QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE),
]
|
| 18/2 |
2026/08/20 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 32697
output: 40
thoughts: 44
Thoughts: Here's my thinking process:
**Diving into the cxacru Driver**
Okay, so I see a reference in `drivers/usb/atm/cxacru.c` to a specific USB device ID, `0x0572` and `0xcafe`. That tells me this file is likely handling the driver for a particular device. My immediate thought is to check `cxacru.c` itself. I need to understand what this driver does, how it interacts with the USB subsystem, and specifically, what hardware this device ID corresponds to. Knowing the vendor and product ID is a good starting point, but I need to analyze the code to truly understand the device's functionality within the ATM (Asynchronous Transfer Mode) context. I’ll be looking for things like initialization routines, endpoint configuration, data transfer mechanisms, and error handling. I want to build a mental model of how this driver fits into the larger USB and ATM networking ecosystem. Time to dig in!
|
| 19/2 |
2026/08/20 00:55 |
tool |
read-file |
0m
Args: map[File:drivers/usb/atm/cxacru.c FirstLine:1280 LineCount:20]
Results: map[Contents:1280: .pll_f_clk = 0x5,
1281: .pll_b_clk = 0x3,
1282: .boot_rom_patch = 0,
1283: };
1284:
1285: static const struct usb_device_id cxacru_usb_ids[] = {
1286: { /* V = Conexant P = ADSL modem (Euphrates project) */
1287: USB_DEVICE(0x0572, 0xcafe), .driver_info = (unsigned long) &cxacru_cafe
1288: },
1289: { /* V = Conexant P = ADSL modem (Hasbani project) */
1290: USB_DEVICE(0x0572, 0xcb00), .driver_info = (unsigned long) &cxacru_cb00
1291: },
1292: { /* V = Conexant P = ADSL modem */
1293: USB_DEVICE(0x0572, 0xcb01), .driver_info = (unsigned long) &cxacru_cb00
1294: },
1295: { /* V = Conexant P = ADSL modem (Well PTI-800) */
1296: USB_DEVICE(0x0572, 0xcb02), .driver_info = (unsigned long) &cxacru_cb00
1297: },
1298: { /* V = Conexant P = ADSL modem */
1299: USB_DEVICE(0x0572, 0xcb06), .driver_info = (unsigned long) &cxacru_cb00
]
|
| 20/2 |
2026/08/20 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 33467
output: 29
thoughts: 50
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience, presented in the first person:
**Analyzing the USB ATM Driver Initialization**
Alright, so this reproducer is clever. It's essentially crafting a dummy USB device designed to hook up with that `cxacru` driver. Classic test case setup. The key here is, we're talking about the `cxacru` driver, which, as a USB ATM driver, has a very specific set of requirements for initialization. Now, the next logical step is to dive into how `cxacru` goes about setting up its `ci_range` variable. I need to understand its strategy for this initialization. I'll need to look at how the code decides what resources to allocate or which ranges to define for ATM communication. This is where the magic (or the bugs!) typically manifest. Let's see how they handle that.
|
| 21/2 |
2026/08/20 00:55 |
tool |
grepper |
0m
Args: map[Expression:ci_range PathPrefix:drivers/usb/atm/]
Results: map[Output:drivers/usb/atm/usbatm.c=901=static int usbatm_atm_init(struct usbatm_data *instance)
--
drivers/usb/atm/usbatm.c-919-
drivers/usb/atm/usbatm.c:920: atm_dev->ci_range.vpi_bits = ATM_CI_MAX;
drivers/usb/atm/usbatm.c:921: atm_dev->ci_range.vci_bits = ATM_CI_MAX;
drivers/usb/atm/usbatm.c-922- atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
]
|
| 22/2 |
2026/08/20 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 33909
output: 39
thoughts: 291
Thoughts: **ATM Device Initialization: A Curious Case of Bit Shifts**
Okay, here's what's running through my head. I'm looking at this `usbatm_atm_init` function, and it's setting `atm_dev->ci_range.vpi_bits` and `atm_dev->ci_range.vci_bits` to `ATM_CI_MAX`. Now, I know `ATM_CI_MAX` is defined as -1. That's immediately making me raise an eyebrow.
Then, I see how `__vcc_connect` in `net/atm/common.c` uses those values:
```c
if ((vpi != ATM_VPI_UNSPEC && vpi != ATM_VPI_ANY &&
vpi >> dev->ci_range.vpi_bits) || (vci != ATM_VCI_UNSPEC &&
vci != ATM_VCI_ANY && vci >> dev->ci_range.vci_bits))
return -EINVAL;
```
If `vpi_bits` ends up being -1, the code attempts to bit-shift `vpi` right by -1, which is, obviously, a shift-out-of-bounds operation. That's a textbook recipe for undefined behavior, which is concerning.
But wait a minute... Maybe I'm missing something. Perhaps `ATM_CI_MAX` being -1 isn't meant literally as a negative bit count. Maybe, just maybe, it represents something else. It *is* defined as "maximum range of VPI/VCI". Perhaps the code is interpreting this -1 value as a special marker for the maximum number of bits available for VPI and VCI, respectively. Could this mean 8 bits for VPI and 16 bits for VCI? That would be a reasonable interpretation in an ATM context.
I need to quickly check the `include/uapi/linux/atmdev.h` header to confirm this interpretation and avoid any misunderstanding of the intended behavior.
|
| 23/2 |
2026/08/20 00:55 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/atmdev.h FirstLine:138 LineCount:20]
Results: map[Contents: 138: struct atm_iobuf {
139: int length;
140: void __user *buffer;
141: };
142:
143: /* for ATM_GETCIRANGE / ATM_SETCIRANGE */
144:
145: #define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */
146:
147: struct atm_cirange {
148: signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */
149: signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */
150: };
151:
152: /* for ATM_SETSC; actually taken from the ATM_VF number space */
153:
154: #define ATM_SC_RX 1024 /* enable RX single-copy */
155: #define ATM_SC_TX 2048 /* enable TX single-copy */
156:
157: #define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out
]
|
| 24/2 |
2026/08/20 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 35033
output: 27
thoughts: 230
Thoughts: **Analyzing the ATM VPI/VCI Range Calculation**
Okay, so `ATM_CI_MAX` is definitely defined as -1. Right. And -1 for `vpi_bits` signifies the maximum value, which in this case is 8. But here's the problem: `__vcc_connect` uses `vpi >> dev->ci_range.vpi_bits`. If `vpi_bits` is -1, that becomes `vpi >> -1`. C doesn't define what that does and it's undefined behavior! It might work on some compilers, but that doesn't mean it's right.
Let me just double-check that `__vcc_connect` code block... Yep, there it is:
```c
if ((vpi != ATM_VPI_UNSPEC && vpi != ATM_VPI_ANY &&
vpi >> dev->ci_range.vpi_bits) || (vci != ATM_VCI_UNSPEC &&
vci != ATM_VCI_ANY && vci >> dev->ci_range.vci_bits))
return -EINVAL;
```
So, as I suspected, the potential `vpi >> -1` is a direct consequence of `vpi_bits` being -1, leading to the undefined behavior. I need to be absolutely certain this isn't handled elsewhere. Is there any other instance where `ci_range` is used? I'll need to go through the code to verify.
|
| 25/2 |
2026/08/20 00:55 |
tool |
grepper |
0m
Args: map[Expression:ci_range PathPrefix:net/atm/]
Results: map[Output:net/atm/common.c=330=static int find_ci(const struct atm_vcc *vcc, short *vpi, int *vci)
--
net/atm/common.c-344- p = *vpi;
net/atm/common.c:345: else if (p >= 1 << vcc->dev->ci_range.vpi_bits)
net/atm/common.c-346- p = 0;
--
net/atm/common.c-348- c = *vci;
net/atm/common.c:349: else if (c < ATM_NOT_RSV_VCI || c >= 1 << vcc->dev->ci_range.vci_bits)
net/atm/common.c-350- c = ATM_NOT_RSV_VCI;
--
net/atm/common.c-360- c++;
net/atm/common.c:361: if (c >= 1 << vcc->dev->ci_range.vci_bits)
net/atm/common.c-362- c = ATM_NOT_RSV_VCI;
--
net/atm/common.c-366- p++;
net/atm/common.c:367: if (p >= 1 << vcc->dev->ci_range.vpi_bits)
net/atm/common.c-368- p = 0;
--
net/atm/common.c=374=static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, short vpi,
--
net/atm/common.c-380- if ((vpi != ATM_VPI_UNSPEC && vpi != ATM_VPI_ANY &&
net/atm/common.c:381: vpi >> dev->ci_range.vpi_bits) || (vci != ATM_VCI_UNSPEC &&
net/atm/common.c:382: vci != ATM_VCI_ANY && vci >> dev->ci_range.vci_bits))
net/atm/common.c-383- return -EINVAL;
--
net/atm/resources.c=223=int atm_dev_ioctl(unsigned int cmd, void __user *buf, int __user *sioc_len,
--
net/atm/resources.c-289- size = sizeof(struct atm_cirange);
net/atm/resources.c:290: if (copy_to_user(buf, &dev->ci_range, size)) {
net/atm/resources.c-291- error = -EFAULT;
]
|
| 26/2 |
2026/08/20 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 36301
output: 19
thoughts: 126
Thoughts: **My Initial Thoughts on the `find_ci` Function**
Okay, so looking at this `find_ci` function, I see it's doing that bit shift: `1 << vcc->dev->ci_range.vpi_bits`. And there it is, if `vpi_bits` ends up being -1, then `1 << -1` is going to be undefined behavior. Wait a minute, that's not just UB, it's a shift-out-of-bounds. How has this escaped our notice for so long? I'm puzzled.
Aha! Now I remember, the `usbatm` driver specifically sets `vpi_bits` to `ATM_CI_MAX`, which is -1! That explains it. I wonder if there are any other drivers out there that are also using that `ATM_CI_MAX` value, potentially introducing the same vulnerability. I need to investigate further.
|
| 27/2 |
2026/08/20 00:55 |
tool |
grepper |
0m
Args: map[Expression:ATM_CI_MAX]
Results: map[Output:drivers/usb/atm/usbatm.c=901=static int usbatm_atm_init(struct usbatm_data *instance)
--
drivers/usb/atm/usbatm.c-919-
drivers/usb/atm/usbatm.c:920: atm_dev->ci_range.vpi_bits = ATM_CI_MAX;
drivers/usb/atm/usbatm.c:921: atm_dev->ci_range.vci_bits = ATM_CI_MAX;
drivers/usb/atm/usbatm.c-922- atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
--
include/uapi/linux/atmdev.h=138=struct atm_iobuf {
--
include/uapi/linux/atmdev.h-144-
include/uapi/linux/atmdev.h:145:#define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */
include/uapi/linux/atmdev.h-146-
include/uapi/linux/atmdev.h=147=struct atm_cirange {
include/uapi/linux/atmdev.h:148: signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */
include/uapi/linux/atmdev.h:149: signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */
include/uapi/linux/atmdev.h-150-};
]
|
| 28/2 |
2026/08/20 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 37050
output: 43
thoughts: 712
Thoughts: **Analyzing a Potential Vulnerability in the usbatm Framework**
Okay, so I'm looking at this `usbatm.c` code, specifically how it handles VPI/VCI values. It seems the `usbatm` framework, which many drivers like `cxacru`, `speedtch`, `ueagle-atm`, and `xusbatm` rely on, sets `vpi_bits` and `vci_bits` to `-1`. This is where it gets interesting.
When a user tries to `bind()` an ATM socket with a USB ATM device using this framework, the `__vcc_connect` function gets called. Inside that function, there's a shift operation: `vpi >> dev->ci_range.vpi_bits`. Now, since `vpi_bits` is `-1`, this is where things could go sideways because shifting by a negative amount is undefined behavior in C. On x86, it gets masked to 31.
Since `vpi` is a `short`, it's promoted to an `int` for the shift. So `vpi >> -1` effectively becomes `vpi >> 31`. If `vpi` is positive or zero, the result of this shift is 0. If `vpi` is negative, the result is -1. The `__vcc_connect` function signature confirms that `vpi` is indeed a `short`. Valid VPI values range from 0 to 255. With a correct bit mask, `vpi >> 8` would evaluate to zero for a valid range of `vpi`, non-zero otherwise.
Here's the problem: with `vpi_bits = -1`, any positive `vpi` value, no matter how large, will result in 0 after this shift. This means the code *fails to reject* out-of-bounds `vpi` values. Even if someone passes a `vpi` of, say, 1000, the shift operation still results in 0, which looks like a valid value. So, the check passes incorrectly!
So, `vcc->vpi = vpi;` gets set, and the code continues. It goes through `__vcc_insert_socket(sk);`, calls `atm_init_aal5(vcc);`, and eventually hits the device's `open` operation, which, in this case, points to `usbatm_atm_devops`. This seems like a pretty significant oversight. It's essentially allowing invalid VPI values to be used, potentially leading to all sorts of issues further down the line. I need to dig deeper to see if this represents a security vulnerability.
|
| 29/2 |
2026/08/20 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/usb/atm/usbatm.c Name:usbatm_atm_devops]
Results: map[SourceCode: 162: static const struct atmdev_ops usbatm_atm_devops = {
163: .dev_close = usbatm_atm_dev_close,
164: .open = usbatm_atm_open,
165: .close = usbatm_atm_close,
166: .ioctl = usbatm_atm_ioctl,
167: .send = usbatm_atm_send,
168: .proc_read = usbatm_atm_proc_read,
169: .owner = THIS_MODULE,
170: };
SourceFile:drivers/usb/atm/usbatm.c]
|
| 30/2 |
2026/08/20 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 38590
output: 42
thoughts: 13
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Diving into `usbatm_atm_open`**
Okay, time to zero in on `usbatm_atm_open`. This function is the entry point, the critical piece of the puzzle. I need to understand its behavior, its interactions, and any potential vulnerabilities or bottlenecks it might introduce in this ATM (Asynchronous Transfer Mode) over USB context. I'll need to dissect the code: identify resource allocation, error handling, parameter validation – all the usual suspects. I'll want to trace any calls it makes to lower-level drivers or hardware abstractions. Are there any race conditions lurking in its initialization sequence? Does it handle concurrent access correctly? I'll also be looking for any signs of inefficient buffer management or potential denial-of-service vectors. Given that it's dealing with USB and ATM, I'll be extra vigilant about potential buffer overflows or issues related to fragmented packets. Right, time to roll up my sleeves and get started.
|
| 31/2 |
2026/08/20 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/usb/atm/usbatm.c Name:usbatm_atm_open]
Results: map[SourceCode: 770: static int usbatm_atm_open(struct atm_vcc *vcc)
771: {
772: struct usbatm_data *instance = vcc->dev->dev_data;
773: struct usbatm_vcc_data *new = NULL;
774: int ret;
775: int vci = vcc->vci;
776: short vpi = vcc->vpi;
777:
778: if (!instance)
779: return -ENODEV;
780:
781: /* only support AAL5 */
782: if ((vcc->qos.aal != ATM_AAL5)) {
783: atm_warn(instance, "%s: unsupported ATM type %d!\n", __func__, vcc->qos.aal);
784: return -EINVAL;
785: }
786:
787: /* sanity checks */
788: if ((vcc->qos.rxtp.max_sdu < 0) || (vcc->qos.rxtp.max_sdu > ATM_MAX_AAL5_PDU)) {
789: atm_dbg(instance, "%s: max_sdu %d out of range!\n", __func__, vcc->qos.rxtp.max_sdu);
790: return -EINVAL;
791: }
792:
793: mutex_lock(&instance->serialize); /* vs self, usbatm_atm_close, usbatm_usb_disconnect */
794:
795: if (instance->disconnected) {
796: atm_dbg(instance, "%s: disconnected!\n", __func__);
797: ret = -ENODEV;
798: goto fail;
799: }
800:
801: if (usbatm_find_vcc(instance, vpi, vci)) {
802: atm_dbg(instance, "%s: %hd/%d already in use!\n", __func__, vpi, vci);
803: ret = -EADDRINUSE;
804: goto fail;
805: }
806:
807: new = kzalloc_obj(struct usbatm_vcc_data);
808: if (!new) {
809: ret = -ENOMEM;
810: goto fail;
811: }
812:
813: new->vcc = vcc;
814: new->vpi = vpi;
815: new->vci = vci;
816:
817: new->sarb = alloc_skb(usbatm_pdu_length(vcc->qos.rxtp.max_sdu), GFP_KERNEL);
818: if (!new->sarb) {
819: atm_err(instance, "%s: no memory for SAR buffer!\n", __func__);
820: ret = -ENOMEM;
821: goto fail;
822: }
823:
824: vcc->dev_data = new;
825:
826: tasklet_disable(&instance->rx_channel.tasklet);
827: instance->cached_vcc = new;
828: instance->cached_vpi = vpi;
829: instance->cached_vci = vci;
830: list_add(&new->list, &instance->vcc_list);
831: tasklet_enable(&instance->rx_channel.tasklet);
832:
833: set_bit(ATM_VF_ADDR, &vcc->flags);
834: set_bit(ATM_VF_PARTIAL, &vcc->flags);
835: set_bit(ATM_VF_READY, &vcc->flags);
836:
837: mutex_unlock(&instance->serialize);
838:
839: atm_dbg(instance, "%s: allocated vcc data 0x%p\n", __func__, new);
840:
841: return 0;
842:
843: fail:
844: kfree(new);
845: mutex_unlock(&instance->serialize);
846: return ret;
847: }
SourceFile:drivers/usb/atm/usbatm.c]
|
| 32/2 |
2026/08/20 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 40124
output: 43
thoughts: 61
Thoughts: Okay, let me think this through.
**Analyzing USB ATM Driver Initialization**
Alright, so `usbatm_atm_open` is the entry point, the first piece of the puzzle. It looks like all it does is stash the `vpi` and `vci` values into the `new->vpi` and `new->vci` structure members, respectively. That's it? No immediate indexing, no array lookups based on those values, which is good. That implies these values are just being saved for later, presumably for the established ATM connection.
Now, what about the next logical step – `usbatm_find_vcc`? I need to check how it uses those `vpi` and `vci` parameters. Does it use the stored values as part of a lookup or configuration process? Is `usbatm_find_vcc` where the critical connection establishment logic lives, where those values are actually used to identify or configure the virtual circuit? I should check if the function handles those parameters appropriately, since the prior function just stored them in `new->vpi` and `new->vci`. I bet that function is key to making this thing work, so let's start there.
|
| 33/2 |
2026/08/20 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/usb/atm/usbatm.c Name:usbatm_find_vcc]
Results: map[SourceCode: 280: static inline struct usbatm_vcc_data *usbatm_find_vcc(struct usbatm_data *instance,
281: short vpi, int vci)
282: {
283: struct usbatm_vcc_data *vcc_data;
284:
285: list_for_each_entry(vcc_data, &instance->vcc_list, list)
286: if ((vcc_data->vci == vci) && (vcc_data->vpi == vpi))
287: return vcc_data;
288: return NULL;
289: }
SourceFile:drivers/usb/atm/usbatm.c]
|
| 34/2 |
2026/08/20 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 40706
output: 34
thoughts: 31
Thoughts: Okay, here's my interpretation of those thoughts, summarized from a professional perspective, as though they were my own:
**Linked List Iteration & ATM Context**
Right, so this piece of code is simply traversing a linked list. No fancy array indexing or anything like that. Standard stuff, really. But it does bring up a point... I wonder about `find_ci` function in `net/atm/common.c`. I need to review that code to refresh my memory on the way it traverses the linked list. What is the context here? Is there something relevant that I need to be aware of?
|
| 35/2 |
2026/08/20 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/atm/common.c Name:find_ci]
Results: map[SourceCode: 330: static int find_ci(const struct atm_vcc *vcc, short *vpi, int *vci)
331: {
332: static short p; /* poor man's per-device cache */
333: static int c;
334: short old_p;
335: int old_c;
336: int err;
337:
338: if (*vpi != ATM_VPI_ANY && *vci != ATM_VCI_ANY) {
339: err = check_ci(vcc, *vpi, *vci);
340: return err;
341: }
342: /* last scan may have left values out of bounds for current device */
343: if (*vpi != ATM_VPI_ANY)
344: p = *vpi;
345: else if (p >= 1 << vcc->dev->ci_range.vpi_bits)
346: p = 0;
347: if (*vci != ATM_VCI_ANY)
348: c = *vci;
349: else if (c < ATM_NOT_RSV_VCI || c >= 1 << vcc->dev->ci_range.vci_bits)
350: c = ATM_NOT_RSV_VCI;
351: old_p = p;
352: old_c = c;
353: do {
354: if (!check_ci(vcc, p, c)) {
355: *vpi = p;
356: *vci = c;
357: return 0;
358: }
359: if (*vci == ATM_VCI_ANY) {
360: c++;
361: if (c >= 1 << vcc->dev->ci_range.vci_bits)
362: c = ATM_NOT_RSV_VCI;
363: }
364: if ((c == ATM_NOT_RSV_VCI || *vci != ATM_VCI_ANY) &&
365: *vpi == ATM_VPI_ANY) {
366: p++;
367: if (p >= 1 << vcc->dev->ci_range.vpi_bits)
368: p = 0;
369: }
370: } while (old_p != p || old_c != c);
371: return -EADDRINUSE;
372: }
SourceFile:net/atm/common.c]
|
| 36/2 |
2026/08/20 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 41642
output: 33
thoughts: 908
Thoughts: **Analyzing a Potential Vulnerability in ATM Device Drivers**
Okay, so I'm looking at this code and immediately see a potential issue with how `vpi_bits` is handled. If it's -1, then `1 << -1` is undefined behavior (UB), and on x86, this translates to `1 << 31`, which is effectively `-2147483648`. I need to be careful here because the C standard says this behavior is undefined.
My thinking continues: Because `1` is an integer, so `1 << 31` becomes the negative value I mentioned above. So, when the code evaluates `p >= 1 << vcc->dev->ci_range.vpi_bits`, it's now checking if `p` (which is a `short`, and gets promoted to an `int`) is greater than or equal to -2147483648. Since `p` is *always* going to be greater than or equal to that incredibly negative value, the code always executes `p = 0;`. And the same logic applies to `c`, which is also always set to `ATM_NOT_RSV_VCI`.
Initially, I'm thinking this might cause an infinite loop, but I need to see the loop logic. The code then checks `check_ci(vcc, p, c)`. If this fails, then `c` is incremented, and then *reset* to `ATM_NOT_RSV_VCI` because of the same negative shift. Then `p` is incremented *then* set to 0. So the variables are bouncing back and forth.
Hang on. I think I see it now. The code then compares the *old* values of `p` and `c` to their *new* values. Because `p` and `c` are constantly reset to their initial values in each iteration, the loop condition `old_p != p || old_c != c` will always be *false*. So the loop actually terminates after a single iteration. This means `find_ci` returns `-EADDRINUSE`.
Therefore, the upshot of all this is that the code just fails to find an available VPI/VCI when the parameters are set to `ATM_VPI_ANY` or `ATM_VCI_ANY`. It's a functional denial of service bug. It's not a security vulnerability in the strictest sense because it just causes an error, it doesn't allow privilege escalation or memory corruption, but it is a denial of service.
Now, let's circle back to the UB. I see that the shift-out-of-bounds is the root cause. This triggers a UBSAN report, but I know that these reports don't crash the kernel unless `panic_on_warn` is set, or if the kernel is compiled with `CONFIG_UBSAN_TRAP`. In production kernels, this is usually not the case or, if it is, it might cause a panic.
The main takeaway is no memory corruption is happening, because the result of the shift is just a garbage number, but that's what's getting checked in conditionals. Now I'm checking to make sure that VPI or VCI doesn't point to an array that might cause an issue. Looking at `usbatm` and `cxacru`, I see that the `usbatm_atm_open` code simply stores VPI/VCI and uses a linked list so there is no array indexing issue. I need to keep looking at `cxacru`.
|
| 37/2 |
2026/08/20 00:56 |
tool |
grepper |
0m
Error:
Args: map[Expression:vpi PathPrefix:drivers/usb/atm/cxacru.c]
Results:
|
| 38/2 |
2026/08/20 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 43369
output: 32
thoughts: 35
Thoughts: **A Quick Debugging Thought**
Alright, hang on a second. I was about to dive into `cxacru.c` to trace that particular issue, but hold up... I'm pretty sure that code base doesn't actually interact with the Virtual Procedural Interface (VPI) or the Verilog Configuration Interface (VCI) at all. That's a red herring. Let's switch gears and investigate `speedtch.c` instead. It's much more likely the root of the problem. Time is of the essence!
|
| 39/2 |
2026/08/20 00:56 |
tool |
grepper |
0m
Error:
Args: map[Expression:vpi PathPrefix:drivers/usb/atm/speedtch.c]
Results:
|
| 40/2 |
2026/08/20 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 43565
output: 34
thoughts: 12
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Diving into `ueagle-atm.c`**
Okay, time to get my hands dirty. I'm thinking I need to start with `ueagle-atm.c`. Seems like the logical entry point for anything ATM-related within this module, given the filename convention. I'm expecting to find the core driver logic for the Eagle ATM device here, including initialization routines, interrupt handlers (hopefully well-commented!), and the essential functions for packet transmission and reception over the ATM interface. I'll be looking for things like buffer management, SAR (Segmentation and Reassembly) handling, and any specific hardware interactions for the Eagle ASIC that might be abstracted by this layer. I'm anticipating some potentially low-level register manipulation, but hoping the code is reasonably well-structured. I'm also curious about any potential error handling strategies they’ve implemented—particularly how they deal with cell loss or corruption, and whether it’s compliant with AAL protocols. Let's see what we've got.
|
| 41/2 |
2026/08/20 00:56 |
tool |
grepper |
0m
Error:
Args: map[Expression:vpi PathPrefix:drivers/usb/atm/ueagle-atm.c]
Results:
|
| 42/2 |
2026/08/20 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 43854
output: 29
thoughts: 72
Thoughts: **ATM Driver Implementation Thoughts**
Okay, so it seems the USB ATM drivers are *completely* oblivious to the Virtual Path Identifier (VPI) and Virtual Circuit Identifier (VCI). They just hand the data off to the ATM layer, which makes sense. I wouldn't expect them to handle the ATM-specific stuff. But then, it got me thinking... what *does* the ATM layer do with these identifiers? Are they used to index arrays or something similar? I need to clarify how those values are consumed by the driver. Best place to start is likely `net/atm/common.c`. I should probably check that out and see how the identifiers are used.
|
| 43/2 |
2026/08/20 00:56 |
tool |
grepper |
0m
Args: map[Expression:vpi PathPrefix:net/atm/common.c]
Results: map[Output:net/atm/common.c=139=int vcc_create(struct net *net, struct socket *sock, int protocol, int family, int kern)
--
net/atm/common.c-162- vcc->release_cb = NULL;
net/atm/common.c:163: vcc->vpi = vcc->vci = 0; /* no VCI/VPI yet */
net/atm/common.c-164- vcc->atm_options = vcc->aal_options = 0;
--
net/atm/common.c=280=static int adjust_tp(struct atm_trafprm *tp, unsigned char aal)
--
net/atm/common.c-304-
net/atm/common.c:305:static int check_ci(const struct atm_vcc *vcc, short vpi, int vci)
net/atm/common.c-306-{
--
net/atm/common.c-314- continue;
net/atm/common.c:315: if (test_bit(ATM_VF_ADDR, &walk->flags) && walk->vpi == vpi &&
net/atm/common.c-316- walk->vci == vci && ((walk->qos.txtp.traffic_class !=
--
net/atm/common.c-329-
net/atm/common.c:330:static int find_ci(const struct atm_vcc *vcc, short *vpi, int *vci)
net/atm/common.c-331-{
--
net/atm/common.c-337-
net/atm/common.c:338: if (*vpi != ATM_VPI_ANY && *vci != ATM_VCI_ANY) {
net/atm/common.c:339: err = check_ci(vcc, *vpi, *vci);
net/atm/common.c-340- return err;
--
net/atm/common.c-342- /* last scan may have left values out of bounds for current device */
net/atm/common.c:343: if (*vpi != ATM_VPI_ANY)
net/atm/common.c:344: p = *vpi;
net/atm/common.c:345: else if (p >= 1 << vcc->dev->ci_range.vpi_bits)
net/atm/common.c-346- p = 0;
--
net/atm/common.c-354- if (!check_ci(vcc, p, c)) {
net/atm/common.c:355: *vpi = p;
net/atm/common.c-356- *vci = c;
--
net/atm/common.c-364- if ((c == ATM_NOT_RSV_VCI || *vci != ATM_VCI_ANY) &&
net/atm/common.c:365: *vpi == ATM_VPI_ANY) {
net/atm/common.c-366- p++;
net/atm/common.c:367: if (p >= 1 << vcc->dev->ci_range.vpi_bits)
net/atm/common.c-368- p = 0;
--
net/atm/common.c-373-
net/atm/common.c:374:static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, short vpi,
net/atm/common.c-375- int vci)
--
net/atm/common.c-379-
net/atm/common.c:380: if ((vpi != ATM_VPI_UNSPEC && vpi != ATM_VPI_ANY &&
net/atm/common.c:381: vpi >> dev->ci_range.vpi_bits) || (vci != ATM_VCI_UNSPEC &&
net/atm/common.c-382- vci != ATM_VCI_ANY && vci >> dev->ci_range.vci_bits))
--
net/atm/common.c-391- if (test_bit(ATM_DF_REMOVED, &dev->flags) ||
net/atm/common.c:392: (error = find_ci(vcc, &vpi, &vci))) {
net/atm/common.c-393- write_unlock_irq(&vcc_sklist_lock);
--
net/atm/common.c-395- }
net/atm/common.c:396: vcc->vpi = vpi;
net/atm/common.c-397- vcc->vci = vci;
--
net/atm/common.c-421- goto fail;
net/atm/common.c:422: pr_debug("VCC %d.%d, AAL %d\n", vpi, vci, vcc->qos.aal);
net/atm/common.c-423- pr_debug(" TX: %d, PCR %d..%d, SDU %d\n",
--
net/atm/common.c-449-
net/atm/common.c:450:int vcc_connect(struct socket *sock, int itf, short vpi, int vci)
net/atm/common.c-451-{
--
net/atm/common.c-455-
net/atm/common.c:456: pr_debug("(vpi %d, vci %d)\n", vpi, vci);
net/atm/common.c-457- if (sock->state == SS_CONNECTED)
--
net/atm/common.c-460- return -EINVAL;
net/atm/common.c:461: if (!(vpi || vci))
net/atm/common.c-462- return -EINVAL;
net/atm/common.c-463-
net/atm/common.c:464: if (vpi != ATM_VPI_UNSPEC && vci != ATM_VCI_UNSPEC)
net/atm/common.c-465- clear_bit(ATM_VF_PARTIAL, &vcc->flags);
--
net/atm/common.c-497- return -ENODEV;
net/atm/common.c:498: error = __vcc_connect(vcc, dev, vpi, vci);
net/atm/common.c-499- if (error) {
--
net/atm/common.c-502- }
net/atm/common.c:503: if (vpi == ATM_VPI_UNSPEC || vci == ATM_VCI_UNSPEC)
net/atm/common.c-504- set_bit(ATM_VF_PARTIAL, &vcc->flags);
--
net/atm/common.c=756=int vcc_getsockopt(struct socket *sock, int level, int optname,
--
net/atm/common.c-787- pvc.sap_addr.itf = vcc->dev->number;
net/atm/common.c:788: pvc.sap_addr.vpi = vcc->vpi;
net/atm/common.c-789- pvc.sap_addr.vci = vcc->vci;
]
|
| 44/2 |
2026/08/20 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 45982
output: 27
thoughts: 858
Thoughts: **Analyzing the Potential UBSAN Warning in usbatm**
Okay, so it seems like the `vpi` and `vci` values are primarily used as identifiers, stored directly within the `vcc` structure for matching purposes in the `check_ci` function. This function checks for duplicate bindings on the same `vpi` and `vci` combination. No direct array indexing using `vpi` or `vci` occurs in the core ATM code, which is good.
But, I need to consider potential issues with other drivers. If someone creates a dummy USB ATM device, they could theoretically bind to it with any `vpi` and `vci`. Of course, since it's a dummy device, it wouldn't *do* anything. However, if they bind to a real ATM device, like a PCI ATM card, the `ci_range` is set with valid values, ensuring that the `vpi >> dev->ci_range.vpi_bits` check works correctly, rejecting out-of-bounds `vpi` values, and so avoiding any shift-out-of-bounds problems.
The shift-out-of-bounds only arises when `vpi_bits` is set to `ATM_CI_MAX` (-1), and only the `usbatm` driver does this. So, this specific issue is localized to `usbatm` devices. Since `vpi` and `vci` act as identifiers in `usbatm` and aren't used for array indexing, the shift-out-of-bounds *won't* cause memory corruption. The concern is purely a UBSAN warning.
Now, let's explore the consequences. If `vpi_bits` is -1, `vpi >> -1` is undefined behavior (UB). On x86, this effectively becomes `vpi >> 31`, which is 0 for positive `vpi`. So, any positive `vpi` will pass the `vpi >> dev->ci_range.vpi_bits` check. However, since `vpi` is a `short` (limited up to 32767), this means `32767` will just get stored in `vcc->vpi` and, ultimately, in `new->vpi`. Subsequent calls to `usbatm_find_vcc` will match this vpi if another socket attempts to bind to the same vpi. Again, this isn't a corruption or privilege escalation issue; it's still a UBSAN warning.
Now, what about negative `vpi` values? If `vpi` is negative, `vpi >> 31` becomes -1, so `vpi >> dev->ci_range.vpi_bits` evaluates to true, resulting in `-EINVAL` being returned. Negative values will be rejected. I see explicit checks for specific negative values such as `ATM_VPI_UNSPEC` and `ATM_VPI_ANY` too. Other negative values will be properly rejected. So, it's positive `vpi` values that pass.
Finally, I need to verify that `ci_range` isn't used anywhere else unexpectedly. I've grepped the `net/atm/` directory and reviewed `find_ci`, `__vcc_connect`, and `atm_dev_ioctl`. In `atm_dev_ioctl`, it's just copied to userspace. I have to wonder: are there any other drivers that use `ci_range`?
|
| 45/2 |
2026/08/20 00:56 |
tool |
grepper |
0m
Args: map[Expression:ci_range PathPrefix:drivers/atm/]
Results: map[Output:drivers/atm/solos-pci.c=1348=static int atm_init(struct solos_card *card, struct device *parent)
--
drivers/atm/solos-pci.c-1371-
drivers/atm/solos-pci.c:1372: card->atmdev[i]->ci_range.vpi_bits = 8;
drivers/atm/solos-pci.c:1373: card->atmdev[i]->ci_range.vci_bits = 16;
drivers/atm/solos-pci.c-1374- card->atmdev[i]->dev_data = card;
]
|
| 46/2 |
2026/08/20 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 47799
output: 36
thoughts: 144
Thoughts: **Analyzing the Variable Initialization for PCI Configuration**
Okay, so I'm digging into this PCI configuration code. It looks like the `solos-pci.c` driver is the only one explicitly setting this value, and it's doing so to either 8 or 16. That's a key detail to keep in mind. I need to figure out what happens when other drivers *don't* explicitly set it. My initial assumption is that they probably leave it at zero.
Now, if a driver *does* leave it at zero, the crucial bitwise operation `vpi >> 0` effectively leaves `vpi` unchanged. Here’s the catch: if that unchanged `vpi` value is anything *but* zero, the system will reject it! This is where things get interesting.
Wait, if `ci_range` is zero, then *any* `vpi` value greater than zero, after the right shift by zero, will be non-zero. That seems very restrictive. This would mean that any positive `vpi` value would be rejected outright. I need to understand how `ci_range` gets initialized, and that's the heart of the matter. So, let's trace the initialization of `ci_range` in the `atm_dev_register` function. That's the key to unlocking this puzzle.
|
| 47/2 |
2026/08/20 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/atm/resources.c Name:atm_dev_register]
Results: map[SourceCode: 71: struct atm_dev *atm_dev_register(const char *type, struct device *parent,
72: const struct atmdev_ops *ops, int number,
73: unsigned long *flags)
74: {
75: struct atm_dev *dev, *inuse;
76:
77: dev = __alloc_atm_dev(type);
78: if (!dev) {
79: pr_err("no space for dev %s\n", type);
80: return NULL;
81: }
82: mutex_lock(&atm_dev_mutex);
83: if (number != -1) {
84: inuse = __atm_dev_lookup(number);
85: if (inuse) {
86: atm_dev_put(inuse);
87: mutex_unlock(&atm_dev_mutex);
88: kfree(dev);
89: return NULL;
90: }
91: dev->number = number;
92: } else {
93: dev->number = 0;
94: while ((inuse = __atm_dev_lookup(dev->number))) {
95: atm_dev_put(inuse);
96: dev->number++;
97: }
98: }
99:
100: dev->ops = ops;
101: if (flags)
102: dev->flags = *flags;
103: else
104: memset(&dev->flags, 0, sizeof(dev->flags));
105: memset(&dev->stats, 0, sizeof(dev->stats));
106: refcount_set(&dev->refcnt, 1);
107:
108: if (atm_proc_dev_register(dev) < 0) {
109: pr_err("atm_proc_dev_register failed for dev %s\n", type);
110: mutex_unlock(&atm_dev_mutex);
111: kfree(dev);
112: return NULL;
113: }
114:
115: if (atm_register_sysfs(dev, parent) < 0) {
116: pr_err("atm_register_sysfs failed for dev %s\n", type);
117: atm_proc_dev_deregister(dev);
118: goto out_fail;
119: }
120:
121: list_add_tail(&dev->dev_list, &atm_devs);
122:
123: out:
124: mutex_unlock(&atm_dev_mutex);
125: return dev;
126:
127: out_fail:
128: put_device(&dev->class_dev);
129: dev = NULL;
130: goto out;
131: }
SourceFile:net/atm/resources.c]
|
| 48/2 |
2026/08/20 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 49121
output: 37
thoughts: 20
Thoughts: Here's a summary of my thought process, as requested:
**Deconstructing Device Allocation**
Okay, so I'm looking at this code and my immediate thought is, "Hang on, `__alloc_atm_dev` is the function that actually allocates the ATM device, right?" I need to confirm that. That's the critical step. So, I need to go and analyze the `__alloc_atm_dev` function to thoroughly understand its specific implementation details.
|
| 49/2 |
2026/08/20 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/atm/resources.c Name:__alloc_atm_dev]
Results: map[SourceCode: 33: static struct atm_dev *__alloc_atm_dev(const char *type)
34: {
35: struct atm_dev *dev;
36:
37: dev = kzalloc_obj(*dev);
38: if (!dev)
39: return NULL;
40: dev->type = type;
41: dev->signal = ATM_PHY_SIG_UNKNOWN;
42: dev->link_rate = ATM_OC3_PCR;
43:
44: return dev;
45: }
SourceFile:net/atm/resources.c]
|
| 50/2 |
2026/08/20 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 49464
output: 27
thoughts: 99
Thoughts: **Initial Assessment of ATM Device Configuration**
Okay, so I'm looking at this ATM device driver code, and it's using `kzalloc`. That immediately tells me `ci_range` is initialized to zero, which makes sense. Now, let's think this through. If `ci_range` is zero, then a right shift of `vpi` by zero bits is just `vpi` itself. That means if `vpi` has any value other than zero, it's going to be rejected. So, am I right in thinking this device only supports VPI and VCI values of zero by default? It seems like it, given this initialization. To confirm, I should investigate other ATM drivers in this codebase. I need to see how they're handling `ci_range` to understand if this is a common default or a specific limitation of this particular driver.
|
| 51/2 |
2026/08/20 00:56 |
tool |
grepper |
0m
Args: map[Expression:ci_range PathPrefix:drivers/atm/]
Results: map[Output:drivers/atm/solos-pci.c=1348=static int atm_init(struct solos_card *card, struct device *parent)
--
drivers/atm/solos-pci.c-1371-
drivers/atm/solos-pci.c:1372: card->atmdev[i]->ci_range.vpi_bits = 8;
drivers/atm/solos-pci.c:1373: card->atmdev[i]->ci_range.vci_bits = 16;
drivers/atm/solos-pci.c-1374- card->atmdev[i]->dev_data = card;
]
|
| 52/2 |
2026/08/20 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 49953
output: 28
thoughts: 23
Thoughts: Okay, here's my interpretation of those thoughts, speaking as an expert:
**Investigative Line of Reasoning**
Hmm, hold on a second. My initial grep was focused solely on `ci_range`. That was a good starting point, but I might be jumping to conclusions a bit too quickly. What if, instead of using the `ci_range` variable, someone on the team (or in an older part of the code) set `vpi_bits` directly? They might have bypassed the intended method and coded a bit of a workaround. I need to be careful; sometimes the obvious approach isn't the one that's actually implemented. Time to expand my search and see if that's what's happened! This might explain why I'm not finding what I expect to.
|
| 53/2 |
2026/08/20 00:56 |
tool |
grepper |
0m
Args: map[Expression:vpi_bits PathPrefix:drivers/atm/]
Results: map[Output:drivers/atm/solos-pci.c=1348=static int atm_init(struct solos_card *card, struct device *parent)
--
drivers/atm/solos-pci.c-1371-
drivers/atm/solos-pci.c:1372: card->atmdev[i]->ci_range.vpi_bits = 8;
drivers/atm/solos-pci.c-1373- card->atmdev[i]->ci_range.vci_bits = 16;
]
|
| 54/2 |
2026/08/20 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 50317
output: 30
thoughts: 74
Thoughts: **Investigating the `vpi_bits` Variable**
Okay, so I'm digging into this code, and it's striking me that only `solos-pci.c` seems to be the place where `vpi_bits` is actually getting set. That's a bit surprising. I mean, we're dealing with network drivers here, and `vpi_bits` is pretty crucial for handling virtual path identifiers, which are fundamental to ATM and other similar technologies.
My initial thought is, what about the other drivers? Specifically, I'm thinking about `he.c`, `idt77252.c`, `nicstar.c`, and `zatm.c` – they are all ATM related. Are they *really* not setting `vpi_bits` themselves? That feels wrong, or at least potentially incomplete. It could be that the intention is for some common function to set them, or maybe there is another layer in between.
I need to quickly verify this. My next step is definitely to dive into `he.c` and see what's happening there. Let's see if that driver clarifies the situation.
|
| 55/2 |
2026/08/20 00:56 |
tool |
grepper |
0m
Error:
Args: map[Expression:ci_range PathPrefix:drivers/atm/he.c]
Results:
|
| 56/2 |
2026/08/20 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 50682
output: 32
thoughts: 16
Thoughts: Here's a summary of my thought process:
**Diving into `he.c` for `atm_dev` Usage**
Okay, time to get this done. I need to take a look at how the `atm_dev` structure is being used within `he.c`. Let's see what's happening in there. Specifically, I want to trace the code and see how `atm_dev` is being manipulated. What functions call it? Where is it being passed? Are there any potential areas for optimization or, even worse, bugs lurking around? I'm expecting to find either direct accesses or calls to device-specific functions that operate on it. I need to understand the control flow related to this structure to ensure everything's working as expected. This will help me with my work today. I will use my understanding of the code to find the correct calls and manipulations.
|
| 57/2 |
2026/08/20 00:57 |
tool |
grepper |
0m
Error:
Args: map[Expression:atm_dev_register PathPrefix:drivers/atm/he.c]
Results:
|
| 58/2 |
2026/08/20 00:57 |
llm |
expert |
0m
Model:
Tokens:
input: 50930
output: 30
thoughts: 23
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Investigating the ATM Driver Registration**
Okay, so I see `he.c` is nestled away in the `drivers/atm/` directory. That immediately piques my interest – I need to understand how this driver hooks into the ATM subsystem. I'm going to quickly check the registration process within the code. I need to see how it's initializing, what structures it's using, and what API calls are being made to inform the kernel about its presence and capabilities within the ATM infrastructure. Specifically, I'm looking for the registration function, the driver's entry points (e.g., probe, attach, detach functions), and any associated data structures like `atm_dev` or similar that would be employed in the process. I want a high-level view of how the driver presents itself to the system. From there I can determine which key interfaces are being used.
|
| 59/2 |
2026/08/20 00:57 |
tool |
grepper |
0m
Error:
Args: map[Expression:atm_dev PathPrefix:drivers/atm/he.c]
Results:
|
| 60/2 |
2026/08/20 00:57 |
llm |
expert |
0m
Model:
Tokens:
input: 51199
output: 28
thoughts: 14
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and presented as if it were my own internal monologue:
**Quick Diagnostic - `he.c` is an ATM Driver?**
Right, let me just quickly run that through my mental checklist. When I see `he.c`, my initial reaction is, "Hang on, isn't that a common naming convention for a driver related to automated teller machines?" I'm immediately doing a quick memory scan for related codebases, projects I've worked on, or even just industry best practices. My focus is immediately narrowed down to that specific domain. I'm assuming, based on this naming pattern, it's highly likely that `he.c` refers to an ATM driver, probably at a low level of interaction with the hardware. I need to make sure my assumptions are right and if that isn't true then I will need more information before proceeding.
|
| 61/2 |
2026/08/20 00:57 |
tool |
grepper |
0m
Error:
Args: map[Expression:atm PathPrefix:drivers/atm/he.c]
Results:
|
| 62/2 |
2026/08/20 00:57 |
llm |
expert |
0m
Model:
Tokens:
input: 51452
output: 22
thoughts: 22
Thoughts: Here's my take on the situation:
**Investigating a Missing File**
Okay, so I'm looking for `he.c`, and it seems like it's not where I expected it to be. Huh. That's a little strange. Given the context, my next logical step is to broaden the search. I think it's likely a driver file, so it makes sense to dig into the `drivers/atm/` directory. Maybe it's misfiled, or perhaps it's named something slightly different. Time to see what's in there and figure out where this file actually resides. No point just staring at the problem, gotta go hunting!
|
| 63/2 |
2026/08/20 00:57 |
tool |
codesearch-dir-index |
0m
Args:
Results: map[Files:[solos-attrlist.c solos-pci.c] Subdirs:<nil>]
|
| 64/2 |
2026/08/20 00:57 |
llm |
expert |
0m
Model:
Tokens:
input: 51671
output: 33
thoughts: 1059
Thoughts: **Analyzing a Potential Linux Kernel ATM Driver Vulnerability**
Okay, so it looks like most of the ATM drivers in the Linux kernel are gone – only `solos-pci.c` and the USB ATM drivers (`usbatm.c`, `cxacru.c`, `speedtch.c`, `ueagle-atm.c`, `xusbatm.c`) are left. Let's focus on those. I see that the `solos-pci` driver defines `vpi_bits` and `vci_bits`, but the `usbatm` driver sets these to -1, or `ATM_CI_MAX`. Hmm, that's interesting...
So, with `vpi_bits` being -1 in `usbatm`, the shift operation `vpi >> dev->ci_range.vpi_bits` becomes a problem. Since it's negative, this causes undefined behavior. On an x86 system, this evaluates to `vpi >> 31`. For positive `vpi` values, that's just zero. Which means the range check `vpi >> dev->ci_range.vpi_bits` doesn't actually *fail*, allowing any `vpi >= 0`. This allows arbitrary `vpi` values to be assigned to `vcc->vpi` and `new->vpi`.
However, from what I'm seeing, this isn't immediately exploitable for memory corruption or out-of-bounds access. The values seem to be used solely as identifiers within `find_ci` and `check_ci`. It's essentially a logical bug – a broken VPI/VCI range check. The only real consequence I see is a UBSAN warning, but that's disabled in production kernels, which means no crash, no memory corruption, no information leak. So it's not looking like a big deal here.
Now, could there be a denial-of-service vector? If a user tries to use `ATM_VPI_ANY` or `ATM_VCI_ANY`, `find_ci` will loop and return `-EADDRINUSE`. This fails `bind()` calls, but that's a functional bug, not a full DoS. The kernel isn't crashing, it's just reporting an error.
Wait, let's look at `1 << dev->ci_range.vpi_bits`... With `vpi_bits` being -1, that's `1 << -1`, another UB. On x86, this is equivalent to `1 << 31`, which becomes `-2147483648`. I see, so `p >= -2147483648` is always true, so `p` is reset to 0. Similarly, `c >= -2147483648` is always true so `c` becomes `ATM_NOT_RSV_VCI`. Then `check_ci()` gets called. If it fails (VPI/VCI already in use), the values of `c` and `p` are incremented, but then reset. So the loop condition becomes false and the result is `-EADDRINUSE`. So, it just fails to find a free VPI/VCI, again just a failed `bind()`, no DoS.
Okay, let's consider architecture-specific behaviour: could `vpi >> -1` or `1 << -1` actually *trap* on some other architecture? On x86 and ARM, it's masked or modulo, so no. On some architectures it could be UB that the compiler might optimize in weird ways, but typically it won't cause a trap, unless UBSAN is enabled with `panic_on_warn`. But we are analyzing without debug tools. In production, no, this is not exploitable and doesn't lead to DoS.
I should check the `net/atm/` code to see if `vpi` or `vci` could be used to index an array somewhere else. That's the next step, I need to check how it's used elsewhere in the networking stack.
|
| 65/2 |
2026/08/20 00:57 |
tool |
grepper |
0m
Error:
Args: map[Expression:\[vpi\]|\[vci\] PathPrefix:net/atm/]
Results:
|
| 66/2 |
2026/08/20 00:57 |
llm |
expert |
0m
Model:
Tokens:
input: 53674
output: 29
thoughts: 10
Thoughts: Here's my attempt at summarizing that thought process, tailored for an expert audience:
**Considering Potential Vector-to-Physical Interface Implications**
Okay, so I'm thinking about how we're handling the vector control circuit (VCC) interactions with the physical interface, specifically, the Vector-to-Physical Interface (`vcc->vpi`). I need to really consider what this implementation entails. My brain is already running through different scenarios in how this could impact latency, what the data flow implications are, and whether it introduces any new potential bottlenecks in the system. I also need to make sure that the control hand-off between the `vcc` and `vpi` is clean, that the protocol is well-defined, and that we don't introduce race conditions. The overall design needs to be robust, performant, and, ideally, minimize the amount of overhead associated with this particular interface. I should go check the spec to make sure it covers it fully. I am mentally mapping out the architecture with that thought in mind.
|
| 67/2 |
2026/08/20 00:57 |
tool |
grepper |
0m
Args: map[Expression:vcc->vpi PathPrefix:net/atm/]
Results: map[Output:net/atm/br2684.c=784=static int br2684_seq_show(struct seq_file *seq, void *v)
--
net/atm/br2684.c-800- "\n", brvcc->atmvcc->dev->number,
net/atm/br2684.c:801: brvcc->atmvcc->vpi, brvcc->atmvcc->vci,
net/atm/br2684.c-802- (brvcc->encaps == e_llc) ? "LLC" : "VC",
--
net/atm/common.c=139=int vcc_create(struct net *net, struct socket *sock, int protocol, int family, int kern)
--
net/atm/common.c-162- vcc->release_cb = NULL;
net/atm/common.c:163: vcc->vpi = vcc->vci = 0; /* no VCI/VPI yet */
net/atm/common.c-164- vcc->atm_options = vcc->aal_options = 0;
--
net/atm/common.c=374=static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, short vpi,
--
net/atm/common.c-395- }
net/atm/common.c:396: vcc->vpi = vpi;
net/atm/common.c-397- vcc->vci = vci;
--
net/atm/common.c=756=int vcc_getsockopt(struct socket *sock, int level, int optname,
--
net/atm/common.c-787- pvc.sap_addr.itf = vcc->dev->number;
net/atm/common.c:788: pvc.sap_addr.vpi = vcc->vpi;
net/atm/common.c-789- pvc.sap_addr.vci = vcc->vci;
--
net/atm/proc.c=138=static void pvc_info(struct seq_file *seq, struct atm_vcc *vcc)
--
net/atm/proc.c-148- seq_printf(seq, "%3d %3d %5d %-3s %7d %-5s %7d %-6s",
net/atm/proc.c:149: vcc->dev->number, vcc->vpi, vcc->vci,
net/atm/proc.c-150- vcc->qos.aal >= ARRAY_SIZE(aal_name) ? "err" :
--
net/atm/proc.c=158=static void vcc_info(struct seq_file *seq, struct atm_vcc *vcc)
--
net/atm/proc.c-165- else
net/atm/proc.c:166: seq_printf(seq, "%3d %3d %5d ", vcc->dev->number, vcc->vpi,
net/atm/proc.c-167- vcc->vci);
--
net/atm/pvc.c=27=static int pvc_bind(struct socket *sock, struct sockaddr_unsized *sockaddr,
--
net/atm/pvc.c-46- if (test_bit(ATM_VF_PARTIAL, &vcc->flags)) {
net/atm/pvc.c:47: if (vcc->vpi != ATM_VPI_UNSPEC)
net/atm/pvc.c:48: addr->sap_addr.vpi = vcc->vpi;
net/atm/pvc.c-49- if (vcc->vci != ATM_VCI_UNSPEC)
--
net/atm/pvc.c=89=static int pvc_getname(struct socket *sock, struct sockaddr *sockaddr,
--
net/atm/pvc.c-100- addr->sap_addr.itf = vcc->dev->number;
net/atm/pvc.c:101: addr->sap_addr.vpi = vcc->vpi;
net/atm/pvc.c-102- addr->sap_addr.vci = vcc->vci;
--
net/atm/raw.c=44=static int atm_send_aal0(struct atm_vcc *vcc, struct sk_buff *skb)
--
net/atm/raw.c-51- (((u32 *)skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) !=
net/atm/raw.c:52: ((vcc->vpi << ATM_HDR_VPI_SHIFT) |
net/atm/raw.c-53- (vcc->vci << ATM_HDR_VCI_SHIFT))) {
]
|
| 68/2 |
2026/08/20 00:57 |
llm |
expert |
0m
Model:
Tokens:
input: 55177
output: 28
thoughts: 252
Thoughts: **My Initial Assessment of the ATM Header Check**
Okay, so I'm looking at this bit of code in `net/atm/raw.c`, specifically this check here: `(((u32 *)skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) != ((vcc->vpi << ATM_HDR_VPI_SHIFT) | (vcc->vci << ATM_HDR_VCI_SHIFT)))`. It's pretty straightforward, comparing values from the incoming packet's header against the expected VPI and VCI of the ATM virtual circuit. However, my immediate concern is the potential for integer overflow in the shift operation, especially with `vcc->vpi`. Since `ATM_HDR_VPI_SHIFT` is 20 bits, and `vcc->vpi` is a `short`, which, if negative, gets promoted to an `int` for the shift, that's where the problem lies. A very large or negative `vcc->vpi` could easily cause an overflow or overlap, potentially leading to incorrect comparisons.
Now, this is just a sanity check for outgoing AAL0 packets. It's not a security vulnerability in the strictest sense because it's about packet filtering, not arbitrary code execution. Worst case, the packet is probably dropped or rerouted incorrectly. It’s definitely something that needs to be addressed for robustness, and potentially for correct operation if the VPI values are unusually large, but I don't see an immediate threat surface.
Next, I think I'll investigate the `drivers/usb/atm/` directory to see how `vpi` and `vci` are used there. It's always good to understand the broader context.
|
| 69/2 |
2026/08/20 00:57 |
tool |
grepper |
0m
Args: map[Expression:vpi PathPrefix:drivers/usb/atm/]
Results: map[Output:drivers/usb/atm/usbatm.c=130=struct usbatm_vcc_data {
drivers/usb/atm/usbatm.c:131: /* vpi/vci lookup */
drivers/usb/atm/usbatm.c-132- struct list_head list;
drivers/usb/atm/usbatm.c:133: short vpi;
drivers/usb/atm/usbatm.c-134- int vci;
--
drivers/usb/atm/usbatm.c=280=static inline struct usbatm_vcc_data *usbatm_find_vcc(struct usbatm_data *instance,
drivers/usb/atm/usbatm.c:281: short vpi, int vci)
drivers/usb/atm/usbatm.c-282-{
--
drivers/usb/atm/usbatm.c-285- list_for_each_entry(vcc_data, &instance->vcc_list, list)
drivers/usb/atm/usbatm.c:286: if ((vcc_data->vci == vci) && (vcc_data->vpi == vpi))
drivers/usb/atm/usbatm.c-287- return vcc_data;
--
drivers/usb/atm/usbatm.c=291=static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char *source)
--
drivers/usb/atm/usbatm.c-294- struct sk_buff *sarb;
drivers/usb/atm/usbatm.c:295: short vpi = ((source[0] & 0x0f) << 4) | (source[1] >> 4);
drivers/usb/atm/usbatm.c-296- int vci = ((source[1] & 0x0f) << 12) | (source[2] << 4) | (source[3] >> 4);
--
drivers/usb/atm/usbatm.c-298-
drivers/usb/atm/usbatm.c:299: if ((vci != instance->cached_vci) || (vpi != instance->cached_vpi)) {
drivers/usb/atm/usbatm.c:300: instance->cached_vpi = vpi;
drivers/usb/atm/usbatm.c-301- instance->cached_vci = vci;
drivers/usb/atm/usbatm.c-302-
drivers/usb/atm/usbatm.c:303: instance->cached_vcc = usbatm_find_vcc(instance, vpi, vci);
drivers/usb/atm/usbatm.c-304-
drivers/usb/atm/usbatm.c-305- if (!instance->cached_vcc)
drivers/usb/atm/usbatm.c:306: atm_rldbg(instance, "%s: unknown vpi/vci (%hd/%d)!\n", __func__, vpi, vci);
drivers/usb/atm/usbatm.c-307- }
--
drivers/usb/atm/usbatm.c-316- if (printk_ratelimit())
drivers/usb/atm/usbatm.c:317: atm_warn(instance, "%s: OAM not supported (vpi %d, vci %d)!\n",
drivers/usb/atm/usbatm.c:318: __func__, vpi, vci);
drivers/usb/atm/usbatm.c-319- atomic_inc(&vcc->stats->rx_err);
--
drivers/usb/atm/usbatm.c=454=static unsigned int usbatm_write_cells(struct usbatm_data *instance,
--
drivers/usb/atm/usbatm.c-468-
drivers/usb/atm/usbatm.c:469: ptr[0] = vcc->vpi >> 4;
drivers/usb/atm/usbatm.c:470: ptr[1] = (vcc->vpi << 4) | (vcc->vci >> 12);
drivers/usb/atm/usbatm.c-471- ptr[2] = vcc->vci >> 4;
--
drivers/usb/atm/usbatm.c=770=static int usbatm_atm_open(struct atm_vcc *vcc)
--
drivers/usb/atm/usbatm.c-775- int vci = vcc->vci;
drivers/usb/atm/usbatm.c:776: short vpi = vcc->vpi;
drivers/usb/atm/usbatm.c-777-
--
drivers/usb/atm/usbatm.c-800-
drivers/usb/atm/usbatm.c:801: if (usbatm_find_vcc(instance, vpi, vci)) {
drivers/usb/atm/usbatm.c:802: atm_dbg(instance, "%s: %hd/%d already in use!\n", __func__, vpi, vci);
drivers/usb/atm/usbatm.c-803- ret = -EADDRINUSE;
--
drivers/usb/atm/usbatm.c-813- new->vcc = vcc;
drivers/usb/atm/usbatm.c:814: new->vpi = vpi;
drivers/usb/atm/usbatm.c-815- new->vci = vci;
--
drivers/usb/atm/usbatm.c-827- instance->cached_vcc = new;
drivers/usb/atm/usbatm.c:828: instance->cached_vpi = vpi;
drivers/usb/atm/usbatm.c-829- instance->cached_vci = vci;
--
drivers/usb/atm/usbatm.c=849=static void usbatm_atm_close(struct atm_vcc *vcc)
--
drivers/usb/atm/usbatm.c-863- instance->cached_vcc = NULL;
drivers/usb/atm/usbatm.c:864: instance->cached_vpi = ATM_VPI_UNSPEC;
drivers/usb/atm/usbatm.c-865- instance->cached_vci = ATM_VCI_UNSPEC;
--
drivers/usb/atm/usbatm.c-875-
drivers/usb/atm/usbatm.c:876: vcc->vpi = ATM_VPI_UNSPEC;
drivers/usb/atm/usbatm.c-877- vcc->vci = ATM_VCI_UNSPEC;
--
drivers/usb/atm/usbatm.c=901=static int usbatm_atm_init(struct usbatm_data *instance)
--
drivers/usb/atm/usbatm.c-919-
drivers/usb/atm/usbatm.c:920: atm_dev->ci_range.vpi_bits = ATM_CI_MAX;
drivers/usb/atm/usbatm.c-921- atm_dev->ci_range.vci_bits = ATM_CI_MAX;
--
drivers/usb/atm/usbatm.c=1008=int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
--
drivers/usb/atm/usbatm.c-1164-
drivers/usb/atm/usbatm.c:1165: instance->cached_vpi = ATM_VPI_UNSPEC;
drivers/usb/atm/usbatm.c-1166- instance->cached_vci = ATM_VCI_UNSPEC;
--
drivers/usb/atm/usbatm.h=119=struct usbatm_data {
--
drivers/usb/atm/usbatm.h-161- int cached_vci;
drivers/usb/atm/usbatm.h:162: short cached_vpi;
drivers/usb/atm/usbatm.h-163-
]
|
| 70/2 |
2026/08/20 00:57 |
llm |
expert |
0m
Model:
Tokens:
input: 57925
output: 66
thoughts: 3414
Thoughts: **Assessment of the ATM VPI/VCI Handling Vulnerability**
Okay, after a deep dive, here's my understanding of this ATM VPI/VCI issue. It boils down to a UBSAN shift-out-of-bounds situation, primarily affecting the `usbatm` driver. My initial concern was about potential denial-of-service or exploitability, but the reality is thankfully less severe, and the risk lies in functional issues rather than security breaches.
The core of the problem stems from how `vpi_bits` and `vci_bits` are handled. Specifically, in `__vcc_connect` and `find_ci` where `ci_range.vpi_bits` is -1. This leads to a shift by a negative amount, undefined behavior per the C standard. However, on most common architectures like x86, ARM, and others, this is masked and doesn't trigger a kernel panic directly (unless UBSAN is configured to do so). It just allows or rejects invalid VPI/VCI values due to truncation, so in practice, the shifts are not critical.
Here's the breakdown of what I see:
* **Exploitability**: Not really. There's no memory corruption, information leakage, or privilege escalation. It's strictly a UBSAN issue.
* **Denial of Service**: Again, unlikely. While the code might return an error if specific VPI/VCIs are used, or limit you to one `ANY` binding, it doesn't cause a kernel crash or make the system unresponsive. It might lead to a failure in binding, but not a DoS.
* **Access from Unprivileged Processes**: Yes, definitely. An unprivileged user can trigger this through the `socket(AF_ATMPVC, SOCK_DGRAM, 0)` and `bind()` system calls. The check with `capable(CAP_NET_BIND_SERVICE)` is relevant for VCI values, but if VCI is 32 or more, no capabilities are needed. It's easy for unprivileged users to reach this, so they can trigger the buggy logic.
* **Access from User Namespaces**: Yes, the same applies here.
* **Peripheral Trigger**: Yes, the reproducer uses USB to trigger this. This means an unprivileged user can trigger this issue by connecting a USB ATM device and then using `bind()`.
* **Other Trigger Vectors**: Not applicable.
The interesting bit is `find_ci`. The potential for an infinite loop if `vpi_bits` is -1 looks possible, but I've carefully re-verified that logic and found that's not the case. It terminates, returning -EADDRINUSE. The result is you can only have one socket bound to `ANY` on a `usbatm` device! So you'll have binding errors from then on.
The main concern seems to be a functional bug, where the driver doesn't properly validate the VPI/VCI values, but it's not a security vulnerability. The impact seems very low. Since UBSAN isn't enabled in a production system, it's not a major issue.
So the most accurate description is a functional bug that, while not exploitable or a DoS, is triggerable by unprivileged users with a USB ATM device. I'll stick with that. I'm confident in this evaluation.
|
| 71/2 |
2026/08/20 00:58 |
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]
|
| 72/2 |
2026/08/20 00:58 |
llm |
expert |
0m
Model:
Tokens:
input: 62195
output: 778
thoughts: 404
Thoughts: **My Final Thoughts on the USB ATM Bug**
Okay, the analysis is complete, and it's time to craft the final response. Here's how I see this:
The issue boils down to a shift-out-of-bounds in the ATM code, specifically within `net/atm/common.c`, in the `__vcc_connect` and `find_ci` functions. It all starts with how the USB ATM framework, `usbatm`, initializes the `atm_dev->ci_range.vpi_bits` and `vci_bits` variables to `ATM_CI_MAX`, which is defined as -1. That sets the stage for disaster.
When a user, like myself, binds an ATM socket to a USB ATM device, the kernel ends up evaluating expressions like `vpi >> dev->ci_range.vpi_bits` (essentially, `vpi >> -1`) and `1 << dev->ci_range.vpi_bits` (or `1 << -1`). And that's where the problem arises: negative shift counts in C lead to undefined behavior. We're talking about a UBSAN warning here.
While this might seem like a critical vulnerability, on most architectures, the shift count gets masked. This masks the negative shifts by architecture-specific values (e.g., 31 or 63). This prevents a hard crash (no trap or hardware exception). Instead, we get a shift to 0 or a garbage value.
The real trouble is the *logical* consequence. This undefined behavior introduces a subtle bug. The VPI/VCI range check that follows is bypassed or produces incorrect results, meaning that the kernel either wrongly claims that a valid VPI/VCI is free, or misses a valid one. However, the good news is that this doesn't lead to memory corruption, out-of-bounds access, information leaks, or a kernel panic. It's a logic error, but not a memory safety issue.
The practical impact is further limited by the fact that UBSAN is typically disabled in production builds. Therefore, this bug isn't a security concern for most real-world deployments. An unprivileged user can trigger this (binding to VCI >= 32 doesn't require `CAP_NET_BIND_SERVICE`) if a USB ATM device is present or plugged in, which presents a peripheral trigger. That's the core of the issue.
Now I'll craft a clear, concise explanation of this analysis, ready for consumption.
|
| 73/1 |
2026/08/20 00:58 |
action |
format-explanation |
0m
Results: map[Explanation:Based on the analysis of the provided bug report and the kernel source code,
here is the assessment of the bug's security impact:
### Bug Mechanism
The bug is a shift-out-of-bounds (Undefined Behavior) in the ATM subsystem,
specifically in `__vcc_connect` and `find_ci` within `net/atm/common.c`.
It is triggered when a user attempts to `bind()` an ATM socket to a device
managed by the USB ATM framework (`drivers/usb/atm/usbatm.c`). During the
initialization of a USB ATM device, the framework sets the device's VPI and VCI
bit ranges to `ATM_CI_MAX`:
```c
atm_dev->ci_range.vpi_bits = ATM_CI_MAX;
atm_dev->ci_range.vci_bits = ATM_CI_MAX;
```
`ATM_CI_MAX` is defined as `-1` in `include/uapi/linux/atmdev.h`.
Later, when `bind()` is called, the kernel validates the requested VPI/VCI
values using a bitwise shift:
```c
if ((vpi != ATM_VPI_UNSPEC && vpi != ATM_VPI_ANY &&
vpi >> dev->ci_range.vpi_bits) || ...
```
Because `vpi_bits` is `-1`, the expression evaluates to `vpi >> -1` (and
similarly `1 << -1` in `find_ci`). Shifting by a negative exponent is undefined
behavior in C, which is correctly caught by the Undefined Behavior Sanitizer
(UBSAN).
### Security Impact
**Exploitable: False**
**Denial of Service: False**
While this is undefined behavior in C, on all major hardware architectures (x86,
ARM, PowerPC, RISC-V, etc.), the CPU simply masks the shift count (e.g., by 31
or 63). For example, on x86, `vpi >> -1` becomes `vpi >> 31`. This does not
cause a hardware trap, CPU exception, or kernel panic.
The result of this masked shift is just used in a boolean condition. It leads to
a logical flaw where the kernel fails to properly restrict the maximum VPI/VCI
values or fails to auto-assign a free VPI/VCI (`-EADDRINUSE`). However, these
values are merely used as identifiers and are not used to index arrays or
allocate memory. Therefore, it does not lead to memory corruption, out-of-bounds
memory accesses, or information leaks. In a production kernel where UBSAN is
disabled, this bug is completely benign and has no security implications.
**Accessible From Unprivileged Processes: True**
**Accessible From User Namespaces: True**
An unprivileged user can create an `AF_ATMPVC` socket and call `bind()`. The
kernel only requires `CAP_NET_BIND_SERVICE` if the requested VCI is less than
`ATM_NOT_RSV_VCI` (32). Binding to a VCI $\ge$ 32 is entirely unprivileged.
**Peripheral Trigger: True**
To reach this specific code path, an ATM device that sets `vpi_bits = -1` must
be present. In the Linux kernel, only the `usbatm` framework does this.
Therefore, the bug can be triggered if a malicious or legitimate USB ATM modem
is physically plugged into the system (as simulated by the `syz_usb_connect`
call in the reproducer).]
|