syzbot


uvm_fault: witness_checkorder

Status: fixed on 2019/10/22 13:03
Reported-by: syzbot+e5df02aad1d9e0ca30dd@syzkaller.appspotmail.com
Fix commit: put bpfdesc reference counting back, revert change introduced in 1.175 as: BPF: remove redundant reference counting of filedescriptors
First crash: 1144d, last: 1144d
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
openbsd uvm_fault: witness_checkorder (2) 1 1113d 1113d 0/3 auto-closed as invalid on 2020/02/18 09:16

Sample crash report:
uvm_fault(0xfffffd807f00a8a0, 0x8, 0, 1) -> e
kernel: page fault trap, code=0
Stopped at      witness_checkorder+0x121:       movl    0x8(%r15),%ebx
ddb{0}> 
ddb{0}> set $lines = 0
ddb{0}> set $maxwidth = 0
ddb{0}> show panic
kernel page fault
uvm_fault(0xfffffd807f00a8a0, 0x8, 0, 1) -> e
witness_checkorder(ffff800000a5fe18,9,0) at witness_checkorder+0x121 sys/kern/subr_witness.c:776
end trace frame: 0xffff800020b67000, count: 0
ddb{0}> trace
witness_checkorder(ffff800000a5fe18,9,0) at witness_checkorder+0x121 sys/kern/subr_witness.c:776
mtx_enter(ffff800000a5fe08) at mtx_enter+0x3a sys/kern/kern_lock.c:265
filt_bpfread(fffffd806eb7e620,0) at filt_bpfread+0x4e sys/net/bpf.c:1210
kqueue_register(fffffd806e7f4b60,ffff800020b670f0,ffff800020ab1160) at kqueue_register+0x425 sys/kern/kern_event.c:664
sys_kevent(ffff800020ab1160,ffff800020b672b8,ffff800020b67300) at sys_kevent+0x2b1 sys/kern/kern_event.c:527
syscall(ffff800020b67380) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline]
syscall(ffff800020b67380) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555
Xsyscall(6,0,ffffffffffffff80,0,6,6613bf580e0) at Xsyscall+0x128
end of kernel
end trace frame: 0x6637655c240, count: -7
ddb{0}> show registers
rdi                                0
rsi                          0x20000    acpi_pdirpa+0xbe68
rbp               0xffff800020b66fc0
rbx                             0x70
rdx                                0
rcx               0xfffffd8002fdab80
rax               0xffffffff8248eff0    cpu_info_full_primary+0x1ff0
r8                    0x7f7fffffc000
r9                              0x2b
r10               0xc8f53ad9a7d7366e
r11               0x881cccb5ed16e230
r12               0xdeaf4152deaf4152
r13                                0
r14               0xffff800020ab1160
r15                                0
rip               0xffffffff811658b1    witness_checkorder+0x121
cs                               0x8
rflags                       0x10246    __ALIGN_SIZE+0xf246
rsp               0xffff800020b66f20
ss                              0x10
witness_checkorder+0x121:       movl    0x8(%r15),%ebx
ddb{0}> show proc
PROC (syz-executor.0) pid=403766 stat=onproc
    flags process=0 proc=4000000<THREAD>
    pri=50, usrpri=50, nice=20
    forw=0xffffffffffffffff, list=0xffff800020ab13d8,0xffff800020ab0ef8
    process=0xffff800020adca80 user=0xffff800020b62000, vmspace=0xfffffd807f00a8a0
    estcpu=0, cpticks=0, pctcpu=0.0
    user=0, sys=0, intr=0
ddb{0}> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
  1314  243670  83188      0  7           0                syz-executor.0
  1314  453099  83188      0  3   0x4000080  kqread        syz-executor.0
* 1314  403766  83188      0  7   0x4000000                syz-executor.0
  1314  255455  83188      0  3   0x4000080  fsleep        syz-executor.0
 83188  523964  20443      0  3        0x82  nanosleep     syz-executor.0
 20443  195881  22637      0  3        0x82  thrsleep      syz-execprog
 20443  142353  22637      0  3   0x4000082  thrsleep      syz-execprog
 20443  266975  22637      0  3   0x4000082  thrsleep      syz-execprog
 20443  128235  22637      0  3   0x4000082  thrsleep      syz-execprog
 20443  315228  22637      0  3   0x4000082  thrsleep      syz-execprog
 20443  321496  22637      0  3   0x4000082  thrsleep      syz-execprog
 20443  395764  22637      0  3   0x4000082  thrsleep      syz-execprog
 20443  261453  22637      0  3   0x4000082  thrsleep      syz-execprog
 20443  444214  22637      0  3   0x4000082  kqread        syz-execprog
 22637  331214  29853      0  3    0x10008a  pause         ksh
 29853  215402  63743      0  3        0x92  select        sshd
 41624  359930      1      0  3    0x100083  ttyin         getty
 63743  353468      1      0  3        0x80  select        sshd
 72874  459548    429     74  3    0x100092  bpf           pflogd
   429  447148      1      0  3        0x80  netio         pflogd
  8982  129626  11831     73  3    0x100090  kqread        syslogd
 11831  234052      1      0  3    0x100082  netio         syslogd
 73687   85203      1     77  3    0x100090  poll          dhclient
 23513    2481      1      0  3        0x80  poll          dhclient
 37129  472318      0      0  3     0x14200  pgzero        zerothread
 93612  198165      0      0  3     0x14200  aiodoned      aiodoned
 91924  329769      0      0  3     0x14200  syncer        update
 72336  375675      0      0  3     0x14200  cleaner       cleaner
 36043  278028      0      0  3     0x14200  reaper        reaper
 35395  126339      0      0  3     0x14200  pgdaemon      pagedaemon
 95711   31691      0      0  3     0x14200  bored         crynlk
 33224  175211      0      0  3     0x14200  bored         crypto
 75911   30836      0      0  3  0x40014200  acpi0         acpi0
 27633  435410      0      0  3  0x40014200                idle1
 48884  332799      0      0  3     0x14200  bored         softnet
 72101  391742      0      0  3     0x14200  bored         systqmp
 87152  375043      0      0  3     0x14200  bored         systq
 11277  412940      0      0  3  0x40014200  bored         softclock
 77481      77      0      0  3  0x40014200                idle0
 37736   16445      0      0  3     0x14200  bored         smr
     1  489779      0      0  3        0x82  wait          init
     0       0     -1      0  3     0x10200  scheduler     swapper
ddb{0}> show all locks
Process 1314 (syz-executor.0) thread 0xffff800020ab1160 (403766)
exclusive kernel_lock &kernel_lock r = 1 (0xffffffff82622388)
#0  witness_lock+0x52e sys/kern/subr_witness.c:1163
#1  syscall+0x400 mi_syscall sys/sys/syscall_mi.h:83 [inline]
#1  syscall+0x400 sys/arch/amd64/amd64/trap.c:555
#2  Xsyscall+0x128
ddb{0}> show malloc
           Type InUse  MemUse  HighUse   Limit  Requests Type Lim Kern Lim
         devbuf  9453   6383K    6449K  78643K     10548        0        0
            pcb    13      8K       8K  78643K        15        0        0
         rtable    63      2K       2K  78643K       169        0        0
         ifaddr    26      8K       9K  78643K        34        0        0
       counters    39     33K      33K  78643K        39        0        0
       ioctlops     0      0K       4K  78643K      1468        0        0
          mount     1      1K       1K  78643K         1        0        0
         vnodes  1182     74K      74K  78643K      1188        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     3      8K      12K  78643K        18        0        0
           proc    59     63K      83K  78643K       384        0        0
    NFS srvsock     1      0K       0K  78643K         1        0        0
     NFS daemon     1     16K      16K  78643K         1        0        0
       in_multi    11      0K       1K  78643K        22        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       199        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    76     12K      12K  78643K       960        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         7        0        0
           temp    41   3544K    3606K  78643K      3338        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        4    0        2     1     0     1     1     0     8    0
plcache    128       20    0        0     1     0     1     1     0     8    0
rtpcb       80       18    0       15     1     0     1     1     0     8    0
rtentry    112       34    0       11     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     2     0     1     0     8    0
tcpcb      544        8    0        5     1     0     1     1     0     8    0
inpcb      280       34    0       27     1     0     1     1     0     8    0
nd6         48        2    0        2     1     0     1     1     0     8    1
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       11    0        2     1     0     1     1     0     8    0
pfstkey    112       11    0        2     1     0     1     1     0     8    0
pfstate    328       11    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      167    0       47    11     0    11    11     0     8    2
art_table   32      168    0       47     2     0     2     2     0     8    0
art_node    16       33    0       12     1     0     1     1     0     8    0
dirhash    1024      17    0        0     3     0     3     3     0     8    0
dino1pl    128     1422    0       20    46     0    46    46     0     8    0
ffsino     272     1422    0       20    94     0    94    94     0     8    0
nchpl      144     1661    0       49    60     0    60    60     0     8    0
uvmvnodes   72     1434    0        0    27     0    27    27     0     8    0
vnodes     208     1434    0        0    76     0    76    76     0     8    0
namei      1024    4146    0     4146     2     1     1     1     0     8    1
percpumem   16       30    0        0     1     0     1     1     0     8    0
scxspl     192     4243    0     4243     9     8     1     7     0     8    1
plimitpl   152       15    0        8     1     0     1     1     0     8    0
sigapl     432      226    0      212     2     0     2     2     0     8    0
futexpl     56       10    0        9     1     0     1     1     0     8    0
knotepl    112       40    0       28     1     0     1     1     0     8    0
kqueuepl   104        4    0        0     1     0     1     1     0     8    0
pipepl     112      154    0      141     2     1     1     1     0     8    0
fdescpl    488      227    0      212     3     0     3     3     0     8    0
filepl     152     1128    0     1064     3     0     3     3     0     8    0
lockfpl    104        5    0        4     1     0     1     1     0     8    0
lockfspl    48        3    0        2     1     0     1     1     0     8    0
sessionpl  112       19    0        9     1     0     1     1     0     8    0
pgrppl      48       19    0        9     1     0     1     1     0     8    0
ucredpl     96       52    0       43     1     0     1     1     0     8    0
zombiepl   144      212    0      212     2     1     1     1     0     8    1
processpl  896      242    0      212     4     0     4     4     0     8    0
procpl     632      253    0      212     4     0     4     4     0     8    0
srpgc       64        2    0        2     1     0     1     1     0     8    1
sockpl     384       81    0       61     2     0     2     2     0     8    0
mcl4k      4096       1    0        0     1     0     1     1     0     8    0
mcl2k      2048      81    0        0    10     0    10    10     0     8    0
mtagpl      80        1    0        0     1     0     1     1     0     8    0
mbufpl     256      184    0        0    10     0    10    10     0     8    0
bufpl      256     5886    0     1315   286     0   286   286     0     8    0
anonpl      16    22252    0    20614    15     2    13    13     0   124    6
amapchunkpl 152     806    0      734     5     0     5     5     0   158    2
amappl16   192      138    0      107     2     0     2     2     0     8    0
amappl14   176       35    0       30     2     1     1     1     0     8    0
amappl12   160        5    0        4     2     1     1     1     0     8    0
amappl11   152       54    0       39     1     0     1     1     0     8    0
amappl10   144       17    0       14     1     0     1     1     0     8    0
amappl9    136      463    0      457     1     0     1     1     0     8    0
amappl8    128      130    0      118     1     0     1     1     0     8    0
amappl7    120       33    0       30     1     0     1     1     0     8    0
amappl6    112       81    0       70     1     0     1     1     0     8    0
amappl5    104      122    0      109     1     0     1     1     0     8    0
amappl4     96      495    0      468     1     0     1     1     0     8    0
amappl3     88      118    0      112     1     0     1     1     0     8    0
amappl2     80      958    0      891     3     0     3     3     0     8    1
amappl1     72    15309    0    14874    26     8    18    20     0     8    8
amappl      80      483    0      451     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
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       17    0       17     1     1     0     1     0     8    0
aobjpl      64        1    0        0     1     0     1     1     0     8    0
uaddrrnd    24      227    0      212     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24      227    0      212     1     0     1     1     0     8    0
vmmpekpl   168     6421    0     6399     2     0     2     2     0     8    0
vmmpepl    168    32710    0    31723    94    14    80    80     0   357   37
vmsppl     368      226    0      212     2     0     2     2     0     8    0
pdppl      4096     461    0      424     6     0     6     6     0     8    1
pvpl        32   112565    0   108479   119     4   115   115     0   265   81
pmappl     232      226    0      212     1     0     1     1     0     8    0
extentpl    40       41    0       26     1     0     1     1     0     8    0
phpool     112      431    0        4    13     0    13    13     0     8    0
ddb{0}> 

Crashes (2):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-openbsd-multicore 2019/10/19 22:31 openbsd b1a121060c68 8c88c9c1 .config log report syz
ci-openbsd-multicore 2019/10/19 22:06 openbsd b1a121060c68 8c88c9c1 .config log report
* Struck through repros no longer work on HEAD.