From c7ec2d19f82830161738378f96761b57328eed7a Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 19 Nov 2020 10:53:39 +0100 Subject: 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 --- vm/vmimpl/linux.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 vm/vmimpl/linux.go (limited to 'vm/vmimpl') 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 +} -- cgit mrf-deployment