xref: /freebsd/tools/test/stress2/misc/syzkaller10.sh (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1#!/bin/sh
2
3# panic: sbsndptr_noadv: sb_mb is NULL
4# cpuid = 0
5# time = 1586867804
6# KDB: stack backtrace:
7# db_trace_self_wrapper() at db_trace_self_wrapper+0x47/frame 0xfffffe0025a68360
8# vpanic() at vpanic+0x1c7/frame 0xfffffe0025a683c0
9# panic() at panic+0x43/frame 0xfffffe0025a68420
10# sbsndptr_noadv() at sbsndptr_noadv+0xae/frame 0xfffffe0025a68460
11# rack_output() at rack_output+0x51f5/frame 0xfffffe0025a68700
12# tcp_usr_send() at tcp_usr_send+0x5c7/frame 0xfffffe0025a687e0
13# sosend_generic() at sosend_generic+0x8fd/frame 0xfffffe0025a688e0
14# sosend() at sosend+0xc6/frame 0xfffffe0025a68950
15# kern_sendit() at kern_sendit+0x33d/frame 0xfffffe0025a68a00
16# sendit() at sendit+0x224/frame 0xfffffe0025a68a60
17# sys_sendto() at sys_sendto+0x5c/frame 0xfffffe0025a68ac0
18# amd64_syscall() at amd64_syscall+0x262/frame 0xfffffe0025a68bf0
19
20[ `uname -p` = "i386" ] && exit 0
21
22. ../default.cfg
23cat > /tmp/syzkaller10.c <<EOF
24// https://syzkaller.appspot.com/bug?id=048f650e99696f881872a285cef0e3b9bd4f4e25
25// autogenerated by syzkaller (https://github.com/google/syzkaller)
26
27#define _GNU_SOURCE
28
29#include <pwd.h>
30#include <stdarg.h>
31#include <stdbool.h>
32#include <stdint.h>
33#include <stdio.h>
34#include <stdlib.h>
35#include <string.h>
36#include <sys/endian.h>
37#include <sys/syscall.h>
38#include <unistd.h>
39
40uint64_t r[1] = {0xffffffffffffffff};
41
42int main(void)
43{
44  syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 3ul, 0x1012ul, -1, 0ul);
45  intptr_t res = 0;
46  res = syscall(SYS_socket, 2ul, 1ul, 0);
47  if (res != -1)
48    r[0] = res;
49  memcpy((void*)0x20000080,
50         "rack\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
51         "\000\000\000\000\000\000\000\000\000\000\000\000",
52         32);
53  *(uint32_t*)0x200000a0 = 0;
54  syscall(SYS_setsockopt, r[0], 6, 0x2000, 0x20000080ul, 0x24ul);
55  *(uint8_t*)0x20000000 = 0x2c;
56  *(uint8_t*)0x20000001 = 2;
57  *(uint16_t*)0x20000002 = htobe16(0x4e21);
58  *(uint32_t*)0x20000004 = htobe32(-1);
59  *(uint8_t*)0x20000008 = 0;
60  *(uint8_t*)0x20000009 = 0;
61  *(uint8_t*)0x2000000a = 0;
62  *(uint8_t*)0x2000000b = 0;
63  *(uint8_t*)0x2000000c = 0;
64  *(uint8_t*)0x2000000d = 0;
65  *(uint8_t*)0x2000000e = 0;
66  *(uint8_t*)0x2000000f = 0;
67  syscall(SYS_sendto, r[0], 0ul, 0ul, 0ul, 0x20000000ul, 0x10ul);
68  *(uint8_t*)0x20000040 = 0x10;
69  *(uint8_t*)0x20000041 = 2;
70  *(uint16_t*)0x20000042 = htobe16(0x4e21);
71  *(uint32_t*)0x20000044 = htobe32(0);
72  *(uint8_t*)0x20000048 = 0;
73  *(uint8_t*)0x20000049 = 0;
74  *(uint8_t*)0x2000004a = 0;
75  *(uint8_t*)0x2000004b = 0;
76  *(uint8_t*)0x2000004c = 0;
77  *(uint8_t*)0x2000004d = 0;
78  *(uint8_t*)0x2000004e = 0;
79  *(uint8_t*)0x2000004f = 0;
80  syscall(SYS_sendto, r[0], 0ul, 0ul, 0x60005ul, 0x20000040ul, 0x10ul);
81  return 0;
82}
83EOF
84mycc -o /tmp/syzkaller10 -Wall -Wextra -O2 /tmp/syzkaller10.c -lpthread ||
85    exit 1
86
87(cd /tmp; ./syzkaller10) &
88sleep 60
89pkill -9 syzkaller10
90wait
91
92rm -f /tmp/syzkaller10 /tmp/syzkaller10.c /tmp/syzkaller10.core
93exit 0
94