syzbot


panic: syn_cache_insert: bucketoverflow: impossible

Status: fixed on 2020/06/19 02:23
Reported-by: syzbot+aee24ad9b7bf5665912d@syzkaller.appspotmail.com
Fix commit: 2b10bfc1e665 Refuse to set 0 or a negative value for net.inet.tcp.synbucketlimit.
First crash: 921d, last: 902d

Sample crash report:
login: panic: syn_cache_insert: bucketoverflow: impossible
Stopped at      db_enter+0x18:  addq    $0x8,%rsp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
 135617  92851      0         0x2          0    1  syz-executor5992
*510129  61050      0     0x14000      0x200    0  softnet
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic(ffffffff821e4f24) at panic+0x15c sys/kern/subr_prf.c:207
syn_cache_insert(fffffd80780ffd70,ffff800000a0a880) at syn_cache_insert+0x9d4 sys/netinet/tcp_input.c:3235
syn_cache_add(ffff800020e38ec0,ffff800020e38e70,fffffd8007e06868,28,fffffd806f6deaf0,fffffd807f01e800) at syn_cache_add+0x6e9 tcpstat_inc sys/netinet/tcp_var.h:645 [inline]
syn_cache_add(ffff800020e38ec0,ffff800020e38e70,fffffd8007e06868,28,fffffd806f6deaf0,fffffd807f01e800) at syn_cache_add+0x6e9 sys/netinet/tcp_input.c:3871
tcp_input(ffff800020e391d8,ffff800020e391e4,6,18) at tcp_input+0x3c67 sys/netinet/tcp_input.c:830
ip_deliver(ffff800020e391d8,ffff800020e391e4,6,18) at ip_deliver+0x353 sys/netinet/ip_input.c:668
ip6_input_if(ffff800020e391d8,ffff800020e391e4,29,0,ffff80000067a800) at ip6_input_if+0x17e1 ip6_ours sys/netinet6/ip6_input.c:538 [inline]
ip6_input_if(ffff800020e391d8,ffff800020e391e4,29,0,ffff80000067a800) at ip6_input_if+0x17e1 sys/netinet6/ip6_input.c:471
ipv6_input(ffff80000067a800,fffffd807f01e800) at ipv6_input+0x48 sys/netinet6/ip6_input.c:171
if_input_local(ffff80000067a800,fffffd807f01e800,18) at if_input_local+0x121 sys/net/if.c:781
loinput(ffff80000067a800,fffffd807f01e800,0) at loinput+0x4f sys/net/if_loop.c:239
if_input_process(ffff80000067a800,ffff800020e39348) at if_input_process+0x10b if_ih_input sys/net/if.c:910 [inline]
if_input_process(ffff80000067a800,ffff800020e39348) at if_input_process+0x10b sys/net/if.c:944
ifiq_process(ffff80000067abf8) at ifiq_process+0x80 sys/net/ifq.c:646
taskq_thread(ffff80000002b080) at taskq_thread+0x9c sys/kern/kern_task.c:369
end trace frame: 0x0, count: 2
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{0}> 
ddb{0}> set $lines = 0
ddb{0}> set $maxwidth = 0
ddb{0}> show panic
syn_cache_insert: bucketoverflow: impossible
ddb{0}> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic(ffffffff821e4f24) at panic+0x15c sys/kern/subr_prf.c:207
syn_cache_insert(fffffd80780ffd70,ffff800000a0a880) at syn_cache_insert+0x9d4 sys/netinet/tcp_input.c:3235
syn_cache_add(ffff800020e38ec0,ffff800020e38e70,fffffd8007e06868,28,fffffd806f6deaf0,fffffd807f01e800) at syn_cache_add+0x6e9 tcpstat_inc sys/netinet/tcp_var.h:645 [inline]
syn_cache_add(ffff800020e38ec0,ffff800020e38e70,fffffd8007e06868,28,fffffd806f6deaf0,fffffd807f01e800) at syn_cache_add+0x6e9 sys/netinet/tcp_input.c:3871
tcp_input(ffff800020e391d8,ffff800020e391e4,6,18) at tcp_input+0x3c67 sys/netinet/tcp_input.c:830
ip_deliver(ffff800020e391d8,ffff800020e391e4,6,18) at ip_deliver+0x353 sys/netinet/ip_input.c:668
ip6_input_if(ffff800020e391d8,ffff800020e391e4,29,0,ffff80000067a800) at ip6_input_if+0x17e1 ip6_ours sys/netinet6/ip6_input.c:538 [inline]
ip6_input_if(ffff800020e391d8,ffff800020e391e4,29,0,ffff80000067a800) at ip6_input_if+0x17e1 sys/netinet6/ip6_input.c:471
ipv6_input(ffff80000067a800,fffffd807f01e800) at ipv6_input+0x48 sys/netinet6/ip6_input.c:171
if_input_local(ffff80000067a800,fffffd807f01e800,18) at if_input_local+0x121 sys/net/if.c:781
loinput(ffff80000067a800,fffffd807f01e800,0) at loinput+0x4f sys/net/if_loop.c:239
if_input_process(ffff80000067a800,ffff800020e39348) at if_input_process+0x10b if_ih_input sys/net/if.c:910 [inline]
if_input_process(ffff80000067a800,ffff800020e39348) at if_input_process+0x10b sys/net/if.c:944
ifiq_process(ffff80000067abf8) at ifiq_process+0x80 sys/net/ifq.c:646
taskq_thread(ffff80000002b080) at taskq_thread+0x9c sys/kern/kern_task.c:369
end trace frame: 0x0, count: -13
ddb{0}> show registers
rdi                                0
rsi                              0x1
rbp               0xffff800020e38a40
rbx               0xffff800020e38af0
rdx                             0x8b
rcx                              0x2
rax                              0x1
r8                0xffffffff81f3c28f    kprintf+0x16f
r9                               0x1
r10                              0x2
r11               0x3a6ac3a7c0f5c585
r12                     0x3000000008
r13               0xffff800020e38a50
r14                            0x100
r15                              0x1
rip               0xffffffff8149f5a8    db_enter+0x18
cs                               0x8
rflags                         0x246
rsp               0xffff800020e38a30
ss                              0x10
db_enter+0x18:  addq    $0x8,%rsp
ddb{0}> show proc
PROC (softnet) pid=510129 stat=onproc
    flags process=14000<NOZOMBIE,SYSTEM> proc=200<SYSTEM>
    pri=32, usrpri=50, nice=20
    forw=0xffffffffffffffff, list=0xffff800020e184e0,0xffff800020e18010
    process=0xffff800020e1ab88 user=0xffff800020e34000, vmspace=0xffffffff8267e568
    estcpu=0, cpticks=1, pctcpu=0.1
    user=0, sys=1, intr=0
ddb{0}> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
 92851  135617   8952      0  7         0x2                syz-executor5992
 92851      24   8952      0  3   0x4000082  netcon2       syz-executor5992
  8952  111152  73746      0  3    0x10008a  pause         ksh
 73746  495736  32846      0  3        0x92  select        sshd
 74929  140057      1      0  3    0x100083  ttyin         getty
 32846  296780      1      0  3        0x80  select        sshd
 13442  358398  16675     74  3    0x100092  bpf           pflogd
 16675  377445      1      0  3        0x80  netio         pflogd
 29083  252719  68027     73  3    0x100090  kqread        syslogd
 68027  462228      1      0  3    0x100082  netio         syslogd
 67825  356081      1     77  3    0x100090  poll          dhclient
 90844  105670      1      0  3        0x80  poll          dhclient
  1329  363142      0      0  3     0x14200  bored         smr
 23256  137046      0      0  2     0x14200                zerothread
 48980  493395      0      0  3     0x14200  aiodoned      aiodoned
  9511  304072      0      0  3     0x14200  syncer        update
 59479  451722      0      0  3     0x14200  cleaner       cleaner
 14370  127740      0      0  3     0x14200  reaper        reaper
 15246  451015      0      0  3     0x14200  pgdaemon      pagedaemon
 95886  371729      0      0  3     0x14200  bored         crynlk
  2564  206539      0      0  3     0x14200  bored         crypto
 26269  463971      0      0  3  0x40014200  acpi0         acpi0
 62338  164829      0      0  3  0x40014200                idle1
*61050  510129      0      0  7     0x14200                softnet
 27311  230125      0      0  3     0x14200  bored         systqmp
  2437  428281      0      0  3     0x14200  bored         systq
  2980  436637      0      0  3  0x40014200  bored         softclock
 98808  476607      0      0  3  0x40014200                idle0
     1  142221      0      0  3        0x82  wait          init
     0       0     -1      0  3     0x10200  scheduler     swapper
ddb{0}> show all locks
Process 61050 (softnet) thread 0xffff800020e18270 (510129)
exclusive rwlock netlock r = 0 (0xffffffff824b7688)
#0  witness_lock+0x4c7 stacktrace_save sys/sys/stacktrace.h:36 [inline]
#0  witness_lock+0x4c7 sys/kern/subr_witness.c:1164
#1  if_input_process+0x85 sys/net/if.c:943
#2  ifiq_process+0x80 sys/net/ifq.c:646
#3  taskq_thread+0x9c sys/kern/kern_task.c:369
#4  proc_trampoline+0x1c
shared rwlock softnet r = 0 (0xffff80000002b0e0)
#0  witness_lock+0x4c7 stacktrace_save sys/sys/stacktrace.h:36 [inline]
#0  witness_lock+0x4c7 sys/kern/subr_witness.c:1164
#1  taskq_thread+0x8f sys/kern/kern_task.c:368
#2  proc_trampoline+0x1c
ddb{0}> show malloc
           Type InUse  MemUse  HighUse   Limit  Requests Type Lim
         devbuf  9463   6393K    6394K  78643K     10556        0
            pcb    13      8K       8K  78643K        13        0
         rtable    61      2K       2K  78643K       127        0
         ifaddr    29      8K       8K  78643K        30        0
       counters    39     33K      33K  78643K        39        0
       ioctlops     0      0K       4K  78643K      1467        0
          mount     1      1K       1K  78643K         1        0
         vnodes  1183     74K      75K  78643K      1188        0
      UFS quota     1     32K      32K  78643K         1        0
      UFS mount     5     36K      36K  78643K         5        0
            shm     2      1K       1K  78643K         2        0
         VM map     2      1K       1K  78643K         2        0
            sem     2      0K       0K  78643K         2        0
        dirhash    12      2K       2K  78643K        12        0
           ACPI  1824    197K     290K  78643K     13058        0
      file desc     1      0K       0K  78643K         1        0
           proc    59     63K      71K  78643K       358        0
    NFS srvsock     1      0K       0K  78643K         1        0
     NFS daemon     1     16K      16K  78643K         1        0
       in_multi    11      0K       0K  78643K        11        0
    ether_multi     1      0K       0K  78643K         1        0
    ISOFS mount     1     32K      32K  78643K         1        0
  MSDOSFS mount     1     16K      16K  78643K         1        0
           ttys    19     95K      95K  78643K        19        0
           exec     0      0K       1K  78643K       177        0
        pagedep     1      8K       8K  78643K         1        0
       inodedep     1     32K      32K  78643K         1        0
         newblk     1      0K       0K  78643K         1        0
        VM swap     7     26K      26K  78643K         7        0
       UVM amap    62      3K       3K  78643K       798        0
       UVM aobj     2      2K       2K  78643K         2        0
        memdesc     1      4K       4K  78643K         1        0
    crypto data     1      1K       1K  78643K         1        0
            NDP     4      0K       0K  78643K         4        0
           temp    24   3029K    3093K  78643K      1670        0
         kqueue     2      2K       2K  78643K         2        0
      SYN cache     2     16K      16K  78643K         2        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
plcache    128       20    0        0     1     0     1     1     0     8    0
rtpcb       80       15    0       13     1     0     1     1     0     8    0
rtentry    112       23    0        1     1     0     1     1     0     8    0
unpcb      120       29    0       19     1     0     1     1     0     8    0
syncache   264        6    0        5     2     1     1     1     0     8    0
tcpcb      544       10    0        5     1     0     1     1     0     8    0
inpcb      280       31    0       23     1     0     1     1     0     8    0
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        9    0        0     1     0     1     1     0     8    0
pfstkey    112        9    0        0     1     0     1     1     0     8    0
pfstate    328        9    0        0     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       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
dino2pl    256     1400    0       16    87     0    87    87     0     8    0
ffsino     272     1400    0       16    93     0    93    93     0     8    0
nchpl      144     1574    0       32    58     0    58    58     0     8    0
uvmvnodes   72     1410    0        0    26     0    26    26     0     8    0
vnodes     208     1410    0        0    75     0    75    75     0     8    0
namei      1024    3777    0     3777     2     1     1     1     0     8    1
percpumem   16       30    0        0     1     0     1     1     0     8    0
scxspl     192     2816    0     2816     2     1     1     2     0     8    1
plimitpl   152       14    0        8     1     0     1     1     0     8    0
sigapl     424      220    0      192     4     0     4     4     0     8    0
knotepl    112        5    0        0     1     0     1     1     0     8    0
kqueuepl   144        1    0        0     1     0     1     1     0     8    0
pipelkpl    48       64    0       60     2     1     1     1     0     8    0
pipepl     120      128    0      121     2     1     1     1     0     8    0
fdescpl    496      205    0      192     3     0     3     3     0     8    0
filepl     152      963    0      913     2     0     2     2     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       18    0        9     1     0     1     1     0     8    0
pgrppl      48       18    0        9     1     0     1     1     0     8    0
ucredpl     96       62    0       53     1     0     1     1     0     8    0
zombiepl   144      192    0      192     2     1     1     1     0     8    1
processpl  984      220    0      192     4     0     4     4     0     8    0
procpl     624      221    0      192     3     0     3     3     0     8    0
sockpl     400       75    0       55     2     0     2     2     0     8    0
mcl4k      4096       2    0        0     1     0     1     1     0     8    0
mcl2k      2048      80    0        0    10     0    10    10     0     8    0
mtagpl      80        1    0        0     1     0     1     1     0     8    0
mbufpl     256       96    0        0     6     0     6     6     0     8    0
bufpl      280     1901    0       91   130     0   130   130     0     8    0
anonpl      16    19250    0    17997     8     2     6     7     0   124    0
amapchunkpl 152     527    0      487     2     0     2     2     0   158    0
amappl16   192       85    0       81     1     0     1     1     0     8    0
amappl15   184        1    0        0     1     0     1     1     0     8    0
amappl14   176       22    0       19     1     0     1     1     0     8    0
amappl13   168       14    0       13     2     1     1     1     0     8    0
amappl12   160        3    0        3     1     1     0     1     0     8    0
amappl11   152       53    0       38     1     0     1     1     0     8    0
amappl10   144       12    0       10     1     0     1     1     0     8    0
amappl9    136      231    0      230     1     0     1     1     0     8    0
amappl8    128      238    0      235     1     0     1     1     0     8    0
amappl7    120       90    0       82     1     0     1     1     0     8    0
amappl6    112       14    0       14     1     1     0     1     0     8    0
amappl5    104      146    0      132     1     0     1     1     0     8    0
amappl4     96      462    0      438     1     0     1     1     0     8    0
amappl3     88       97    0       91     1     0     1     1     0     8    0
amappl2     80      781    0      720     3     1     2     2     0     8    0
amappl1     72    13848    0    13417    15     5    10    15     0     8    0
amappl      80      410    0      388     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       18    0       17     1     0     1     1     0     8    0
aobjpl      64        1    0        0     1     0     1     1     0     8    0
uaddrrnd    24      205    0      192     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24      205    0      192     1     0     1     1     0     8    0
vmmpekpl   168     5472    0     5450     2     0     2     2     0     8    0
vmmpepl    168    29237    0    28367    48     9    39    47     0   357    1
vmsppl     368      204    0      192     2     0     2     2     0     8    0
pdppl      4096     418    0      384     6     0     6     6     0     8    0
pvpl        32    79370    0    76374    32     4    28    28     0   265    3
pmappl     232      204    0      192     1     0     1     1     0     8    0
extentpl    40       53    0       36     1     0     1     1     0     8    0
phpool     112      228    0        4     7     0     7     7     0     8    0
ddb{0}> machine ddbcpu 0
Invalid cpu 0
ddb{0}> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic(ffffffff821e4f24) at panic+0x15c sys/kern/subr_prf.c:207
syn_cache_insert(fffffd80780ffd70,ffff800000a0a880) at syn_cache_insert+0x9d4 sys/netinet/tcp_input.c:3235
syn_cache_add(ffff800020e38ec0,ffff800020e38e70,fffffd8007e06868,28,fffffd806f6deaf0,fffffd807f01e800) at syn_cache_add+0x6e9 tcpstat_inc sys/netinet/tcp_var.h:645 [inline]
syn_cache_add(ffff800020e38ec0,ffff800020e38e70,fffffd8007e06868,28,fffffd806f6deaf0,fffffd807f01e800) at syn_cache_add+0x6e9 sys/netinet/tcp_input.c:3871
tcp_input(ffff800020e391d8,ffff800020e391e4,6,18) at tcp_input+0x3c67 sys/netinet/tcp_input.c:830
ip_deliver(ffff800020e391d8,ffff800020e391e4,6,18) at ip_deliver+0x353 sys/netinet/ip_input.c:668
ip6_input_if(ffff800020e391d8,ffff800020e391e4,29,0,ffff80000067a800) at ip6_input_if+0x17e1 ip6_ours sys/netinet6/ip6_input.c:538 [inline]
ip6_input_if(ffff800020e391d8,ffff800020e391e4,29,0,ffff80000067a800) at ip6_input_if+0x17e1 sys/netinet6/ip6_input.c:471
ipv6_input(ffff80000067a800,fffffd807f01e800) at ipv6_input+0x48 sys/netinet6/ip6_input.c:171
if_input_local(ffff80000067a800,fffffd807f01e800,18) at if_input_local+0x121 sys/net/if.c:781
loinput(ffff80000067a800,fffffd807f01e800,0) at loinput+0x4f sys/net/if_loop.c:239
if_input_process(ffff80000067a800,ffff800020e39348) at if_input_process+0x10b if_ih_input sys/net/if.c:910 [inline]
if_input_process(ffff80000067a800,ffff800020e39348) at if_input_process+0x10b sys/net/if.c:944
ifiq_process(ffff80000067abf8) at ifiq_process+0x80 sys/net/ifq.c:646
taskq_thread(ffff80000002b080) at taskq_thread+0x9c sys/kern/kern_task.c:369
end trace frame: 0x0, count: -13
ddb{0}> machine ddbcpu 1
Stopped at      x86_ipi_db+0x1a:        addq    $0x8,%rsp
x86_ipi_db(ffff800020e00ff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:352
x86_ipi_handler() at x86_ipi_handler+0xc6 sys/arch/amd64/amd64/ipi.c:106
Xresume_lapic_ipi() at Xresume_lapic_ipi+0x23
end of kernel
end trace frame: 0x7f7ffffe0ea0, count: 12
ddb{1}> trace
x86_ipi_db(ffff800020e00ff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:352
x86_ipi_handler() at x86_ipi_handler+0xc6 sys/arch/amd64/amd64/ipi.c:106
Xresume_lapic_ipi() at Xresume_lapic_ipi+0x23
end of kernel
end trace frame: 0x7f7ffffe0ea0, count: -3
ddb{1}> 

Crashes (5):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-openbsd-multicore 2020/05/28 14:02 openbsd d2236770fb31 c7192a2f .config log report syz C
ci-openbsd-main 2020/06/15 18:58 openbsd 2207d07413d2 8e3ab941 .config log report
ci-openbsd-multicore 2020/06/12 05:12 openbsd b981186b7111 819b58b0 .config log report
ci-openbsd-main 2020/05/29 20:07 openbsd 151ba632fd9d cdc5f8a2 .config log report
ci-openbsd-multicore 2020/05/28 13:09 openbsd d2236770fb31 c7192a2f .config log report
* Struck through repros no longer work on HEAD.