xref: /freebsd/tools/test/stress2/misc/syzkaller35.sh (revision 014a2b1a1125fb0129258b8109dc33fd7bf24b14)
12018d488SPeter Holm#!/bin/sh
22018d488SPeter Holm
32018d488SPeter Holm# panic: AEAD without a separate IV
42018d488SPeter Holm# cpuid = 18
52018d488SPeter Holm# time = 1620305816
62018d488SPeter Holm# KDB: stack backtrace:
72018d488SPeter Holm# db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe01aeea25d0
82018d488SPeter Holm# vpanic() at vpanic+0x181/frame 0xfffffe01aeea2620
92018d488SPeter Holm# panic() at panic+0x43/frame 0xfffffe01aeea2680
102018d488SPeter Holm# crp_sanity() at crp_sanity+0x4e9/frame 0xfffffe01aeea26b0
112018d488SPeter Holm# crypto_dispatch() at crypto_dispatch+0xf/frame 0xfffffe01aeea26d0
122018d488SPeter Holm# crypto_ioctl() at crypto_ioctl+0x1e33/frame 0xfffffe01aeea27e0
132018d488SPeter Holm# devfs_ioctl() at devfs_ioctl+0xcd/frame 0xfffffe01aeea2830
142018d488SPeter Holm# VOP_IOCTL_APV() at VOP_IOCTL_APV+0x59/frame 0xfffffe01aeea2850
152018d488SPeter Holm# vn_ioctl() at vn_ioctl+0x133/frame 0xfffffe01aeea2960
162018d488SPeter Holm# devfs_ioctl_f() at devfs_ioctl_f+0x1e/frame 0xfffffe01aeea2980
172018d488SPeter Holm# kern_ioctl() at kern_ioctl+0x289/frame 0xfffffe01aeea29f0
182018d488SPeter Holm# sys_ioctl() at sys_ioctl+0x12a/frame 0xfffffe01aeea2ac0
192018d488SPeter Holm# amd64_syscall() at amd64_syscall+0x147/frame 0xfffffe01aeea2bf0
202018d488SPeter Holm# fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe01aeea2bf0
212018d488SPeter Holm# --- syscall (0, FreeBSD ELF64, nosys), rip = 0x8003827da, rsp = 0x7fffffffe848, rbp = 0x7fffffffe890 ---
222018d488SPeter Holm# KDB: enter: panic
232018d488SPeter Holm# [ thread pid 4018 tid 100350 ]
242018d488SPeter Holm# Stopped at      kdb_enter+0x37: movq    $0,0x1282a9e(%rip)
252018d488SPeter Holm# db> x/s version
262018d488SPeter Holm# version: FreeBSD 14.0-CURRENT #0 main-n246502-49c894ddced: Thu May  6 09:17:33 CEST 2021
272018d488SPeter Holm# pho@t2.osted.lan:/usr/src/sys/amd64/compile/PHO
282018d488SPeter Holm# db>
292018d488SPeter Holm
302018d488SPeter Holm[ `uname -p` != "amd64" ] && exit 0
312018d488SPeter Holm[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
322018d488SPeter Holm
332018d488SPeter Holm. ../default.cfg
342018d488SPeter Holmcat > /tmp/syzkaller35.c <<EOF
352018d488SPeter Holm// https://syzkaller.appspot.com/bug?id=53246f1d9a11588c630ff9e2676551ee0a2757a4
362018d488SPeter Holm// autogenerated by syzkaller (https://github.com/google/syzkaller)
372018d488SPeter Holm// Reported-by: syzbot+007341439ae295cee74f@syzkaller.appspotmail.com
382018d488SPeter Holm
392018d488SPeter Holm#define _GNU_SOURCE
402018d488SPeter Holm
412018d488SPeter Holm#include <pwd.h>
422018d488SPeter Holm#include <stdarg.h>
432018d488SPeter Holm#include <stdbool.h>
442018d488SPeter Holm#include <stdint.h>
452018d488SPeter Holm#include <stdio.h>
462018d488SPeter Holm#include <stdlib.h>
472018d488SPeter Holm#include <string.h>
482018d488SPeter Holm#include <sys/endian.h>
492018d488SPeter Holm#include <sys/syscall.h>
502018d488SPeter Holm#include <unistd.h>
512018d488SPeter Holm
522018d488SPeter Holmuint64_t r[1] = {0xffffffffffffffff};
532018d488SPeter Holm
542018d488SPeter Holmint main(void)
552018d488SPeter Holm{
562018d488SPeter Holm  syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul);
572018d488SPeter Holm  intptr_t res = 0;
582018d488SPeter Holm  memcpy((void*)0x20000340, "/dev/crypto\000", 12);
592018d488SPeter Holm  res = syscall(SYS_openat, 0xffffffffffffff9cul, 0x20000340ul, 0ul, 0ul);
602018d488SPeter Holm  if (res != -1)
612018d488SPeter Holm    r[0] = res;
622018d488SPeter Holm  *(uint32_t*)0x20000440 = 0x28;
632018d488SPeter Holm  *(uint32_t*)0x20000444 = 0;
642018d488SPeter Holm  *(uint32_t*)0x20000448 = 0x10;
652018d488SPeter Holm  *(uint64_t*)0x20000450 = 0x20000380;
662018d488SPeter Holm  memcpy((void*)0x20000380,
672018d488SPeter Holm         "\x3c\x02\x2e\x61\x79\x2e\xec\xb0\x7f\x8a\xee\x18\xe5\xaa\x35\x05",
682018d488SPeter Holm         16);
692018d488SPeter Holm  *(uint32_t*)0x20000458 = 0;
702018d488SPeter Holm  *(uint64_t*)0x20000460 = 0;
712018d488SPeter Holm  *(uint32_t*)0x20000468 = 0;
722018d488SPeter Holm  *(uint32_t*)0x2000046c = 0xfdffffff;
732018d488SPeter Holm  *(uint32_t*)0x20000470 = 0;
742018d488SPeter Holm  *(uint32_t*)0x20000474 = 0;
752018d488SPeter Holm  *(uint32_t*)0x20000478 = 0;
762018d488SPeter Holm  *(uint32_t*)0x2000047c = 0;
772018d488SPeter Holm  syscall(SYS_ioctl, r[0], 0xc040636aul, 0x20000440ul);
782018d488SPeter Holm  *(uint32_t*)0x20000280 = 0;
792018d488SPeter Holm  *(uint16_t*)0x20000284 = 1;
802018d488SPeter Holm  *(uint16_t*)0x20000286 = 0;
812018d488SPeter Holm  *(uint32_t*)0x20000288 = 0xf0a;
822018d488SPeter Holm  *(uint32_t*)0x2000028c = 0;
832018d488SPeter Holm  *(uint32_t*)0x20000290 = 0;
842018d488SPeter Holm  *(uint64_t*)0x20000298 = 0x20000480;
852018d488SPeter Holm  *(uint64_t*)0x200002a0 = 0;
862018d488SPeter Holm  *(uint64_t*)0x200002a8 = 0;
872018d488SPeter Holm  *(uint64_t*)0x200002b0 = 0x20000680;
882018d488SPeter Holm  *(uint64_t*)0x200002b8 = 0;
892018d488SPeter Holm  syscall(SYS_ioctl, r[0], 0xc040636dul, 0x20000280ul);
902018d488SPeter Holm  return 0;
912018d488SPeter Holm}
922018d488SPeter HolmEOF
932018d488SPeter Holmmycc -o /tmp/syzkaller35 -Wall -Wextra -O0 /tmp/syzkaller35.c ||
942018d488SPeter Holm    exit 1
952018d488SPeter Holm
962018d488SPeter Holmkldload cryptodev.ko && loaded=1
972018d488SPeter Holm(cd /tmp; timeout 3m ./syzkaller35)
982018d488SPeter Holm[ $loaded ] && kldunload cryptodev.ko
992018d488SPeter Holm
100*014a2b1aSPeter Holmrm -rf /tmp/syzkaller35 /tmp/syzkaller35.c /tmp/syzkaller.*
1012018d488SPeter Holmexit 0
102