diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-11-19 10:53:39 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-11-21 09:22:22 +0100 |
| commit | c7ec2d19f82830161738378f96761b57328eed7a (patch) | |
| tree | 86224fb35bf138ed6c9cd8ad3fbf47c080a8c93a /vm/vmimpl | |
| parent | 22238b0b79fc80d9a0218f8bf9ecf3e91401bd12 (diff) | |
vm/qemu, vm/gce: dump LOCKDEP state in Diagnose
For context see the discussion at:
https://groups.google.com/g/syzkaller/c/ruwaYUvwHTw/m/E9Cg9OfvAgAJ
Diffstat (limited to 'vm/vmimpl')
| -rw-r--r-- | vm/vmimpl/linux.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vm/vmimpl/linux.go b/vm/vmimpl/linux.go new file mode 100644 index 000000000..0406035f6 --- /dev/null +++ b/vm/vmimpl/linux.go @@ -0,0 +1,26 @@ +// 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 vmimpl + +import ( + "regexp" + "strings" + + "github.com/google/syzkaller/pkg/report" +) + +// DiagnoseLinux diagnoses some Linux kernel bugs over the provided ssh callback. +func DiagnoseLinux(rep *report.Report, ssh func(args ...string) ([]byte, error)) (output []byte, wait, handled bool) { + if !strings.Contains(rep.Title, "MAX_LOCKDEP") { + return nil, false, false + } + // Dump /proc/lockdep* files on BUG: MAX_LOCKDEP_{KEYS,ENTRIES,CHAINS,CHAIN_HLOCKS} too low! + output, err := ssh("cat", "/proc/lockdep_stats", "/proc/lockdep", "/proc/lockdep_chains") + if err != nil { + output = append(output, err.Error()...) + } + // Remove mangled pointer values, they take lots of space but don't add any value. + output = regexp.MustCompile(` *\[?[0-9a-f]{8,}\]?\s*`).ReplaceAll(output, nil) + return output, false, true +} |
