aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_usb.h
Commit message (Collapse)AuthorAgeFilesLines
* executor: resolve pseudo syscall compilation problemsAleksandr Nogikh2023-05-041-8/+19
|
* executor: fix out of bounds write in lookup_connect_response_in()Ovidiu Panait2022-06-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gcc 12.1 reports the following -Werror=array-bounds error: /// In function 'bool lookup_connect_response_in(...)' executor/common_usb.h:632:66: error: array subscript 'usb_qualifier_descriptor[0]' is partly outside array bounds of 'char [8]' [-Werror=array-bounds] | 632 | qual->bNumConfigurations = index->dev->bNumConfigurations; | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function 'volatile long int syz_usb_connect_impl(...)': executor/common_usb_linux.h:332:23: note: object 'response_data' of size 8 | 332 | char* response_data = NULL; | ^~~~~~~~~~~~~ ... In function 'bool lookup_connect_response_in(...)', executor/common_usb.h:633:57: error: array subscript 'usb_qualifier_descriptor[0]' is partly outside array bounds of 'char [8]' [-Werror=array-bounds] | 633 | qual->bRESERVED = 0; | ~~~~~~~~~~~~~~~~^~~ In function 'volatile long int syz_usb_connect_impl(...)': executor/common_usb_linux.h:332:23: note: object 'response_data' of size 8 332 | char* response_data = NULL; | ^~~~~~~~~~~~~ /// Current code in USB_DT_DEVICE_QUALIFIER case treats respose_data as a buffer, but in reality it is just a pointer, as detailed in the error trace above. In order to allow passing a usb_qualifier_descriptor struct back to the caller (via response_data), add a new parameter to lookup_connect_response_in(). Build tested only. Fixes: 0c00210ff32 ("executor: always provide DEVICE_QUALIFIER USB descriptor") Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
* executor: check for single-line compound statementsDmitry Vyukov2021-10-011-2/+1
| | | | | | Historically the code base does not use single-line compound statements ({} around single-line blocks). But there are few precedents creeped into already. Add a check to keep the code base consistent.
* executor: warn about C89-style var declarationsDmitry Vyukov2020-08-141-2/+1
| | | | | | | | | | | | | | | | | We generally use the newer C99 var declarations combined with initialization because: - declarations are more local, reduced scope - fewer lines of code - less potential for using uninit vars and other bugs However, we have some relic code from times when we did not understand if we need to stick with C89 or not. Also some external contributions that don't follow style around. Add a static check for C89-style declarations and fix existing precedents. Akaros toolchain uses -std=gnu89 (or something) and does not allow variable declarations inside of for init statement. And we can't switch it to -std=c99 because Akaros headers are C89 themselves. So in common.h we need to declare loop counters outside of for.
* executor: remove NONFAILING from pseudo-syscallsDmitry Vyukov2020-07-151-3/+1
| | | | | | This is not needed anymore afer the previous commit. Fixes #1918
* executor: add support for USB fuzzing on NetBSDm00nbsd2020-05-191-8/+2
|
* executor, sys/linux: syz_usb_ep_read/write accept endpoint addressAndrey Konovalov2020-05-151-2/+15
| | | | | This patch changes syz_usb_ep_read/write pseudo-syscalls to accept endpoint address as specified in its endpoint descriptor, instead of endpoint index.
* executor: stall unknown usb requestsAndrey Konovalov2020-05-151-3/+7
| | | | Also don't fail(), leave that to USB_DEBUG and analyze_control_request().
* executor/usb: don't fail when ath9k is not enabledAndrey Konovalov2020-04-071-1/+1
|
* executor: add some comments to USB helper functionsAndrey Konovalov2020-03-281-0/+17
|
* executor: split out Linux specific USB codeAndrey Konovalov2020-03-281-533/+27
|
* executor, sys/linux: add ath9k usb descriptionsAndrey Konovalov2020-03-131-26/+106
| | | | | | | Among other things this changes timeout for USB programs from 2 to 3 seconds. ath9k fuzzing also requires ath9k firmware to be present, so system images need to be regenerated with the updated script.
* executor: provide explicit values for usb_raw_event_typeAndrey Konovalov2020-01-131-3/+3
| | | | To match the kernel uapi headers.
* executor: update raw gadget interfaceAndrey Konovalov2019-12-111-5/+7
|
* executor: extend USB debug messagesAndrey Konovalov2019-11-191-43/+435
| | | | | When USB_DEBUG is enabled, syzkaller crashes on unknown USB requests. This helps to find missing descriptions for particular USB classes.
* executor, pkg/host: update usb raw-gadget interfaceAndrey Konovalov2019-11-151-18/+18
| | | | The patches are being upstreamed and the interface has changed.
* executor: update the list of raw usb eventsAndrey Konovalov2019-11-051-2/+0
| | | | The number of reported event types changed.
* executor, pkg/host, dashboard/config: rename usb-fuzzer to usb raw-gadgetAndrey Konovalov2019-11-041-88/+87
| | | | The interface is being upstreamed and the name has changed.
* executor/usb: enable endpoints on SET_INTERFACEAndrey Konovalov2019-10-211-49/+182
| | | | | This commit changes syz_usb_control_io to enable the relevant endpoints for the interface being set via a SET_INTERFACE request.
* executor: handle USB IN requests with wLength == 0Andrey Konovalov2019-09-191-3/+7
|
* executor: always provide DEVICE_QUALIFIER USB descriptorAndrey Konovalov2019-09-191-0/+16
|
* executor/usb: use UTF16 encoding for default stringAndrey Konovalov2019-09-061-6/+18
| | | | Also respond with lang ID when string #0 is requested.
* executor/usb: fix null-ptr-deref in syz_usb_control_ioAndrey Konovalov2019-09-061-2/+2
|
* executor/usb: improve debugging messagesAndrey Konovalov2019-09-061-9/+9
|
* executor/usb: allow syz_usb_control_io args to be 0Andrey Konovalov2019-09-061-2/+7
|
* sys/linux, executor: basic support for multiple USB interfacesAndrey Konovalov2019-09-061-15/+26
|
* executor: fix sigsegv for default USB string responseAndrey Konovalov2019-09-051-1/+1
|
* sys/linux, executor: minor USB fixes (#1361)Andrey Konovalov2019-08-231-3/+6
|
* sys/linux: add basic USB CDC Ethernet descriptions (#1328)Andrey Konovalov2019-08-091-1/+1
|
* executor: add some USB realted TODOs (#1319)Andrey Konovalov2019-08-071-0/+2
| | | Also simplify timeout related code a bit.
* sys/linux, executor: improve USB descriptionsAndrey Konovalov2019-07-161-6/+49
| | | | | 1. Change HID descriptions to allow devices to have two interrupt endpoints. 2. Remove unneeded responses to OUT control requests from descriptions. 3. Add some debugging code to detect and report missing descriptions.
* executor: fix out-of-bounds in USB fuzzing codeAndrey Konovalov2019-07-111-5/+9
| | | | | We might not have any string descriptors provided at all, use a hardcoded string in this case.
* executor: update USB fuzzing code to use new kernel APIAndrey Konovalov2019-07-111-42/+68
| | | | | The kernel API has changed and now differentiates between IN and OUT control requests.
* sys/linux, executor: add syz_usb_ep_read syzkallAndrey Konovalov2019-07-011-19/+71
| | | | syz_usb_ep_read reads data from USB endpoints other than #0.
* sys/linux, executor: add basic USB HID fuzzing supportAndrey Konovalov2019-06-241-30/+73
| | | | | This commit adds the necessary descriptions and executor adjustments to enable targeted fuzzing of the enumeration process of USB HID devices.
* executor: fix another compiler warningAndrey Konovalov2019-04-251-1/+1
|
* executor: fix compiler warningAndrey Konovalov2019-04-241-2/+2
|
* executor: use NONFAILING in common_usb.hAndrey Konovalov2019-04-231-105/+130
| | | | Also move some code to helper functions.
* executor: adjust waiting time for all usb syzcallsAndrey Konovalov2019-04-231-2/+0
| | | | | | Allow 2000 ms of waiting time for syz_usb_connect and and the same time for the whole program is this syzkall is present. Allow 200 ms of waiting time for syz_usb_disconnect. Remove sleep from syz_usb_control_io.
* all: add basic USB fuzzing supportAndrey Konovalov2019-04-111-0/+452
This commits implements 4 syzcalls: syz_usb_connect, syz_usb_io_control, syz_usb_ep_write and syz_usb_disconnect. Those syzcalls are used to emit USB packets through a custom GadgetFS-like interface (currently exposed at /sys/kernel/debug/usb-fuzzer), which requires special kernel patches. USB fuzzing support is quite basic, as it mostly covers only the USB device enumeration process. Even though the syz_usb_ep_write syzcall does allow to communicate with USB endpoints after the device has been enumerated, no coverage is collected from that code yet.