mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-23 11:29:46 +00:00
tools/syz-check: inject description compilation warnings
Currently we print them as part of `make genereate`, but nobody reads them, too much output each time. Don't print them in `make generate` and instead print in syz-check, the warn files are a good mechanism to handle "known warnings".
This commit is contained in:
parent
ae5ed0b140
commit
f83f92fd5e
3
Makefile
3
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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user