aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux/init_vusb.go
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@gmail.com>2025-08-17 14:53:44 +0000
committerAleksandr Nogikh <nogikh@google.com>2025-08-21 12:29:58 +0000
commit5ec502e031c3ca7cad5ac0aa468469b7b9b85d1d (patch)
tree2904dc7b5bdfa922285d36d577b844a359b47427 /sys/linux/init_vusb.go
parent32aa395ffd5035ed3d563077ade0202f3d5eb516 (diff)
tools/usbgen: extract driver names
Change the kernel patch and the syz-usbgen tool to split the extracted USB IDs by the driver they belong to. This will allow for a more precise patching of class/driver-specific USB descriptors. Also update USB IDs with Linux kernel 6.16.
Diffstat (limited to 'sys/linux/init_vusb.go')
-rw-r--r--sys/linux/init_vusb.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/linux/init_vusb.go b/sys/linux/init_vusb.go
index ca645bf45..0c1906819 100644
--- a/sys/linux/init_vusb.go
+++ b/sys/linux/init_vusb.go
@@ -92,9 +92,9 @@ func (arch *arch) generateUsbDeviceDescriptor(g *prog.Gen, typ0 prog.Type, dir p
}
func randUsbDeviceID(g *prog.Gen) UsbDeviceID {
- totalIds := len(usbIds) / BytesPerUsbID
+ totalIds := len(usbIdsAll) / BytesPerUsbID
idNum := g.Rand().Intn(totalIds)
- base := usbIds[idNum*BytesPerUsbID : (idNum+1)*BytesPerUsbID]
+ base := usbIdsAll[idNum*BytesPerUsbID : (idNum+1)*BytesPerUsbID]
p := strings.NewReader(base)
var id UsbDeviceID
@@ -151,9 +151,9 @@ func (arch *arch) generateUsbHidDeviceDescriptor(g *prog.Gen, typ0 prog.Type, di
return
}
- totalIds := len(hidIds) / BytesPerHidID
+ totalIds := len(hidIdsAll) / BytesPerHidID
idNum := g.Rand().Intn(totalIds)
- base := hidIds[idNum*BytesPerHidID : (idNum+1)*BytesPerHidID]
+ base := hidIdsAll[idNum*BytesPerHidID : (idNum+1)*BytesPerHidID]
p := strings.NewReader(base)
var id HidDeviceID