panic: kernel diagnostic assertion "TAILQ_EMPTY(&kq->kq_head)" failed: file "/syzkaller/managers/multicore/kernel/sys/kern/kern_event.c", line 1268
Stopped at      db_enter+0x18:  addq    $0x8,%rsp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
*483275  29128      0           0  0x4000000    0  syz-executor.0
 174656  62957      0         0x2      0x480    1  syz-executor.1
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic(ffffffff823c3c11) at panic+0x15e sys/kern/subr_prf.c:218
__assert(ffffffff8242d86c,ffffffff82425328,4f4,ffffffff823ad335) at __assert+0x2b sys/kern/subr_prf.c:162
kqueue_terminate(ffff8000214ac000,fffffd80686ec220) at kqueue_terminate+0x152 sys/kern/kern_event.c:1268
kqueue_close(fffffd8069a12130,ffff80002123c7e0) at kqueue_close+0x40 sys/kern/kern_event.c:1286
fdrop(fffffd8069a12130,ffff80002123c7e0) at fdrop+0xc2 sys/kern/kern_descrip.c:1279
closef(fffffd8069a12130,ffff80002123c7e0) at closef+0x11c sys/kern/kern_descrip.c:1263
finishdup(ffff80002123c7e0,fffffd8069a122f8,4,3,ffff8000222dfb40,2) at finishdup+0x321 sys/kern/kern_descrip.c:691
dodup3(ffff80002123c7e0,4,3,0,ffff8000222dfb40) at dodup3+0x5cf sys/kern/kern_descrip.c:397
syscall(ffff8000222dfbc0) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline]
syscall(ffff8000222dfbc0) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0xff030cab130, count: 4
https://www.openbsd.org/ddb.html describes the minimum info required in bug
reports.  Insufficient info makes it difficult to find and fix bugs.
ddb{0}> 
ddb{0}> set $lines = 0
ddb{0}> set $maxwidth = 0
ddb{0}> show panic
kernel diagnostic assertion "TAILQ_EMPTY(&kq->kq_head)" failed: file "/syzkaller/managers/multicore/kernel/sys/kern/kern_event.c", line 1268
ddb{0}> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic(ffffffff823c3c11) at panic+0x15e sys/kern/subr_prf.c:218
__assert(ffffffff8242d86c,ffffffff82425328,4f4,ffffffff823ad335) at __assert+0x2b sys/kern/subr_prf.c:162
kqueue_terminate(ffff8000214ac000,fffffd80686ec220) at kqueue_terminate+0x152 sys/kern/kern_event.c:1268
kqueue_close(fffffd8069a12130,ffff80002123c7e0) at kqueue_close+0x40 sys/kern/kern_event.c:1286
fdrop(fffffd8069a12130,ffff80002123c7e0) at fdrop+0xc2 sys/kern/kern_descrip.c:1279
closef(fffffd8069a12130,ffff80002123c7e0) at closef+0x11c sys/kern/kern_descrip.c:1263
finishdup(ffff80002123c7e0,fffffd8069a122f8,4,3,ffff8000222dfb40,2) at finishdup+0x321 sys/kern/kern_descrip.c:691
dodup3(ffff80002123c7e0,4,3,0,ffff8000222dfb40) at dodup3+0x5cf sys/kern/kern_descrip.c:397
syscall(ffff8000222dfbc0) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline]
syscall(ffff8000222dfbc0) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0xff030cab130, count: -11
ddb{0}> show registers
rdi                                0
rsi                              0x1
rbp               0xffff8000222df760
rbx               0xffff8000222df770
rdx                             0x8b
rcx                              0x2
rax                              0x1
r8                0xffffffff821c43c5    kprintf+0x145
r9                               0x1
r10               0x2b1eb14d2e853785
r11               0x109c9fc891b5566b
r12                     0x3000000008
r13               0xffff8000222df810
r14                            0x100
r15                              0x1
rip               0xffffffff81df8258    db_enter+0x18
cs                               0x8
rflags                         0x246
rsp               0xffff8000222df750
ss                              0x10
db_enter+0x18:  addq    $0x8,%rsp
ddb{0}> show proc
PROC (syz-executor.0) pid=483275 stat=onproc
    flags process=0 proc=4000000<THREAD>
    pri=65, usrpri=65, nice=20
    forw=0xffffffffffffffff, list=0xffff80002123cfc0,0xffffffff828cc870
    process=0xffff800021235960 user=0xffff8000222da000, vmspace=0xfffffd80084968a0
    estcpu=15, cpticks=2, pctcpu=0.0
    user=0, sys=2, intr=0
ddb{0}> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
 29128  158928  47874      0  2           0                syz-executor.0
 29128   73032  47874      0  3   0x4000080  kqread        syz-executor.0
*29128  483275  47874      0  7   0x4000000                syz-executor.0
 62957  174656  24241      0  7       0x482                syz-executor.1
 47874   72719  24241      0  2         0x2                syz-executor.0
 24241   29677  86784      0  3        0x82  thrsleep      syz-fuzzer
 24241  212995  86784      0  3   0x4000082  thrsleep      syz-fuzzer
 24241  275826  86784      0  3   0x4000082  thrsleep      syz-fuzzer
 24241   60661  86784      0  3   0x4000082  kqread        syz-fuzzer
 24241  367464  86784      0  3   0x4000082  thrsleep      syz-fuzzer
 24241  105237  86784      0  3   0x4000082  thrsleep      syz-fuzzer
 24241  176077  86784      0  3   0x4000082  thrsleep      syz-fuzzer
 24241  251763  86784      0  3   0x4000082  thrsleep      syz-fuzzer
 86784    8880  42810      0  3    0x10008a  sigsusp       ksh
 42810  418943  42095      0  3        0x92  select        sshd
 53128   95631      1      0  3    0x100083  ttyin         getty
 42095  323626      1      0  3        0x80  select        sshd
 42605  227811  15979     74  3    0x100092  bpf           pflogd
 15979  295403      1      0  3        0x80  netio         pflogd
 26789  111695  50244     73  3    0x100090  kqread        syslogd
 50244    1796      1      0  3    0x100082  netio         syslogd
 47110  346746      1     77  3    0x100090  poll          dhclient
 51936   62735      1      0  3        0x80  poll          dhclient
 86468  203016      0      0  3     0x14200  bored         smr
  6753  412620      0      0  2     0x14200                zerothread
 83659  346568      0      0  3     0x14200  aiodoned      aiodoned
 46730  323586      0      0  3     0x14200  syncer        update
 25715  520712      0      0  3     0x14200  cleaner       cleaner
 34779    9088      0      0  3     0x14200  reaper        reaper
 85014   61930      0      0  3     0x14200  pgdaemon      pagedaemon
 81558  314126      0      0  3     0x14200  bored         crynlk
 38693  175608      0      0  3     0x14200  bored         crypto
 54336  125190      0      0  3     0x14200  bored         viomb
 13677  360890      0      0  3  0x40014200  acpi0         acpi0
 50155  289024      0      0  3  0x40014200                idle1
 58589  417037      0      0  3     0x14200  bored         softnet
 68316  241999      0      0  3     0x14200  bored         systqmp
 18871  326611      0      0  3     0x14200  bored         systq
 59609  359580      0      0  2  0x40014200                softclock
 45042  464869      0      0  3  0x40014200                idle0
     1  112848      0      0  3        0x82  wait          init
     0       0     -1      0  3     0x10200  scheduler     swapper
ddb{0}> show all locks
Process 29128 (syz-executor.0) thread 0xffff80002123c7e0 (483275)
exclusive kernel_lock &kernel_lock r = 0 (0xffffffff828cca98)
#0  witness_lock+0x4b0 stacktrace_save sys/sys/stacktrace.h:36 [inline]
#0  witness_lock+0x4b0 sys/kern/subr_witness.c:1176
#1  kqueue_close+0x2d sys/kern/kern_event.c:1284
#2  fdrop+0xc2 sys/kern/kern_descrip.c:1279
#3  closef+0x11c sys/kern/kern_descrip.c:1263
#4  finishdup+0x321 sys/kern/kern_descrip.c:691
#5  dodup3+0x5cf sys/kern/kern_descrip.c:397
#6  syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline]
#6  syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590
#7  Xsyscall+0x128
ddb{0}> show malloc
           Type InUse  MemUse  HighUse   Limit  Requests Type Lim
         devbuf  9490   6441K    6446K  78643K     26441        0
            pcb    13      8K       8K  78643K       451        0
         rtable   111      3K       3K  78643K       205        0
         ifaddr    44     10K      10K  78643K        45        0
         sysctl     2      0K       0K  78643K         2        0
       counters    44     34K      34K  78643K        44        0
       ioctlops     0      0K       4K  78643K      3005        0
            iov     0      0K      16K  78643K       945        0
          mount     1      1K       1K  78643K         1        0
         vnodes  1222     77K      77K  78643K     10934        0
      UFS quota     1     32K      32K  78643K         1        0
      UFS mount     5     36K      36K  78643K         5        0
            shm     2      1K       5K  78643K       168        0
         VM map     2      1K       1K  78643K         2        0
            sem    12      0K       0K  78643K       330        0
        dirhash    12      2K       2K  78643K        12        0
           ACPI  1697    195K     286K  78643K     12598        0
      file desc     5     13K      25K  78643K     53845        0
           proc    60     63K      95K  78643K       448        0
        subproc    32      2K       2K  78643K        34        0
    NFS srvsock     1      0K       0K  78643K         1        0
     NFS daemon     1     16K      16K  78643K         1        0
       in_multi    33      2K       2K  78643K        33        0
    ether_multi     1      0K       0K  78643K         1        0
    ISOFS mount     1     32K      32K  78643K         1        0
  MSDOSFS mount     1     16K      16K  78643K         1        0
           ttys    55    254K     254K  78643K        55        0
           exec     0      0K       2K  78643K       358        0
        pagedep     1      8K       8K  78643K         1        0
       inodedep     1     32K      32K  78643K         1        0
         newblk     1      0K       0K  78643K         1        0
        VM swap     7     26K      26K  78643K         7        0
       UVM amap   185     26K      27K  78643K    124331        0
       UVM aobj   131      4K       4K  78643K       267        0
        memdesc     1      4K       4K  78643K         1        0
    crypto data     1      1K       1K  78643K         1        0
            NDP     6      0K       0K  78643K        10        0
           temp   106   3981K    4047K  78643K    122538        0
         kqueue     7      8K      15K  78643K      4691        0
      SYN cache     2     16K      16K  78643K         2        0
ddb{0}> show all pools
Name      Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle
arp         64        6    0        0     1     0     1     1     0     8    0
plcache    128       20    0        0     1     0     1     1     0     8    0
rtpcb      120       19    0       17     1     0     1     1     0     8    0
rtentry    112       48    0        1     2     0     2     2     0     8    0
unpcb      120    16078    0    16068     1     0     1     1     0     8    0
syncache   296        4    0        4     1     1     0     1     0     8    0
tcpcb      736      400    0      396    14    13     1     6     0     8    0
inpcb      304     4936    0     4929     1     0     1     1     0     8    0
nd6         48        9    0        0     1     0     1     1     0     8    0
kcovpl      48        2    0        0     1     0     1     1     0     8    0
pffrag     232        8    0        8     4     3     1     1     0   482    1
pffrnode    88        7    0        7     4     3     1     1     0     8    1
pffrent     40      143    0      143     4     3     1     1     0     8    1
pfosfp      40     1428    0     1005     5     0     5     5     0     8    0
pfosfpen   112     1428    0      714    21     0    21    21     0     8    0
pfstitem    24       72    0       70     1     0     1     1     0     8    0
pfstkey    112       72    0       70     2     1     1     2     0     8    0
pfstate    328       72    0       70     5     4     1     4     0     8    0
pfrule     1360      21    0       16     2     1     1     2     0     8    0
art_heap8  4096       1    0        0     1     0     1     1     0     8    0
art_heap4  256      193    0        0    13     0    13    13     0     8    0
art_table   32      194    0        0     2     0     2     2     0     8    0
art_node    16       47    0        4     1     0     1     1     0     8    0
semapl     112      328    0      318     1     0     1     1     0     8    0
shmpl      112      264    0      136     4     0     4     4     0     8    0
dirhash    1024      17    0        0     3     0     3     3     0     8    0
dino2pl    256    60661    0    59260    88     0    88    88     0     8    0
ffsino     272    60661    0    59260    94     0    94    94     0     8    0
nchpl      144   137840    0   136233    60     0    60    60     0     8    0
uvmvnodes   72     5926    0        0   108     0   108   108     0     8    0
vnodes     224     5926    0        0   349     0   349   349     0     8    0
namei      1024  370721    0   370721     1     0     1     1     0     8    1
percpumem   16       33    0        0     1     0     1     1     0     8    0
scxspl     216   345652    0   345652     9     8     1     8     0     8    1
plimitpl   152      181    0      173     1     0     1     1     0     8    0
sigapl     424    54061    0    54029     4     0     4     4     0     8    0
futexpl     56   235236    0   235236     3     2     1     1     0     8    1
knotepl    112     4654    0     4634     1     0     1     1     0     8    0
kqueuepl   168     6801    0     6716     6     2     4     4     0     8    0
pipepl     336     4427    0     4416    60    59     1     2     0     8    0
fdescpl    496    54045    0    54029     3     0     3     3     0     8    0
filepl     152   180810    0   180706    11     6     5     5     0     8    0
lockfpl    104     5184    0     5183     1     0     1     1     0     8    0
lockfspl    48     2142    0     2141     1     0     1     1     0     8    0
sessionpl  144       18    0        7     1     0     1     1     0     8    0
pgrppl      48      236    0      225     1     0     1     1     0     8    0
ucredpl     96    19810    0    19801     1     0     1     1     0     8    0
zombiepl   144    54029    0    54028     1     0     1     1     0     8    0
processpl  1080   54061    0    54028     3     0     3     3     0     8    0
procpl     672   123677    0   123635     8     4     4     5     0     8    0
sockpl     432    21059    0    21040    18    15     3     4     0     8    0
mcl64k     65536     35    0        0     4     1     3     3     0     8    0
mcl16k     16384     30    0        0     3     1     2     3     0     8    0
mcl12k     12288     72    0        0     3     1     2     2     0     8    0
mcl9k      9216      32    0        0     2     0     2     2     0     8    0
mcl8k      8192      27    0        0     3     0     3     3     0     8    0
mcl4k      4096      25    0        0     4     1     3     3     0     8    0
mcl2k2     2112      26    0        0     2     0     2     2     0     8    0
mcl2k      2048     178    0        0    13     1    12    12     0     8    0
mtagpl      96        1    0        0     1     0     1     1     0     8    0
mbufpl     256     1543    0        0    18     3    15    18     0     8    0
bufpl      280    57692    0    51445   447     0   447   447     0     8    0
anonpl      24  3382145    0  3376960    63    27    36    59     0   186    0
amapchunkpl 152  194273    0   194099    16     8     8     8     0   158    0
amappl16   200   165683    0   165504    32    21    11    23     0     8    0
amappl15   192        2    0        0     1     0     1     1     0     8    0
amappl14   184    26692    0    26686     1     0     1     1     0     8    0
amappl13   176       27    0       24     1     0     1     1     0     8    0
amappl12   168        5    0        3     1     0     1     1     0     8    0
amappl11   160    27214    0    27196     1     0     1     1     0     8    0
amappl10   152       15    0        9     1     0     1     1     0     8    0
amappl9    144      283    0      283     1     1     0     1     0     8    0
amappl8    136     1264    0     1128     5     0     5     5     0     8    0
amappl7    128      243    0      235     1     0     1     1     0     8    0
amappl6    120       69    0       57     1     0     1     1     0     8    0
amappl5    112    55640    0    55622     1     0     1     1     0     8    0
amappl4    104    27671    0    27645     1     0     1     1     0     8    0
amappl3     96     3359    0     3351     1     0     1     1     0     8    0
amappl2     88   459003    0   458931     3     1     2     3     0     8    0
amappl1     80  1497475    0  1497001    27    15    12    21     0     8    0
amappl      88   123914    0   123862     2     0     2     2     0    92    0
dma4096    4096       1    0        1     1     1     0     1     0     8    0
dma1024    1024       1    0        0     1     0     1     1     0     8    0
dma256     256        6    0        6     1     1     0     1     0     8    0
dma128     128      253    0      253     1     1     0     1     0     8    0
dma64       64        6    0        6     1     1     0     1     0     8    0
dma32       32        7    0        7     1     1     0     1     0     8    0
dma16       16       18    0       17     1     0     1     1     0     8    0
aobjpl      64      266    0      136     3     0     3     3     0     8    0
uaddrrnd    24    54045    0    54029     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24    54045    0    54029     1     0     1     1     0     8    0
vmmpekpl   168   310292    0   310267     2     0     2     2     0     8    0
vmmpepl    168  6664272    0  6662770   190   118    72    83     0   357    1
vmsppl     368    54044    0    54029     2     0     2     2     0     8    0
rwobjpl     56  1381814    0  1380843    50    35    15    19     0     8    0
pdppl      4096  108097    0   108058    57    16    41    45     0     8    2
pvpl        32 10536487    0 10528244   232   158    74   117     0   265    0
pmappl     232    54044    0    54029     2     1     1     2     0     8    0
extentpl    40       58    0       40     1     0     1     1     0     8    0
phpool     112      383    0       98     9     0     9     9     0     8    0
ddb{0}> machine ddbcpu 0
Invalid cpu 0
ddb{0}> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic(ffffffff823c3c11) at panic+0x15e sys/kern/subr_prf.c:218
__assert(ffffffff8242d86c,ffffffff82425328,4f4,ffffffff823ad335) at __assert+0x2b sys/kern/subr_prf.c:162
kqueue_terminate(ffff8000214ac000,fffffd80686ec220) at kqueue_terminate+0x152 sys/kern/kern_event.c:1268
kqueue_close(fffffd8069a12130,ffff80002123c7e0) at kqueue_close+0x40 sys/kern/kern_event.c:1286
fdrop(fffffd8069a12130,ffff80002123c7e0) at fdrop+0xc2 sys/kern/kern_descrip.c:1279
closef(fffffd8069a12130,ffff80002123c7e0) at closef+0x11c sys/kern/kern_descrip.c:1263
finishdup(ffff80002123c7e0,fffffd8069a122f8,4,3,ffff8000222dfb40,2) at finishdup+0x321 sys/kern/kern_descrip.c:691
dodup3(ffff80002123c7e0,4,3,0,ffff8000222dfb40) at dodup3+0x5cf sys/kern/kern_descrip.c:397
syscall(ffff8000222dfbc0) at syscall+0x4a1 mi_syscall sys/sys/syscall_mi.h:102 [inline]
syscall(ffff8000222dfbc0) at syscall+0x4a1 sys/arch/amd64/amd64/trap.c:590
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0xff030cab130, count: -11
ddb{0}> machine ddbcpu 1