From b6de93e603915b57a1eccadc8bd530efd00d28f2 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 10 Aug 2020 07:50:55 +0200 Subject: pkg/compiler: merge const files into a single file We now have 8 arches for Linux and .const files produce lots of noise in PRs and lots of diffs. If 3 .txt files are touched, the PR will have 24 .const files, which will be intermixed with .txt files. Frequently const values are equal across arches, and even if they don't spreading a single value across 8 files is inconvinient. Merge all 8 *_arch.const files into a single .const file. See the test for details of the new format. The old format is still parsed for now, we can't update all OSes at once. For Linux this reduces number of const files/lines from 1288/96599 to 158/11603. Fixes #1983 --- pkg/compiler/compiler_test.go | 2 +- pkg/compiler/const_file.go | 294 ++++++++++++++++++++++++++++++++++++++ pkg/compiler/const_file_test.go | 130 +++++++++++++++++ pkg/compiler/consts.go | 116 --------------- sys/syz-extract/extract.go | 68 +++++---- sys/syz-sysgen/sysgen.go | 9 +- sys/test/test.txt.const | 6 + sys/test/test_32_fork_shmem.const | 4 - sys/test/test_32_shmem.const | 4 - sys/test/test_64.const | 4 - sys/test/test_64_fork.const | 3 - tools/syz-check/check.go | 2 +- 12 files changed, 475 insertions(+), 167 deletions(-) create mode 100644 pkg/compiler/const_file.go create mode 100644 pkg/compiler/const_file_test.go create mode 100644 sys/test/test.txt.const delete mode 100644 sys/test/test_32_fork_shmem.const delete mode 100644 sys/test/test_32_shmem.const delete mode 100644 sys/test/test_64.const delete mode 100644 sys/test/test_64_fork.const diff --git a/pkg/compiler/compiler_test.go b/pkg/compiler/compiler_test.go index 3d4ee3e64..e5c7987d1 100644 --- a/pkg/compiler/compiler_test.go +++ b/pkg/compiler/compiler_test.go @@ -44,7 +44,7 @@ func TestCompileAll(t *testing.T) { defer func() { t.Logf("\n%s", errors.Bytes()) }() - consts := DeserializeConstsGlob(filepath.Join(path, "*_"+arch+".const"), eh) + consts := DeserializeConstFile(filepath.Join(path, "*.const"), eh).Arch(arch) if consts == nil { t.Fatalf("reading consts failed") } diff --git a/pkg/compiler/const_file.go b/pkg/compiler/const_file.go new file mode 100644 index 000000000..d64c15207 --- /dev/null +++ b/pkg/compiler/const_file.go @@ -0,0 +1,294 @@ +// Copyright 2020 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +package compiler + +import ( + "bufio" + "bytes" + "fmt" + "io/ioutil" + "path/filepath" + "regexp" + "sort" + "strconv" + "strings" + + "github.com/google/syzkaller/pkg/ast" +) + +// ConstFile serializes/deserializes .const files. +type ConstFile struct { + arches map[string]bool + m map[string]constVal +} + +type constVal struct { + name string + vals map[string]uint64 // arch -> value +} + +const undefined = "???" + +func NewConstFile() *ConstFile { + return &ConstFile{ + arches: make(map[string]bool), + m: make(map[string]constVal), + } +} + +func (cf *ConstFile) AddArch(arch string, consts map[string]uint64, undeclared map[string]bool) error { + cf.arches[arch] = true + for name, val := range consts { + if err := cf.addConst(arch, name, val, true); err != nil { + return err + } + } + for name := range undeclared { + if err := cf.addConst(arch, name, 0, false); err != nil { + return err + } + } + return nil +} + +func (cf *ConstFile) addConst(arch, name string, val uint64, declared bool) error { + cv := cf.m[name] + if cv.vals == nil { + cv.name = name + cv.vals = make(map[string]uint64) + } + if val0, declared0 := cv.vals[arch]; declared && declared0 && val != val0 { + return fmt.Errorf("const=%v arch=%v has different values: %v[%v] vs %v[%v]", + name, arch, val, declared, val0, declared0) + } + if declared { + cv.vals[arch] = val + } + cf.m[name] = cv + return nil +} + +func (cf *ConstFile) Arch(arch string) map[string]uint64 { + if cf == nil { + return nil + } + m := make(map[string]uint64) + for name, cv := range cf.m { + if v, ok := cv.vals[arch]; ok { + m[name] = v + } + } + return m +} + +func (cf *ConstFile) Serialize() []byte { + if len(cf.arches) == 0 { + return nil + } + var arches []string + for arch := range cf.arches { + arches = append(arches, arch) + } + sort.Strings(arches) + var consts []constVal + for _, cv := range cf.m { + consts = append(consts, cv) + } + sort.Slice(consts, func(i, j int) bool { + return consts[i].name < consts[j].name + }) + buf := new(bytes.Buffer) + fmt.Fprintf(buf, "# Code generated by syz-sysgen. DO NOT EDIT.\n") + fmt.Fprintf(buf, "arches = %v\n", strings.Join(arches, ", ")) + for _, cv := range consts { + fmt.Fprintf(buf, "%v = ", cv.name) + if len(cv.vals) == 0 { + // Undefined for all arches. + fmt.Fprintf(buf, "%v\n", undefined) + continue + } + count := make(map[uint64]int) + max, dflt := 0, uint64(0) + for _, val := range cv.vals { + count[val]++ + if count[val] > 1 && (count[val] > max || count[val] == max && val < dflt) { + max, dflt = count[val], val + } + } + if max != 0 { + // Have a default value. + fmt.Fprintf(buf, "%v", dflt) + } + handled := make([]bool, len(arches)) + for i, arch := range arches { + val, ok := cv.vals[arch] + if ok && val == dflt || handled[i] { + // Default value or serialized on a previous iteration. + continue + } + if i != 0 || max != 0 { + fmt.Fprintf(buf, ", ") + } + fmt.Fprintf(buf, "%v:", arch) + for j := i + 1; j < len(arches); j++ { + // Add more arches with the same value. + arch1 := arches[j] + val1, ok1 := cv.vals[arch1] + if ok1 == ok && val1 == val { + fmt.Fprintf(buf, "%v:", arch1) + handled[j] = true + } + } + if ok { + fmt.Fprintf(buf, "%v", val) + } else { + fmt.Fprint(buf, undefined) + } + } + fmt.Fprintf(buf, "\n") + } + return buf.Bytes() +} + +func DeserializeConstFile(glob string, eh ast.ErrorHandler) *ConstFile { + if eh == nil { + eh = ast.LoggingHandler + } + files, err := filepath.Glob(glob) + if err != nil { + eh(ast.Pos{}, fmt.Sprintf("failed to find const files: %v", err)) + return nil + } + if len(files) == 0 { + eh(ast.Pos{}, fmt.Sprintf("no const files matched by glob %q", glob)) + return nil + } + cf := NewConstFile() + oldFormat := regexp.MustCompile(`_([a-z0-9]+)\.const$`) + for _, f := range files { + data, err := ioutil.ReadFile(f) + if err != nil { + eh(ast.Pos{}, fmt.Sprintf("failed to read const file: %v", err)) + return nil + } + // Support for old per-arch format. + // Remove it once we don't have any *_arch.const files anymore. + arch := "" + if match := oldFormat.FindStringSubmatch(f); match != nil { + arch = match[1] + } + if !cf.deserializeFile(data, filepath.Base(f), arch, eh) { + return nil + } + } + return cf +} + +func (cf *ConstFile) deserializeFile(data []byte, file, arch string, eh ast.ErrorHandler) bool { + pos := ast.Pos{File: file, Line: 1} + errf := func(msg string, args ...interface{}) bool { + eh(pos, fmt.Sprintf(msg, args...)) + return false + } + s := bufio.NewScanner(bytes.NewReader(data)) + var arches []string + for ; s.Scan(); pos.Line++ { + line := s.Text() + if line == "" || line[0] == '#' { + continue + } + eq := strings.IndexByte(line, '=') + if eq == -1 { + return errf("expect '='") + } + name, val := strings.TrimSpace(line[:eq]), strings.TrimSpace(line[eq+1:]) + if arch != "" { + // Old format. + if !cf.parseOldConst(arch, name, val, errf) { + return false + } + continue + } + if arch == "" && len(arches) == 0 { + if name != "arches" { + return errf("missing arches header") + } + for _, arch := range strings.Split(val, ",") { + arches = append(arches, strings.TrimSpace(arch)) + } + continue + } + if !cf.parseConst(arches, name, val, errf) { + return false + } + } + if err := s.Err(); err != nil { + return errf("failed to parse: %v", err) + } + return true +} + +type errft func(msg string, args ...interface{}) bool + +func (cf *ConstFile) parseConst(arches []string, name, line string, errf errft) bool { + var dflt map[string]uint64 + for _, pair := range strings.Split(line, ",") { + fields := strings.Split(pair, ":") + if len(fields) == 1 { + // Default value. + if dflt != nil { + return errf("duplicate default value") + } + dflt = make(map[string]uint64) + valStr := strings.TrimSpace(fields[0]) + if valStr == undefined { + continue + } + val, err := strconv.ParseUint(valStr, 0, 64) + if err != nil { + return errf("failed to parse int: %v", err) + } + for _, arch := range arches { + dflt[arch] = val + } + continue + } + if len(fields) < 2 { + return errf("bad value: %v", pair) + } + valStr := strings.TrimSpace(fields[len(fields)-1]) + defined := valStr != undefined + var val uint64 + if defined { + var err error + if val, err = strconv.ParseUint(valStr, 0, 64); err != nil { + return errf("failed to parse int: %v", err) + } + } + for _, arch := range fields[:len(fields)-1] { + arch = strings.TrimSpace(arch) + delete(dflt, arch) + if err := cf.addConst(arch, name, val, defined); err != nil { + return errf("%v", err) + } + } + } + for arch, val := range dflt { + if err := cf.addConst(arch, name, val, true); err != nil { + return errf("%v", err) + } + } + return true +} + +func (cf *ConstFile) parseOldConst(arch, name, line string, errf errft) bool { + val, err := strconv.ParseUint(strings.TrimSpace(line), 0, 64) + if err != nil { + return errf("failed to parse int: %v", err) + } + if err := cf.addConst(arch, name, val, true); err != nil { + return errf("%v", err) + } + return true +} diff --git a/pkg/compiler/const_file_test.go b/pkg/compiler/const_file_test.go new file mode 100644 index 000000000..51858a790 --- /dev/null +++ b/pkg/compiler/const_file_test.go @@ -0,0 +1,130 @@ +// Copyright 2020 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +package compiler + +import ( + "io/ioutil" + "os" + "path/filepath" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestConstFile(t *testing.T) { + type arch struct { + consts map[string]uint64 + undefined map[string]bool + oldFormat string + } + arches := map[string]arch{ + "arch1": { + consts: map[string]uint64{ + "CONST1_ALL_DIFFERENT": 11, + "CONST2_ALL_THE_SAME": 3, + "CONST3_SOME_UNDEFINED": 100, + "CONST5_SOME_UNDEFINED2": 100, + }, + undefined: map[string]bool{ + "CONST4_ALL_UNDEFINED": true, + }, + oldFormat: ` +CONST1_ALL_DIFFERENT = 11 +CONST2_ALL_THE_SAME = 3 +CONST3_SOME_UNDEFINED = 100 +CONST5_SOME_UNDEFINED2 = 100 +# CONST4_ALL_UNDEFINED is not set +`, + }, + "arch2": { + consts: map[string]uint64{ + "CONST1_ALL_DIFFERENT": 22, + "CONST2_ALL_THE_SAME": 3, + "CONST5_SOME_UNDEFINED2": 100, + }, + undefined: map[string]bool{ + "CONST4_ALL_UNDEFINED": true, + "CONST3_SOME_UNDEFINED": true, + }, + oldFormat: ` +CONST1_ALL_DIFFERENT = 22 +CONST2_ALL_THE_SAME = 3 +# CONST3_SOME_UNDEFINED is not set +CONST5_SOME_UNDEFINED2 = 100 +# CONST4_ALL_UNDEFINED is not set +`, + }, + "arch3": { + consts: map[string]uint64{ + "CONST1_ALL_DIFFERENT": 33, + "CONST2_ALL_THE_SAME": 3, + }, + undefined: map[string]bool{ + "CONST4_ALL_UNDEFINED": true, + "CONST3_SOME_UNDEFINED": true, + "CONST5_SOME_UNDEFINED2": true, + }, + oldFormat: ` +CONST1_ALL_DIFFERENT = 33 +CONST2_ALL_THE_SAME = 3 +# CONST3_SOME_UNDEFINED is not set +# CONST5_SOME_UNDEFINED2 is not set +# CONST4_ALL_UNDEFINED is not set +`, + }, + } + const serialized = `# Code generated by syz-sysgen. DO NOT EDIT. +arches = arch1, arch2, arch3 +CONST1_ALL_DIFFERENT = arch1:11, arch2:22, arch3:33 +CONST2_ALL_THE_SAME = 3 +CONST3_SOME_UNDEFINED = arch1:100, arch2:arch3:??? +CONST4_ALL_UNDEFINED = ??? +CONST5_SOME_UNDEFINED2 = 100, arch3:??? +` + cf := NewConstFile() + for name, arch := range arches { + cf.AddArch(name, arch.consts, arch.undefined) + } + data := cf.Serialize() + if diff := cmp.Diff(serialized, string(data)); diff != "" { + t.Fatal(diff) + } + { + file, err := ioutil.TempFile("", "syz-const") + if err != nil { + t.Fatal(err) + } + defer file.Close() + defer os.Remove(file.Name()) + if _, err := file.Write(data); err != nil { + t.Fatal(err) + } + file.Close() + cf1 := DeserializeConstFile(file.Name(), nil) + for name, arch := range arches { + if diff := cmp.Diff(arch.consts, cf1.Arch(name)); diff != "" { + t.Errorf("%v: %v", name, diff) + } + } + } + { + dir, err := ioutil.TempDir("", "syz-const") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(dir) + for name, arch := range arches { + file := filepath.Join(dir, "consts_"+name+".const") + if err := ioutil.WriteFile(file, []byte(arch.oldFormat), 0600); err != nil { + t.Fatal(err) + } + } + cf1 := DeserializeConstFile(filepath.Join(dir, "*"), nil) + for name, arch := range arches { + if diff := cmp.Diff(arch.consts, cf1.Arch(name)); diff != "" { + t.Errorf("%v: %v", name, diff) + } + } + } +} diff --git a/pkg/compiler/consts.go b/pkg/compiler/consts.go index e57d599cb..3e8773a03 100644 --- a/pkg/compiler/consts.go +++ b/pkg/compiler/consts.go @@ -4,13 +4,7 @@ package compiler import ( - "bufio" - "bytes" "fmt" - "io/ioutil" - "path/filepath" - "sort" - "strconv" "strings" "github.com/google/syzkaller/pkg/ast" @@ -294,113 +288,3 @@ func (comp *compiler) patchConst(val *uint64, id *string, consts map[string]uint *val = 1 return false } - -func SerializeConsts(consts map[string]uint64, undeclared map[string]bool) []byte { - type nameValuePair struct { - declared bool - name string - val uint64 - } - var nv []nameValuePair - for k, v := range consts { - nv = append(nv, nameValuePair{true, k, v}) - } - for k := range undeclared { - nv = append(nv, nameValuePair{false, k, 0}) - } - sort.Slice(nv, func(i, j int) bool { - return nv[i].name < nv[j].name - }) - - buf := new(bytes.Buffer) - fmt.Fprintf(buf, "# AUTOGENERATED FILE\n") - for _, x := range nv { - if x.declared { - fmt.Fprintf(buf, "%v = %v\n", x.name, x.val) - } else { - fmt.Fprintf(buf, "# %v is not set\n", x.name) - } - } - return buf.Bytes() -} - -func DeserializeConsts(data []byte, file string, eh ast.ErrorHandler) map[string]uint64 { - consts := make(map[string]uint64) - pos := ast.Pos{ - File: file, - Line: 1, - } - ok := true - s := bufio.NewScanner(bytes.NewReader(data)) - for ; s.Scan(); pos.Line++ { - line := s.Text() - if line == "" || line[0] == '#' { - continue - } - eq := strings.IndexByte(line, '=') - if eq == -1 { - eh(pos, "expect '='") - ok = false - continue - } - name := strings.TrimSpace(line[:eq]) - val, err := strconv.ParseUint(strings.TrimSpace(line[eq+1:]), 0, 64) - if err != nil { - eh(pos, fmt.Sprintf("failed to parse int: %v", err)) - ok = false - continue - } - if _, dup := consts[name]; dup { - eh(pos, fmt.Sprintf("duplicate const %q", name)) - ok = false - continue - } - consts[name] = val - } - if err := s.Err(); err != nil { - eh(pos, fmt.Sprintf("failed to parse: %v", err)) - ok = false - } - if !ok { - return nil - } - return consts -} - -func DeserializeConstsGlob(glob string, eh ast.ErrorHandler) map[string]uint64 { - if eh == nil { - eh = ast.LoggingHandler - } - files, err := filepath.Glob(glob) - if err != nil { - eh(ast.Pos{}, fmt.Sprintf("failed to find const files: %v", err)) - return nil - } - if len(files) == 0 { - eh(ast.Pos{}, fmt.Sprintf("no const files matched by glob %q", glob)) - return nil - } - consts := make(map[string]uint64) - for _, f := range files { - data, err := ioutil.ReadFile(f) - if err != nil { - eh(ast.Pos{}, fmt.Sprintf("failed to read const file: %v", err)) - return nil - } - consts1 := DeserializeConsts(data, filepath.Base(f), eh) - if consts1 == nil { - consts = nil - } - if consts != nil { - for n, v := range consts1 { - if old, ok := consts[n]; ok && old != v { - eh(ast.Pos{}, fmt.Sprintf( - "different values for const %q: %v vs %v", n, v, old)) - return nil - } - consts[n] = v - } - } - } - return consts -} diff --git a/sys/syz-extract/extract.go b/sys/syz-extract/extract.go index 22cd44402..10b8b6541 100644 --- a/sys/syz-extract/extract.go +++ b/sys/syz-extract/extract.go @@ -101,28 +101,14 @@ func main() { } for p := 0; p < runtime.GOMAXPROCS(0); p++ { - go func() { - for job := range jobC { - switch j := job.(type) { - case *Arch: - infos, err := processArch(extractor, j) - j.err = err - close(j.done) - if j.err == nil { - for _, f := range j.files { - f.info = infos[filepath.Join("sys", j.target.OS, f.name)] - jobC <- f - } - } - case *File: - j.consts, j.undeclared, j.err = processFile(extractor, j.arch, j) - close(j.done) - } - } - }() + go worker(extractor, jobC) } failed := false + constFiles := make(map[string]*compiler.ConstFile) + for _, file := range files { + constFiles[file] = compiler.NewConstFile() + } for _, arch := range arches { fmt.Printf("generating %v/%v...\n", arch.target.OS, arch.target.Arch) <-arch.done @@ -138,6 +124,18 @@ func main() { fmt.Printf("%v: %v\n", f.name, f.err) continue } + constFiles[f.name].AddArch(f.arch.target.Arch, f.consts, f.undeclared) + } + } + for file, cf := range constFiles { + outname := filepath.Join("sys", OS, file+".const") + data := cf.Serialize() + if len(data) == 0 { + os.Remove(outname) + continue + } + if err := osutil.WriteFile(outname, data); err != nil { + failf("failed to write output file: %v", err) } } @@ -154,6 +152,26 @@ func main() { } } +func worker(extractor Extractor, jobC chan interface{}) { + for job := range jobC { + switch j := job.(type) { + case *Arch: + infos, err := processArch(extractor, j) + j.err = err + close(j.done) + if j.err == nil { + for _, f := range j.files { + f.info = infos[filepath.Join("sys", j.target.OS, f.name)] + jobC <- f + } + } + case *File: + j.consts, j.undeclared, j.err = processFile(extractor, j.arch, j) + close(j.done) + } + } +} + func createArches(OS string, archArray, files []string) ([]*Arch, error) { var arches []*Arch for _, archStr := range archArray { @@ -291,21 +309,11 @@ func processArch(extractor Extractor, arch *Arch) (map[string]*compiler.ConstInf func processFile(extractor Extractor, arch *Arch, file *File) (map[string]uint64, map[string]bool, error) { inname := filepath.Join("sys", arch.target.OS, file.name) - outname := strings.TrimSuffix(inname, ".txt") + "_" + arch.target.Arch + ".const" if file.info == nil { return nil, nil, fmt.Errorf("const info for input file %v is missing", inname) } if len(file.info.Consts) == 0 { - os.Remove(outname) return nil, nil, nil } - consts, undeclared, err := extractor.processFile(arch, file.info) - if err != nil { - return nil, nil, err - } - data := compiler.SerializeConsts(consts, undeclared) - if err := osutil.WriteFile(outname, data); err != nil { - return nil, nil, fmt.Errorf("failed to write output file: %v", err) - } - return consts, undeclared, nil + return extractor.processFile(arch, file.info) } diff --git a/sys/syz-sysgen/sysgen.go b/sys/syz-sysgen/sysgen.go index 5fc2be7b7..8dfedb6a2 100644 --- a/sys/syz-sysgen/sysgen.go +++ b/sys/syz-sysgen/sysgen.go @@ -75,6 +75,10 @@ func main() { if descriptions == nil { os.Exit(1) } + constFile := compiler.DeserializeConstFile(filepath.Join(*srcDir, "sys", OS, "*.const"), nil) + if constFile == nil { + os.Exit(1) + } osutil.MkdirAll(filepath.Join(*outDir, "sys", OS, "gen")) var archs []string @@ -109,10 +113,7 @@ func main() { eh := func(pos ast.Pos, msg string) { job.Errors = append(job.Errors, fmt.Sprintf("%v: %v\n", pos, msg)) } - consts := compiler.DeserializeConstsGlob(filepath.Join(*srcDir, "sys", OS, "*_"+job.Target.Arch+".const"), eh) - if consts == nil { - return - } + consts := constFile.Arch(job.Target.Arch) top := descriptions if OS == "linux" && (job.Target.Arch == "arm" || job.Target.Arch == "riscv64") { // Hack: KVM is not supported on ARM anymore. On riscv64 it diff --git a/sys/test/test.txt.const b/sys/test/test.txt.const new file mode 100644 index 000000000..11f548df0 --- /dev/null +++ b/sys/test/test.txt.const @@ -0,0 +1,6 @@ +arches = 32_fork_shmem, 32_shmem, 64, 64_fork +IPPROTO_ICMPV6 = 58 +IPPROTO_TCP = 6 +IPPROTO_UDP = 17 +ONLY_32BITS_CONST = 32_fork_shmem:1, 32_shmem:1 +ARCH_64_SPECIFIC_CONST = 64:10 diff --git a/sys/test/test_32_fork_shmem.const b/sys/test/test_32_fork_shmem.const deleted file mode 100644 index 938b68f89..000000000 --- a/sys/test/test_32_fork_shmem.const +++ /dev/null @@ -1,4 +0,0 @@ -IPPROTO_ICMPV6 = 58 -IPPROTO_TCP = 6 -IPPROTO_UDP = 17 -ONLY_32BITS_CONST = 1 diff --git a/sys/test/test_32_shmem.const b/sys/test/test_32_shmem.const deleted file mode 100644 index 938b68f89..000000000 --- a/sys/test/test_32_shmem.const +++ /dev/null @@ -1,4 +0,0 @@ -IPPROTO_ICMPV6 = 58 -IPPROTO_TCP = 6 -IPPROTO_UDP = 17 -ONLY_32BITS_CONST = 1 diff --git a/sys/test/test_64.const b/sys/test/test_64.const deleted file mode 100644 index 8b4c45cca..000000000 --- a/sys/test/test_64.const +++ /dev/null @@ -1,4 +0,0 @@ -IPPROTO_ICMPV6 = 58 -IPPROTO_TCP = 6 -IPPROTO_UDP = 17 -ARCH_64_SPECIFIC_CONST = 10 diff --git a/sys/test/test_64_fork.const b/sys/test/test_64_fork.const deleted file mode 100644 index 30db9e24f..000000000 --- a/sys/test/test_64_fork.const +++ /dev/null @@ -1,3 +0,0 @@ -IPPROTO_ICMPV6 = 58 -IPPROTO_TCP = 6 -IPPROTO_UDP = 17 diff --git a/tools/syz-check/check.go b/tools/syz-check/check.go index 58f34c6fb..86048f9a4 100644 --- a/tools/syz-check/check.go +++ b/tools/syz-check/check.go @@ -317,7 +317,7 @@ func parseDescriptions(OS, arch string) ([]prog.Type, map[string]*ast.Struct, [] if top == nil { 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) + consts := compiler.DeserializeConstFile(filepath.Join("sys", OS, "*.const"), eh).Arch(arch) if consts == nil { return nil, nil, nil, fmt.Errorf("failed to parse const files:\n%s", errorBuf.Bytes()) } -- cgit mrf-deployment