aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-03-18 09:22:31 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-03-18 09:23:24 +0100
commit0a96a13cb96316b8374bb7d8dd0793bcaff166a0 (patch)
tree4a57dfd26caab2244762f4407a4e02754d47125b
parent97bc55cead011ec5d60af8c3696ee2724b78fea5 (diff)
tools/syz-check: extend usage docs
Allow to run for only 1 arch and extend docs.
-rw-r--r--tools/syz-check/check.go25
1 files changed, 22 insertions, 3 deletions
diff --git a/tools/syz-check/check.go b/tools/syz-check/check.go
index 060bad99b..8cfc20294 100644
--- a/tools/syz-check/check.go
+++ b/tools/syz-check/check.go
@@ -4,12 +4,22 @@
// syz-check does best-effort static correctness checking of the syscall descriptions in sys/os/*.txt.
// Use:
// $ go install ./tools/syz-check
-// $ syz-check -obj /linux/vmlinux
-// Currently it works only for linux and only for one arch at a time.
+// $ syz-check -obj-amd64 /linux_amd64/vmlinux -obj-arm64 /linux_arm64/vmlinux \
+// -obj-386 /linux_386/vmlinux -obj-arm /linux_arm/vmlinux
+//
// The vmlinux files should include debug info and enable all relevant configs (since we parse dwarf).
+// You may check only one arch as well (but then don't commit changes to warn files):
+//
+// $ syz-check -obj-amd64 /linux_amd64/vmlinux
+//
+// You may also disable dwarf or netlink checks with the corresponding flags.
+// E.g. -dwarf=0 greatly speeds up checking if you are only interested in netlink warnings
+// (but then again don't commit changes).
+//
// The results are produced in sys/os/*.warn files.
// On implementation level syz-check parses vmlinux dwarf, extracts struct descriptions
-// and compares them with what we have (size, fields, alignment, etc).
+// and compares them with what we have (size, fields, alignment, etc). Netlink checking extracts policy symbols
+// from the object files and parses them.
package main
import (
@@ -77,6 +87,10 @@ func main() {
}
var warnings []Warn
for arch, obj := range arches {
+ if *obj == "" {
+ delete(arches, arch)
+ continue
+ }
warnings1, err := check(*flagOS, arch, *obj, *flagDWARF, *flagNetlink)
if err != nil {
failf("%v", err)
@@ -84,6 +98,11 @@ func main() {
warnings = append(warnings, warnings1...)
runtime.GC()
}
+ if len(arches) == 0 {
+ fmt.Fprintf(os.Stderr, "specify at least one -obj-arch flag\n")
+ flag.PrintDefaults()
+ os.Exit(1)
+ }
if err := writeWarnings(*flagOS, len(arches), warnings); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)