From e2f27c3515f1d25672dedf92071bf6d40f623969 Mon Sep 17 00:00:00 2001 From: fellair Date: Thu, 19 Jun 2025 19:51:06 +0300 Subject: sys/linux: add descriptions for BSG devices BSG is a block layer version of SG driver with its own devices, which can be found in /dev/bsg/*. Currently, syzkaller barely touches related code in block/ and drivers/scsi/ source directories, so update the descriptions to nudge the fuzzer in the right direction. Specifically, - create a separate description file dev_bsg.txt; - move openat$bsg from sys.txt and fix the way devices in question are accessed; - describe necessary syscalls and structs, most importantly, sg_io_v4. - add a few TODOs to address later. A few words about flaws in sq_io_v4 description: Some fields were left more ambigious than desired. Once more research into the way bsg operates is done, as well as related coverage is gathered, those flaws will be corrected. --- sys/linux/dev_bsg.txt.const | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 sys/linux/dev_bsg.txt.const (limited to 'sys/linux/dev_bsg.txt.const') diff --git a/sys/linux/dev_bsg.txt.const b/sys/linux/dev_bsg.txt.const new file mode 100644 index 000000000..e0a6045d2 --- /dev/null +++ b/sys/linux/dev_bsg.txt.const @@ -0,0 +1,23 @@ +# Code generated by syz-sysgen. DO NOT EDIT. +arches = 386, amd64, arm, arm64, mips64le, ppc64le, riscv64, s390x +AT_FDCWD = 18446744073709551516 +BSG_FLAG_Q_AT_HEAD = 32 +BSG_FLAG_Q_AT_TAIL = 16 +BSG_PROTOCOL_SCSI = 0 +BSG_SUB_PROTOCOL_SCSI_CMD = 0 +BSG_SUB_PROTOCOL_SCSI_TMF = 1 +BSG_SUB_PROTOCOL_SCSI_TRANSPORT = 2 +BSG_XFER_SIZE = 128 +SCSI_CDB_SIZE = 32 +SCSI_SENSE_BUFFERSIZE = 96 +SG_EMULATED_HOST = 8707 +SG_GET_COMMAND_Q = 8816 +SG_GET_RESERVED_SIZE = 8818 +SG_GET_TIMEOUT = 8706 +SG_GET_VERSION_NUM = 8834 +SG_IO = 8837 +SG_SET_COMMAND_Q = 8817 +SG_SET_RESERVED_SIZE = 8821 +SG_SET_TIMEOUT = 8705 +__NR_ioctl = 54, amd64:16, arm64:riscv64:29, mips64le:5015 +__NR_openat = 56, 386:295, amd64:257, arm:322, mips64le:5247, ppc64le:286, s390x:288 -- cgit mrf-deployment