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