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

     1  // Copyright 2018 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 ctorOpenbsd(cfg *config) (reporterImpl, []string, error) {
    13  	symbolizeRes := []*regexp.Regexp{
    14  		// stack
    15  		regexp.MustCompile(` at ([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  	ctx, err := ctorBSD(cfg, openbsdOopses, symbolizeRes)
    20  	if err != nil {
    21  		return nil, nil, err
    22  	}
    23  	suppressions := []string{
    24  		"panic: vop_generic_badop",
    25  		"witness: lock order reversal:\\n(.*\\n)*.*[0-9stnd]+ 0x[0-9a-f]+ inode(.*\\n)*.*lock order .* first seen at",
    26  		"panic:.*send disconnect: Broken pipe",
    27  	}
    28  	return ctx, suppressions, nil
    29  }
    30  
    31  var openbsdOopses = append([]*oops{
    32  	{
    33  		[]byte("cleaned vnode"),
    34  		[]oopsFormat{
    35  			{
    36  				title: compile("cleaned vnode: "),
    37  				fmt:   "panic: cleaned vnode isn't",
    38  			},
    39  		},
    40  		[]*regexp.Regexp{},
    41  		crash.UnknownType,
    42  	},
    43  	{
    44  		[]byte("panic:"),
    45  		[]oopsFormat{
    46  			{
    47  				title: compile(`\nddb\{\d+\}> show panic(?Us:.*)[*]cpu\d+: ([^\n]+)(?Us:.*)\nddb\{\d+\}> trace`),
    48  				fmt:   "panic: %[1]v",
    49  			},
    50  			{
    51  				title: compile("panic: kernel diagnostic assertion (.+) failed: file \".*/([^\"]+)"),
    52  				fmt:   "assert %[1]v failed in %[2]v",
    53  			},
    54  			{
    55  				title: compile("panic: Data modified on freelist: .* previous type ([^ ]+)"),
    56  				fmt:   "malloc: free list modified: %[1]v",
    57  			},
    58  			{
    59  				title: compile("panic: pool_cache_item_magic_check: ([^ ]+) cpu free list modified"),
    60  				fmt:   "pool: cpu free list modified: %[1]v",
    61  			},
    62  			{
    63  				title: compile("panic: pool_do_put: ([^:]+): double pool_put"),
    64  				fmt:   "pool: double put: %[1]v",
    65  			},
    66  			{
    67  				title: compile("panic: pool_do_get: ([^:]+) free list modified"),
    68  				fmt:   "pool: free list modified: %[1]v",
    69  			},
    70  			{
    71  				title: compile("panic: pool_p_free: ([^:]+) free list modified"),
    72  				fmt:   "pool: free list modified: %[1]v",
    73  			},
    74  			{
    75  				title: compile("panic: timeout_add: to_ticks \\(.+\\) < 0"),
    76  				fmt:   "panic: timeout_add: to_ticks < 0",
    77  			},
    78  			{
    79  				title: compile("panic: attempt to execute user address {{ADDR}} in supervisor mode"),
    80  				fmt:   "panic: attempt to execute user address",
    81  			},
    82  			{
    83  				title: compile("panic: unhandled af"),
    84  				fmt:   "panic: unhandled af",
    85  			},
    86  			{
    87  				title: compile("panic: (kqueue|knote).* ([a-z]+ .*)"),
    88  				fmt:   "kqueue: %[2]v",
    89  			},
    90  			{
    91  				title: compile("panic: receive ([0-9][a-z]*):"),
    92  				fmt:   "soreceive %[1]v",
    93  			},
    94  		},
    95  		[]*regexp.Regexp{},
    96  		crash.UnknownType,
    97  	},
    98  	{
    99  		[]byte("lock order reversal:"),
   100  		[]oopsFormat{
   101  			{
   102  				title: compile("lock order reversal:\\n(?:.*\\n)*lock order data .* missing"),
   103  				fmt:   "witness: reversal: lock order data missing",
   104  			},
   105  			{
   106  				title: compile("lock order reversal:\\n+.*1st {{ADDR}} ([^\\ ]+).*\\n.*2nd {{ADDR}} ([^\\ ]+)"),
   107  				fmt:   "witness: reversal: %[1]v %[2]v",
   108  			},
   109  		},
   110  		[]*regexp.Regexp{},
   111  		crash.UnknownType,
   112  	},
   113  	{
   114  		[]byte("witness:"),
   115  		[]oopsFormat{
   116  			{
   117  				title: compile("witness: thread {{ADDR}} exiting with the following locks held:"),
   118  				fmt:   "witness: thread exiting with locks held",
   119  			},
   120  			{
   121  				title: compile("witness: userret: returning with the following locks held:(.*\\n)+?.*sys_([a-z0-9_]+)\\+"),
   122  				fmt:   "witness: userret: %[2]v",
   123  			},
   124  			{
   125  				title: compile("(witness: .*)"),
   126  				fmt:   "%[1]v",
   127  			},
   128  		},
   129  		[]*regexp.Regexp{},
   130  		crash.UnknownType,
   131  	},
   132  	{
   133  		[]byte("uvm_fault("),
   134  		[]oopsFormat{
   135  			{
   136  				title:  compile("uvm_fault\\((?:.*\\n)+?.*Stopped at[ ]+{{ADDR}}"),
   137  				report: compile("uvm_fault\\((?:.*\\n)+?.*end trace frame"),
   138  				fmt:    "uvm_fault",
   139  			},
   140  			{
   141  				title:  compile("uvm_fault\\((?:.*\\n)+?.*Stopped at[ ]+([^\\+]+)"),
   142  				report: compile("uvm_fault(?:.*\\n)+?.*Stopped at[ ]+([^\\+]+)(?:.*\\n)+?.*end trace frame"),
   143  				fmt:    "uvm_fault: %[1]v",
   144  			},
   145  			{
   146  				title:     compile("uvm_fault\\("),
   147  				fmt:       "uvm_fault",
   148  				corrupted: true,
   149  			},
   150  		},
   151  		[]*regexp.Regexp{},
   152  		crash.UnknownType,
   153  	},
   154  	{
   155  		[]byte("kernel:"),
   156  		[]oopsFormat{
   157  			{
   158  				title: compile("kernel: page fault trap, code=0.*\\nStopped at[ ]+([^\\+]+)"),
   159  				fmt:   "uvm_fault: %[1]v",
   160  			},
   161  			{
   162  				title: compile("kernel: protection fault trap, code=0.*\\nStopped at[ ]+([^\\+]+)"),
   163  				fmt:   "protection_fault: %[1]v",
   164  			},
   165  		},
   166  		[]*regexp.Regexp{
   167  			compile("reorder_kernel"),
   168  		},
   169  		crash.UnknownType,
   170  	},
   171  	&groupGoRuntimeErrors,
   172  }, commonOopses...)