syzbot


panic: malloc: allocation too large, type = 98, size = ADDR

Status: fixed on 2020/10/05 13:43
Reported-by: syzbot+d80de26a8db6c009d060@syzkaller.appspotmail.com
Fix commit: Recent changes for PROT_NONE pages to not count against resource limits, failed to note this also guarded against heavy amap allocations in the MAP_SHARED case. Bring back the checks for MAP_SHARED from semarie, ok kettenis https://syzkaller.appspot.com/bug?extid=d80de26a8db6c009d060
First crash: 1509d, last: 1509d

Sample crash report:
panic: malloc: allocation too large, type = 98, size = 760898376

Stopped at      db_enter+0x18:  addq    $0x8,%rsp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
*366334  70733      0         0x2          0    0  syz-executor3062
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic(ffffffff82398933) at panic+0x15e sys/kern/subr_prf.c:218
malloc(2d5a6348,62,1) at malloc+0x9bd sys/kern/kern_malloc.c:344
amap_alloc1(5ab4c68c,1,0) at amap_alloc1+0x207 sys/uvm/uvm_amap.c:338
amap_alloc(5ab4c68c000,1,0) at amap_alloc+0x80 sys/uvm/uvm_amap.c:393
uvm_mapanon(fffffd806bc0a880,ffff80001d91f5d8,5ab4c68c000,0,1030700) at uvm_mapanon+0x8b9 sys/uvm/uvm_map.c:1109
sys_mmap(ffff80001d8fc010,ffff80001d91f688,ffff80001d91f6d0) at sys_mmap+0x98c uvm_mmapanon sys/uvm/uvm_mmap.c:949 [inline]
sys_mmap(ffff80001d8fc010,ffff80001d91f688,ffff80001d91f6d0) at sys_mmap+0x98c sys/uvm/uvm_mmap.c:423
syscall(ffff80001d91f750) at syscall+0x507 sys/arch/amd64/amd64/trap.c:567
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffd81c0, count: 6
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
malloc: allocation too large, type = 98, size = 760898376

ddb> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic(ffffffff82398933) at panic+0x15e sys/kern/subr_prf.c:218
malloc(2d5a6348,62,1) at malloc+0x9bd sys/kern/kern_malloc.c:344
amap_alloc1(5ab4c68c,1,0) at amap_alloc1+0x207 sys/uvm/uvm_amap.c:338
amap_alloc(5ab4c68c000,1,0) at amap_alloc+0x80 sys/uvm/uvm_amap.c:393
uvm_mapanon(fffffd806bc0a880,ffff80001d91f5d8,5ab4c68c000,0,1030700) at uvm_mapanon+0x8b9 sys/uvm/uvm_map.c:1109
sys_mmap(ffff80001d8fc010,ffff80001d91f688,ffff80001d91f6d0) at sys_mmap+0x98c uvm_mmapanon sys/uvm/uvm_mmap.c:949 [inline]
sys_mmap(ffff80001d8fc010,ffff80001d91f688,ffff80001d91f6d0) at sys_mmap+0x98c sys/uvm/uvm_mmap.c:423
syscall(ffff80001d91f750) at syscall+0x507 sys/arch/amd64/amd64/trap.c:567
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffd81c0, count: -9
ddb> show registers
rdi                                0
rsi                              0x1
rbp               0xffff80001d91f1f0
rbx               0xffff80001d91f200
rdx                             0x8b
rcx                              0x2
rax                              0x1
r8                0xffffffff811f91f0    kprintf+0x140
r9                               0x1
r10               0x83ad1e7d3c1054f5
r11               0xb62d605af128619b
r12                     0x3000000008
r13               0xffff80001d91f2a0
r14                            0x100
r15                              0x1
rip               0xffffffff81506bd8    db_enter+0x18
cs                               0x8
rflags                         0x246
rsp               0xffff80001d91f1e0
ss                              0x10
db_enter+0x18:  addq    $0x8,%rsp
ddb> show proc
PROC (syz-executor3062) pid=366334 stat=onproc
    flags process=2<EXEC,8ORPHAN> proc=0
    pri=53, usrpri=53, nice=20
    forw=0xffffffffffffffff, list=0xffff80001d8fcc68,0xffffffff827db0d8
    process=0xffff80001d8fe3c8 user=0xffff80001d91a000, vmspace=0xfffffd806bc0a880
    estcpu=3, cpticks=0, pctcpu=0.0
    user=0, sys=0, intr=0
ddb> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
*70733  366334  58819      0  7         0x2                syz-executor3062
 58819  206191   7567      0  3    0x10008a  pause         ksh
  7567   41459  83690      0  3        0x92  select        sshd
 32299  496488      1      0  3    0x100083  ttyin         getty
 83690  168893      1      0  3        0x80  select        sshd
  7862  194759  12669     73  3    0x100090  kqread        syslogd
 12669  342253      1      0  3    0x100082  netio         syslogd
 28075  477893      1     77  3    0x100090  poll          dhclient
 27706  414274      1      0  3        0x80  poll          dhclient
 25846  407789      0      0  3     0x14200  bored         smr
 93397  276521      0      0  2     0x14200                zerothread
 52438  238550      0      0  3     0x14200  aiodoned      aiodoned
 61459  271481      0      0  3     0x14200  syncer        update
  7475  268871      0      0  3     0x14200  cleaner       cleaner
 38162  215346      0      0  3     0x14200  reaper        reaper
 15405   76264      0      0  3     0x14200  pgdaemon      pagedaemon
 93380  407255      0      0  3     0x14200  bored         crynlk
 62787  459969      0      0  3     0x14200  bored         crypto
 74577  293832      0      0  3  0x40014200  acpi0         acpi0
 14677   51560      0      0  3     0x14200  bored         softnet
 43145  112191      0      0  3     0x14200  bored         systqmp
 72837  146343      0      0  3     0x14200  bored         systq
 21883  449755      0      0  3  0x40014200  bored         softclock
 31651  185149      0      0  3  0x40014200                idle0
     1  521466      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
         devbuf  9438   6318K    6319K  78643K     10536        0
            pcb    13      8K       8K  78643K        13        0
         rtable    61      1K       2K  78643K       117        0
         ifaddr    24      7K       7K  78643K        24        0
       counters    19     16K      16K  78643K        19        0
       ioctlops     0      0K       2K  78643K        13        0
          mount     1      1K       1K  78643K         1        0
         vnodes  1182     74K      74K  78643K      1187        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      0K       0K  78643K         2        0
            sem     2      0K       0K  78643K         2        0
        dirhash    12      2K       2K  78643K        12        0
           ACPI  1809    195K     288K  78643K     12938        0
      file desc     1      0K       0K  78643K         1        0
           proc    47     38K      46K  78643K       284        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       2K  78643K       261        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    32      1K       2K  78643K       511        0
       UVM aobj     3      2K       2K  78643K         3        0
        memdesc     1      4K       4K  78643K         1        0
    crypto data     1      1K       1K  78643K         1        0
            NDP     3      0K       0K  78643K         3        0
           temp    18   3945K    4009K  78643K      1435        0
         kqueue     2      2K       2K  78643K         2        0
      SYN cache     2     16K      16K  78643K         2        0
ddb> 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
rtpcb       96       15    0       13     1     0     1     1     0     8    0
rtentry    112       23    0        1     1     0     1     1     0     8    0
unpcb      120       27    0       19     1     0     1     1     0     8    0
syncache   272        5    0        5     2     1     1     1     0     8    1
tcpcb      592        8    0        5     1     0     1     1     0     8    0
inpcb      296       22    0       16     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
dino2pl    256     1389    0       15    86     0    86    86     0     8    0
ffsino     240     1389    0       15    81     0    81    81     0     8    0
nchpl      144     1563    0       31    57     0    57    57     0     8    0
uvmvnodes   72     1398    0        0    26     0    26    26     0     8    0
vnodes     208     1398    0        0    74     0    74    74     0     8    0
namei      1024    3489    0     3489     2     1     1     1     0     8    1
scxspl     192     3094    0     3094     1     0     1     1     0     8    1
plimitpl   152       13    0        8     1     0     1     1     0     8    0
sigapl     424      191    0      166     4     0     4     4     0     8    0
knotepl    112        5    0        0     1     0     1     1     0     8    0
kqueuepl   152        1    0        0     1     0     1     1     0     8    0
pipepl     272       57    0       53     2     1     1     1     0     8    0
fdescpl    432      177    0      166     2     0     2     2     0     8    0
filepl     120      822    0      779     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  120       17    0        9     1     0     1     1     0     8    0
pgrppl      48       17    0        9     1     0     1     1     0     8    0
ucredpl     96       57    0       50     1     0     1     1     0     8    0
zombiepl   144      166    0      166     2     1     1     1     0     8    1
processpl  944      191    0      166     4     0     4     4     0     8    0
procpl     632      191    0      166     3     0     3     3     0     8    0
sockpl     400       64    0       48     2     0     2     2     0     8    0
mcl4k      4096      10    0       10     2     1     1     1     0     8    1
mcl2k      2048    5409    0     5381     8     2     6     6     0     8    2
mtagpl      96        2    0        2     1     1     0     1     0     8    0
mbufpl     256     9410    0     9369     5     1     4     4     0     8    0
bufpl      280     1837    0      105   124     0   124   124     0     8    0
anonpl      16    17691    0    16566     7     2     5     7     0   107    0
amapchunkpl 152     468    0      433     3     1     2     3     0   158    0
amappl16   192       73    0       69     1     0     1     1     0     8    0
amappl15   184        1    0        0     1     0     1     1     0     8    0
amappl13   168       12    0       11     2     1     1     1     0     8    0
amappl12   160        6    0        6     1     1     0     1     0     8    0
amappl11   152       39    0       30     1     0     1     1     0     8    0
amappl10   144        7    0        5     1     0     1     1     0     8    0
amappl9    136      190    0      190     1     1     0     1     0     8    0
amappl8    128       61    0       57     1     0     1     1     0     8    0
amappl7    120      207    0      205     1     0     1     1     0     8    0
amappl6    112       92    0       81     1     0     1     1     0     8    0
amappl5    104      288    0      281     1     0     1     1     0     8    0
amappl4     96      254    0      230     1     0     1     1     0     8    0
amappl3     88       51    0       46     1     0     1     1     0     8    0
amappl2     80      748    0      700     3     1     2     2     0     8    0
amappl1     72    12784    0    12403    14     6     8    14     0     8    0
amappl      80      349    0      330     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        2    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     5206    0     5192     1     0     1     1     0     8    0
vmmpepl    168    26150    0    25410    44     8    36    44     0   357    2
vmsppl     272      176    0      166     1     0     1     1     0     8    0
pdppl      4096     360    0      332     5     0     5     5     0     8    0
pvpl        32    72251    0    69521    29     3    26    26     0   265    1
pmappl     200      176    0      166     1     0     1     1     0     8    0
extentpl    40       53    0       36     1     0     1     1     0     8    0
phpool     112      209    0        9     6     0     6     6     0     8    0
ddb> machine ddbcpu 0
No such command
ddb> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic(ffffffff82398933) at panic+0x15e sys/kern/subr_prf.c:218
malloc(2d5a6348,62,1) at malloc+0x9bd sys/kern/kern_malloc.c:344
amap_alloc1(5ab4c68c,1,0) at amap_alloc1+0x207 sys/uvm/uvm_amap.c:338
amap_alloc(5ab4c68c000,1,0) at amap_alloc+0x80 sys/uvm/uvm_amap.c:393
uvm_mapanon(fffffd806bc0a880,ffff80001d91f5d8,5ab4c68c000,0,1030700) at uvm_mapanon+0x8b9 sys/uvm/uvm_map.c:1109
sys_mmap(ffff80001d8fc010,ffff80001d91f688,ffff80001d91f6d0) at sys_mmap+0x98c uvm_mmapanon sys/uvm/uvm_mmap.c:949 [inline]
sys_mmap(ffff80001d8fc010,ffff80001d91f688,ffff80001d91f6d0) at sys_mmap+0x98c sys/uvm/uvm_mmap.c:423
syscall(ffff80001d91f750) at syscall+0x507 sys/arch/amd64/amd64/trap.c:567
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffd81c0, count: -9
ddb> machine ddbcpu 1
No such command
ddb> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic(ffffffff82398933) at panic+0x15e sys/kern/subr_prf.c:218
malloc(2d5a6348,62,1) at malloc+0x9bd sys/kern/kern_malloc.c:344
amap_alloc1(5ab4c68c,1,0) at amap_alloc1+0x207 sys/uvm/uvm_amap.c:338
amap_alloc(5ab4c68c000,1,0) at amap_alloc+0x80 sys/uvm/uvm_amap.c:393
uvm_mapanon(fffffd806bc0a880,ffff80001d91f5d8,5ab4c68c000,0,1030700) at uvm_mapanon+0x8b9 sys/uvm/uvm_map.c:1109
sys_mmap(ffff80001d8fc010,ffff80001d91f688,ffff80001d91f6d0) at sys_mmap+0x98c uvm_mmapanon sys/uvm/uvm_mmap.c:949 [inline]
sys_mmap(ffff80001d8fc010,ffff80001d91f688,ffff80001d91f6d0) at sys_mmap+0x98c sys/uvm/uvm_mmap.c:423
syscall(ffff80001d91f750) at syscall+0x507 sys/arch/amd64/amd64/trap.c:567
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffd81c0, count: -9
ddb> 

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/10/04 10:44 openbsd 06d46252717d 1a3f9408 .config console log report syz C ci-openbsd-main
2020/10/04 10:37 openbsd 06d46252717d 1a3f9408 .config console log report ci-openbsd-main
* Struck through repros no longer work on HEAD.