diff --git a/Makefile b/Makefile index 4d160120..36e5abcb 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,8 @@ ENV := $(subst \n,$(newline),$(shell \ SOURCEDIR=$(SOURCEDIR) HOSTOS=$(HOSTOS) HOSTARCH=$(HOSTARCH) \ TARGETOS=$(TARGETOS) TARGETARCH=$(TARGETARCH) TARGETVMARCH=$(TARGETVMARCH) \ go run tools/syz-env/env.go)) -$(info $(ENV)) +# Uncomment in case of emergency. +# $(info $(ENV)) $(eval $(ENV)) ifeq ("$(NCORES)", "") $(error syz-env failed) diff --git a/sys/linux/dev_kvm.txt.warn b/sys/linux/dev_kvm.txt.warn index d9e7a02e..e202534e 100644 --- a/sys/linux/dev_kvm.txt.warn +++ b/sys/linux/dev_kvm.txt.warn @@ -1,3 +1,4 @@ +unsupported syscall: ioctl$KVM_ARM_VCPU_INIT due to missing const KVM_ARM_VCPU_INIT struct kvm_text_x86: no corresponding struct in kernel struct kvm_text_x86_real: no corresponding struct in kernel struct kvm_text_x86_16: no corresponding struct in kernel diff --git a/sys/linux/dev_snd_control.txt.warn b/sys/linux/dev_snd_control.txt.warn index fb7e6fc7..f5ba6bdc 100644 --- a/sys/linux/dev_snd_control.txt.warn +++ b/sys/linux/dev_snd_control.txt.warn @@ -1,5 +1,6 @@ struct snd_ctl_elem_info: bad number of fields: syz=12 kernel=8 field snd_ctl_elem_info.items/value: bad size: syz=4 kernel=128 +len target names_ptr refer to an array with variable-size elements (do you mean bytesize?) field snd_ctl_elem_info.item/dimen: bad offset: syz=84 kernel=208 field snd_ctl_elem_info.item/dimen: bad size: syz=4 kernel=8 field snd_ctl_elem_info.name/reserved: bad offset: syz=88 kernel=216 diff --git a/sys/linux/netfilter_bridge.txt.warn b/sys/linux/netfilter_bridge.txt.warn index 26b7d658..62cb48b0 100644 --- a/sys/linux/netfilter_bridge.txt.warn +++ b/sys/linux/netfilter_bridge.txt.warn @@ -1,3 +1,4 @@ +len target entries refer to an array with variable-size elements (do you mean bytesize?) struct ebt_getinfo: no corresponding struct in kernel struct ebt_get_entries: no corresponding struct in kernel struct ebt_ip_info: bad number of fields: syz=12 kernel=10 diff --git a/sys/linux/sys.txt.warn b/sys/linux/sys.txt.warn index e0ea3a8b..2b297345 100644 --- a/sys/linux/sys.txt.warn +++ b/sys/linux/sys.txt.warn @@ -1,3 +1,4 @@ +unsupported syscall: sendfile64 due to missing const __NR_sendfile64 field seccomp_metadata.flags: bad size: syz=4 kernel=8 struct pipefd: no corresponding struct in kernel struct stat: bad size: syz=68 kernel=144 diff --git a/sys/linux/trusty.txt.warn b/sys/linux/trusty.txt.warn index 077fa810..92433828 100644 --- a/sys/linux/trusty.txt.warn +++ b/sys/linux/trusty.txt.warn @@ -4,6 +4,8 @@ struct trusty_password_handle: no corresponding struct in kernel struct trusty_km_secure_msg: no corresponding struct in kernel struct trusty_km_supported_digests: no corresponding struct in kernel struct trusty_km_configure: no corresponding struct in kernel +len target params refer to an array with variable-size elements (do you mean bytesize?) +len target elements refer to an array with variable-size elements (do you mean bytesize?) struct trusty_authorization_bytes: no corresponding struct in kernel struct trusty_avb_rollback_index: no corresponding struct in kernel struct trusty_storage_file_close_req: no corresponding struct in kernel diff --git a/sys/linux/vusb.txt.warn b/sys/linux/vusb.txt.warn index 34cf6e5e..ad9effbc 100644 --- a/sys/linux/vusb.txt.warn +++ b/sys/linux/vusb.txt.warn @@ -1,6 +1,10 @@ +len target configs refer to an array with variable-size elements (do you mean bytesize?) +len target interfaces refer to an array with variable-size elements (do you mean bytesize?) +len target endpoints refer to an array with variable-size elements (do you mean bytesize?) struct vusb_connect_string_descriptor: no corresponding struct in kernel struct vusb_descriptors: no corresponding struct in kernel struct vusb_responses: no corresponding struct in kernel +len target caps refer to an array with variable-size elements (do you mean bytesize?) struct usb_wireless_cap_descriptor: no corresponding struct in kernel struct usb_ext_cap_descriptor: bad number of fields: syz=7 kernel=4 field usb_ext_cap_descriptor.bmAttributes1/bmAttributes: bad bit size/offset: syz=8/0 kernel=0/0 diff --git a/sys/syz-sysgen/sysgen.go b/sys/syz-sysgen/sysgen.go index c5f2be3d..254cbf56 100644 --- a/sys/syz-sysgen/sysgen.go +++ b/sys/syz-sysgen/sysgen.go @@ -111,6 +111,8 @@ func main() { job.ArchData = generateExecutorSyscalls(job.Target, prog.Syscalls, rev) + // Don't print warnings, they are printed in syz-check. + job.Errors = nil job.OK = true }() } @@ -131,7 +133,6 @@ func main() { for u := range job.Unsupported { unsupported[u]++ } - fmt.Printf("\n") } oses = append(oses, OSData{ GOOS: OS, diff --git a/tools/syz-check/check.go b/tools/syz-check/check.go index 5bd55651..6b28d367 100644 --- a/tools/syz-check/check.go +++ b/tools/syz-check/check.go @@ -74,7 +74,7 @@ func main() { } func check(OS, arch, obj string) error { - structDescs, locs, err := parseDescriptions(OS, arch) + structDescs, locs, warnings1, err := parseDescriptions(OS, arch) if err != nil { return err } @@ -82,11 +82,11 @@ func check(OS, arch, obj string) error { if err != nil { return err } - warnings, err := checkImpl(structs, structDescs, locs) + warnings2, err := checkImpl(structs, structDescs, locs) if err != nil { return err } - return writeWarnings(OS, arch, warnings) + return writeWarnings(OS, arch, append(warnings1, warnings2...)) } type Warn struct { @@ -224,22 +224,24 @@ func checkStruct(typ *prog.StructDesc, astStruct *ast.Struct, str *dwarf.StructT return warnings, nil } -func parseDescriptions(OS, arch string) ([]*prog.KeyedStruct, map[string]*ast.Struct, error) { +func parseDescriptions(OS, arch string) ([]*prog.KeyedStruct, map[string]*ast.Struct, []Warn, error) { errorBuf := new(bytes.Buffer) + var warnings []Warn eh := func(pos ast.Pos, msg string) { + warnings = append(warnings, Warn{pos, msg}) fmt.Fprintf(errorBuf, "%v: %v\n", pos, msg) } top := ast.ParseGlob(filepath.Join("sys", OS, "*.txt"), eh) if top == nil { - return nil, nil, fmt.Errorf("failed to parse txt files:\n%s", errorBuf.Bytes()) + return nil, nil, nil, fmt.Errorf("failed to parse txt files:\n%s", errorBuf.Bytes()) } consts := compiler.DeserializeConstsGlob(filepath.Join("sys", OS, "*_"+arch+".const"), eh) if consts == nil { - return nil, nil, fmt.Errorf("failed to parse const files:\n%s", errorBuf.Bytes()) + return nil, nil, nil, fmt.Errorf("failed to parse const files:\n%s", errorBuf.Bytes()) } prg := compiler.Compile(top, consts, targets.Get(OS, arch), eh) if prg == nil { - return nil, nil, fmt.Errorf("failed to compile descriptions:\n%s", errorBuf.Bytes()) + return nil, nil, nil, fmt.Errorf("failed to compile descriptions:\n%s", errorBuf.Bytes()) } prog.RestoreLinks(prg.Syscalls, prg.Resources, prg.StructDescs) locs := make(map[string]*ast.Struct) @@ -249,5 +251,5 @@ func parseDescriptions(OS, arch string) ([]*prog.KeyedStruct, map[string]*ast.St locs[n.Name.Name] = n } } - return prg.StructDescs, locs, nil + return prg.StructDescs, locs, warnings, nil }