syzbot


panic: timeout_add: to_ticks < 0 (3)

Status: fixed on 2019/04/26 02:50
Reported-by: syzbot+6771e3d6d9567b3983aa@syzkaller.appspotmail.com
Fix commit: 1af424413523 Lower the accepted upper bound for bd_rtout to INT_MAX in order to prevent passing negative values to timeout_add().
First crash: 1837d, last: 1837d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
openbsd panic: timeout_add: to_ticks < 0 (2) syz 12 1848d 1849d 3/3 fixed on 2019/04/04 06:46
openbsd panic: timeout_add: to_ticks < 0 C 66 1890d 1894d 3/3 fixed on 2019/02/20 21:58

Sample crash report:
panic: timeout_add: to_ticks (-100) < 0
Stopped at      db_enter+0x18:  addq    $0x8,%rsp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
*190935  82984      0           0  0x4000000    0  syz-executor.0
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic() at panic+0x15c sys/kern/subr_prf.c:208
timeout_add(ffff8000149e4c70,ffffff9c) at timeout_add+0x17f sys/kern/kern_timeout.c:190
msleep(ffff80000410b900,ffff80000410b908,11a,ffffffff81f0c55d,ffffff9c) at msleep+0x17c sleep_setup_timeout sys/kern/kern_synch.c:330 [inline]
msleep(ffff80000410b900,ffff80000410b908,11a,ffffffff81f0c55d,ffffff9c) at msleep+0x17c sys/kern/kern_synch.c:210
bpfread(21700,ffff800014a1b948,0) at bpfread+0x1ef sys/net/bpf.c:486
spec_read(ffff800014a1b788) at spec_read+0xe9 sys/kern/spec_vnops.c:223
VOP_READ(fffffd803ce3c8c0,ffff800014a1b948,0,fffffd803f7c6b40) at VOP_READ+0x63 sys/kern/vfs_vops.c:247
vn_read(fffffd80361f45a8,ffff800014a1b948,0) at vn_read+0x1c3 sys/kern/vfs_vnops.c:365
dofilereadv(ffff8000149e4bd0,3,ffff800014a1b948,0,ffff800014a1ba60) at dofilereadv+0x19f sys/kern/sys_generic.c:236
sys_read(ffff8000149e4bd0,ffff800014a1b9f8,ffff800014a1ba60) at sys_read+0x83 sys/kern/sys_generic.c:156
syscall(ffff800014a1bad0) at syscall+0x511
Xsyscall(6,0,ffffffffffffffb9,0,3,b0c654bf010) at Xsyscall+0x128
end of kernel
end trace frame: 0x2a6, count: 3
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> 
ddb> set $lines = 0
ddb> set $maxwidth = 0
ddb> show panic
timeout_add: to_ticks (-100) < 0
ddb> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic() at panic+0x15c sys/kern/subr_prf.c:208
timeout_add(ffff8000149e4c70,ffffff9c) at timeout_add+0x17f sys/kern/kern_timeout.c:190
msleep(ffff80000410b900,ffff80000410b908,11a,ffffffff81f0c55d,ffffff9c) at msleep+0x17c sleep_setup_timeout sys/kern/kern_synch.c:330 [inline]
msleep(ffff80000410b900,ffff80000410b908,11a,ffffffff81f0c55d,ffffff9c) at msleep+0x17c sys/kern/kern_synch.c:210
bpfread(21700,ffff800014a1b948,0) at bpfread+0x1ef sys/net/bpf.c:486
spec_read(ffff800014a1b788) at spec_read+0xe9 sys/kern/spec_vnops.c:223
VOP_READ(fffffd803ce3c8c0,ffff800014a1b948,0,fffffd803f7c6b40) at VOP_READ+0x63 sys/kern/vfs_vops.c:247
vn_read(fffffd80361f45a8,ffff800014a1b948,0) at vn_read+0x1c3 sys/kern/vfs_vnops.c:365
dofilereadv(ffff8000149e4bd0,3,ffff800014a1b948,0,ffff800014a1ba60) at dofilereadv+0x19f sys/kern/sys_generic.c:236
sys_read(ffff8000149e4bd0,ffff800014a1b9f8,ffff800014a1ba60) at sys_read+0x83 sys/kern/sys_generic.c:156
syscall(ffff800014a1bad0) at syscall+0x511
Xsyscall(6,0,ffffffffffffffb9,0,3,b0c654bf010) at Xsyscall+0x128
end of kernel
end trace frame: 0x2a6, count: -12
ddb> show registers
rdi               0xffffffff8171b787    db_enter+0x17
rsi                           0x10fc    __ALIGN_SIZE+0xfc
rbp               0xffff800014a1b4c0
rbx               0xffff800014a1b570
rdx                           0x10fd    __ALIGN_SIZE+0xfd
rcx               0xffff800000d3d000
rax               0xffff800000d3d000
r8                0xffff800014a1b480
r9                               0x1
r10               0xffff800000936e40
r11               0xeb37b32c8993bbc3
r12                     0x3000000008
r13               0xffff800014a1b4d0
r14                            0x100
r15                              0x1
rip               0xffffffff8171b788    db_enter+0x18
cs                               0x8
rflags                         0x246
rsp               0xffff800014a1b4b0
ss                              0x10
db_enter+0x18:  addq    $0x8,%rsp
ddb> show proc
PROC (syz-executor.0) pid=190935 stat=onproc
    flags process=0 proc=4000000<THREAD>
    pri=26, usrpri=61, nice=20
    forw=0x0, list=0xffff8000149e4720,0xffffffff8220fb10
    process=0xffff8000ffff73c0 user=0xffff800014a16000, vmspace=0xfffffd803f014c60
    estcpu=26, cpticks=0, pctcpu=0.0
    user=0, sys=0, intr=0
ddb> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
 82984  193635  43617      0  2           0                syz-executor.0
*82984  190935  43617      0  7   0x4000000  bpf           syz-executor.0
 43617   55230  93473      0  3        0x82  nanosleep     syz-executor.0
 71566  313509  93473      0  3         0x2  biowait       syz-executor.1
 19367   18640      1      0  3    0x100083  ttyin         getty
 54527  152944      0      0  3     0x14200  bored         sosplice
 93473  133230  24084      0  3        0x82  thrsleep      syz-fuzzer
 93473  461603  24084      0  3   0x4000082  nanosleep     syz-fuzzer
 93473  479326  24084      0  3   0x4000082  thrsleep      syz-fuzzer
 93473   56100  24084      0  3   0x4000082  thrsleep      syz-fuzzer
 93473  134163  24084      0  3   0x4000082  kqread        syz-fuzzer
 93473  505980  24084      0  3   0x4000082  thrsleep      syz-fuzzer
 93473  184171  24084      0  3   0x4000082  thrsleep      syz-fuzzer
 93473  148241  24084      0  3   0x4000082  thrsleep      syz-fuzzer
 24084  443459  88106      0  3    0x10008a  pause         ksh
 88106  452863  19557      0  3        0x92  select        sshd
 19557  477347      1      0  3        0x80  select        sshd
 15011   23314  51106     73  3    0x100090  kqread        syslogd
 51106  298420      1      0  3    0x100082  netio         syslogd
 47239  320710      1     77  3    0x100090  poll          dhclient
 23940  238243      1      0  3        0x80  poll          dhclient
 95719    8367      0      0  2     0x14200                zerothread
 62477  334776      0      0  3     0x14200  aiodoned      aiodoned
 83312  425360      0      0  3     0x14200  syncer        update
 28078  234451      0      0  3     0x14200  cleaner       cleaner
 93402  105678      0      0  3     0x14200  reaper        reaper
 61945  194301      0      0  3     0x14200  pgdaemon      pagedaemon
 56102  368400      0      0  3     0x14200  bored         crynlk
 41427  184167      0      0  3     0x14200  bored         crypto
 50872  518127      0      0  3  0x40014200  acpi0         acpi0
 76696  473301      0      0  3     0x14200  bored         softnet
 10245  484376      0      0  3     0x14200  bored         systqmp
 74342  501151      0      0  3     0x14200  bored         systq
 76135  429556      0      0  3  0x40014200  bored         softclock
 91523    5136      0      0  3  0x40014200                idle0
 20616  396176      0      0  3     0x14200  bored         smr
     1  206118      0      0  3        0x82  wait          init
     0       0     -1      0  3     0x10200  scheduler     swapper
ddb> show all locks
No such command
ddb> show malloc
           Type InUse  MemUse  HighUse   Limit  Requests Type Lim Kern Lim
         devbuf  9597   6436K   14565K  78643K     45799        0        0
            pcb    23      9K      12K  78643K      8549        0        0
         rtable   103      4K       4K  78643K      7685        0        0
         ifaddr    82     27K      35K  78643K      2616        0        0
       counters    19     16K      16K  78643K        19        0        0
       ioctlops     0      0K       2K  78643K       412        0        0
            iov     0      0K      28K  78643K      2395        0        0
          mount     1      1K       1K  78643K         1        0        0
         vnodes  1186     74K      76K  78643K     15890        0        0
      UFS quota     1     32K      32K  78643K         1        0        0
      UFS mount     5     36K      36K  78643K         5        0        0
            shm     2      1K       9K  78643K       241        0        0
         VM map     2      0K       0K  78643K         2        0        0
            sem    12      0K       1K  78643K      2528        0        0
        dirhash    15      2K       2K  78643K        18        0        0
           ACPI  1793    195K     288K  78643K     12537        0        0
      file desc     5     13K      25K  78643K     18279        0        0
          sigio     0      0K       0K  78643K       302        0        0
           proc    42     30K      54K  78643K      4931        0        0
        subproc    64  65538K   69634K  78643K      4858        0        0
    NFS srvsock     1      0K       0K  78643K         1        0        0
     NFS daemon     1     16K      16K  78643K         1        0        0
    ip_moptions     0      0K       0K  78643K      2169        0        0
       in_multi    33      2K       2K  78643K      2213        0        0
    ether_multi     1      0K       0K  78643K       106        0        0
            mrt     0      0K       0K  78643K        32        0        0
    ISOFS mount     1     32K      32K  78643K         1        0        0
  MSDOSFS mount     1     16K      16K  78643K         1        0        0
           ttys   132    583K     583K  78643K       132        0        0
           exec     0      0K       1K  78643K      2362        0        0
     pfkey data     0      0K       0K  78643K        10        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   114     22K      31K  78643K     44048        0        0
       UVM aobj   130      6K       6K  78643K       138        0        0
        memdesc     1      4K       4K  78643K         1        0        0
    crypto data     1      1K       1K  78643K         1        0        0
    ip6_options     0      0K       1K  78643K       913        0        0
            NDP    20      0K       1K  78643K       890        0        0
           temp   226   2360K    3000K  78643K     65390        0        0
         kqueue     0      0K       0K  78643K       115        0        0
      SYN cache     2     16K      16K  78643K         2        0        0
ddb> show all pools
Name      Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle
arp         64      143    0      139     1     0     1     1     0     8    0
inpcbpl    280     8197    0     8190     1     0     1     1     0     8    0
plimitpl   152      686    0      679     1     0     1     1     0     8    0
rtentry    112     1292    0     1252     2     0     2     2     0     8    0
syncache   264        4    0        4     1     1     0     1     0     8    0
tcpcb      544     3044    0     3040     1     0     1     1     0     8    0
nd6         48      282    0      278     1     0     1     1     0     8    0
ppxss      1128     366    0      366    59    59     0     1     0     8    0
art_heap8  4096       1    0        0     1     0     1     1     0     8    0
art_heap4  256     6099    0     5905    18     5    13    13     0     8    0
art_table   32     6100    0     5905     2     0     2     2     0     8    0
art_node    16     1291    0     1257     1     0     1     1     0     8    0
sysvmsgpl   40       32    0       19     1     0     1     1     0     8    0
semapl     112     2526    0     2516     1     0     1     1     0     8    0
shmpl      112      136    0        8     4     0     4     4     0     8    0
dirhash    1024      22    0        2     3     0     3     3     0     8    0
dino1pl    128    29630    0    27422    72     0    72    72     0     8    0
ffsino     240    29630    0    27422   132     1   131   131     0     8    0
nchpl      144    55222    0    53087    82     2    80    80     0     8    0
uvmvnodes   72     7444    0        0   136     0   136   136     0     8    0
vnodes     200     7444    0        0   392     0   392   392     0     8    0
namei      1024  186346    0   186346     2     1     1     1     0     8    1
scsiplug    64       38    0       38    30    30     0     1     0     8    0
scxspl     192   229348    0   229347    81    78     3     6     0     8    2
sigapl     432    18037    0    18024     2     0     2     2     0     8    0
futexpl     56   303467    0   303467     1     0     1     1     0     8    1
knotepl    112     6015    0     5996     1     0     1     1     0     8    0
kqueuepl   104     4463    0     4461     1     0     1     1     0     8    0
pipepl     112    11380    0    11359    26    25     1     2     0     8    0
fdescpl    424    18038    0    18024     2     0     2     2     0     8    0
filepl     120   115117    0   115020    14    10     4     5     0     8    1
lockfpl    104     5164    0     5164     5     4     1     1     0     8    1
lockfspl    32     3583    0     3583     5     4     1     1     0     8    1
sessionpl  112      161    0      151     1     0     1     1     0     8    0
pgrppl      48      409    0      399     1     0     1     1     0     8    0
ucredpl     96    19731    0    19724     1     0     1     1     0     8    0
zombiepl   144    18024    0    18024     2     1     1     1     0     8    1
processpl  840    18053    0    18024     4     0     4     4     0     8    0
procpl     600    40069    0    40032     4     0     4     4     0     8    0
sosppl     128      237    0      237    57    57     0     1     0     8    0
sockpl     384    15658    0    15641    18    15     3     4     0     8    1
mcl64k     65536   4444    0     4444   420   420     0    33     0     8    0
mcl16k     16384     51    0       51    37    37     0     1     0     8    0
mcl12k     12288    325    0      325    53    52     1     1     0     8    1
mcl9k      9216     284    0      284    56    56     0     1     0     8    0
mcl8k      8192     243    0      243    58    57     1     1     0     8    1
mcl4k      4096     889    0      889    18    17     1     1     0     8    1
mcl2k2     2112     116    0      116    57    57     0     1     0     8    0
mcl2k      2048   82123    0    82083    15     9     6    10     0     8    0
mtagpl      80        4    0        4     2     2     0     1     0     8    0
mbufpl     256   238365    0   238252   220   212     8    23     0     8    0
bufpl      256    55288    0    47844   466     0   466   466     0     8    0
anonpl      16  1867469    0  1858146   506   444    62    74     0    62   13
amapchunkpl 152   79417    0    79316   180   175     5    15     0   158    0
amappl16   192   106069    0   105489   655   613    42    54     0     8   12
amappl15   184     2985    0     2983    16    15     1     1     0     8    0
amappl14   176     4620    0     4617     2     1     1     1     0     8    0
amappl13   168     2093    0     2092     1     0     1     1     0     8    0
amappl12   160     1927    0     1924     1     0     1     1     0     8    0
amappl11   152     1853    0     1839     1     0     1     1     0     8    0
amappl10   144     2455    0     2452     1     0     1     1     0     8    0
amappl9    136     2475    0     2472     1     0     1     1     0     8    0
amappl8    128     2037    0     1993     3     1     2     2     0     8    0
amappl7    120     2669    0     2663     1     0     1     1     0     8    0
amappl6    112     1929    0     1913     1     0     1     1     0     8    0
amappl5    104     2399    0     2388     1     0     1     1     0     8    0
amappl4     96    16374    0    16339     2     1     1     2     0     8    0
amappl3     88     6754    0     6749     1     0     1     1     0     8    0
amappl2     80   160391    0   160337     2     0     2     2     0     8    0
amappl1     72   326328    0   325911    26    17     9    19     0     8    0
amappl      72    41308    0    41273     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      137    0        8     3     0     3     3     0     8    0
uaddrrnd    24    18038    0    18024     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24    18038    0    18024     1     0     1     1     0     8    0
vmmpekpl   168   113534    0   113513     2     0     2     2     0     8    0
vmmpepl    168  1933511    0  1931961   628   540    88   105     0   357    8
vmsppl     264    18037    0    18024    12    11     1     2     0     8    0
pdppl      4096   36082    0    36048     6     1     5     6     0     8    0
pvpl        32  5612664    0  5600246  1174  1019   155   233     0   265   36
pmappl     200    18037    0    18024     1     0     1     1     0     8    0
extentpl    40       39    0       25     1     0     1     1     0     8    0
phpool     112     1399    0      762    19     0    19    19     0     8    0

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/04/14 08:40 openbsd 23a4e4a1e891 c402d8f1 .config console log report ci-openbsd-main
* Struck through repros no longer work on HEAD.