syzbot


panic: vput: ref cnt

Status: fixed on 2019/08/15 14:16
Reported-by: syzbot+bf2ac4d4fa9ee92903b8@syzkaller.appspotmail.com
Fix commit: d627fa5cc364 Serialize access to the vnode pointers associated with acct(2) system accounting. Prevents a race where the acct thread and the acct(2) syscall both tries to close a vnode.
First crash: 1712d, last: 1711d
Last patch testing requests (2)
Created Duration User Patch Repo Result
2019/08/13 08:42 18m anton@basename.se https://github.com/mptre/openbsd-src acct OK
2019/08/12 11:52 16m anton@basename.se https://github.com/mptre/openbsd-src acct OK

Sample crash report:
panic: vput: ref cnt
Stopped at      db_enter+0x18:  addq    $0x8,%rsp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
*307047  84887      0           0          0    0K syz-executor7760
  79340   3092      0           0          0    1  syz-executor7760
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic() at panic+0x15c sys/kern/subr_prf.c:207
vput(fffffd8076dcb268) at vput+0x14b sys/kern/vfs_subr.c:750
vn_close(fffffd8076dcb268,2,fffffd807f7c6ae0,ffff800020afe9e8) at vn_close+0xfb sys/kern/vfs_vnops.c:291
sys_acct(ffff800020afe9e8,ffff800020bc3988,ffff800020bc39f0) at sys_acct+0x15b sys/kern/kern_acct.c:134
syscall(ffff800020bc3a60) at syscall+0x552 mi_syscall sys/sys/syscall_mi.h:92 [inline]
syscall(ffff800020bc3a60) at syscall+0x552 sys/arch/amd64/amd64/trap.c:555
Xsyscall(6,0,2,0,431bde82d7b634db,7f7fffff78b0) at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7fffff7910, count: 8
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
vput: ref cnt
ddb{0}> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic() at panic+0x15c sys/kern/subr_prf.c:207
vput(fffffd8076dcb268) at vput+0x14b sys/kern/vfs_subr.c:750
vn_close(fffffd8076dcb268,2,fffffd807f7c6ae0,ffff800020afe9e8) at vn_close+0xfb sys/kern/vfs_vnops.c:291
sys_acct(ffff800020afe9e8,ffff800020bc3988,ffff800020bc39f0) at sys_acct+0x15b sys/kern/kern_acct.c:134
syscall(ffff800020bc3a60) at syscall+0x552 mi_syscall sys/sys/syscall_mi.h:92 [inline]
syscall(ffff800020bc3a60) at syscall+0x552 sys/arch/amd64/amd64/trap.c:555
Xsyscall(6,0,2,0,431bde82d7b634db,7f7fffff78b0) at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7fffff7910, count: -7
ddb{0}> show registers
rdi                                0
rsi                              0x1
rbp               0xffff800020bc3700
rbx               0xffff800020bc37b0
rdx                             0x8b
rcx                              0x2
rax                              0x1
r8                0xffffffff815a9073    kprintf+0x173
r9                               0x1
r10                0x277b1cf6cdabbe2
r11               0xe9d34a32f11cd0f0
r12                     0x3000000008
r13               0xffff800020bc3710
r14                            0x100
r15                              0x1
rip               0xffffffff81e595e8    db_enter+0x18
cs                               0x8
rflags                         0x246
rsp               0xffff800020bc36f0
ss                              0x10
db_enter+0x18:  addq    $0x8,%rsp
ddb{0}> show proc
PROC (syz-executor7760) pid=307047 stat=onproc
    flags process=0 proc=0
    pri=32, usrpri=53, nice=20
    forw=0xffffffffffffffff, list=0xffff800020afe008,0xffffffff8236fbe0
    process=0xffff800020b7d180 user=0xffff800020bbe000, vmspace=0xfffffd807effe000
    estcpu=12, cpticks=1, pctcpu=0.0
    user=0, sys=1, intr=0
ddb{0}> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
*84887  307047   5211      0  7           0                syz-executor7760
  3092   79340  60010      0  7           0                syz-executor7760
  3591   52504      0      0  3     0x14200  acct          acct
 60010  292771  79806      0  3        0x80  nanosleep     syz-executor7760
  5211   59744  79806      0  3        0x80  nanosleep     syz-executor7760
 79806  471208  93309      0  3        0x82  nanosleep     syz-executor7760
 93309  115215  35169      0  3    0x10008a  pause         ksh
 35169  453254  44798      0  3        0x92  select        sshd
 27835   84376      1      0  3    0x100083  ttyin         getty
 44798  442806      1      0  3        0x80  select        sshd
 59938  160657  20544     74  3    0x100092  bpf           pflogd
 20544  458131      1      0  3        0x80  netio         pflogd
 43275  503730  75348     73  2    0x100090                syslogd
 75348  354477      1      0  3    0x100082  netio         syslogd
 55480  396975      1     77  3    0x100090  poll          dhclient
  6226  429921      1      0  3        0x80  poll          dhclient
 65912    3220      0      0  3     0x14200  pgzero        zerothread
 16012   86214      0      0  3     0x14200  aiodoned      aiodoned
 13817   49093      0      0  3     0x14200  syncer        update
 77691  264412      0      0  3     0x14200  cleaner       cleaner
 65480  444097      0      0  3     0x14200  reaper        reaper
 13029   68349      0      0  3     0x14200  pgdaemon      pagedaemon
 62993  479602      0      0  3     0x14200  bored         crynlk
 62871   64701      0      0  3     0x14200  bored         crypto
 67644  376495      0      0  3  0x40014200  acpi0         acpi0
 77362  139830      0      0  3  0x40014200                idle1
 11434  508851      0      0  3     0x14200  bored         softnet
 69668  356425      0      0  3     0x14200  bored         systqmp
 54868  194131      0      0  3     0x14200  bored         systq
  9257   74611      0      0  3  0x40014200  bored         softclock
 20404  310548      0      0  3  0x40014200                idle0
 96199  102066      0      0  3     0x14200  bored         smr
     1   49464      0      0  3        0x82  wait          init
     0       0     -1      0  3     0x10200  scheduler     swapper
ddb{0}> show all locks
Process 84887 (syz-executor7760) thread 0xffff800020afe9e8 (307047)
exclusive rrwlock inode r = 0 (0xfffffd806d9ff3d8)
#0  witness_lock+0x52e sys/kern/subr_witness.c:1163
#1  rw_enter+0x46d sys/kern/kern_rwlock.c:306
#2  rrw_enter+0x4f sys/kern/kern_rwlock.c:435
#3  VOP_LOCK+0x4b sys/kern/vfs_vops.c:602
#4  vn_close+0xb9 vn_lock sys/kern/vfs_vnops.c:561 [inline]
#4  vn_close+0xb9 sys/kern/vfs_vnops.c:288
#5  sys_acct+0x15b sys/kern/kern_acct.c:134
#6  syscall+0x552 mi_syscall sys/sys/syscall_mi.h:92 [inline]
#6  syscall+0x552 sys/arch/amd64/amd64/trap.c:555
#7  Xsyscall+0x128
exclusive kernel_lock &kernel_lock r = 0 (0xffffffff823822f8)
#0  witness_lock+0x52e sys/kern/subr_witness.c:1163
#1  __mp_acquire_count+0x51 sys/kern/kern_lock.c:227
#2  mi_switch+0x38f sys/kern/sched_bsd.c:441
#3  sleep_finish+0x113 sys/kern/kern_synch.c:373
#4  rw_enter+0x366 sys/kern/kern_rwlock.c:282
#5  rrw_enter+0x4f sys/kern/kern_rwlock.c:435
#6  VOP_LOCK+0x4b sys/kern/vfs_vops.c:602
#7  vn_close+0xb9 vn_lock sys/kern/vfs_vnops.c:561 [inline]
#7  vn_close+0xb9 sys/kern/vfs_vnops.c:288
#8  sys_acct+0x15b sys/kern/kern_acct.c:134
#9  syscall+0x552 mi_syscall sys/sys/syscall_mi.h:92 [inline]
#9  syscall+0x552 sys/arch/amd64/amd64/trap.c:555
#10 Xsyscall+0x128
ddb{0}> show malloc
           Type InUse  MemUse  HighUse   Limit  Requests Type Lim Kern Lim
         devbuf  9452   6383K    6384K  78643K     10539        0        0
            pcb    13      8K       8K  78643K        13        0        0
         rtable    61      2K       2K  78643K       126        0        0
         ifaddr    25      7K       7K  78643K        26        0        0
       counters    39     33K      33K  78643K        39        0        0
       ioctlops     0      0K       4K  78643K      1467        0        0
          mount     1      1K       1K  78643K         1        0        0
         vnodes  1181     74K      74K  78643K      1186        0        0
      UFS quota     1     32K      32K  78643K         1        0        0
      UFS mount     5     36K      36K  78643K         5        0        0
            shm     2      1K       1K  78643K         2        0        0
         VM map     2      1K       1K  78643K         2        0        0
            sem     2      0K       0K  78643K         2        0        0
        dirhash    12      2K       2K  78643K        12        0        0
           ACPI  1808    196K     290K  78643K     12765        0        0
      file desc     1      0K       0K  78643K         1        0        0
           proc    52     50K      58K  78643K       334        0        0
    NFS srvsock     1      0K       0K  78643K         1        0        0
     NFS daemon     1     16K      16K  78643K         1        0        0
       in_multi    11      0K       0K  78643K        11        0        0
    ether_multi     1      0K       0K  78643K         1        0        0
    ISOFS mount     1     32K      32K  78643K         1        0        0
  MSDOSFS mount     1     16K      16K  78643K         1        0        0
           ttys    18     79K      79K  78643K        18        0        0
           exec     0      0K       1K  78643K       179        0        0
        pagedep     1      8K       8K  78643K         1        0        0
       inodedep     1     32K      32K  78643K         1        0        0
         newblk     1      0K       0K  78643K         1        0        0
        VM swap     7     26K      26K  78643K         7        0        0
       UVM amap    66      3K       4K  78643K       825        0        0
       UVM aobj     2      2K       2K  78643K         2        0        0
        memdesc     1      4K       4K  78643K         1        0        0
    crypto data     1      1K       1K  78643K         1        0        0
            NDP     4      0K       0K  78643K         4        0        0
           temp    39   2732K    2796K  78643K      2004        0        0
      SYN cache     2     16K      16K  78643K         2        0        0
ddb{0}> show all pools
Name      Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle
arp         64        2    0        0     1     0     1     1     0     8    0
plcache    128       20    0        0     1     0     1     1     0     8    0
rtpcb       80       15    0       13     1     0     1     1     0     8    0
rtentry    112       23    0        1     1     0     1     1     0     8    0
unpcb      120       29    0       19     1     0     1     1     0     8    0
syncache   264        5    0        5     2     1     1     1     0     8    1
tcpcb      544        8    0        5     1     0     1     1     0     8    0
inpcb      280       29    0       23     1     0     1     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
pfstitem    24        8    0        2     1     0     1     1     0     8    0
pfstkey    112        8    0        2     1     0     1     1     0     8    0
pfstate    328        8    0        2     1     0     1     1     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       97    0        0     7     0     7     7     0     8    0
art_table   32       98    0        0     1     0     1     1     0     8    0
art_node    16       22    0        2     1     0     1     1     0     8    0
dirhash    1024      17    0        0     3     0     3     3     0     8    0
dino1pl    128     1414    0       25    45     0    45    45     0     8    0
ffsino     272     1414    0       25    93     0    93    93     0     8    0
nchpl      144     1613    0       63    58     0    58    58     0     8    0
uvmvnodes   72     1424    0        0    26     0    26    26     0     8    0
vnodes     200     1424    0        0    75     0    75    75     0     8    0
namei      1024    3805    0     3805     2     1     1     1     0     8    1
percpumem   16       30    0        0     1     0     1     1     0     8    0
scxspl     192     2522    0     2522     8     7     1     6     0     8    1
plimitpl   152       14    0        8     1     0     1     1     0     8    0
sigapl     432      213    0      197     2     0     2     2     0     8    0
knotepl    112        5    0        0     1     0     1     1     0     8    0
kqueuepl   104        1    0        0     1     0     1     1     0     8    0
pipepl     112      134    0      127     2     1     1     1     0     8    0
fdescpl    488      214    0      197     3     0     3     3     0     8    0
filepl     152      993    0      944     2     0     2     2     0     8    0
lockfpl    104        6    0        6     1     1     0     1     0     8    0
lockfspl    48        3    0        3     1     1     0     1     0     8    0
sessionpl  112       18    0        9     1     0     1     1     0     8    0
pgrppl      48       18    0        9     1     0     1     1     0     8    0
ucredpl     96       52    0       43     1     0     1     1     0     8    0
zombiepl   144      197    0      197     2     1     1     1     0     8    1
processpl  896      230    0      197     4     0     4     4     0     8    0
procpl     632      230    0      197     3     0     3     3     0     8    0
sockpl     384       73    0       55     2     0     2     2     0     8    0
mcl4k      4096       3    0        0     1     0     1     1     0     8    0
mcl2k      2048      86    0        0     9     0     9     9     0     8    0
mtagpl      80        1    0        0     1     0     1     1     0     8    0
mbufpl     256      105    0        0     6     0     6     6     0     8    0
bufpl      256     2177    0      276   119     0   119   119     0     8    0
anonpl      16    20274    0    18988     7     1     6     7     0   125    0
amapchunkpl 152     545    0      504     2     0     2     2     0   158    0
amappl16   192       91    0       81     1     0     1     1     0     8    0
amappl14   176       38    0       34     1     0     1     1     0     8    0
amappl12   160       10    0       10     2     1     1     1     0     8    1
amappl11   152       51    0       36     1     0     1     1     0     8    0
amappl10   144       56    0       54     1     0     1     1     0     8    0
amappl9    136      426    0      425     1     0     1     1     0     8    0
amappl8    128      100    0       96     1     0     1     1     0     8    0
amappl7    120       21    0       20     1     0     1     1     0     8    0
amappl6    112       47    0       42     1     0     1     1     0     8    0
amappl5    104      145    0      129     1     0     1     1     0     8    0
amappl4     96      466    0      442     1     0     1     1     0     8    0
amappl3     88      158    0      147     1     0     1     1     0     8    0
amappl2     80      770    0      712     2     0     2     2     0     8    0
amappl1     72    13806    0    13375    15     5    10    15     0     8    0
amappl      80      429    0      404     1     0     1     1     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
dma64       64      259    0      259     1     1     0     1     0     8    0
dma32       32        7    0        7     1     1     0     1     0     8    0
dma16       16       17    0       17     1     1     0     1     0     8    0
aobjpl      64        1    0        0     1     0     1     1     0     8    0
uaddrrnd    24      214    0      197     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24      214    0      197     1     0     1     1     0     8    0
vmmpekpl   168     5628    0     5607     2     0     2     2     0     8    0
vmmpepl    168    29589    0    28653    51    10    41    47     0   357    0
vmsppl     368      213    0      197     2     0     2     2     0     8    0
pdppl      4096     436    0      394     6     0     6     6     0     8    0
pvpl        32    80908    0    77796    32     4    28    28     0   265    1
pmappl     232      213    0      197     1     0     1     1     0     8    0
extentpl    40       41    0       26     1     0     1     1     0     8    0
phpool     112      254    0        4     8     0     8     8     0     8    0

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/08/12 09:57 openbsd 4e6b438a7e45 8620c2c2 .config console log report syz C ci-openbsd-multicore
2019/08/13 22:13 openbsd 723403cbe800 74d61399 .config console log report ci-openbsd-multicore
2019/08/13 12:05 openbsd 723403cbe800 8620c2c2 .config console log report ci-openbsd-multicore
2019/08/13 06:45 openbsd 8c9a8c5f30e0 8620c2c2 .config console log report ci-openbsd-multicore
2019/08/12 23:02 openbsd 8c9a8c5f30e0 8620c2c2 .config console log report ci-openbsd-main
2019/08/12 09:42 openbsd 4e6b438a7e45 8620c2c2 .config console log report ci-openbsd-multicore
* Struck through repros no longer work on HEAD.