syzbot


uvm_fault: mrt6_ioctl

Status: fixed on 2019/06/04 23:55
Reported-by: syzbot+bdc489ecb509995a21ed@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: 1789d, last: 1789d

Sample crash report:
login: uvm_fault(0xfffffd806e8f4878, 0x110, 0, 1) -> e
kernel: page fault trap, code=0
Stopped at      mrt6_ioctl+0xa2:        movl    0x110(%r12),%r15d
ddb{1}> 
ddb{1}> set $lines = 0
ddb{1}> set $maxwidth = 0
ddb{1}> show panic
kernel page fault
uvm_fault(0xfffffd806e8f4878, 0x110, 0, 1) -> e
mrt6_ioctl(fffffd806ea94c08,c028756b,ffff800020ba7c10) at mrt6_ioctl+0xa2 get_mif6_cnt sys/netinet6/ip6_mroute.c:306 [inline]
mrt6_ioctl(fffffd806ea94c08,c028756b,ffff800020ba7c10) at mrt6_ioctl+0xa2 sys/netinet6/ip6_mroute.c:256
end trace frame: 0xffff800020ba7d10, count: 0
ddb{1}> trace
mrt6_ioctl(fffffd806ea94c08,c028756b,ffff800020ba7c10) at mrt6_ioctl+0xa2 get_mif6_cnt sys/netinet6/ip6_mroute.c:306 [inline]
mrt6_ioctl(fffffd806ea94c08,c028756b,ffff800020ba7c10) at mrt6_ioctl+0xa2 sys/netinet6/ip6_mroute.c:256
sys_ioctl(ffff800020b85078,ffff800020ba7d38,ffff800020ba7da0) at sys_ioctl+0x5b8
syscall(ffff800020ba7e10) at syscall+0x552 mi_syscall sys/sys/syscall_mi.h:99 [inline]
syscall(ffff800020ba7e10) at syscall+0x552 sys/arch/amd64/amd64/trap.c:574
Xsyscall(6,0,e7d3efec000,0,7f7ffffd3da8,7f7ffffd3d98) at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffd3d20, count: -4
ddb{1}> show registers
rdi                                0
rsi                                0
rbp               0xffff800020ba7c00
rbx               0xffff80000066e000
rdx                              0x1
rcx                                0
rax                              0xd
r8                0xffffffff81937b14    mrt6_ioctl+0x44
r9                               0x7
r10               0xb6bdb82d09df9263
r11               0x987b58a3e6efcc74
r12                                0
r13                             0x28
r14               0xffff800020ba7c10
r15                       0xc028756b
rip               0xffffffff81937b72    mrt6_ioctl+0xa2
cs                               0x8
rflags                       0x10286    __ALIGN_SIZE+0xf286
rsp               0xffff800020ba7ba0
ss                              0x10
mrt6_ioctl+0xa2:        movl    0x110(%r12),%r15d
ddb{1}> show proc
PROC (syz-executor1923) pid=212281 stat=onproc
    flags process=2<EXEC> proc=0
    pri=50, usrpri=50, nice=20
    forw=0xffffffffffffffff, list=0xffff800020b844c0,0xffffffff82374f30
    process=0xffff800020b8c6a8 user=0xffff800020ba2000, vmspace=0xfffffd806e8f4878
    estcpu=0, cpticks=1, pctcpu=0.0
    user=0, sys=1, intr=0
ddb{1}> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
*30704  212281  25216      0  7         0x2                syz-executor1923
 25216  305106  96822      0  3    0x10008a  pause         ksh
 96822  292373   8286      0  7        0x12                sshd
 30785  122503      1      0  3    0x100083  ttyin         getty
  8286  176758      1      0  3        0x80  select        sshd
 78994  424446  41711     73  2    0x100090                syslogd
 41711  351014      1      0  3    0x100082  netio         syslogd
 82009   75731      1     77  3    0x100090  poll          dhclient
 78613  307554      1      0  3        0x80  poll          dhclient
 14202   69877      0      0  3     0x14200  pgzero        zerothread
 76992  231748      0      0  3     0x14200  aiodoned      aiodoned
 44397  497103      0      0  3     0x14200  syncer        update
 14132  277969      0      0  3     0x14200  cleaner       cleaner
 60655  455377      0      0  3     0x14200  reaper        reaper
 43393  408102      0      0  3     0x14200  pgdaemon      pagedaemon
 21821  251113      0      0  3     0x14200  bored         crynlk
 46736  405267      0      0  3     0x14200  bored         crypto
 49510  269869      0      0  3  0x40014200  acpi0         acpi0
 89516  469978      0      0  3  0x40014200                idle1
 45768  411813      0      0  3     0x14200  bored         softnet
 85451  116372      0      0  3     0x14200  bored         systqmp
 40672  155684      0      0  3     0x14200  bored         systq
 35261  269846      0      0  3  0x40014200  bored         softclock
 52315  211888      0      0  3  0x40014200                idle0
 58127   45024      0      0  3     0x14200  bored         smr
     1  163065      0      0  3        0x82  wait          init
     0       0     -1      0  3     0x10200  scheduler     swapper
ddb{1}> show all locks
Process 30704 (syz-executor1923) thread 0xffff800020b85078 (212281)
shared rwlock netlock r = 0 (0xffffffff821d55b8)
#0  witness_lock+0x52e sys/kern/subr_witness.c:1161
#1  mrt6_ioctl+0x91 mrt6_iflookupbymif sys/netinet6/ip6_mroute.c:1182 [inline]
#1  mrt6_ioctl+0x91 get_mif6_cnt sys/netinet6/ip6_mroute.c:306 [inline]
#1  mrt6_ioctl+0x91 sys/netinet6/ip6_mroute.c:256
#2  sys_ioctl+0x5b8
#3  syscall+0x552 mi_syscall sys/sys/syscall_mi.h:99 [inline]
#3  syscall+0x552 sys/arch/amd64/amd64/trap.c:574
#4  Xsyscall+0x128
exclusive kernel_lock &kernel_lock r = 1 (0xffffffff82373c68)
#0  witness_lock+0x52e sys/kern/subr_witness.c:1161
#1  syscall+0x43a mi_syscall sys/sys/syscall_mi.h:91 [inline]
#1  syscall+0x43a sys/arch/amd64/amd64/trap.c:574
#2  Xsyscall+0x128
ddb{1}> show malloc
           Type InUse  MemUse  HighUse   Limit  Requests Type Lim Kern Lim
         devbuf  9442   6315K    6316K  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    52      2K       3K  78643K       704        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   2711K    2775K  78643K      1720        0        0
      SYN cache     2     16K      16K  78643K         2        0        0
ddb{1}> 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
plimitpl   152       13    0        8     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     2     1     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     3     2     1     1     0     8    1
percpumem   16       30    0        0     1     0     1     1     0     8    0
scxspl     192     2396    0     2396    10     9     1     6     0     8    1
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     3     2     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     3     2     1     1     0     8    1
processpl  840      192    0      166     4     0     4     4     0     8    0
procpl     600      192    0      166     3     0     3     3     0     8    0
sockpl     384       65    0       48     2     0     2     2     0     8    0
mcl4k      4096       5    0        0     1     0     1     1     0     8    0
mcl2k      2048      84    0        0    11     0    11    11     0     8    0
mtagpl      80        1    0        0     1     0     1     1     0     8    0
mbufpl     256      130    0        0     8     1     7     7     0     8    0
bufpl      256     2055    0      258   113     0   113   113     0     8    0
anonpl      16    17439    0    16327     7     2     5     6     0   125    0
amapchunkpl 152     493    0      458     2     0     2     2     0   158    0
amappl16   192       71    0       65     1     0     1     1     0     8    0
amappl14   176       14    0       13     3     2     1     1     0     8    0
amappl12   160       10    0       10     1     1     0     1     0     8    0
amappl11   152       39    0       25     1     0     1     1     0     8    0
amappl10   144       46    0       46     3     2     1     1     0     8    1
amappl9    136      385    0      383     1     0     1     1     0     8    0
amappl8    128       85    0       81     1     0     1     1     0     8    0
amappl7    120       14    0       13     1     0     1     1     0     8    0
amappl6    112       41    0       37     1     0     1     1     0     8    0
amappl5    104      114    0      102     1     0     1     1     0     8    0
amappl4     96      324    0      306     1     0     1     1     0     8    0
amappl3     88      155    0      145     1     0     1     1     0     8    0
amappl2     80      728    0      680     4     2     2     2     0     8    1
amappl1     72    11678    0    11302    14     5     9    14     0     8    0
amappl      80      370    0      351     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     5271    0     5252     1     0     1     1     0     8    0
vmmpepl    168    24940    0    24222    56    21    35    43     0   357    3
vmsppl     360      176    0      166     2     0     2     2     0     8    0
pdppl      4096     362    0      332     5     0     5     5     0     8    0
pvpl        32    71404    0    68656    38    11    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      247    0        5     7     0     7     7     0     8    0

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/05/24 01:56 openbsd df989dde9731 0dadcd9d .config console log report syz C ci-openbsd-setuid
2019/05/24 01:36 openbsd df989dde9731 0dadcd9d .config console log report ci-openbsd-setuid
* Struck through repros no longer work on HEAD.