diff options
| author | Andrey Konovalov <andreyknvl@google.com> | 2019-08-07 18:03:59 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-08-08 15:34:27 +0200 |
| commit | d545e945ce3761556e10fd6b4c20a952c0e821a1 (patch) | |
| tree | 9eac971ae8d917de598827c1941d872253d67080 /sys/linux/init.go | |
| parent | bcc419e9414564fc64cdde076635d6295641f9a4 (diff) | |
sys/linux: add syz_open_dev$char_usb descriptions
syz_open_dev$char_usb opens char devices with major = USB_MAJOR.
Sanitize its values to make sure it doesn't open other char/block devices.
Diffstat (limited to 'sys/linux/init.go')
| -rw-r--r-- | sys/linux/init.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/linux/init.go b/sys/linux/init.go index e24e7eb77..5ae9f001d 100644 --- a/sys/linux/init.go +++ b/sys/linux/init.go @@ -41,6 +41,7 @@ func InitTarget(target *prog.Target) { AF_AX25: target.GetConst("AF_AX25"), AF_NETROM: target.GetConst("AF_NETROM"), AF_ROSE: target.GetConst("AF_ROSE"), + USB_MAJOR: target.GetConst("USB_MAJOR"), // These are not present on all arches. ARCH_SET_FS: target.ConstMap["ARCH_SET_FS"], ARCH_SET_GS: target.ConstMap["ARCH_SET_GS"], @@ -138,6 +139,7 @@ type arch struct { AF_AX25 uint64 AF_NETROM uint64 AF_ROSE uint64 + USB_MAJOR uint64 } func (arch *arch) sanitizeCall(c *prog.Call) { @@ -206,6 +208,10 @@ func (arch *arch) sanitizeCall(c *prog.Call) { switch c.Meta.Name { case "setsockopt$EBT_SO_SET_ENTRIES": arch.sanitizeEbtables(c) + case "syz_open_dev$char_usb": + // Don't allow opening various char and block devices. + c.Args[0].(*prog.ConstArg).Val = 0xc + c.Args[1].(*prog.ConstArg).Val = arch.USB_MAJOR } } |
