github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/pkg/report/netbsd.go (about)

     1  // Copyright 2017 syzkaller project authors. All rights reserved.
     2  // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  package report
     5  
     6  import (
     7  	"regexp"
     8  
     9  	"github.com/google/syzkaller/pkg/report/crash"
    10  )
    11  
    12  func ctorNetbsd(cfg *config) (reporterImpl, []string, error) {
    13  	symbolizeRes := []*regexp.Regexp{
    14  		// stack
    15  		regexp.MustCompile(` at netbsd:([A-Za-z0-9_]+)\+0x([0-9a-f]+)`),
    16  		// witness
    17  		regexp.MustCompile(`#[0-9]+ +([A-Za-z0-9_]+)\+0x([0-9a-f]+)`),
    18  	}
    19  	cfg.ignores = append(cfg.ignores, regexp.MustCompile("event_init: unable to initialize")) // postfix output
    20  	ctx, err := ctorBSD(cfg, netbsdOopses, symbolizeRes)
    21  	return ctx, nil, err
    22  }
    23  
    24  // nolint: lll
    25  var netbsdOopses = append([]*oops{
    26  	{
    27  		[]byte("fault in supervisor mode"),
    28  		[]oopsFormat{
    29  			{
    30  				title:  compile("fatal (page|protection|integer divide) fault in supervisor mode"),
    31  				report: compile(`fatal (page|protection|integer divide) fault in supervisor mode(?:.*\n)+?.*Stopped in.*netbsd:([^\\+]+)`),
    32  				fmt:    "%[1]v fault in %[2]v",
    33  			},
    34  		},
    35  		[]*regexp.Regexp{},
    36  		crash.UnknownType,
    37  	},
    38  	{
    39  		[]byte("panic: "),
    40  		[]oopsFormat{
    41  			{
    42  				title:  compile("panic: kernel diagnostic assertion"),
    43  				report: compile(`panic: kernel diagnostic assertion "(.*?)"`),
    44  				fmt:    "assert failed: %[1]v",
    45  			},
    46  			{
    47  				title:  compile("panic: lock error"),
    48  				report: compile(`panic: lock error:(?:.*\n)+?.*?Begin traceback.*?\n(?:.*(?:panic|printf|lockdebug|abort|mutex).*\n)*.*?\](.*?)\(`),
    49  				fmt:    "lock error in %[1]v",
    50  			},
    51  			{
    52  				title:  compile("ASan: Unauthorized Access"),
    53  				report: compile(`ASan: Unauthorized Access (?:.*\n)+(?:kasan|__asan).*\n(.*)\(`),
    54  				fmt:    "ASan: Unauthorized Access in %[1]v",
    55  			},
    56  			{
    57  				title:  compile("MSan: Uninitialized"),
    58  				report: compile(`MSan: Uninitialized (?:.*\n)+(?:kmsan|__msan).*\n(.*)\(`),
    59  				fmt:    "MSan: Uninitialized Memory in %[1]v",
    60  			},
    61  			{
    62  				title:  compile("UBSan: Undefined Behavior"),
    63  				report: compile(`UBSan: Undefined Behavior (?:.*\n)+(?:Handle|__ubsan).*\n(.*)\(`),
    64  				fmt:    "UBSan: Undefined Behavior in %[1]v",
    65  			},
    66  		},
    67  		[]*regexp.Regexp{
    68  			compile(`ddb\.onpanic:`),
    69  		},
    70  		crash.UnknownType,
    71  	},
    72  	{
    73  		[]byte("UBSan:"),
    74  		[]oopsFormat{
    75  			{
    76  				title: compile("UBSan:"),
    77  				fmt:   "UBSan: Undefined behavior",
    78  			},
    79  		},
    80  		[]*regexp.Regexp{},
    81  		crash.UnknownType,
    82  	},
    83  	&groupGoRuntimeErrors,
    84  }, commonOopses...)