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