syzbot


uvm_fault: mrt_ioctl

Status: fixed on 2019/06/04 23:55
Reported-by: syzbot+156405fdea9f2ab15d40@syzkaller.appspotmail.com
Fix commit: a8f2b5c7d3d3 Add missing NULL check for the protocol control block (pcb) pointer in mrt{6,}_ioctl. Calling shutdown(2) on the socket prior to the ioctl command can cause it to be NULL.
First crash: 1273d, last: 1273d

Sample crash report:
login: uvm_fault(0xfffffd806e8d9a18, 0x110, 0, 1) -> e
kernel: page fault trap, code=0
Stopped at      mrt_ioctl+0x35: movl    0x110(%r13),%eax
ddb{0}> 
ddb{0}> set $lines = 0
ddb{0}> set $maxwidth = 0
ddb{0}> show panic
kernel page fault
uvm_fault(0xfffffd806e8d9a18, 0x110, 0, 1) -> e
mrt_ioctl(fffffd806ea8c908,c0287533,ffff800020ba72c0) at mrt_ioctl+0x35 sys/netinet/ip_mroute.c:262
end trace frame: 0xffff800020ba73c0, count: 0
ddb{0}> trace
mrt_ioctl(fffffd806ea8c908,c0287533,ffff800020ba72c0) at mrt_ioctl+0x35 sys/netinet/ip_mroute.c:262
sys_ioctl(ffff800020b85120,ffff800020ba73d8,ffff800020ba7440) at sys_ioctl+0x5b8
syscall(ffff800020ba74b0) at syscall+0x552 mi_syscall sys/sys/syscall_mi.h:90 [inline]
syscall(ffff800020ba74b0) at syscall+0x552 sys/arch/amd64/amd64/trap.c:554
Xsyscall(6,0,524d28d3000,0,7f7fffffaf38,7f7fffffaf28) at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7fffffaeb0, count: -4
ddb{0}> show registers
rdi               0xfffffd806ea8c908
rsi                       0xc0287533
rbp               0xffff800020ba72b0
rbx               0xffff800020ba72c0
rdx               0xffff800020ba72c0
rcx                              0x2
rax                       0xc0287533
r8                0xffffffff816a9630    in_control+0x30
r9                               0x7
r10               0x304a699bdbf987da
r11               0xcfb596645a1e0322
r12               0xfffffd806ea8c908
r13                                0
r14               0xffff800020b85120
r15                       0xc0287533
rip               0xffffffff819bd9f5    mrt_ioctl+0x35
cs                               0x8
rflags                       0x10246    __ALIGN_SIZE+0xf246
rsp               0xffff800020ba7250
ss                              0x10
mrt_ioctl+0x35: movl    0x110(%r13),%eax
ddb{0}> show proc
PROC (syz-executor7763) pid=153833 stat=onproc
    flags process=2<EXEC> proc=0
    pri=52, usrpri=52, nice=20
    forw=0xffffffffffffffff, list=0xffff800020b84280,0xffffffff8239ddd0
    process=0xffff800020b8d080 user=0xffff800020ba2000, vmspace=0xfffffd806e8d9a18
    estcpu=2, cpticks=1, pctcpu=0.0
    user=0, sys=1, intr=0
ddb{0}> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
*64530  153833     82      0  7         0x2                syz-executor7763
    82   41255   4842      0  3    0x10008a  pause         ksh
  4842  321022  89263      0  7        0x12                sshd
 68450  320935      1      0  3    0x100083  ttyin         getty
 89263  445803      1      0  3        0x80  select        sshd
 88164  246998  64698     73  2    0x100090                syslogd
 64698  390397      1      0  3    0x100082  netio         syslogd
 32868  353400      1     77  3    0x100090  poll          dhclient
 35835  239090      1      0  3        0x80  poll          dhclient
 62868  391343      0      0  2     0x14200                zerothread
 78792   49546      0      0  3     0x14200  aiodoned      aiodoned
 89879  425894      0      0  3     0x14200  syncer        update
 86419  290332      0      0  3     0x14200  cleaner       cleaner
 24136  201536      0      0  3     0x14200  reaper        reaper
 67862  517514      0      0  3     0x14200  pgdaemon      pagedaemon
 44010  206150      0      0  3     0x14200  bored         crynlk
 79932  155527      0      0  3     0x14200  bored         crypto
 37622   25746      0      0  3  0x40014200  acpi0         acpi0
 88736  516607      0      0  3  0x40014200                idle1
 59112  469557      0      0  3     0x14200  bored         softnet
 55298  213957      0      0  3     0x14200  bored         systqmp
 80245   74659      0      0  3     0x14200  bored         systq
 45390   83615      0      0  2  0x40014200                softclock
  6184  232300      0      0  3  0x40014200                idle0
  8830   57632      0      0  3     0x14200  bored         smr
     1  304446      0      0  3        0x82  wait          init
     0       0     -1      0  3     0x10200  scheduler     swapper
ddb{0}> show all locks
Process 64530 (syz-executor7763) thread 0xffff800020b85120 (153833)
exclusive kernel_lock &kernel_lock r = 1 (0xffffffff82388510)
#0  witness_lock+0x52e sys/kern/subr_witness.c:1161
#1  syscall+0x412 mi_syscall sys/sys/syscall_mi.h:81 [inline]
#1  syscall+0x412 sys/arch/amd64/amd64/trap.c:554
#2  Xsyscall+0x128
ddb{0}> show malloc
           Type InUse  MemUse  HighUse   Limit  Requests Type Lim Kern Lim
         devbuf  9442   6316K    6317K  78643K     10529        0        0
            pcb    23      9K       9K  78643K        55        0        0
         rtable    61      2K       2K  78643K       115        0        0
         ifaddr    21      7K       7K  78643K        21        0        0
       counters    39     33K      33K  78643K        39        0        0
       ioctlops     0      0K       2K  78643K        13        0        0
          mount     1      1K       1K  78643K         1        0        0
         vnodes  1174     74K      74K  78643K      1179        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     12628        0        0
      file desc     1      0K       0K  78643K         1        0        0
           proc    40     38K      46K  78643K       207        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       152        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    51      2K       3K  78643K       703        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     3      0K       0K  78643K         3        0        0
           temp    30   2715K    2779K  78643K      1720        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
inpcbpl    280       23    0       17     1     0     1     1     0     8    0
plcache    128       20    0        0     1     0     1     1     0     8    0
rtentry    112       23    0        1     1     0     1     1     0     8    0
syncache   264        5    0        5     1     0     1     1     0     8    1
tcpcb      544        9    0        5     1     0     1     1     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     1385    0       16    45     0    45    45     0     8    0
ffsino     272     1385    0       16    92     0    92    92     0     8    0
nchpl      144     1558    0       30    57     0    57    57     0     8    0
uvmvnodes   72     1394    0        0    26     0    26    26     0     8    0
vnodes     200     1394    0        0    74     0    74    74     0     8    0
namei      1024    3280    0     3280     2     1     1     1     0     8    1
percpumem   16       30    0        0     1     0     1     1     0     8    0
scxspl     192     2386    0     2386     8     7     1     6     0     8    1
plimitpl   152       13    0        8     1     0     1     1     0     8    0
sigapl     432      176    0      166     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      118    0      111     2     1     1     1     0     8    0
fdescpl    488      177    0      166     2     0     2     2     0     8    0
filepl     152      817    0      774     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       17    0        9     1     0     1     1     0     8    0
pgrppl      48       17    0        9     1     0     1     1     0     8    0
ucredpl     96       47    0       40     1     0     1     1     0     8    0
zombiepl   144      166    0      166     2     1     1     1     0     8    1
processpl  840      192    0      166     4     0     4     4     0     8    0
procpl     624      192    0      166     3     0     3     3     0     8    0
sockpl     384       65    0       48     2     0     2     2     0     8    0
mcl4k      4096       2    0        0     1     0     1     1     0     8    0
mcl2k      2048      56    0        0     7     0     7     7     0     8    0
mtagpl      80        1    0        0     1     0     1     1     0     8    0
mbufpl     256       77    0        0     5     0     5     5     0     8    0
bufpl      256     2054    0      258   113     0   113   113     0     8    0
anonpl      16    17436    0    16317     7     1     6     6     0   125    1
amapchunkpl 152     491    0      456     2     0     2     2     0   158    0
amappl16   192       76    0       71     1     0     1     1     0     8    0
amappl14   176       14    0       13     2     1     1     1     0     8    0
amappl12   160        7    0        7     1     0     1     1     0     8    1
amappl11   152       44    0       30     1     0     1     1     0     8    0
amappl10   144       45    0       45     2     1     1     1     0     8    1
amappl9    136      370    0      369     1     0     1     1     0     8    0
amappl8    128       86    0       82     1     0     1     1     0     8    0
amappl7    120       17    0       15     1     0     1     1     0     8    0
amappl6    112       41    0       37     1     0     1     1     0     8    0
amappl5    104      137    0      127     1     0     1     1     0     8    0
amappl4     96      315    0      296     1     0     1     1     0     8    0
amappl3     88      154    0      144     1     0     1     1     0     8    0
amappl2     80      728    0      679     3     1     2     2     0     8    0
amappl1     72    11657    0    11272    14     4    10    14     0     8    0
amappl      80      369    0      350     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      177    0      166     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24      177    0      166     1     0     1     1     0     8    0
vmmpekpl   168     5274    0     5255     1     0     1     1     0     8    0
vmmpepl    168    25093    0    24369    51    15    36    44     0   357    4
vmsppl     368      176    0      166     2     0     2     2     0     8    0
pdppl      4096     362    0      332     5     0     5     5     0     8    0
pvpl        32    71325    0    68578    31     4    27    27     0   265    4
pmappl     232      176    0      166     1     0     1     1     0     8    0
extentpl    40       41    0       26     1     0     1     1     0     8    0
phpool     112      244    0        3     7     0     7     7     0     8    0

Crashes (2):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-openbsd-setuid 2019/06/04 00:09 openbsd 0bb0865d8b1d ce07a7ae .config log report syz C
ci-openbsd-setuid 2019/06/03 23:41 openbsd 0bb0865d8b1d ce07a7ae .config log report
* Struck through repros no longer work on HEAD.