-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
TL;DR: syzkaller needs to be tuned in a few ways to expand coverage of select usb drivers.
There are a few usb drivers that either have not been properly covered from the start or have lost coverage over time (judging from 8-month long stats derived from syzbot - I used it to identify flaws listed below). I've done a quick, incomplete audit to determine the possible reasons and their solutions. Some issues are already mentioned in #533.
1. Failed usb interface/endpoint checks (or other settings like USB speed)
Examples:
rtl8150 - lost coverage; ironically, syzkaller can't pass a check made by me...
au0828 - lost coverage; mostly breaks due to incorrectly set USB speed.
+others like radio-shark, radio-shark2, redrat3 etc.
Q: Ideally, we need to tweak generic syz* calls that deal with connecting to increase chances of correct ennumeration (better mutation and whatnot). But in the meantime, should we describe syz_usb_connect$ variants (plus others), similar to ath9k but without modified pseudo-calls, to gain coverage?
2. Failed due to a number of early CONTROL requests in both directions during probe.
Examples:
cx231xx - probe can't finish; syzkaller tries to react to READ requests but doesn't seem to succeed fully.
lan78xx - syzbot shows failure at ep check time; however, the main issue is during probe() there are tens of ctrl requests, in and out. Having experimented a bit, I've come to a conclusion that the sheer number of requests is so high that fuzzer may not want to generate essentially the same syscalls in a row, thus stoping probe() half way. It will generate a program with ~15 syz_usb_control_io$, when 30 is necessary. I've tried manually crafting a program to push it further but read requests are tricky. And that's on top of connect$ and control_io$ call variants tailored for lan78xx.
+some others.
Q: Describing syscall variants$ for drivers with such specific issues should help somewhat. Is it a good idea? As for lan78xx, I wonder if a single pseudo-call that loops for ~30 secs and sends/receives requests until probe is finished is in order?
3. r8152 device needs to handle a READ request early.
See usb_control_msg here. It's similar to ath9k case, just a different direction. In my view, this necessitates describing a separate syz_usb_connect pseudo-call for r8152 as well as changing syz_usb_connect_impl() call to take a different lookup_connect_response_in() (not _out) function as an argument.
Q: Is this solution sound?
4. Missing firmware.
Examples:
s2255 - again, usb ep checks fail, but firmware also can't be found.
go7007 - same case.
I don't remember why firmware may not be found but I imagine the fault is either with missing config options or with missing packages from the image. This can be easily remedied.
Provided my suggestions are deemed sensible, I'll start implementing them. Thank you for your time.