aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-05-23 14:44:07 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-05-23 14:44:07 +0200
commit38b947b94fbe003e7caa6955302d6e6033e4cc5d (patch)
tree443bb7dfad280d1fda3f6d55c959a83bd15f9b68
parentb83d2cc8893cb6f6523a796cd12752163c5948b6 (diff)
syz-symbolize: symbolize all console output
Currently syz-symbolize uses report.Parse function that extracts crash messages from console output. Symbolize all console output instead. E.g. there can be something on the console that is not crash.
-rw-r--r--report/report.go23
-rw-r--r--tools/syz-symbolize/symbolize.go4
2 files changed, 25 insertions, 2 deletions
diff --git a/report/report.go b/report/report.go
index 8d1f0f28f..5a8f4a8bd 100644
--- a/report/report.go
+++ b/report/report.go
@@ -408,6 +408,29 @@ func Parse(output []byte, ignores []*regexp.Regexp) (desc string, text []byte, s
return
}
+func ExtractConsoleOutput(output []byte) (result []byte) {
+ for pos := 0; pos < len(output); {
+ next := bytes.IndexByte(output[pos:], '\n')
+ if next != -1 {
+ next += pos
+ } else {
+ next = len(output)
+ }
+ if consoleOutputRe.Match(output[pos:next]) &&
+ (!questionableRe.Match(output[pos:next]) || bytes.Index(output[pos:next], eoi) != -1) {
+ lineStart := bytes.Index(output[pos:next], []byte("] ")) + pos + 2
+ lineEnd := next
+ if lineEnd != 0 && output[lineEnd-1] == '\r' {
+ lineEnd--
+ }
+ result = append(result, output[lineStart:lineEnd]...)
+ result = append(result, '\n')
+ }
+ pos = next + 1
+ }
+ return
+}
+
func matchOops(line []byte, oops *oops, ignores []*regexp.Regexp) int {
match := bytes.Index(line, oops.header)
if match == -1 {
diff --git a/tools/syz-symbolize/symbolize.go b/tools/syz-symbolize/symbolize.go
index 4e5e8564b..d348b7148 100644
--- a/tools/syz-symbolize/symbolize.go
+++ b/tools/syz-symbolize/symbolize.go
@@ -29,8 +29,8 @@ func main() {
fmt.Fprintf(os.Stderr, "failed to open input file: %v\n", err)
os.Exit(1)
}
- if _, parsed, _, _ := report.Parse(text, nil); len(parsed) != 0 {
- text = parsed
+ if console := report.ExtractConsoleOutput(text); len(console) != 0 {
+ text = console
}
text, err = report.Symbolize(filepath.Join(*flagLinux, "vmlinux"), text)
if err != nil {