xref: /freebsd/tools/test/stress2/misc/syzkaller35.sh (revision 43a5ec4eb41567cc92586503212743d89686d78f)
1#!/bin/sh
2
3# panic: AEAD without a separate IV
4# cpuid = 18
5# time = 1620305816
6# KDB: stack backtrace:
7# db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe01aeea25d0
8# vpanic() at vpanic+0x181/frame 0xfffffe01aeea2620
9# panic() at panic+0x43/frame 0xfffffe01aeea2680
10# crp_sanity() at crp_sanity+0x4e9/frame 0xfffffe01aeea26b0
11# crypto_dispatch() at crypto_dispatch+0xf/frame 0xfffffe01aeea26d0
12# crypto_ioctl() at crypto_ioctl+0x1e33/frame 0xfffffe01aeea27e0
13# devfs_ioctl() at devfs_ioctl+0xcd/frame 0xfffffe01aeea2830
14# VOP_IOCTL_APV() at VOP_IOCTL_APV+0x59/frame 0xfffffe01aeea2850
15# vn_ioctl() at vn_ioctl+0x133/frame 0xfffffe01aeea2960
16# devfs_ioctl_f() at devfs_ioctl_f+0x1e/frame 0xfffffe01aeea2980
17# kern_ioctl() at kern_ioctl+0x289/frame 0xfffffe01aeea29f0
18# sys_ioctl() at sys_ioctl+0x12a/frame 0xfffffe01aeea2ac0
19# amd64_syscall() at amd64_syscall+0x147/frame 0xfffffe01aeea2bf0
20# fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe01aeea2bf0
21# --- syscall (0, FreeBSD ELF64, nosys), rip = 0x8003827da, rsp = 0x7fffffffe848, rbp = 0x7fffffffe890 ---
22# KDB: enter: panic
23# [ thread pid 4018 tid 100350 ]
24# Stopped at      kdb_enter+0x37: movq    $0,0x1282a9e(%rip)
25# db> x/s version
26# version: FreeBSD 14.0-CURRENT #0 main-n246502-49c894ddced: Thu May  6 09:17:33 CEST 2021
27# pho@t2.osted.lan:/usr/src/sys/amd64/compile/PHO
28# db>
29
30[ `uname -p` != "amd64" ] && exit 0
31[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
32
33. ../default.cfg
34cat > /tmp/syzkaller35.c <<EOF
35// https://syzkaller.appspot.com/bug?id=53246f1d9a11588c630ff9e2676551ee0a2757a4
36// autogenerated by syzkaller (https://github.com/google/syzkaller)
37// Reported-by: syzbot+007341439ae295cee74f@syzkaller.appspotmail.com
38
39#define _GNU_SOURCE
40
41#include <pwd.h>
42#include <stdarg.h>
43#include <stdbool.h>
44#include <stdint.h>
45#include <stdio.h>
46#include <stdlib.h>
47#include <string.h>
48#include <sys/endian.h>
49#include <sys/syscall.h>
50#include <unistd.h>
51
52uint64_t r[1] = {0xffffffffffffffff};
53
54int main(void)
55{
56  syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul);
57  intptr_t res = 0;
58  memcpy((void*)0x20000340, "/dev/crypto\000", 12);
59  res = syscall(SYS_openat, 0xffffffffffffff9cul, 0x20000340ul, 0ul, 0ul);
60  if (res != -1)
61    r[0] = res;
62  *(uint32_t*)0x20000440 = 0x28;
63  *(uint32_t*)0x20000444 = 0;
64  *(uint32_t*)0x20000448 = 0x10;
65  *(uint64_t*)0x20000450 = 0x20000380;
66  memcpy((void*)0x20000380,
67         "\x3c\x02\x2e\x61\x79\x2e\xec\xb0\x7f\x8a\xee\x18\xe5\xaa\x35\x05",
68         16);
69  *(uint32_t*)0x20000458 = 0;
70  *(uint64_t*)0x20000460 = 0;
71  *(uint32_t*)0x20000468 = 0;
72  *(uint32_t*)0x2000046c = 0xfdffffff;
73  *(uint32_t*)0x20000470 = 0;
74  *(uint32_t*)0x20000474 = 0;
75  *(uint32_t*)0x20000478 = 0;
76  *(uint32_t*)0x2000047c = 0;
77  syscall(SYS_ioctl, r[0], 0xc040636aul, 0x20000440ul);
78  *(uint32_t*)0x20000280 = 0;
79  *(uint16_t*)0x20000284 = 1;
80  *(uint16_t*)0x20000286 = 0;
81  *(uint32_t*)0x20000288 = 0xf0a;
82  *(uint32_t*)0x2000028c = 0;
83  *(uint32_t*)0x20000290 = 0;
84  *(uint64_t*)0x20000298 = 0x20000480;
85  *(uint64_t*)0x200002a0 = 0;
86  *(uint64_t*)0x200002a8 = 0;
87  *(uint64_t*)0x200002b0 = 0x20000680;
88  *(uint64_t*)0x200002b8 = 0;
89  syscall(SYS_ioctl, r[0], 0xc040636dul, 0x20000280ul);
90  return 0;
91}
92EOF
93mycc -o /tmp/syzkaller35 -Wall -Wextra -O0 /tmp/syzkaller35.c ||
94    exit 1
95
96kldload cryptodev.ko && loaded=1
97(cd /tmp; timeout 3m ./syzkaller35)
98[ $loaded ] && kldunload cryptodev.ko
99
100rm -rf /tmp/syzkaller35 syzkaller35.c /tmp/syzkaller.*
101exit 0
102