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 *269341 76048 32767 0x1810 0x4080080 0 syz-executor.6 37885 75022 32767 0x10 0 1 syz-executor.5 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(ffff8000fffe6550,1,c) at single_thread_check_locked+0x1f6 sys/kern/kern_sig.c:2037 single_thread_check(ffff8000fffe6550,1) at single_thread_check+0x4b sys/kern/kern_sig.c:2057 sleep_finish(ffff80002618ca00,1) at sleep_finish+0x75 sleep_signal_check sys/kern/kern_synch.c:464 [inline] sleep_finish(ffff80002618ca00,1) at sleep_finish+0x75 sys/kern/kern_synch.c:400 rwsleep(ffff8000fffe6550,ffffffff8296a1a0,120,ffffffff82595f34,0) at rwsleep+0xd5 sys/kern/kern_synch.c:314 futex_wait(ce69beb8040,2,0,2) at futex_wait+0x13c sys/kern/sys_futex.c:260 sys_futex(ffff8000fffe6550,ffff80002618cb90,ffff80002618cbf0) at sys_futex+0xf8 sys/kern/sys_futex.c:111 syscall(ffff80002618cc60) at syscall+0x484 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002618cc60) at syscall+0x484 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xce685f31540, 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(ffff8000fffe6550,1,c) at single_thread_check_locked+0x1f6 sys/kern/kern_sig.c:2037 single_thread_check(ffff8000fffe6550,1) at single_thread_check+0x4b sys/kern/kern_sig.c:2057 sleep_finish(ffff80002618ca00,1) at sleep_finish+0x75 sleep_signal_check sys/kern/kern_synch.c:464 [inline] sleep_finish(ffff80002618ca00,1) at sleep_finish+0x75 sys/kern/kern_synch.c:400 rwsleep(ffff8000fffe6550,ffffffff8296a1a0,120,ffffffff82595f34,0) at rwsleep+0xd5 sys/kern/kern_synch.c:314 futex_wait(ce69beb8040,2,0,2) at futex_wait+0x13c sys/kern/sys_futex.c:260 sys_futex(ffff8000fffe6550,ffff80002618cb90,ffff80002618cbf0) at sys_futex+0xf8 sys/kern/sys_futex.c:111 syscall(ffff80002618cc60) at syscall+0x484 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002618cc60) at syscall+0x484 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xce685f31540, count: -12 ddb{0}> show registers rdi 0 rsi 0x1 rbp 0xffff80002618c7c0 rbx 0xffffffff82989bb7 cpu_info_full_primary+0x2bb7 rdx 0xffff800000bf0880 rcx 0 rax 0xffff8000fffe6550 r8 0x101010101010101 r9 0x8080808080808080 r10 0x49fa4a36d32ddae4 r11 0x810bb6cde30cc50c r12 0xffffffff829899b8 cpu_info_full_primary+0x29b8 r13 0 r14 0 r15 0x1 rip 0xffffffff813e2898 db_enter+0x18 cs 0x8 rflags 0x246 rsp 0xffff80002618c7b0 ss 0 db_enter+0x18: addq $0x8,%rsp ddb{0}> show proc PROC (syz-executor.6) pid=269341 stat=onproc flags process=1810 proc=4080080 pri=76, usrpri=76, nice=20 forw=0xffffffffffffffff, list=0xffff8000fffec548,0xffffffff82adab00 process=0xffff8000ffff14d8 user=0xffff800026187000, vmspace=0xfffffd806ef8b2e8 estcpu=36, cpticks=0, pctcpu=0.0 user=0, sys=0, intr=0 ddb{0}> ps PID TID PPID UID S FLAGS WAIT COMMAND 42847 493806 81325 32767 2 0x10 syz-executor.3 76048 198164 79935 32767 2 0x3810 syz-executor.6 *76048 269341 79935 32767 7 0x4081890 syz-executor.6 75022 37885 80213 32767 7 0x10 syz-executor.5 75022 115142 80213 32767 2 0x4000010 syz-executor.5 85983 259077 77943 32767 2 0x10 syz-executor.7 85983 241660 77943 32767 3 0x4000090 fsleep syz-executor.7 61575 360309 50741 32767 2 0x10 syz-executor.0 61575 277691 50741 32767 2 0x4000010 syz-executor.0 24534 292872 96326 32767 2 0x10 syz-executor.1 5096 242233 34923 32767 2 0x10 syz-executor.4 5096 242209 34923 32767 2 0x4000010 syz-executor.4 79935 24109 74905 32767 3 0x90 nanoslp syz-executor.6 74905 373990 31508 0 3 0x82 wait syz-executor.6 77943 170656 73227 32767 3 0x90 nanoslp syz-executor.7 73227 94234 31508 0 3 0x82 wait syz-executor.7 81325 335127 47968 32767 3 0x90 nanoslp syz-executor.3 47968 241457 31508 0 3 0x82 wait syz-executor.3 24227 427842 0 0 3 0x14200 bored sosplice 34923 254040 96610 32767 3 0x90 nanoslp syz-executor.4 80213 54114 61566 32767 3 0x90 nanoslp syz-executor.5 96610 11740 31508 0 3 0x82 wait syz-executor.4 61566 498690 31508 0 3 0x82 wait syz-executor.5 96326 394655 3683 32767 3 0x90 nanoslp syz-executor.1 43336 51587 46571 32767 3 0x90 nanoslp syz-executor.2 46571 121475 31508 0 3 0x82 wait syz-executor.2 50741 456814 6286 32767 3 0x90 nanoslp syz-executor.0 3683 104091 31508 0 3 0x82 wait syz-executor.1 6286 455747 31508 0 3 0x82 wait syz-executor.0 31508 503675 18410 0 3 0x82 thrsleep syz-fuzzer 31508 286706 18410 0 3 0x4000082 thrsleep syz-fuzzer 31508 144780 18410 0 3 0x4000082 thrsleep syz-fuzzer 31508 506491 18410 0 3 0x4000082 thrsleep syz-fuzzer 31508 463893 18410 0 3 0x4000082 kqread syz-fuzzer 31508 51798 18410 0 3 0x4000082 thrsleep syz-fuzzer 31508 434757 18410 0 3 0x4000082 thrsleep syz-fuzzer 31508 161208 18410 0 3 0x4000082 thrsleep syz-fuzzer 31508 388047 18410 0 3 0x4000082 thrsleep syz-fuzzer 18410 486090 7211 0 3 0x10008a sigsusp ksh 7211 352752 84722 0 3 0x9a kqread sshd 84876 246070 1 0 3 0x100083 ttyin getty 84722 396442 1 0 3 0x88 kqread sshd 58719 66115 84956 73 3 0x1100090 kqread syslogd 84956 168176 1 0 3 0x100082 netio syslogd 348 147103 1 0 3 0x100080 kqread resolvd 46801 375847 97178 77 3 0x100092 kqread dhcpleased 76968 247795 97178 77 3 0x100092 kqread dhcpleased 97178 421683 1 0 3 0x80 kqread dhcpleased 15894 423986 0 0 3 0x14200 bored smr 60853 381590 0 0 2 0x14200 zerothread 37056 371235 0 0 3 0x14200 aiodoned aiodoned 95879 31199 0 0 3 0x14200 syncer update 43052 64793 0 0 3 0x14200 cleaner cleaner 83362 252217 0 0 3 0x14200 reaper reaper 18186 91237 0 0 3 0x14200 pgdaemon pagedaemon 6082 293691 0 0 3 0x14200 bored viomb 6583 70354 0 0 3 0x40014200 acpi0 acpi0 26841 122762 0 0 3 0x40014200 idle1 15856 183823 0 0 3 0x14200 bored softnet 75841 90694 0 0 3 0x14200 bored softnet 14080 152697 0 0 3 0x14200 bored softnet 39545 120136 0 0 3 0x14200 bored softnet 13733 105079 0 0 3 0x14200 bored systqmp 30114 141889 0 0 3 0x14200 bored systq 12939 55481 0 0 3 0x40014200 bored softclock 98486 132722 0 0 3 0x40014200 idle0 1 433320 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 10216 6413K 6420K 78643K 11326 0 pcb 13 8K 8K 78643K 13 0 rtable 240 6K 7K 78643K 1041 0 ifaddr 81 17K 17K 78643K 125 0 sysctl 3 1K 1K 78643K 7 0 counters 56 35K 35K 78643K 68 0 ioctlops 0 0K 2K 78643K 52 0 iov 0 0K 28K 78643K 673 0 mount 1 1K 1K 78643K 1 0 log 0 0K 0K 78643K 4 0 vnodes 1271 79K 79K 78643K 2256 0 UFS quota 1 32K 32K 78643K 1 0 UFS mount 5 36K 36K 78643K 5 0 shm 3 5K 5K 78643K 67 0 VM map 2 1K 1K 78643K 2 0 sem 12 0K 0K 78643K 901 0 dirhash 12 2K 2K 78643K 12 0 ACPI 1697 195K 286K 78643K 12548 0 file desc 25 93K 121K 78643K 4055 0 sigio 0 0K 0K 78643K 58 0 proc 56 78K 103K 78643K 866 0 subproc 104 6K 6K 78643K 182 0 NFS srvsock 1 0K 0K 78643K 1 0 NFS daemon 1 16K 16K 78643K 1 0 ip_moptions 0 0K 0K 78643K 192 0 in_multi 99 6K 6K 78643K 202 0 ether_multi 1 0K 0K 78643K 20 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 295 1314K 1314K 78643K 295 0 exec 0 0K 2K 78643K 1188 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 281 86K 95K 78643K 26178 0 UVM aobj 131 4K 4K 78643K 145 0 memdesc 1 4K 4K 78643K 1 0 crypto data 1 1K 1K 78643K 1 0 ip6_options 0 0K 0K 78643K 115 0 NDP 13 0K 2K 78643K 45 0 temp 124 4722K 4845K 78643K 13033 0 kqueue 12 18K 28K 78643K 422 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 379 0 376 4 3 1 3 0 8 0 rtentry 112 185 0 72 4 0 4 4 0 8 0 unpcb 136 2704 0 2691 36 35 1 8 0 8 0 syncache 296 31 0 31 5 5 0 1 0 8 0 tcpqe 32 23 0 23 4 4 0 1 0 8 0 tcpcb 736 1443 0 1435 36 34 2 14 0 8 1 arp 120 32 0 12 1 0 1 1 0 8 0 ipq 40 2 0 0 1 0 1 1 0 8 0 ipqe 40 8 0 6 1 0 1 1 0 8 0 inpcb 320 3076 0 3060 43 41 2 13 0 8 0 ip6q 72 10 0 10 2 2 0 1 0 8 0 ip6af 40 30 0 30 2 2 0 1 0 8 0 nd6 48 48 0 23 1 0 1 1 0 8 0 kcovpl 48 14 0 6 1 0 1 1 0 8 0 art_heap8 4096 1 0 0 1 0 1 1 0 8 0 art_heap4 256 766 0 296 31 1 30 30 0 8 0 art_table 32 767 0 296 4 0 4 4 0 8 0 art_node 16 184 0 81 1 0 1 1 0 8 0 sysvmsgpl 40 17 0 12 1 0 1 1 0 8 0 semupl 112 3 0 3 1 1 0 1 0 8 0 semapl 112 899 0 889 1 0 1 1 0 8 0 shmpl 112 142 0 14 4 0 4 4 0 8 0 dirhash 1024 17 0 0 3 0 3 3 0 8 0 dino2pl 256 7383 0 5937 91 0 91 91 0 8 0 ffsino 272 7383 0 5937 97 0 97 97 0 8 0 nchpl 144 13064 0 11426 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 46499 0 46499 2 1 1 2 0 8 1 percpumem 16 46 0 6 1 0 1 1 0 8 0 kstatmem 264 34 0 12 2 0 2 2 0 8 0 scxspl 216 35921 0 35921 20 17 3 8 0 8 3 plimitpl 152 873 0 850 3 2 1 2 0 8 0 sigapl 424 4329 0 4274 7 0 7 7 0 8 0 futexpl 64 38759 0 38757 1 0 1 1 0 8 0 knotepl 120 340 0 0 9 0 9 9 0 8 0 kqueuepl 224 1096 0 1088 14 13 1 5 0 8 0 pipepl 336 868 0 840 23 17 6 8 0 8 3 fdescpl 496 4311 0 4275 7 2 5 6 0 8 0 filepl 152 30279 0 30046 67 55 12 17 0 8 2 lockfpl 104 1537 0 1535 1 0 1 1 0 8 0 lockfspl 48 654 0 652 1 0 1 1 0 8 0 sessionpl 144 29 0 13 1 0 1 1 0 8 0 pgrppl 48 51 0 35 1 0 1 1 0 8 0 ucredpl 104 6412 0 6394 1 0 1 1 0 8 0 zombiepl 144 4275 0 4274 1 0 1 1 0 8 0 processpl 1064 4329 0 4274 5 1 4 5 0 8 0 procpl 672 12456 0 12388 13 6 7 8 0 8 1 sosppl 168 38 0 37 7 6 1 1 0 8 0 sockpl 480 6380 0 6355 151 145 6 29 0 8 2 mcl64k 65536 23 0 0 3 0 3 3 0 8 0 mcl16k 16384 18 0 0 3 0 3 3 0 8 0 mcl12k 12288 17 0 0 2 0 2 2 0 8 0 mcl9k 9216 17 0 0 2 0 2 2 0 8 0 mcl8k 8192 17 0 0 3 0 3 3 0 8 0 mcl4k 4096 18 0 0 3 0 3 3 0 8 0 mcl2k2 2112 5 0 0 1 0 1 1 0 8 0 mcl2k 2048 240 0 0 18 0 18 18 0 8 0 mtagpl 96 4 0 0 1 0 1 1 0 8 0 mbufpl 256 485 0 0 29 0 29 29 0 8 0 bufpl 288 9850 0 3522 453 0 453 453 0 8 0 anonpl 24 905786 0 894399 182 85 97 105 0 186 0 amapchunkpl 152 75809 0 75226 56 30 26 32 0 158 0 amappl16 200 13359 0 12999 98 77 21 32 0 8 2 amappl15 192 184 0 178 1 0 1 1 0 8 0 amappl14 184 996 0 989 1 0 1 1 0 8 0 amappl13 176 611 0 608 1 0 1 1 0 8 0 amappl12 168 12 0 9 2 1 1 1 0 8 0 amappl11 160 89 0 74 1 0 1 1 0 8 0 amappl10 152 1927 0 1918 1 0 1 1 0 8 0 amappl9 144 996 0 994 1 0 1 1 0 8 0 amappl8 136 895 0 811 3 0 3 3 0 8 0 amappl7 128 244 0 229 1 0 1 1 0 8 0 amappl6 120 834 0 814 2 1 1 2 0 8 0 amappl5 112 5885 0 5855 2 0 2 2 0 8 1 amappl4 104 1053 0 1030 1 0 1 1 0 8 0 amappl3 96 12712 0 12661 2 0 2 2 0 8 0 amappl2 88 5226 0 5157 3 1 2 3 0 8 0 amappl1 80 104776 0 104081 20 4 16 19 0 8 0 amappl 88 25450 0 25278 6 1 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 144 0 14 3 0 3 3 0 8 0 uaddrrnd 24 4311 0 4275 1 0 1 1 0 8 0 uaddrbest 32 2 0 0 1 0 1 1 0 8 0 uaddr 24 4311 0 4275 1 0 1 1 0 8 0 vmmpekpl 168 39418 0 39374 3 0 3 3 0 8 0 vmmpepl 168 429863 0 427126 192 64 128 137 0 357 7 vmsppl 368 4310 0 4275 4 0 4 4 0 8 0 rwobjpl 56 113681 0 106283 113 6 107 109 0 8 0 pdppl 4096 8629 0 8550 237 156 81 93 0 8 2 pvpl 32 1747327 0 1730811 335 160 175 237 0 265 12 pmappl 248 4310 0 4275 4 1 3 3 0 8 0 extentpl 40 58 0 38 1 0 1 1 0 8 0 phpool 112 1040 0 211 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(ffff8000fffe6550,1,c) at single_thread_check_locked+0x1f6 sys/kern/kern_sig.c:2037 single_thread_check(ffff8000fffe6550,1) at single_thread_check+0x4b sys/kern/kern_sig.c:2057 sleep_finish(ffff80002618ca00,1) at sleep_finish+0x75 sleep_signal_check sys/kern/kern_synch.c:464 [inline] sleep_finish(ffff80002618ca00,1) at sleep_finish+0x75 sys/kern/kern_synch.c:400 rwsleep(ffff8000fffe6550,ffffffff8296a1a0,120,ffffffff82595f34,0) at rwsleep+0xd5 sys/kern/kern_synch.c:314 futex_wait(ce69beb8040,2,0,2) at futex_wait+0x13c sys/kern/sys_futex.c:260 sys_futex(ffff8000fffe6550,ffff80002618cb90,ffff80002618cbf0) at sys_futex+0xf8 sys/kern/sys_futex.c:111 syscall(ffff80002618cc60) at syscall+0x484 mi_syscall sys/sys/syscall_mi.h:102 [inline] syscall(ffff80002618cc60) at syscall+0x484 sys/arch/amd64/amd64/trap.c:585 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0xce685f31540, 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(ffff80002e488dc0) at ast+0x108 mi_ast sys/sys/syscall_mi.h:184 [inline] ast(ffff80002e488dc0) at ast+0x108 sys/arch/amd64/amd64/trap.c:508 intr_user_exit() at intr_user_exit+0x3c end of kernel end trace frame: 0x7f7ffffc58d0, 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(ffff80002e488dc0) at ast+0x108 mi_ast sys/sys/syscall_mi.h:184 [inline] ast(ffff80002e488dc0) at ast+0x108 sys/arch/amd64/amd64/trap.c:508 intr_user_exit() at intr_user_exit+0x3c end of kernel end trace frame: 0x7f7ffffc58d0, count: -7