github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/pkg/report/freebsd.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  type freebsd struct {
    13  	*config
    14  }
    15  
    16  func ctorFreebsd(cfg *config) (reporterImpl, []string, error) {
    17  	ctx := &freebsd{
    18  		config: cfg,
    19  	}
    20  	return ctx, nil, nil
    21  }
    22  
    23  func (ctx *freebsd) ContainsCrash(output []byte) bool {
    24  	return containsCrash(output, freebsdOopses, ctx.ignores)
    25  }
    26  
    27  func (ctx *freebsd) Parse(output []byte) *Report {
    28  	return simpleLineParser(output, freebsdOopses, freebsdStackParams, ctx.ignores)
    29  }
    30  
    31  func (ctx *freebsd) Symbolize(rep *Report) error {
    32  	return nil
    33  }
    34  
    35  var freebsdStackParams = &stackParams{}
    36  
    37  // nolint: goconst
    38  var freebsdOopses = append([]*oops{
    39  	{
    40  		[]byte("Fatal trap"),
    41  		[]oopsFormat{
    42  			{
    43  				title: compile("Fatal trap (.+?)\\n(?:.*\\n)+?" +
    44  					"KDB: stack backtrace:\\n" +
    45  					"(?:#[0-9]+ {{ADDR}} at (?:kdb_backtrace|vpanic|panic|trap_fatal|" +
    46  					"trap_pfault|trap|calltrap|m_copydata|__rw_wlock_hard)" +
    47  					"\\+{{ADDR}}\\n)*#[0-9]+ {{ADDR}} at {{FUNC}}{{ADDR}}"),
    48  				fmt: "Fatal trap %[1]v in %[2]v",
    49  			},
    50  			{
    51  				title: compile("(Fatal trap [0-9]+:.*) while in (?:user|kernel) mode\\n(?:.*\\n)+?" +
    52  					"KDB: stack backtrace:\\n" +
    53  					"(?:[a-zA-Z0-9_]+\\(\\) at [a-zA-Z0-9_]+\\+0x.*\\n)*" +
    54  					"--- trap 0x[0-9a-fA-F]+.* ---\\n" +
    55  					"([a-zA-Z0-9_]+)\\(\\) at [a-zA-Z0-9_]+\\+0x.*\\n"),
    56  				fmt: "%[1]v in %[2]v",
    57  			},
    58  		},
    59  		[]*regexp.Regexp{},
    60  		crash.UnknownType,
    61  	},
    62  	{
    63  		[]byte("panic:"),
    64  		[]oopsFormat{
    65  			{
    66  				title: compile("panic: ffs_write: type {{ADDR}} [0-9]+ \\([0-9]+,[0-9]+\\)"),
    67  				fmt:   "panic: ffs_write: type ADDR X (Y,Z)",
    68  			},
    69  			{
    70  				title: compile("panic: ([a-zA-Z]+[a-zA-Z0-9_]*\\(\\)) of destroyed (mutex|rmlock|rwlock|sx) @ " +
    71  					"/.*/(sys/.*:[0-9]+)"),
    72  				fmt: "panic: %[1]v of destroyed %[2]v at %[3]v",
    73  			},
    74  			{
    75  				title: compile("panic: No chunks on the queues for sid [0-9]+\\.\\n"),
    76  				fmt:   "panic: sctp: no chunks on the queues",
    77  			},
    78  			{
    79  				title: compile("panic: size_on_all_streams = [0-9]+ smaller than control length [0-9]+\\n"),
    80  				fmt:   "panic: size_on_all_streams smaller than control length",
    81  			},
    82  			{
    83  				title: compile("panic: sbflush_internal: ccc [0-9]+ mb [0-9]+ mbcnt [0-9]+\\n"),
    84  				fmt:   "panic: sbflush_internal: residual data",
    85  			},
    86  			{
    87  				title: compile("(panic: sx lock still held)\\n(?:.*\\n)+?" +
    88  					"KDB: stack backtrace:\\n" +
    89  					"(?:[a-zA-Z0-9_]+\\(\\) at [a-zA-Z0-9_]+\\+0x.*\\n)*" +
    90  					"sx_destroy\\(\\) at [a-zA-Z0-9_+/ ]+\\n" +
    91  					"([a-zA-Z0-9_]+)\\(\\) at [a-zA-Z0-9_+/ ]+\\+0x.*\\n"),
    92  				fmt: "%[1]v in %[2]v",
    93  			},
    94  			{
    95  				title: compile("panic: pfi_dynaddr_setup: dyn is 0x[0-9a-f]+\\n"),
    96  				fmt:   "panic: pfi_dynaddr_setup: non-NULL dyn",
    97  			},
    98  			{
    99  				title: compile("(panic: ASan: Invalid access, [0-9]+-byte (?:read|write)) at {{ADDR}},.*\\n(?:.*\\n)+?" +
   100  					"KDB: stack backtrace:\\n" +
   101  					"(?:[a-zA-Z0-9_]+\\(\\) at [a-zA-Z0-9_]+\\+0x.*\\n)*" +
   102  					"__asan_.*\\(\\) at [a-zA-Z0-9_+/ ]+\\n" +
   103  					"([a-zA-Z0-9_]+)\\(\\) at [a-zA-Z0-9_+/ ]+\\+0x.*\\n"),
   104  				fmt: "%[1]v in %[2]v",
   105  			},
   106  		},
   107  		[]*regexp.Regexp{},
   108  		crash.UnknownType,
   109  	},
   110  	&groupGoRuntimeErrors,
   111  }, commonOopses...)