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