aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/report/akaros.go14
-rw-r--r--pkg/report/freebsd.go17
-rw-r--r--pkg/report/fuchsia.go14
-rw-r--r--pkg/report/linux.go50
-rw-r--r--pkg/report/linux_test.go3
-rw-r--r--pkg/report/netbsd.go17
-rw-r--r--pkg/report/report.go9
-rw-r--r--pkg/report/windows.go14
-rw-r--r--pkg/repro/repro.go2
9 files changed, 50 insertions, 90 deletions
diff --git a/pkg/report/akaros.go b/pkg/report/akaros.go
index 605047fae..46d20590a 100644
--- a/pkg/report/akaros.go
+++ b/pkg/report/akaros.go
@@ -35,18 +35,6 @@ func (ctx *akaros) Parse(output []byte) *Report {
panic("not implemented")
}
-func (ctx *akaros) Symbolize(text []byte) ([]byte, error) {
- panic("not implemented")
-}
-
-func (ctx *akaros) ExtractConsoleOutput(output []byte) (result []byte) {
- panic("not implemented")
-}
-
-func (ctx *akaros) ExtractGuiltyFile(report []byte) string {
- panic("not implemented")
-}
-
-func (ctx *akaros) GetMaintainers(file string) ([]string, error) {
+func (ctx *akaros) Symbolize(rep *Report) error {
panic("not implemented")
}
diff --git a/pkg/report/freebsd.go b/pkg/report/freebsd.go
index dd9c8178d..25c8f9048 100644
--- a/pkg/report/freebsd.go
+++ b/pkg/report/freebsd.go
@@ -5,7 +5,6 @@ package report
import (
"bytes"
- "fmt"
"regexp"
"github.com/google/syzkaller/pkg/symbolizer"
@@ -76,20 +75,8 @@ func (ctx *freebsd) Parse(output []byte) *Report {
return rep
}
-func (ctx *freebsd) Symbolize(text []byte) ([]byte, error) {
- return nil, fmt.Errorf("not implemented")
-}
-
-func (ctx *freebsd) ExtractConsoleOutput(output []byte) (result []byte) {
- return output
-}
-
-func (ctx *freebsd) ExtractGuiltyFile(report []byte) string {
- return ""
-}
-
-func (ctx *freebsd) GetMaintainers(file string) ([]string, error) {
- return nil, fmt.Errorf("not implemented")
+func (ctx *freebsd) Symbolize(rep *Report) error {
+ return nil
}
var freebsdOopses = []*oops{
diff --git a/pkg/report/fuchsia.go b/pkg/report/fuchsia.go
index 0d529a1d5..9e75c97b7 100644
--- a/pkg/report/fuchsia.go
+++ b/pkg/report/fuchsia.go
@@ -35,18 +35,6 @@ func (ctx *fuchsia) Parse(output []byte) *Report {
panic("not implemented")
}
-func (ctx *fuchsia) Symbolize(text []byte) ([]byte, error) {
- panic("not implemented")
-}
-
-func (ctx *fuchsia) ExtractConsoleOutput(output []byte) (result []byte) {
- panic("not implemented")
-}
-
-func (ctx *fuchsia) ExtractGuiltyFile(report []byte) string {
- panic("not implemented")
-}
-
-func (ctx *fuchsia) GetMaintainers(file string) ([]string, error) {
+func (ctx *fuchsia) Symbolize(rep *Report) error {
panic("not implemented")
}
diff --git a/pkg/report/linux.go b/pkg/report/linux.go
index 2ba0956b2..5c6b23029 100644
--- a/pkg/report/linux.go
+++ b/pkg/report/linux.go
@@ -32,12 +32,15 @@ type linux struct {
func ctorLinux(kernelSrc, kernelObj string, symbols map[string][]symbolizer.Symbol,
ignores []*regexp.Regexp) (Reporter, error) {
- vmlinux := filepath.Join(kernelObj, "vmlinux")
- if symbols == nil {
- var err error
- symbols, err = symbolizer.ReadSymbols(vmlinux)
- if err != nil {
- return nil, err
+ vmlinux := ""
+ if kernelObj != "" {
+ vmlinux = filepath.Join(kernelObj, "vmlinux")
+ if symbols == nil {
+ var err error
+ symbols, err = symbolizer.ReadSymbols(vmlinux)
+ if err != nil {
+ return nil, err
+ }
}
}
ctx := &linux{
@@ -77,7 +80,7 @@ func (ctx *linux) ContainsCrash(output []byte) bool {
}
func (ctx *linux) Parse(output []byte) *Report {
- output = ctx.ExtractConsoleOutput(output)
+ output = ctx.extractConsoleOutput(output)
rep := &Report{
Output: output,
}
@@ -170,7 +173,26 @@ func (ctx *linux) Parse(output []byte) *Report {
return rep
}
-func (ctx *linux) Symbolize(text []byte) ([]byte, error) {
+func (ctx *linux) Symbolize(rep *Report) error {
+ if ctx.vmlinux == "" {
+ return nil
+ }
+ symbolized, err := ctx.symbolize(rep.Report)
+ if err != nil {
+ return err
+ }
+ rep.Report = symbolized
+ guiltyFile := ctx.extractGuiltyFile(rep.Report)
+ if guiltyFile != "" {
+ rep.Maintainers, err = ctx.getMaintainers(guiltyFile)
+ if err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func (ctx *linux) symbolize(text []byte) ([]byte, error) {
symb := symbolizer.NewSymbolizer()
defer symb.Close()
// Strip vmlinux location from all paths.
@@ -253,7 +275,7 @@ func symbolizeLine(symbFunc func(bin string, pc uint64) ([]symbolizer.Frame, err
return symbolized
}
-func (ctx *linux) ExtractConsoleOutput(output []byte) (result []byte) {
+func (ctx *linux) extractConsoleOutput(output []byte) (result []byte) {
for pos := 0; pos < len(output); {
next := bytes.IndexByte(output[pos:], '\n')
if next != -1 {
@@ -277,7 +299,7 @@ func (ctx *linux) ExtractConsoleOutput(output []byte) (result []byte) {
return
}
-func (ctx *linux) ExtractGuiltyFile(report []byte) string {
+func (ctx *linux) extractGuiltyFile(report []byte) string {
files := ctx.extractFiles(report)
nextFile:
for _, file := range files {
@@ -291,13 +313,13 @@ nextFile:
return ""
}
-func (ctx *linux) GetMaintainers(file string) ([]string, error) {
- mtrs, err := ctx.getMaintainers(file, false)
+func (ctx *linux) getMaintainers(file string) ([]string, error) {
+ mtrs, err := ctx.getMaintainersImpl(file, false)
if err != nil {
return nil, err
}
if len(mtrs) <= 1 {
- mtrs, err = ctx.getMaintainers(file, true)
+ mtrs, err = ctx.getMaintainersImpl(file, true)
if err != nil {
return nil, err
}
@@ -305,7 +327,7 @@ func (ctx *linux) GetMaintainers(file string) ([]string, error) {
return mtrs, nil
}
-func (ctx *linux) getMaintainers(file string, blame bool) ([]string, error) {
+func (ctx *linux) getMaintainersImpl(file string, blame bool) ([]string, error) {
args := []string{"--no-n", "--no-rolestats"}
if blame {
args = append(args, "--git-blame")
diff --git a/pkg/report/linux_test.go b/pkg/report/linux_test.go
index 38786b087..9dfbdb640 100644
--- a/pkg/report/linux_test.go
+++ b/pkg/report/linux_test.go
@@ -2910,8 +2910,9 @@ Call Trace:
if err != nil {
t.Fatal(err)
}
+ linux := reporter.(*linux)
for report, guilty0 := range tests {
- if guilty := reporter.ExtractGuiltyFile([]byte(report)); guilty != guilty0 {
+ if guilty := linux.extractGuiltyFile([]byte(report)); guilty != guilty0 {
t.Logf("log:\n%s", report)
t.Logf("want guilty:\n%s", guilty0)
t.Logf("got guilty:\n%s", guilty)
diff --git a/pkg/report/netbsd.go b/pkg/report/netbsd.go
index f5aab3faf..6c4dbedf9 100644
--- a/pkg/report/netbsd.go
+++ b/pkg/report/netbsd.go
@@ -4,7 +4,6 @@
package report
import (
- "fmt"
"regexp"
"github.com/google/syzkaller/pkg/symbolizer"
@@ -36,18 +35,6 @@ func (ctx *netbsd) Parse(output []byte) *Report {
return nil
}
-func (ctx *netbsd) Symbolize(text []byte) ([]byte, error) {
- return nil, fmt.Errorf("not implemented")
-}
-
-func (ctx *netbsd) ExtractConsoleOutput(output []byte) (result []byte) {
- return output
-}
-
-func (ctx *netbsd) ExtractGuiltyFile(report []byte) string {
- return ""
-}
-
-func (ctx *netbsd) GetMaintainers(file string) ([]string, error) {
- return nil, fmt.Errorf("not implemented")
+func (ctx *netbsd) Symbolize(rep *Report) error {
+ return nil
}
diff --git a/pkg/report/report.go b/pkg/report/report.go
index 813e8ef3c..4b7d52804 100644
--- a/pkg/report/report.go
+++ b/pkg/report/report.go
@@ -22,11 +22,8 @@ type Reporter interface {
// Returns nil if no oops found.
Parse(output []byte) *Report
- Symbolize(text []byte) ([]byte, error)
-
- ExtractConsoleOutput(output []byte) (result []byte)
- ExtractGuiltyFile(report []byte) string
- GetMaintainers(file string) ([]string, error)
+ // Symbolize symbolizes rep.Report and fills in Maintainers.
+ Symbolize(rep *Report) error
}
type Report struct {
@@ -41,6 +38,8 @@ type Report struct {
EndPos int
// Corrupted indicates whether the report is truncated of corrupted in some other way.
Corrupted bool
+ // Maintainers is list of maintainer emails.
+ Maintainers []string
}
// NewReporter creates reporter for the specified OS:
diff --git a/pkg/report/windows.go b/pkg/report/windows.go
index 17e1f1bc7..47573c6a5 100644
--- a/pkg/report/windows.go
+++ b/pkg/report/windows.go
@@ -35,18 +35,6 @@ func (ctx *windows) Parse(output []byte) *Report {
panic("not implemented")
}
-func (ctx *windows) Symbolize(text []byte) ([]byte, error) {
- panic("not implemented")
-}
-
-func (ctx *windows) ExtractConsoleOutput(output []byte) (result []byte) {
- panic("not implemented")
-}
-
-func (ctx *windows) ExtractGuiltyFile(report []byte) string {
- panic("not implemented")
-}
-
-func (ctx *windows) GetMaintainers(file string) ([]string, error) {
+func (ctx *windows) Symbolize(rep *Report) error {
panic("not implemented")
}
diff --git a/pkg/repro/repro.go b/pkg/repro/repro.go
index 1d9b51493..29ede6fd4 100644
--- a/pkg/repro/repro.go
+++ b/pkg/repro/repro.go
@@ -35,7 +35,7 @@ type Result struct {
Opts csource.Options
CRepro bool
Stats Stats
- // Information about the final crash that we reproduced.
+ // Information about the final (non-symbolized) crash that we reproduced.
// Can be different from what we started reproducing.
Report *report.Report
}