openbsd: remove shorten report logic (#986)

A line length of 79 in the ddb output does not necessarily imply that the
following line is a continuation of the current line. Since there's no way
to distinguish between ordinary and continuation lines, it could end up
corrupting the report by joining two lines that are disjoint[1].

Instead, disable line wrapping in ddb. If we want some kind of wrapping in
the future it's easier done by pkg/report.

[1] https://syzkaller.appspot.com/bug?extid=03f7377a9848d7d008c9
This commit is contained in:
Anton Lindqvist 2019-02-09 17:23:53 +01:00 committed by Greg Steuck
parent d75f7686f1
commit c69659e352
4 changed files with 7 additions and 25 deletions

View File

@ -70,9 +70,6 @@ func (ctx *openbsd) Parse(output []byte) *Report {
return nil
}
rep.Output = output
if report := ctx.shortenReport(rep.Report); len(report) != 0 {
rep.Report = report
}
return rep
}
@ -142,19 +139,6 @@ func (ctx *openbsd) symbolizeLine(symbFunc func(bin string, pc uint64) ([]symbol
return symbolized
}
func (ctx *openbsd) shortenReport(report []byte) []byte {
out := new(bytes.Buffer)
for s := bufio.NewScanner(bytes.NewReader(report)); s.Scan(); {
line := s.Bytes()
out.Write(line)
// Kernel splits lines at 79 column.
if len(line) != 79 {
out.WriteByte('\n')
}
}
return out.Bytes()
}
var openbsdOopses = []*oops{
{
[]byte("cleaned vnode"),

View File

@ -7,10 +7,8 @@ TITLE: pool: double put: lockfpl
panic() at panic+0x147
pool_do_put(ffffff001692bd18,ffffffff81ec0850) at pool_do_put+0x2e2
pool_put(ffffff0016933440,ffff80000e3793e8) at pool_put+0x37
lf_advlock(40,ffffff001dc251c8,2,ffff80000e3793e8,ffffffff81df26c0,200000040) a
t lf_advlock+0x270
VOP_ADVLOCK(ffffff0015a96da8,ffff80000e2a3080,3,ffffff001f7ca350,3) at VOP_ADVL
OCK+0x67
lf_advlock(40,ffffff001dc251c8,2,ffff80000e3793e8,ffffffff81df26c0,200000040) at lf_advlock+0x270
VOP_ADVLOCK(ffffff0015a96da8,ffff80000e2a3080,3,ffffff001f7ca350,3) at VOP_ADVLOCK+0x67
closef(ffff80000e2a3080,ffffff001f7ca350) at closef+0xaf
fdfree(ffff80000e27c008) at fdfree+0x98
exit1(ffff80000e3795c0,ffff80000e2a3080,ffff80000e27c008) at exit1+0x226
@ -26,10 +24,8 @@ TITLE: pool: double put: lockfpl
panic() at panic+0x147
pool_do_put(ffffff001692bd18,ffffffff81ec0850) at pool_do_put+0x2e2
pool_put(ffffff0016933440,ffff80000e3793e8) at pool_put+0x37
lf_advlock(40,ffffff001dc251c8,2,ffff80000e3793e8,ffffffff81df26c0,200000040) a
t lf_advlock+0x270
VOP_ADVLOCK(ffffff0015a96da8,ffff80000e2a3080,3,ffffff001f7ca350,3) at VOP_ADVL
OCK+0x67
lf_advlock(40,ffffff001dc251c8,2,ffff80000e3793e8,ffffffff81df26c0,200000040) at lf_advlock+0x270
VOP_ADVLOCK(ffffff0015a96da8,ffff80000e2a3080,3,ffffff001f7ca350,3) at VOP_ADVLOCK+0x67
closef(ffff80000e2a3080,ffffff001f7ca350) at closef+0xaf
fdfree(ffff80000e27c008) at fdfree+0x98
exit1(ffff80000e3795c0,ffff80000e2a3080,ffff80000e27c008) at exit1+0x226

View File

@ -43,6 +43,7 @@ EOF
cat >etc/sysctl.conf <<EOF
ddb.max_line=0
ddb.max_width=0
hw.smt=1
EOF

View File

@ -15,7 +15,8 @@ import (
func DiagnoseOpenBSD(w io.Writer) bool {
commands := []string{
"",
"set $lines = 0", // disable pagination
"set $lines = 0", // disable pagination
"set $maxwidth = 0", // disable line continuation
"show panic",
"trace",
"show registers",