panic: kernel diagnostic assertion "__mp_lock_held(&sched_lock, curcpu()) == 0" failed: file "/syzkaller/managers/setuid/kernel/sys/kern/kern_lock.c", line 63 Stopped at db_enter+0x18: addq $0x8,%rsp TID PID UID PRFLAGS PFLAGS CPU COMMAND * 83401 2099 32767 0x1810 0x4080080 0 syz-executor.2 81405 28906 32767 0x10 0 1 syz-executor.0 db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff825a1086) at panic+0x177 sys/kern/subr_prf.c:202 __assert(ffffffff82613da6,ffffffff82617104,3f,ffffffff8264968f) at __assert+0x25 sys/kern/subr_prf.c:161 _kernel_lock() at _kernel_lock+0xb2 sys/kern/kern_lock.c:63 single_thread_check_locked(ffff8000296067f0,1,c) at single_thread_check_locked+0x1f6 sys/kern/kern_sig.c:2037 single_thread_check(ffff8000296067f0,1) at single_thread_check+0x4b sys/kern/kern_sig.c:2057 sleep_finish(ffff80002b861900,1) at sleep_finish+0x75 sleep_signal_check sys/kern/kern_synch.c:464 [inline] sleep_finish(ffff80002b861900,1) at sleep_finish+0x75 sys/kern/kern_synch.c:400 rwsleep(ffff8000296067f0,ffffffff8296a1a0,120,ffffffff82595f34,0) at rwsleep+0xd5 sys/kern/kern_synch.c:314 futex_wait(a2600d68480,2,0,2) at futex_wait+0x13c sys/kern/sys_futex.c:260 sys_futex(ffff8000296067f0,ffff80002b861a90,ffff80002b861af0) at sys_futex+0xf8 sys/kern/sys_futex.c:111 syscall(ffff80002b861b60) at syscall+0x484 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002b861b60) at syscall+0x484 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xa25b95e24d0, count: 3 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 *cpu0: kernel diagnostic assertion "__mp_lock_held(&sched_lock, curcpu()) == 0" failed: file "/syzkaller/managers/setuid/kernel/sys/kern/kern_lock.c", line 63 ddb{0}> trace db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:437 panic(ffffffff825a1086) at panic+0x177 sys/kern/subr_prf.c:202 __assert(ffffffff82613da6,ffffffff82617104,3f,ffffffff8264968f) at __assert+0x25 sys/kern/subr_prf.c:161 _kernel_lock() at _kernel_lock+0xb2 sys/kern/kern_lock.c:63 single_thread_check_locked(ffff8000296067f0,1,c) at single_thread_check_locked+0x1f6 sys/kern/kern_sig.c:2037 single_thread_check(ffff8000296067f0,1) at single_thread_check+0x4b sys/kern/kern_sig.c:2057 sleep_finish(ffff80002b861900,1) at sleep_finish+0x75 sleep_signal_check sys/kern/kern_synch.c:464 [inline] sleep_finish(ffff80002b861900,1) at sleep_finish+0x75 sys/kern/kern_synch.c:400 rwsleep(ffff8000296067f0,ffffffff8296a1a0,120,ffffffff82595f34,0) at rwsleep+0xd5 sys/kern/kern_synch.c:314 futex_wait(a2600d68480,2,0,2) at futex_wait+0x13c sys/kern/sys_futex.c:260 sys_futex(ffff8000296067f0,ffff80002b861a90,ffff80002b861af0) at sys_futex+0xf8 sys/kern/sys_futex.c:111 syscall(ffff80002b861b60) at syscall+0x484 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002b861b60) at syscall+0x484 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xa25b95e24d0, count: -12 ddb{0}> show registers rdi 0 rsi 0x1 rbp 0xffff80002b8616c0 rbx 0xffffffff82989bb7 cpu_info_full_primary+0x2bb7 rdx 0xffff800000bd0400 rcx 0 rax 0xffff8000296067f0 r8 0x101010101010101 r9 0x8080808080808080 r10 0x860bcbc2583b677c r11 0xe265ede0e7c8953e r12 0xffffffff829899b8 cpu_info_full_primary+0x29b8 r13 0 r14 0 r15 0x1 rip 0xffffffff813e2898 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff80002b8616b0 ss 0x10 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.2) pid=83401 stat=onproc flags process=1810 proc=4080080 pri=82, usrpri=82, nice=20 forw=0xffffffffffffffff, list=0xffff8000fffee008,0xffffffff82adab00 process=0xffff8000295eadd0 user=0xffff80002b85c000, vmspace=0xfffffd806c7dc010 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 37671 208131 55657 32767 2 0x10 syz-executor.7 2099 207776 49937 32767 2 0x3810 syz-executor.2 * 2099 83401 49937 32767 7 0x4081890 syz-executor.2 87175 367737 26277 32767 2 0x10 syz-executor.3 87175 374855 26277 32767 3 0x4000090 fsleep syz-executor.3 87175 392130 26277 32767 2 0x4000010 syz-executor.3 28906 81405 15221 32767 7 0x10 syz-executor.0 28906 271347 15221 32767 3 0x4000090 netio syz-executor.0 28906 182343 15221 32767 2 0x4000010 syz-executor.0 98330 58866 95422 32767 3 0x90 nanoslp syz-executor.1 98330 819 95422 32767 3 0x4000090 fsleep syz-executor.1 98330 242876 95422 32767 3 0x4000090 fsleep syz-executor.1 3411 60085 56527 32767 2 0x10 syz-executor.6 3411 129496 56527 32767 3 0x4000090 fsleep syz-executor.6 45268 31029 40520 32767 2 0x10 syz-executor.4 40520 332274 44049 0 3 0x82 wait syz-executor.4 56527 224413 21974 32767 3 0x90 nanoslp syz-executor.6 21974 78941 44049 0 3 0x82 wait syz-executor.6 95422 511926 32040 32767 3 0x90 nanoslp syz-executor.1 32040 287516 44049 0 3 0x82 wait syz-executor.1 55657 84396 18370 32767 2 0x10 syz-executor.7 18370 207266 44049 0 3 0x82 wait syz-executor.7 99934 164403 0 0 3 0x14200 bored sosplice 93272 444534 27085 32767 2 0x10 syz-executor.5 27085 219057 44049 0 3 0x82 wait syz-executor.5 26277 270067 95670 32767 3 0x90 nanoslp syz-executor.3 49937 299365 39959 32767 3 0x90 nanoslp syz-executor.2 95670 222465 44049 0 3 0x82 wait syz-executor.3 15221 49121 17334 32767 3 0x90 nanoslp syz-executor.0 39959 522523 44049 0 3 0x82 wait syz-executor.2 17334 78060 44049 0 3 0x82 wait syz-executor.0 44049 113235 9274 0 3 0x82 thrsleep syz-fuzzer 44049 112693 9274 0 3 0x4000082 nanoslp syz-fuzzer 44049 204967 9274 0 3 0x4000082 thrsleep syz-fuzzer 44049 76852 9274 0 3 0x4000082 kqread syz-fuzzer 44049 129173 9274 0 3 0x4000082 thrsleep syz-fuzzer 44049 380033 9274 0 3 0x4000082 thrsleep syz-fuzzer 44049 453454 9274 0 3 0x4000082 thrsleep syz-fuzzer 44049 78986 9274 0 3 0x4000082 thrsleep syz-fuzzer 9274 427332 32234 0 3 0x10008a sigsusp ksh 32234 257283 85530 0 3 0x9a kqread sshd 83854 371049 1 0 3 0x100083 ttyin getty 85530 118329 1 0 3 0x88 kqread sshd 63679 215911 84133 73 3 0x1100090 kqread syslogd 84133 464355 1 0 3 0x100082 netio syslogd 31213 286020 1 0 3 0x100080 kqread resolvd 18378 28559 28828 77 3 0x100092 kqread dhcpleased 76937 338482 28828 77 3 0x100092 kqread dhcpleased 28828 153666 1 0 3 0x80 kqread dhcpleased 91006 70844 0 0 3 0x14200 bored smr 25575 348008 0 0 2 0x14200 zerothread 81087 141226 0 0 3 0x14200 aiodoned aiodoned 97954 76864 0 0 3 0x14200 syncer update 79925 508365 0 0 3 0x14200 cleaner cleaner 2793 76555 0 0 3 0x14200 reaper reaper 47174 422780 0 0 3 0x14200 pgdaemon pagedaemon 38408 46365 0 0 3 0x14200 bored viomb 64835 268116 0 0 3 0x40014200 acpi0 acpi0 10287 478014 0 0 3 0x40014200 idle1 39495 461282 0 0 3 0x14200 bored softnet 6911 456499 0 0 3 0x14200 bored softnet 86340 61616 0 0 3 0x14200 bored softnet 33924 440000 0 0 3 0x14200 bored softnet 50893 140983 0 0 3 0x14200 bored systqmp 34777 202527 0 0 3 0x14200 bored systq 45733 155456 0 0 3 0x40014200 bored softclock 80620 53926 0 0 3 0x40014200 idle0 1 131907 0 0 3 0x82 wait init 0 0 -1 0 3 0x10200 scheduler swapper ddb{0}> show all locks CPU 0: exclusive sched_lock &sched_lock r = 0 (0xffffffff82a153e0) #0 witness_lock+0x44d #1 __mp_acquire_count+0x48 sys/kern/kern_lock.c:227 #2 mi_switch+0x3d4 sys/kern/sched_bsd.c:419 #3 single_thread_check_locked+0x17f sys/kern/kern_sig.c:2045 #4 single_thread_check+0x4b sys/kern/kern_sig.c:2057 #5 sleep_finish+0x75 sleep_signal_check sys/kern/kern_synch.c:464 [inline] #5 sleep_finish+0x75 sys/kern/kern_synch.c:400 #6 rwsleep+0xd5 sys/kern/kern_synch.c:314 #7 futex_wait+0x13c sys/kern/sys_futex.c:260 #8 sys_futex+0xf8 sys/kern/sys_futex.c:111 #9 syscall+0x484 mi_syscall sys/sys/syscall_mi.h:102 [inline] #9 syscall+0x484 sys/arch/amd64/amd64/trap.c:585 #10 Xsyscall+0x128 ddb{0}> show malloc Type InUse MemUse HighUse Limit Requests Type Lim devbuf 10199 6411K 6420K 78643K 11320 0 pcb 13 10K 12K 78643K 15 0 rtable 240 6K 7K 78643K 915 0 ifaddr 81 17K 17K 78643K 153 0 sysctl 3 1K 1K 78643K 3 0 counters 56 35K 35K 78643K 76 0 ioctlops 0 0K 2K 78643K 75 0 iov 0 0K 16K 78643K 1347 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 5 0 vnodes 1270 79K 79K 78643K 3181 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 2 1K 5K 78643K 69 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 0K 78643K 1303 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 24 89K 117K 78643K 5836 0 sigio 0 0K 0K 78643K 103 0 proc 59 91K 103K 78643K 1158 0 subproc 104 6K 6K 78643K 234 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 776 0 in_multi 99 6K 7K 78643K 272 0 ether_multi 1 0K 0K 78643K 21 0 mrt 2 0K 0K 78643K 2 0 ISOFS mount 1 32K 32K 78643K 1 0 MSDOSFS mount 1 16K 16K 78643K 1 0 ttys 193 864K 864K 78643K 193 0 exec 0 0K 2K 78643K 1612 0 tdb 3 0K 0K 78643K 3 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 310 88K 98K 78643K 37581 0 UVM aobj 131 5K 5K 78643K 148 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 266 0 NDP 11 0K 2K 78643K 57 0 temp 124 4722K 4850K 78643K 17839 0 kqueue 13 18K 24K 78643K 539 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 plcache 128 22 0 0 1 0 1 1 0 8 0 rtpcb 120 644 0 641 12 11 1 3 0 8 0 rtentry 112 230 0 117 4 0 4 4 0 8 0 unpcb 136 4402 0 4387 42 41 1 9 0 8 0 syncache 296 53 0 53 13 12 1 1 0 8 1 tcpqe 32 955 0 955 9 9 0 1 0 8 0 tcpcb 736 2987 0 2983 83 81 2 17 0 8 1 arp 120 39 0 21 1 0 1 1 0 8 0 inpcb 320 5644 0 5637 67 65 2 10 0 8 1 nd6 48 62 0 35 1 0 1 1 0 8 0 kcovpl 48 18 0 10 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 958 0 486 32 2 30 30 0 8 0 art_table 32 959 0 486 4 0 4 4 0 8 0 art_node 16 229 0 126 1 0 1 1 0 8 0 sysvmsgpl 40 17 0 10 1 0 1 1 0 8 0 semapl 112 1301 0 1291 1 0 1 1 0 8 0 shmpl 112 145 0 17 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 10102 0 8654 91 0 91 91 0 8 0 ffsino 272 10102 0 8654 97 0 97 97 0 8 0 nchpl 144 18054 0 16413 63 0 63 63 0 8 0 uvmvnodes 80 5926 0 0 121 0 121 121 0 8 0 vnodes 224 5926 0 0 349 0 349 349 0 8 0 namei 1024 67755 0 67755 2 1 1 2 0 8 1 percpumem 16 50 0 10 1 0 1 1 0 8 0 kstatmem 264 42 0 20 2 0 2 2 0 8 0 scxspl 216 48900 0 48900 21 20 1 8 0 8 1 plimitpl 152 1290 0 1267 5 3 2 2 0 8 1 sigapl 424 6092 0 6038 7 0 7 7 0 8 0 futexpl 64 57339 0 57334 1 0 1 1 0 8 0 knotepl 120 569 0 0 14 0 14 14 0 8 0 kqueuepl 224 1818 0 1809 35 34 1 9 0 8 0 pipepl 336 1318 0 1290 35 32 3 8 0 8 0 fdescpl 496 6074 0 6039 6 1 5 6 0 8 0 filepl 152 48141 0 47901 82 69 13 19 0 8 3 lockfpl 104 769 0 767 2 1 1 2 0 8 0 lockfspl 48 207 0 205 1 0 1 1 0 8 0 sessionpl 144 33 0 17 1 0 1 1 0 8 0 pgrppl 48 85 0 69 1 0 1 1 0 8 0 ucredpl 104 13504 0 13486 1 0 1 1 0 8 0 zombiepl 144 6039 0 6038 1 0 1 1 0 8 0 processpl 1064 6092 0 6038 4 0 4 4 0 8 0 procpl 672 17736 0 17667 18 10 8 9 0 8 1 sosppl 168 86 0 86 11 11 0 1 0 8 0 sockpl 480 10804 0 10779 241 237 4 34 0 8 0 mcl64k 65536 23 0 0 3 1 2 3 0 8 0 mcl16k 16384 17 0 0 3 0 3 3 0 8 0 mcl12k 12288 24 0 0 2 0 2 2 0 8 0 mcl9k 9216 19 0 0 2 0 2 2 0 8 0 mcl8k 8192 23 0 0 3 0 3 3 0 8 0 mcl4k 4096 19 0 0 3 0 3 3 0 8 0 mcl2k2 2112 5 0 0 1 0 1 1 0 8 0 mcl2k 2048 261 0 0 25 0 25 25 0 8 0 mtagpl 96 3 0 0 1 0 1 1 0 8 0 mbufpl 256 642 0 0 29 0 29 29 0 8 0 bufpl 288 13040 0 6709 453 0 453 453 0 8 0 anonpl 24 1230795 0 1218179 183 94 89 110 0 186 0 amapchunkpl 152 110413 0 109815 83 56 27 38 0 158 2 amappl16 200 18432 0 18051 93 71 22 34 0 8 0 amappl15 192 639 0 637 3 2 1 1 0 8 0 amappl14 184 1910 0 1904 1 0 1 1 0 8 0 amappl13 176 588 0 586 1 0 1 1 0 8 0 amappl12 168 576 0 572 1 0 1 1 0 8 0 amappl11 160 752 0 738 1 0 1 1 0 8 0 amappl10 152 328 0 320 1 0 1 1 0 8 0 amappl9 144 2039 0 2028 1 0 1 1 0 8 0 amappl8 136 944 0 842 5 1 4 4 0 8 0 amappl7 128 185 0 170 1 0 1 1 0 8 0 amappl6 120 1853 0 1825 2 1 1 2 0 8 0 amappl5 112 4617 0 4592 1 0 1 1 0 8 0 amappl4 104 2767 0 2739 2 1 1 2 0 8 0 amappl3 96 19049 0 18994 2 0 2 2 0 8 0 amappl2 88 7092 0 7017 3 1 2 3 0 8 0 amappl1 80 148213 0 147515 22 6 16 19 0 8 0 amappl 88 36730 0 36547 5 0 5 5 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 72 147 0 17 3 0 3 3 0 8 0 uaddrrnd 24 6074 0 6039 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 6074 0 6039 1 0 1 1 0 8 0 vmmpekpl 168 50165 0 50107 3 0 3 3 0 8 0 vmmpepl 168 605065 0 602308 199 67 132 139 0 357 6 vmsppl 368 6073 0 6039 4 0 4 4 0 8 0 rwobjpl 56 156828 0 149364 114 5 109 109 0 8 0 pdppl 4096 12155 0 12078 262 181 81 91 0 8 4 pvpl 32 2375517 0 2357644 333 178 155 241 0 265 0 pmappl 248 6073 0 6039 4 1 3 3 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 1132 0 300 25 0 25 25 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:437 panic(ffffffff825a1086) at panic+0x177 sys/kern/subr_prf.c:202 __assert(ffffffff82613da6,ffffffff82617104,3f,ffffffff8264968f) at __assert+0x25 sys/kern/subr_prf.c:161 _kernel_lock() at _kernel_lock+0xb2 sys/kern/kern_lock.c:63 single_thread_check_locked(ffff8000296067f0,1,c) at single_thread_check_locked+0x1f6 sys/kern/kern_sig.c:2037 single_thread_check(ffff8000296067f0,1) at single_thread_check+0x4b sys/kern/kern_sig.c:2057 sleep_finish(ffff80002b861900,1) at sleep_finish+0x75 sleep_signal_check sys/kern/kern_synch.c:464 [inline] sleep_finish(ffff80002b861900,1) at sleep_finish+0x75 sys/kern/kern_synch.c:400 rwsleep(ffff8000296067f0,ffffffff8296a1a0,120,ffffffff82595f34,0) at rwsleep+0xd5 sys/kern/kern_synch.c:314 futex_wait(a2600d68480,2,0,2) at futex_wait+0x13c sys/kern/sys_futex.c:260 sys_futex(ffff8000296067f0,ffff80002b861a90,ffff80002b861af0) at sys_futex+0xf8 sys/kern/sys_futex.c:111 syscall(ffff80002b861b60) at syscall+0x484 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002b861b60) at syscall+0x484 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xa25b95e24d0, count: -12 ddb{0}> machine ddbcpu 1 Stopped at x86_ipi_db+0x1a: addq $0x8,%rsp x86_ipi_db(ffff800020de8ff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:393 x86_ipi_handler() at x86_ipi_handler+0xb7 sys/arch/amd64/amd64/ipi.c:106 Xresume_lapic_ipi() at Xresume_lapic_ipi+0x23 __mp_lock(ffffffff82a151d8) at __mp_lock+0x122 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff82a151d8) at __mp_lock+0x122 sys/kern/kern_lock.c:147 preempt() at preempt+0x36 sys/kern/sched_bsd.c:307 ast(ffff80002e4838e0) at ast+0x108 mi_ast sys/sys/syscall_mi.h:184 [inline] ast(ffff80002e4838e0) at ast+0x108 sys/arch/amd64/amd64/trap.c:508 intr_user_exit() at intr_user_exit+0x3c end of kernel end trace frame: 0x7f7ffffcfc90, count: 8 ddb{1}> trace x86_ipi_db(ffff800020de8ff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:393 x86_ipi_handler() at x86_ipi_handler+0xb7 sys/arch/amd64/amd64/ipi.c:106 Xresume_lapic_ipi() at Xresume_lapic_ipi+0x23 __mp_lock(ffffffff82a151d8) at __mp_lock+0x122 __mp_lock_spin sys/kern/kern_lock.c:116 [inline] __mp_lock(ffffffff82a151d8) at __mp_lock+0x122 sys/kern/kern_lock.c:147 preempt() at preempt+0x36 sys/kern/sched_bsd.c:307 ast(ffff80002e4838e0) at ast+0x108 mi_ast sys/sys/syscall_mi.h:184 [inline] ast(ffff80002e4838e0) at ast+0x108 sys/arch/amd64/amd64/trap.c:508 intr_user_exit() at intr_user_exit+0x3c end of kernel end trace frame: 0x7f7ffffcfc90, count: -7