syzbot


uvm_fault: wsevent_fini (2)

Status: fixed on 2020/07/30 07:21
Reported-by: syzbot+fb9ad34ba42994683850@syzkaller.appspotmail.com
Fix commit: 25f2901d1c23 Fix yet another panic in which wsevent_fini() ends up being called with NULL. This one is a race caused by clearing the me_evp member before calling routines that could end up sleeping.
First crash: 1596d, last: 1596d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
openbsd uvm_fault: wsevent_fini 1 1709d 1709d 3/3 fixed on 2020/03/24 16:19
openbsd uvm_fault: wsevent_fini (3) C 2 1448d 1448d 3/3 fixed on 2020/12/06 19:54

Sample crash report:
uvm_fault(0xfffffd807efff000, 0x28, 0, 1) -> e
kernel: page fault trap, code=0
Stopped at      wsevent_fini+0x12:      movq    0x28(%r14),%r15
ddb{1}> 
ddb{1}> set $lines = 0
ddb{1}> set $maxwidth = 0
ddb{1}> show panic
kernel page fault
uvm_fault(0xfffffd807efff000, 0x28, 0, 1) -> e
wsevent_fini(0) at wsevent_fini+0x12 sys/dev/wscons/wsevent.c:130
end trace frame: 0xffff800023f13cf0, count: 0
ddb{1}> trace
wsevent_fini(0) at wsevent_fini+0x12 sys/dev/wscons/wsevent.c:130
wsmouseclose(4400,1,2000,ffff800020e09c48) at wsmouseclose+0x92 sys/dev/wscons/wsmouse.c:355
spec_close(ffff800023f13d70) at spec_close+0x311 sys/kern/spec_vnops.c:560
VOP_CLOSE(fffffd8070c86688,1,fffffd807f7bf9c0,ffff800020e09c48) at VOP_CLOSE+0xc0 sys/kern/vfs_vops.c:174
vn_closefile(fffffd8065bf3020,ffff800020e09c48) at vn_closefile+0xd7 vn_close sys/kern/vfs_vnops.c:298 [inline]
vn_closefile(fffffd8065bf3020,ffff800020e09c48) at vn_closefile+0xd7 sys/kern/vfs_vnops.c:614
fdrop(fffffd8065bf3020,ffff800020e09c48) at fdrop+0xc2 sys/kern/kern_descrip.c:1279
closef(fffffd8065bf3020,ffff800020e09c48) at closef+0x11c sys/kern/kern_descrip.c:1263
fdfree(ffff800020e09c48) at fdfree+0x101 sys/kern/kern_descrip.c:1195
exit1(ffff800020e09c48,0,0,1) at exit1+0x32c sys/kern/kern_exit.c:197
sys_exit(ffff800020e09c48,ffff800023f14000,ffff800023f14050) at sys_exit+0x16 sys/kern/kern_exit.c:95
syscall(ffff800023f140d0) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:102 [inline]
syscall(ffff800023f140d0) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:570
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7fffff3f00, count: -12
ddb{1}> show registers
rdi                                0
rsi               0xffff800020e09c4c
rbp               0xffff800023f13ca0
rbx                                0
rdx               0xffff800020e09c48
rcx                                0
rax                                0
r8                0xffffffff814ff197    witness_assert+0x207
r9                               0x5
r10                              0xa
r11               0x419808c2d5be5e90
r12                           0x4000    __ALIGN_SIZE+0x3000
r13                           0x2000    __ALIGN_SIZE+0x1000
r14                                0
r15                                0
rip               0xffffffff81784c82    wsevent_fini+0x12
cs                               0x8
rflags                       0x10246    __ALIGN_SIZE+0xf246
rsp               0xffff800023f13c80
ss                                 0
wsevent_fini+0x12:      movq    0x28(%r14),%r15
ddb{1}> show proc
PROC (syz-executor.0) pid=469771 stat=onproc
    flags process=1008<EXITING,SINGLEEXIT> proc=2000<WEXIT>
    pri=0, usrpri=51, nice=20
    forw=0xffffffffffffffff, list=0xffff800020e09eb8,0xffffffff82912c38
    process=0xffff800020eb6400 user=0xffff800023f0f000, vmspace=0xfffffd807efff000
    estcpu=1, cpticks=3, pctcpu=0.0
    user=0, sys=0, intr=0
ddb{1}> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
 42138   87641  74229      0  3         0x2  biowait       syz-executor.1
 38113  194965  74229      0  3        0x82  nanosleep     syz-executor.0
 74229  507116  84464      0  3        0x82  kqread        syz-fuzzer
 74229  453143  84464      0  3   0x4000082  nanosleep     syz-fuzzer
 74229  181046  84464      0  3   0x4000082  thrsleep      syz-fuzzer
 74229  508462  84464      0  3   0x4000082  thrsleep      syz-fuzzer
 74229    2071  84464      0  3   0x4000082  thrsleep      syz-fuzzer
 74229  151630  84464      0  3   0x4000082  thrsleep      syz-fuzzer
 74229  407559  84464      0  3   0x4000082  thrsleep      syz-fuzzer
 74229   59574  84464      0  3   0x4000082  thrsleep      syz-fuzzer
 74229  259082  84464      0  3   0x4000082  nanosleep     syz-fuzzer
 74229   98427  84464      0  3   0x4000082  thrsleep      syz-fuzzer
 84464  500235  75346      0  3    0x10008a  pause         ksh
 75346  518868  23043      0  7        0x12                sshd
 98897  469360      1      0  3    0x100083  ttyin         getty
 23043   26087      1      0  3        0x80  select        sshd
 56196   12822  29616     74  3    0x100092  bpf           pflogd
 29616   17254      1      0  3        0x80  netio         pflogd
 63316   89943  55723     73  3    0x100090  kqread        syslogd
 55723  396703      1      0  3    0x100082  netio         syslogd
 84434  438561      1     77  3    0x100090  poll          dhclient
 98158  309034      1      0  3        0x80  poll          dhclient
 72451  331329      0      0  3     0x14200  bored         smr
 70439  278012      0      0  2     0x14200                zerothread
 26950  375777      0      0  3     0x14200  aiodoned      aiodoned
 36211  126225      0      0  3     0x14200  syncer        update
 81806  248737      0      0  3     0x14200  cleaner       cleaner
 62244  285962      0      0  3     0x14200  reaper        reaper
 20938   50271      0      0  3     0x14200  pgdaemon      pagedaemon
 20860  372738      0      0  3     0x14200  bored         crynlk
 98195   78381      0      0  3     0x14200  bored         crypto
 21441  458550      0      0  3  0x40014200  acpi0         acpi0
 28094  178664      0      0  3  0x40014200                idle1
 93133  429294      0      0  3     0x14200  bored         softnet
 94881  191271      0      0  3     0x14200  bored         systqmp
 45125   29061      0      0  3     0x14200  bored         systq
 97439   84491      0      0  3  0x40014200  bored         softclock
 74281  347907      0      0  3  0x40014200                idle0
     1  283530      0      0  3        0x82  wait          init
     0       0     -1      0  3     0x10200  scheduler     swapper
ddb{1}> show all locks
Process 42138 (syz-executor.1) thread 0xffff800020e09eb8 (87641)
exclusive rrwlock inode r = 0 (0xfffffd806aba7700)
#0  witness_lock+0x4c7 stacktrace_save sys/sys/stacktrace.h:36 [inline]
#0  witness_lock+0x4c7 sys/kern/subr_witness.c:1164
#1  rw_enter+0x453 sys/kern/kern_rwlock.c:311
#2  rrw_enter+0x88 sys/kern/kern_rwlock.c:462
#3  VOP_LOCK+0x4b sys/kern/vfs_vops.c:603
#4  vn_lock+0x81 sys/kern/vfs_vnops.c:575
#5  vget+0x1c8 sys/kern/vfs_subr.c:671
#6  ufs_ihashget+0x141 sys/ufs/ufs/ufs_ihash.c:119
#7  ffs_vget+0x74 sys/ufs/ffs/ffs_vfsops.c:1329
#8  ufs_lookup+0x14b7 sys/ufs/ufs/ufs_lookup.c:487
#9  VOP_LOOKUP+0x5b sys/kern/vfs_vops.c:90
#10 vfs_lookup+0x7a6 sys/kern/vfs_lookup.c:568
#11 namei+0x63c sys/kern/vfs_lookup.c:249
#12 dounlinkat+0x99 sys/kern/vfs_syscalls.c:1853
#13 syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:102 [inline]
#13 syscall+0x4a4 sys/arch/amd64/amd64/trap.c:570
#14 Xsyscall+0x128
exclusive rrwlock inode r = 0 (0xfffffd806b20a5e8)
#0  witness_lock+0x4c7 stacktrace_save sys/sys/stacktrace.h:36 [inline]
#0  witness_lock+0x4c7 sys/kern/subr_witness.c:1164
#1  rw_enter+0x453 sys/kern/kern_rwlock.c:311
#2  rrw_enter+0x88 sys/kern/kern_rwlock.c:462
#3  VOP_LOCK+0x4b sys/kern/vfs_vops.c:603
#4  vn_lock+0x81 sys/kern/vfs_vnops.c:575
#5  vfs_lookup+0xe6 sys/kern/vfs_lookup.c:419
#6  namei+0x63c sys/kern/vfs_lookup.c:249
#7  dounlinkat+0x99 sys/kern/vfs_syscalls.c:1853
#8  syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:102 [inline]
#8  syscall+0x4a4 sys/arch/amd64/amd64/trap.c:570
#9  Xsyscall+0x128
ddb{1}> show malloc
           Type InUse  MemUse  HighUse   Limit  Requests Type Lim
         devbuf  9492   6413K    6938K  78643K     11047        0
            pcb    13      8K       8K  78643K        35        0
         rtable   110      3K       4K  78643K       258        0
         ifaddr    59     13K      13K  78643K        68        0
       counters    43     33K      34K  78643K        45        0
       ioctlops     0      0K       4K  78643K      1485        0
            iov     0      0K      16K  78643K         7        0
          mount     1      1K       1K  78643K         1        0
         vnodes  1222     77K      77K  78643K      1293        0
      UFS quota     1     32K      32K  78643K         1        0
      UFS mount     5     36K      36K  78643K         5        0
            shm     2      1K       1K  78643K         2        0
         VM map     2      1K       1K  78643K         2        0
            sem    12      0K       1K  78643K        16        0
        dirhash    12      2K       2K  78643K        12        0
           ACPI  1824    197K     290K  78643K     13058        0
      file desc     5     13K      25K  78643K       241        0
          sigio     0      0K       0K  78643K         1        0
           proc    61     63K      83K  78643K       451        0
        subproc    32      2K       2K  78643K        34        0
    NFS srvsock     1      0K       0K  78643K         1        0
     NFS daemon     1     16K      16K  78643K         1        0
    ip_moptions     0      0K       0K  78643K         4        0
       in_multi    53      3K       3K  78643K        57        0
    ether_multi     1      0K       0K  78643K         3        0
    ISOFS mount     1     32K      32K  78643K         1        0
  MSDOSFS mount     1     16K      16K  78643K         1        0
           ttys    61    281K     281K  78643K        61        0
           exec     0      0K       1K  78643K       210        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   113     22K      26K  78643K      1604        0
       UVM aobj     3      2K       2K  78643K         3        0
        memdesc     1      4K       4K  78643K         1        0
    crypto data     1      1K       1K  78643K         1        0
    ip6_options     0      0K       1K  78643K        18        0
            NDP     8      0K       0K  78643K        14        0
           temp    80   3857K    3921K  78643K      2503        0
         kqueue     3      4K       5K  78643K         7        0
      SYN cache     2     16K      16K  78643K         2        0
ddb{1}> 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       80       87    0       84     1     0     1     1     0     8    0
rtentry    112       47    0        1     2     0     2     2     0     8    0
unpcb      120      138    0      128     1     0     1     1     0     8    0
syncache   264        4    0        4     1     1     0     1     0     8    0
tcpqe       32       19    0       19     1     1     0     1     0     8    0
tcpcb      544       39    0       35     1     0     1     1     0     8    0
inpcb      296      114    0      107     2     1     1     2     0     8    0
nd6         48        7    0        0     1     0     1     1     0     8    0
pfstscr     40        4    0        4     1     1     0     1     0     8    0
pfosfp      40      846    0      423     5     0     5     5     0     8    0
pfosfpen   112     1428    0      714    21     0    21    21     0     8    0
pfrktable  1344       1    0        1     1     1     0     1     0     8    0
pfstitem    24       20    0        9     1     0     1     1     0     8    0
pfstkey    112       22    0       11     1     0     1     1     0     8    0
pfstate    328       20    0        9     2     0     2     2     0     8    0
pfrule     1360      22    0       17     2     1     1     2     0     8    0
art_heap8  4096       1    0        0     1     0     1     1     0     8    0
art_heap4  256      188    0        0    12     0    12    12     0     8    0
art_table   32      189    0        0     2     0     2     2     0     8    0
art_node    16       46    0        5     1     0     1     1     0     8    0
sysvmsgpl   40        5    0        0     1     0     1     1     0     8    0
semapl     112       14    0        4     1     0     1     1     0     8    0
dirhash    1024      17    0        0     3     0     3     3     0     8    0
dino2pl    256     1694    0      287    89     0    89    89     0     8    0
ffsino     272     1694    0      287    95     0    95    95     0     8    0
nchpl      144     2185    0      574    60     0    60    60     0     8    0
uvmvnodes   72     1786    0        0    33     0    33    33     0     8    0
vnodes     208     1786    0        0    94     0    94    94     0     8    0
namei      1024    6757    0     6757     1     0     1     1     0     8    1
percpumem   16       33    0        1     1     0     1     1     0     8    0
scxspl     192     6447    0     6446     8     7     1     7     0     8    0
plimitpl   152       23    0       15     1     0     1     1     0     8    0
sigapl     424      456    0      425     4     0     4     4     0     8    0
futexpl     56     2748    0     2748     1     0     1     1     0     8    1
knotepl    112       65    0       46     1     0     1     1     0     8    0
kqueuepl   144       12    0       10     1     0     1     1     0     8    0
pipepl     304       95    0       85     2     1     1     2     0     8    0
fdescpl    496      441    0      425     3     0     3     3     0     8    0
filepl     152     2881    0     2776     5     0     5     5     0     8    0
lockfpl    104       98    0       97     1     0     1     1     0     8    0
lockfspl    48       38    0       37     1     0     1     1     0     8    0
sessionpl  112       18    0        7     1     0     1     1     0     8    0
pgrppl      48       18    0        7     1     0     1     1     0     8    0
ucredpl     96      717    0      708     1     0     1     1     0     8    0
zombiepl   144      426    0      425     1     0     1     1     0     8    0
processpl  992      456    0      425     5     0     5     5     0     8    0
procpl     624      845    0      805     4     0     4     4     0     8    0
sockpl     400      339    0      319     4     1     3     4     0     8    0
mcl64k     65536      2    0        0     1     0     1     1     0     8    0
mcl12k     12288      3    0        0     1     0     1     1     0     8    0
mcl8k      8192       2    0        0     1     0     1     1     0     8    0
mcl4k      4096       3    0        0     1     0     1     1     0     8    0
mcl2k2     2112       2    0        0     1     0     1     1     0     8    0
mcl2k      2048     158    0        0    19     0    19    19     0     8    0
mtagpl      96       15    0        0     1     0     1     1     0     8    0
mbufpl     256      357    0        0    22     0    22    22     0     8    0
bufpl      280     3608    0      133   249     0   249   249     0     8    0
anonpl      16    50734    0    35563    63     1    62    62     0   124    0
amapchunkpl 152    2097    0     1947     9     2     7     9     0   158    0
amappl16   192     1781    0      977    41     0    41    41     0     8    0
amappl15   184        1    0        1     1     1     0     1     0     8    0
amappl14   176      231    0      225     1     0     1     1     0     8    0
amappl13   168       29    0       25     1     0     1     1     0     8    0
amappl12   160        7    0        6     1     0     1     1     0     8    0
amappl11   152       56    0       40     1     0     1     1     0     8    0
amappl10   144       18    0       13     1     0     1     1     0     8    0
amappl9    136      405    0      402     1     0     1     1     0     8    0
amappl8    128      323    0      300     1     0     1     1     0     8    0
amappl7    120      116    0      105     1     0     1     1     0     8    0
amappl6    112       26    0       20     1     0     1     1     0     8    0
amappl5    104      335    0      318     1     0     1     1     0     8    0
amappl4     96      486    0      458     1     0     1     1     0     8    0
amappl3     88      311    0      303     1     0     1     1     0     8    0
amappl2     80     2579    0     2510     2     0     2     2     0     8    0
amappl1     72    19159    0    18721    23    13    10    18     0     8    0
amappl      80     1095    0     1048     2     0     2     2     0    84    0
dma4096    4096       1    0        1     1     1     0     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        2    0        0     1     0     1     1     0     8    0
uaddrrnd    24      441    0      425     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24      441    0      425     1     0     1     1     0     8    0
vmmpekpl   168     7196    0     7162     2     0     2     2     0     8    0
vmmpepl    168    60090    0    58128   114    19    95   111     0   357    4
vmsppl     368      440    0      425     2     0     2     2     0     8    0
pdppl      4096     889    0      850     6     0     6     6     0     8    0
pvpl        32   175828    0   157497   153     3   150   151     0   265    1
pmappl     232      440    0      425     2     1     1     2     0     8    0
extentpl    40       53    0       36     1     0     1     1     0     8    0
phpool     112      266    0        4     8     0     8     8     0     8    0
ddb{1}> machine ddbcpu 0
Stopped at      x86_ipi_db+0x1a:        addq    $0x8,%rsp
ddb{0}> trace
x86_ipi_db(ffffffff826f9ff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:352
x86_ipi_handler() at x86_ipi_handler+0xc6 sys/arch/amd64/amd64/ipi.c:106
Xresume_lapic_ipi() at Xresume_lapic_ipi+0x23
__mp_lock(ffffffff829060a0) at __mp_lock+0x127 __mp_lock_spin sys/kern/kern_lock.c:116 [inline]
__mp_lock(ffffffff829060a0) at __mp_lock+0x127 sys/kern/kern_lock.c:147
intr_handler(ffff800020e04060,ffff80000004a400) at intr_handler+0x5e sys/arch/amd64/amd64/intr.c:532
Xintr_ioapic_edge17_untramp() at Xintr_ioapic_edge17_untramp+0x19f
__sanitizer_cov_trace_cmp4(88dce,88dcf) at __sanitizer_cov_trace_cmp4+0x11 kd_curproc sys/dev/kcov.c:397 [inline]
__sanitizer_cov_trace_cmp4(88dce,88dcf) at __sanitizer_cov_trace_cmp4+0x11 trace_cmp sys/dev/kcov.c:104 [inline]
__sanitizer_cov_trace_cmp4(88dce,88dcf) at __sanitizer_cov_trace_cmp4+0x11 sys/dev/kcov.c:135
__mp_lock(ffffffff829060a0) at __mp_lock+0x139 __mp_lock_spin sys/kern/kern_lock.c:116 [inline]
__mp_lock(ffffffff829060a0) at __mp_lock+0x139 sys/kern/kern_lock.c:147
syscall(ffff800020e04250) at syscall+0x400 mi_syscall sys/sys/syscall_mi.h:93 [inline]
syscall(ffff800020e04250) at syscall+0x400 sys/arch/amd64/amd64/trap.c:570
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffd23b0, count: -10
ddb{0}> machine ddbcpu 1
Stopped at      wsevent_fini+0x12:      movq    0x28(%r14),%r15
ddb{1}> trace
wsevent_fini(0) at wsevent_fini+0x12 sys/dev/wscons/wsevent.c:130
wsmouseclose(4400,1,2000,ffff800020e09c48) at wsmouseclose+0x92 sys/dev/wscons/wsmouse.c:355
spec_close(ffff800023f13d70) at spec_close+0x311 sys/kern/spec_vnops.c:560
VOP_CLOSE(fffffd8070c86688,1,fffffd807f7bf9c0,ffff800020e09c48) at VOP_CLOSE+0xc0 sys/kern/vfs_vops.c:174
vn_closefile(fffffd8065bf3020,ffff800020e09c48) at vn_closefile+0xd7 vn_close sys/kern/vfs_vnops.c:298 [inline]
vn_closefile(fffffd8065bf3020,ffff800020e09c48) at vn_closefile+0xd7 sys/kern/vfs_vnops.c:614
fdrop(fffffd8065bf3020,ffff800020e09c48) at fdrop+0xc2 sys/kern/kern_descrip.c:1279
closef(fffffd8065bf3020,ffff800020e09c48) at closef+0x11c sys/kern/kern_descrip.c:1263
fdfree(ffff800020e09c48) at fdfree+0x101 sys/kern/kern_descrip.c:1195
exit1(ffff800020e09c48,0,0,1) at exit1+0x32c sys/kern/kern_exit.c:197
sys_exit(ffff800020e09c48,ffff800023f14000,ffff800023f14050) at sys_exit+0x16 sys/kern/kern_exit.c:95
syscall(ffff800023f140d0) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:102 [inline]
syscall(ffff800023f140d0) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:570
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7fffff3f00, count: -12

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/07/09 10:11 openbsd 69657d9abefd ff85e8be .config console log report ci-openbsd-multicore
* Struck through repros no longer work on HEAD.