xref: /freebsd/tools/test/stress2/misc/syzkaller5.sh (revision 19261079)
1#!/bin/sh
2
3# panic: to_ticks == 0 for timer type 11
4# cpuid = 0
5# time = 1585113766
6# KDB: stack backtrace:
7# db_trace_self_wrapper() at db_trace_self_wrapper+0x47/frame 0xfffffe0024a5e4b0
8# vpanic() at vpanic+0x1c7/frame 0xfffffe0024a5e510
9# panic() at panic+0x43/frame 0xfffffe0024a5e570
10# sctp_timer_start() at sctp_timer_start+0xc7f/frame 0xfffffe0024a5e5d0
11# sctp_lower_sosend() at sctp_lower_sosend+0x4b9a/frame 0xfffffe0024a5e7b0
12# sctp_sosend() at sctp_sosend+0x501/frame 0xfffffe0024a5e8e0
13# sosend() at sosend+0xc6/frame 0xfffffe0024a5e950
14# kern_sendit() at kern_sendit+0x33d/frame 0xfffffe0024a5ea00
15# sendit() at sendit+0x224/frame 0xfffffe0024a5ea60
16# sys_sendto() at sys_sendto+0x5c/frame 0xfffffe0024a5eac0
17# amd64_syscall() at amd64_syscall+0x2f4/frame 0xfffffe0024a5ebf0
18# fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe0024a5ebf0
19
20# Fixed by r359405
21
22[ `uname -p` = "i386" ] && exit 0
23
24. ../default.cfg
25kldstat -v | grep -q sctp || kldload sctp.ko
26cat > /tmp/syzkaller5.c <<EOF
27// https://syzkaller.appspot.com/bug?id=0cebb51a059e6a7e259573cc2dd635db8dffcb80
28// autogenerated by syzkaller (https://github.com/google/syzkaller)
29
30#define _GNU_SOURCE
31
32#include <pwd.h>
33#include <stdarg.h>
34#include <stdbool.h>
35#include <stdint.h>
36#include <stdio.h>
37#include <stdlib.h>
38#include <string.h>
39#include <sys/endian.h>
40#include <sys/syscall.h>
41#include <unistd.h>
42
43uint64_t r[1] = {0xffffffffffffffff};
44
45int main(void)
46{
47  syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 3ul, 0x1012ul, -1, 0ul);
48  intptr_t res = 0;
49  res = syscall(SYS_socket, 0x1cul, 5ul, 0x84);
50  if (res != -1)
51    r[0] = res;
52  *(uint32_t*)0x20000200 = 0;
53  *(uint32_t*)0x20000204 = 0;
54  *(uint32_t*)0x20000208 = 0xfffffffb;
55  *(uint32_t*)0x2000020c = 0;
56  syscall(SYS_setsockopt, r[0], 0x84, 1, 0x20000200ul, 0x3f6ul);
57  memcpy((void*)0x20000040, "\x11", 1);
58  *(uint8_t*)0x20000100 = 0x10;
59  *(uint8_t*)0x20000101 = 2;
60  *(uint16_t*)0x20000102 = htobe16(0x4e21);
61  *(uint8_t*)0x20000104 = 0xac;
62  *(uint8_t*)0x20000105 = 0x14;
63  *(uint8_t*)0x20000106 = 0;
64  *(uint8_t*)0x20000107 = 0xbb;
65  *(uint8_t*)0x20000108 = 0;
66  *(uint8_t*)0x20000109 = 0;
67  *(uint8_t*)0x2000010a = 0;
68  *(uint8_t*)0x2000010b = 0;
69  *(uint8_t*)0x2000010c = 0;
70  *(uint8_t*)0x2000010d = 0;
71  *(uint8_t*)0x2000010e = 0;
72  *(uint8_t*)0x2000010f = 0;
73  syscall(SYS_sendto, r[0], 0x20000040ul, 1ul, 0x104ul, 0x20000100ul, 0x10ul);
74  return 0;
75}
76EOF
77mycc -o /tmp/syzkaller5 -Wall -Wextra -O2 /tmp/syzkaller5.c -lpthread ||
78    exit 1
79
80(cd /tmp; ./syzkaller5)
81
82rm /tmp/syzkaller5 /tmp/syzkaller5.c
83exit 0
84