-
Notifications
You must be signed in to change notification settings - Fork 1.4k
sys/linux: add basic descriptions for BSG devices #6113
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
Conversation
| pad const[0, int32] | ||
| } | ||
|
|
||
| # TODO: Format for bsg devices' names: "/dev/bsg/a:b:c:d". Figure out if a more sensible option exists |
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.
Depends on whether these need to already exist (in which case it's better to hard-code them here) or they can be arbitrary. If they can be arbitrary, something like this could be an option:
syzkaller/sys/linux/security_smack.txt
Lines 110 to 126 in d6cdfb8
| smack_ipv6 { | |
| d1 fmt[hex, int8] | |
| sp1 const[':', int8] | |
| d2 fmt[hex, int8] | |
| sp2 const[':', int8] | |
| d3 fmt[hex, int8] | |
| sp3 const[':', int8] | |
| d4 fmt[hex, int8] | |
| sp4 const[':', int8] | |
| d5 fmt[hex, int8] | |
| sp5 const[':', int8] | |
| d6 fmt[hex, int8] | |
| sp6 const[':', int8] | |
| d7 fmt[hex, int8] | |
| sp7 const[':', int8] | |
| d8 fmt[hex, int8] | |
| } [packed] |
But AFAIK syzkaller could be validating open inputs, so it may require the path to be an explicit string rather than a struct.
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.
Provided necessary config options are enabled (and they are in according syzbot instances), necessary devices are created automatically. The names described in .txt file seem to be consistent enough that I opted to hard-code them. I am looking into ways to spawn more of them (via config options and similar to null_blk) but this solution is stable enough.
Technically, they could be of a:b:c:d format, so it makes sense to look into other options, like the one you suggested. For now though it may fine, till I come up with a more elegant solution.
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.
For now a list of string consts is definitely OK.
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.
a-nogikh
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.
Thanks!
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,
P.S. No descriptions were removed, only expanded. Coverage is slightly improved compared to syzbot one in block/bsg.c and drivers/scsi/scsi_bsg.c among some others.
P.P.S. I plan to fix TODOs at a later date in a separate PR, once I understand more about SCSI and BSG.