aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_usb.h
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2020-05-13 17:36:30 +0200
committerAndrey Konovalov <andreyknvl@gmail.com>2020-05-15 16:30:32 +0200
commit55efafca377a08f2bc5509eb7eda3568ae9cde4e (patch)
tree3c2d1003143c1e547a21ce180e228f401f603756 /executor/common_usb.h
parentd7f9fffab3462d2954b61f144f810256ca007e56 (diff)
executor: stall unknown usb requests
Also don't fail(), leave that to USB_DEBUG and analyze_control_request().
Diffstat (limited to 'executor/common_usb.h')
-rw-r--r--executor/common_usb.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/executor/common_usb.h b/executor/common_usb.h
index 521ea3c28..0722750b7 100644
--- a/executor/common_usb.h
+++ b/executor/common_usb.h
@@ -168,6 +168,8 @@ const char* usb_class_to_string(unsigned value)
return "unknown";
}
+// A helper function that allows to see what kind of device is being emulated.
+// Useful for debugging.
static void analyze_usb_device(struct usb_device_index* index)
{
debug("analyze_usb_device: idVendor = %04x\n", (unsigned)index->dev->idVendor);
@@ -497,6 +499,8 @@ static bool analyze_control_request_vendor(struct usb_device_index* index, struc
return true;
}
+// A helper function that prints a request in readable form and returns whether descriptions for this
+// request exist. Needs to be updated manually when new descriptions are added. Useful for debugging.
static void analyze_control_request(int fd, struct usb_ctrlrequest* ctrl)
{
struct usb_device_index* index = lookup_usb_index(fd);
@@ -560,7 +564,7 @@ static const char default_lang_id[] = {
// lookup_connect_response_in() is a helper function that returns a response to a USB IN request
// based on syzkaller-generated arguments provided to syz_usb_connect* pseudo-syscalls. The data
// and its length to be used as a response are returned in *response_data and *response_length.
-// The return value of this function indicates whether the request is known to syzkaller.
+// The return value of this function lookup_connect_response_inindicates whether the request is known to syzkaller.
static bool lookup_connect_response_in(int fd, const struct vusb_connect_descriptors* descs,
const struct usb_ctrlrequest* ctrl,
@@ -636,7 +640,7 @@ static bool lookup_connect_response_in(int fd, const struct vusb_connect_descrip
break;
}
- fail("lookup_connect_response_in: unknown request");
+ debug("lookup_connect_response_in: unknown request");
return false;
}
@@ -662,7 +666,7 @@ static bool lookup_connect_response_out_generic(int fd, const struct vusb_connec
break;
}
- fail("lookup_connect_response_out: unknown request");
+ debug("lookup_connect_response_out: unknown request");
return false;
}
#endif // SYZ_EXECUTOR || __NR_syz_usb_connect