-
Notifications
You must be signed in to change notification settings - Fork 1.4k
sys/linux: add UAC2, UAC3, and MIDI USB audio class descriptions #6644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This patch extends the USB audio fuzzing support by adding syzlang descriptions for: - UAC2 (USB Audio Class 2.0) devices with clock management units, interface association descriptors, and extended format types. - UAC3 (USB Audio Class 3.0) devices including power domain descriptors and cluster information segments. - USB MIDI devices with jack descriptors and streaming endpoints. A new generateAudioDeviceDescriptor function patches in both auto-extracted USB IDs from the kernel driver matching rules and hardcoded quirk IDs from the USB audio driver sources (sound/usb/). This approach follows the pattern established for the HID and printer classes, allowing exercising driver quirks that cannot be automatically extracted. The config descriptor template now includes an EXTRA field to support Interface Association Descriptors required by UAC2/UAC3. This also requires adjusting the interface field index in patchUsbDeviceID.
|
@xairy could you please have a quick look? |
xairy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Berk! Thank you for the PR! Left some comments - let's deal with these first and then I'll take a look at the syzlang part in a bit more detail.
| {0x0763, 0x2012}, | ||
| {0x047f, 0xc010}, | ||
| {0x2466, 0x8010}, | ||
| // sound/usb/stream.c ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??
| {0x0644, 0x800e}, | ||
| {0x0644, 0x800f}, | ||
| {0x0763, 0x0150}, | ||
| // Test if this covers midi.c | grep USB_VID_VENDOR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something that needs to be done?
| // Patch in IDs auto-extracted from the matching rules for the USB audio class. | ||
| // Do not patch IDs that are not used in the matching rules to avoid subverting | ||
| // the kernel into matching the device to a different driver. | ||
| // TODO: some of these strings might be missing is dict, check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, please do check this.
| # requires: -repeat | ||
|
|
||
| r0 = syz_usb_connect$midi(0x0, 0x0, &AUTO, &AUTO) | ||
| syz_usb_control_io$midi(r0, 0x0, 0x0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these seeds are very basic and probably do not bring any value. We need to either make them more involved (e.g. provide seeds that pass the corresponding driver's probeing) or just drop them.
| } [packed] | ||
|
|
||
| midi_vendor_ids = 0x403, 0x41e, 0x424, 0x45e, 0x499, 0x582, 0x763, 0x7cf, 0x86a, 0x9e8, 0xa12, 0xccd, 0xdba, 0x1235, 0x1395, 0x1686, 0x19b5, 0x1a86, 0x1f38, 0x200c, 0x4752, 0x7104 | ||
| midi_device_ids = 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xe, 0x10, 0x11, 0x12, 0x14, 0x16, 0x18, 0x1b, 0x1d, 0x21, 0x23, 0x25, 0x27, 0x29, 0x2d, 0x2f, 0x33, 0x35, 0x37, 0x40, 0x42, 0x44, 0x47, 0x48, 0x4c, 0x4d, 0x50, 0x52, 0x60, 0x62, 0x64, 0x65, 0x6d, 0x75, 0x7d, 0x80, 0x8b, 0x8d, 0xa3, 0xc4, 0xdd, 0x113, 0x120, 0x12f, 0x159, 0x283, 0x300, 0x1000, 0x100b, 0x1243, 0x1503, 0x1507, 0x1509, 0x150a, 0x150c, 0x2019, 0x2202, 0x3000, 0x6801, 0x6802, 0x752d, 0xb832, 0xb8d8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should not be defined here and should be patched in in proper pairs from the Go code.
Extend the USB audio fuzzing support by adding syzlang descriptions for:
A new generateAudioDeviceDescriptor function patches in both auto-extracted USB IDs from the kernel driver matching rules and hardcoded quirk IDs from the USB audio driver sources (sound/usb/). This approach follows the pattern established for the HID and printer classes, allowing exercising driver quirks that cannot be automatically extracted.
The config descriptor template now includes an EXTRA field to support Interface Association Descriptors required by UAC2/UAC3. This also requires adjusting the interface field index in patchUsbDeviceID.