syzbot


pool: free list modified: semupl

Status: fixed on 2019/02/08 08:15
Reported-by: syzbot+ac1d7685deab53b95ace@syzkaller.appspotmail.com
Fix commit: When freeing the sem_undo structure in semundo_adjust(), update the
First crash: 2031d, last: 1909d

Sample crash report:
panic: pool_do_get: semupl free list modified: page 0xfffffd806ed2f000; item addr 0xfffffd806ed2fe00; offset 0x10=0xdeaf4153
Stopped at      db_enter+0x18:  addq    $0x8,%rsp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
*365791  33244      0           0          0    1K syz-executor2005
 380075  40611      0        0x12          0    0  sshd
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:399
panic() at panic+0x16c sys/kern/subr_prf.c:208
pool_do_get(d10a8966aaa08f6e,2,ffffffff822fbb50) at pool_do_get+0x4bc sys/kern/subr_pool.c:750
pool_get() at pool_get+0x104 sys/kern/subr_pool.c:587
semundo_adjust(720e511c7c24f638,0,ffff800020c04de8,3,ffff800020c04dee) at semundo_adjust+0xee semu_alloc sys/kern/sysv_sem.c:92 [inline]
semundo_adjust(720e511c7c24f638,0,ffff800020c04de8,3,ffff800020c04dee) at semundo_adjust+0xee sys/kern/sysv_sem.c:135
sys_semop(7f95ac01b9b37c20,0,ffff800020be44c0) at sys_semop+0x797 sys/kern/sysv_sem.c:703
syscall(707e873ebaf652ec) at syscall+0x5a0 mi_syscall sys/sys/syscall_mi.h:99 [inline]
syscall(707e873ebaf652ec) at syscall+0x5a0 sys/arch/amd64/amd64/trap.c:583
Xsyscall(6,0,22e,0,7f7ffffec6e0,0) at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffec720, count: 7
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{1}> 
ddb{1}> set $lines = 0
ddb{1}> show panic
pool_do_get: semupl free list modified: page 0xfffffd806ed2f000; item addr 0xfffffd806ed2fe00; offset 0x10=0xdeaf4153
ddb{1}> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:399
panic() at panic+0x16c sys/kern/subr_prf.c:208
pool_do_get(d10a8966aaa08f6e,2,ffffffff822fbb50) at pool_do_get+0x4bc sys/kern/subr_pool.c:750
pool_get() at pool_get+0x104 sys/kern/subr_pool.c:587
semundo_adjust(720e511c7c24f638,0,ffff800020c04de8,3,ffff800020c04dee) at semundo_adjust+0xee semu_alloc sys/kern/sysv_sem.c:92 [inline]
semundo_adjust(720e511c7c24f638,0,ffff800020c04de8,3,ffff800020c04dee) at semundo_adjust+0xee sys/kern/sysv_sem.c:135
sys_semop(7f95ac01b9b37c20,0,ffff800020be44c0) at sys_semop+0x797 sys/kern/sysv_sem.c:703
syscall(707e873ebaf652ec) at syscall+0x5a0 mi_syscall sys/sys/syscall_mi.h:99 [inline]
syscall(707e873ebaf652ec) at syscall+0x5a0 sys/arch/amd64/amd64/trap.c:583
Xsyscall(6,0,22e,0,7f7ffffec6e0,0) at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffec720, count: -8
ddb{1}> show registers
rdi                                0
rsi                              0x1
rbp               0xffff800020c04b30
rbx               0xffff800020c04bd0
rdx               0xffffffff81f31b5c    cy_pio_rec+0x15d8
rcx                            0x201
rax                              0x1
r8                0xffffffff81b488b4    kprintf+0x174
r9                               0x1
r10               0x5961057003919bfe
r11               0x91e5fe029ab1389e
r12                     0x3000000008
r13               0xffff800020c04b40
r14                            0x100
r15                              0x1
rip               0xffffffff8135b538    db_enter+0x18
cs                               0x8
rflags                         0x246
rsp               0xffff800020c04b20
ss                              0x10
db_enter+0x18:  addq    $0x8,%rsp
ddb{1}> show proc
PROC (syz-executor2005) pid=365791 stat=onproc
    flags process=0 proc=0
    pri=51, usrpri=51, nice=20
    forw=0xffffffffffffffff, list=0xffff800020be5078,0xffffffff822fd4d8
    process=0xffff800020bca6a8 user=0xffff800020c00000, vmspace=0xfffffd806e923440
    estcpu=1, cpticks=2, pctcpu=0.0
    user=0, sys=2, intr=0
ddb{1}> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
*33244  365791  41592      0  7           0                syz-executor2005
 41592  227912  78535      0  3        0x82  nanosleep     syz-executor2005
 78535  115543  40611      0  3    0x10008a  pause         ksh
 40611  380075  67739      0  7        0x12                sshd
 10001  146679      1      0  3    0x100083  ttyin         getty
 67739  246502      1      0  3        0x80  select        sshd
 99007    2662   2240     73  3    0x100090  kqread        syslogd
  2240  114204      1      0  3    0x100082  netio         syslogd
 97780  480017      1     77  3    0x100090  poll          dhclient
 40439  437524      1      0  3        0x80  poll          dhclient
 55893  238785      0      0  3     0x14200  pgzero        zerothread
 78618  451373      0      0  3     0x14200  aiodoned      aiodoned
 81369  219966      0      0  3     0x14200  syncer        update
  3827  239647      0      0  3     0x14200  cleaner       cleaner
  7087  401020      0      0  3     0x14200  reaper        reaper
 76019  382624      0      0  3     0x14200  pgdaemon      pagedaemon
 58593  162403      0      0  3     0x14200  bored         crynlk
 84496  362342      0      0  3     0x14200  bored         crypto
 96415   49265      0      0  3  0x40014200  acpi0         acpi0
 26680  272494      0      0  3  0x40014200                idle1
 70891  456264      0      0  3     0x14200  bored         softnet
 13996  447313      0      0  3     0x14200  bored         systqmp
 84368  491029      0      0  3     0x14200  bored         systq
 90467  407245      0      0  3  0x40014200  bored         softclock
 32237  243883      0      0  3  0x40014200                idle0
     1  365921      0      0  3        0x82  wait          init
     0       0     -1      0  3     0x10200  scheduler     swapper
ddb{1}> show all locks
CPU 1:
exclusive mutex semupl r = 0 (0xffffffff822fbb60) locked @ /syzkaller/managers/multicore/kernel/sys/kern/subr_pool.c:583
Process 33244 (syz-executor2005) thread 0xffff800020be44c0 (365791)
exclusive kernel_lock &kernel_lock r = 0 (0xffffffff822d88a8) locked @ /syzkaller/managers/multicore/kernel/sys/sys/syscall_mi.h:90
exclusive mutex semupl r = 0 (0xffffffff822fbb60) locked @ /syzkaller/managers/multicore/kernel/sys/kern/subr_pool.c:583
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  1166     73K      73K  78643K      1171        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     4      0K       0K  78643K         4        0        0
        dirhash    12      2K       2K  78643K        12        0        0
           ACPI  1792    194K     288K  78643K     12592        0        0
      file desc     1      0K       0K  78643K         1        0        0
           proc    40     38K      46K  78643K       201        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       149        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    47      2K       3K  78643K       663        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   2347K    2411K  78643K      1690        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       22    0       16     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     1     0     1     1     0     8    1
tcpcb      544        8    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       96    0        0     6     0     6     6     0     8    0
art_table   32       97    0        0     1     0     1     1     0     8    0
art_node    16       22    0        2     1     0     1     1     0     8    0
semupl     112        1    0        1     1     0     1     1     0     8    1
pool(0xffffffff822fbb50:semupl): page inconsistency: page 0xfffffd806ed2f000; 34 on list, 0 missing, 35 items per page
semapl     112        2    0        0     1     0     1     1     0     8    0
dirhash    1024      17    0        0     3     0     3     3     0     8    0
dino1pl    128     1381    0       16    45     0    45    45     0     8    0
ffsino     272     1381    0       16    91     0    91    91     0     8    0
nchpl      144     1553    0       30    57     0    57    57     0     8    0
uvmvnodes   72     1390    0        0    26     0    26    26     0     8    0
vnodes     200     1390    0        0    74     0    74    74     0     8    0
namei      1024    3255    0     3255     2     1     1     1     0     8    1
percpumem   16       30    0        0     1     0     1     1     0     8    0
scxspl     192     2350    0     2350     9     2     7     7     0     8    7
sigapl     432      175    0      164     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      114    0      107     2     1     1     1     0     8    0
fdescpl    488      176    0      164     2     0     2     2     0     8    0
filepl     152      807    0      765     2     0     2     2     0     8    0
lockfpl    104        6    0        6     1     1     0     1     0     8    0
lockfspl    32        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      164    0      164     2     1     1     1     0     8    1
processpl  840      190    0      164     4     0     4     4     0     8    0
procpl     600      190    0      164     3     0     3     3     0     8    0
sockpl     384       64    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       74    0        0     5     0     5     5     0     8    0
bufpl      256     2001    0      261   109     0   109   109     0     8    0
anonpl      16    17042    0    15940     8     2     6     7     0   125    1
amapchunkpl 152     523    0      487     2     0     2     2     0   158    0
amappl16   192       69    0       64     1     0     1     1     0     8    0
amappl15   184        1    0        1     1     1     0     1     0     8    0
amappl14   176        1    0        1     1     1     0     1     0     8    0
amappl13   168       16    0       13     1     0     1     1     0     8    0
amappl12   160        6    0        6     1     0     1     1     0     8    1
amappl11   152      172    0      163     1     0     1     1     0     8    0
amappl10   144       42    0       42     2     1     1     1     0     8    1
amappl9    136      201    0      200     1     0     1     1     0     8    0
amappl8    128      100    0       94     1     0     1     1     0     8    0
amappl7    120       30    0       26     1     0     1     1     0     8    0
amappl6    112       39    0       34     1     0     1     1     0     8    0
amappl5    104      143    0      131     1     0     1     1     0     8    0
amappl4     96      256    0      237     1     0     1     1     0     8    0
amappl3     88      112    0      107     1     0     1     1     0     8    0
amappl2     80      552    0      517     1     0     1     1     0     8    0
amappl1     72    11453    0    11062    16     6    10    16     0     8    0
amappl      72      379    0      359     1     0     1     1     0    75    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      176    0      164     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24      176    0      164     1     0     1     1     0     8    0
vmmpekpl   168     5120    0     5100     1     0     1     1     0     8    0
vmmpepl    168    23323    0    22619    53    19    34    47     0   357    3
vmsppl     360      175    0      164     2     0     2     2     0     8    0
pdppl      4096     359    0      328     5     0     5     5     0     8    0
pvpl        32    69966    0    67215    30     4    26    26     0   265    3
pmappl     224      175    0      164     1     0     1     1     0     8    0
extentpl    40       39    0       25     1     0     1     1     0     8    0
phpool     112      233    0        3     7     0     7     7     0     8    0
ddb{1}> 

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/02/02 01:29 openbsd d98374d3ab41 564f9a4f .config console log report syz C ci-openbsd-multicore
2019/02/02 00:44 openbsd d98374d3ab41 564f9a4f .config console log report ci-openbsd-multicore
2019/01/16 15:20 openbsd 17e34b32ed8c 352bac0d .config console log report ci-openbsd-main
2018/12/30 10:03 openbsd 1a6243b7c046 35e3f847 .config console log report ci-openbsd-multicore
2018/11/27 13:11 openbsd 5e80c341c144 4ad46ab4 console log report ci-openbsd-main
2018/10/02 14:42 openbsd 44df374beffd a316a2af console log report ci-openbsd-main
* Struck through repros no longer work on HEAD.