syzbot


panic: amap_pp_adjref: negative reference count

Status: fixed on 2019/12/04 16:31
Reported-by: syzbot+27cfad3394f34528cbec@syzkaller.appspotmail.com
Fix commit: 0f83bb56e561 Fix a bad offset calculation in uvm_share.
First crash: 1665d, last: 1613d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
openbsd panic: amap_pp_adjref: negative reference count (2) 1 560d 560d 0/3 auto-obsoleted due to no activity on 2023/01/10 14:24

Sample crash report:
login: panic: amap_pp_adjref: negative reference count
Stopped at      db_enter+0x18:  addq    $0x8,%rsp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
*427126  19152      0         0x2          0    0  syz-executor1284
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic() at panic+0x15c sys/kern/subr_prf.c:207
amap_pp_adjref(fffffd80375a0640,7ff,200,1) at amap_pp_adjref+0x59e sys/uvm/uvm_amap.c:829
uvm_mapent_clone(ffff8000006a2400,0,200000,7fc000,7,7) at uvm_mapent_clone+0x14c sys/uvm/uvm_map.c:3733
uvm_share(ffff8000006a2400,0,7,fffffd803f011990,20800000,200000) at uvm_share+0x4b4 uvm_mapent_share sys/uvm/uvm_map.c:3767 [inline]
uvm_share(ffff8000006a2400,0,7,fffffd803f011990,20800000,200000) at uvm_share+0x4b4 sys/uvm/uvm_map.c:3668
vm_impl_init_vmx(ffff8000ffff3860,ffff8000ffff4010) at vm_impl_init_vmx+0xf1 sys/arch/amd64/amd64/vmm.c:1270
vm_create(ffff800000a65000,ffff8000ffff4010) at vm_create+0x193 vm_impl_init sys/arch/amd64/amd64/vmm.c:1385 [inline]
vm_create(ffff800000a65000,ffff8000ffff4010) at vm_create+0x193 sys/arch/amd64/amd64/vmm.c:1174
VOP_IOCTL(fffffd803a947680,c5005601,ffff800000a65000,1,fffffd803f7c6c00,ffff8000ffff4010) at VOP_IOCTL+0x88 sys/kern/vfs_vops.c:291
vn_ioctl(fffffd8036218a58,c5005601,ffff800000a65000,ffff8000ffff4010) at vn_ioctl+0xb7 sys/kern/vfs_vnops.c:533
sys_ioctl(ffff8000ffff4010,ffff8000148da848,ffff8000148da890) at sys_ioctl+0x5b9
syscall(ffff8000148da910) at syscall+0x507 sys/arch/amd64/amd64/trap.c:555
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffc8af0, 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
amap_pp_adjref: negative reference count
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:207
amap_pp_adjref(fffffd80375a0640,7ff,200,1) at amap_pp_adjref+0x59e sys/uvm/uvm_amap.c:829
uvm_mapent_clone(ffff8000006a2400,0,200000,7fc000,7,7) at uvm_mapent_clone+0x14c sys/uvm/uvm_map.c:3733
uvm_share(ffff8000006a2400,0,7,fffffd803f011990,20800000,200000) at uvm_share+0x4b4 uvm_mapent_share sys/uvm/uvm_map.c:3767 [inline]
uvm_share(ffff8000006a2400,0,7,fffffd803f011990,20800000,200000) at uvm_share+0x4b4 sys/uvm/uvm_map.c:3668
vm_impl_init_vmx(ffff8000ffff3860,ffff8000ffff4010) at vm_impl_init_vmx+0xf1 sys/arch/amd64/amd64/vmm.c:1270
vm_create(ffff800000a65000,ffff8000ffff4010) at vm_create+0x193 vm_impl_init sys/arch/amd64/amd64/vmm.c:1385 [inline]
vm_create(ffff800000a65000,ffff8000ffff4010) at vm_create+0x193 sys/arch/amd64/amd64/vmm.c:1174
VOP_IOCTL(fffffd803a947680,c5005601,ffff800000a65000,1,fffffd803f7c6c00,ffff8000ffff4010) at VOP_IOCTL+0x88 sys/kern/vfs_vops.c:291
vn_ioctl(fffffd8036218a58,c5005601,ffff800000a65000,ffff8000ffff4010) at vn_ioctl+0xb7 sys/kern/vfs_vnops.c:533
sys_ioctl(ffff8000ffff4010,ffff8000148da848,ffff8000148da890) at sys_ioctl+0x5b9
syscall(ffff8000148da910) at syscall+0x507 sys/arch/amd64/amd64/trap.c:555
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffc8af0, count: -12
ddb> show registers
rdi                                0
rsi                              0x1
rbp               0xffff8000148da1a0
rbx               0xffff8000148da250
rdx                              0x2
rcx                              0x1
rax                              0x1
r8                0xffff8000148da160
r9                               0x1
r10               0xa5583dfe5ceec6a4
r11               0x2b07f159e1c94563
r12                     0x3000000008
r13               0xffff8000148da1b0
r14                            0x100
r15                              0x1
rip               0xffffffff812012d8    db_enter+0x18
cs                               0x8
rflags                         0x246
rsp               0xffff8000148da190
ss                              0x10
db_enter+0x18:  addq    $0x8,%rsp
ddb> show proc
PROC (syz-executor1284) pid=427126 stat=onproc
    flags process=2<EXEC> proc=0
    pri=86, usrpri=86, nice=20
    forw=0xffffffffffffffff, list=0xffff8000ffff4c68,0xffffffff825a1c50
    process=0xffff8000148a2018 user=0xffff8000148d5000, vmspace=0xfffffd803f011990
    estcpu=36, cpticks=94, pctcpu=2.55
    user=0, sys=362, intr=0
ddb> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
*19152  427126  90367      0  7         0x2                syz-executor1284
 90367   44126  19333      0  3    0x10008a  pause         ksh
 19333  281632   7398      0  2        0x12                sshd
 88982  307274      1      0  3    0x100083  ttyin         getty
  7398  280111      1      0  3        0x80  select        sshd
 21012  206759  47589     73  3    0x100090  kqread        syslogd
 47589  166148      1      0  3    0x100082  netio         syslogd
 95255  372560      1     77  3    0x100090  poll          dhclient
 94034  296357      1      0  3        0x80  poll          dhclient
 75173  474186      0      0  2     0x14200                zerothread
 52991  265656      0      0  3     0x14200  aiodoned      aiodoned
 15812  341109      0      0  2     0x14200                update
 52542  515431      0      0  3     0x14200  cleaner       cleaner
 95256   29038      0      0  3     0x14200  reaper        reaper
 26964  307942      0      0  3     0x14200  pgdaemon      pagedaemon
 33568  296996      0      0  3     0x14200  bored         crynlk
 86959  139080      0      0  3     0x14200  bored         crypto
 16373  516327      0      0  3  0x40014200  acpi0         acpi0
 96933   37590      0      0  2     0x14200                softnet
 30309  460263      0      0  2     0x14200                systqmp
 93197  174532      0      0  3     0x14200  bored         systq
 97761  479780      0      0  2  0x40014200                softclock
 27048   27355      0      0  3  0x40014200                idle0
 37284   76635      0      0  3     0x14200  bored         smr
     1  156937      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  9438   6318K    6319K  78643K     10535        0        0
            pcb    13      8K       8K  78643K        13        0        0
         rtable    61      1K       2K  78643K       115        0        0
         ifaddr    24      7K       7K  78643K        24        0        0
       counters    19     16K      16K  78643K        19        0        0
       ioctlops     1      2K       2K  78643K        14        0        0
          mount     1      1K       1K  78643K         1        0        0
         vnodes  1180     74K      74K  78643K      1185        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     3      0K       0K  78643K         3        0        0
            sem     2      0K       0K  78643K         2        0        0
        dirhash    12      2K       2K  78643K        12        0        0
           ACPI  1794    195K     288K  78643K     12646        0        0
      file desc     1      0K       0K  78643K         1        0        0
           proc    47     38K      46K  78643K       278        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       151        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     11K      11K  78643K       686        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    21   3519K    3583K  78643K      1687        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        2    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       27    0       19     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
inpcb      280       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       95    0        0     6     0     6     6     0     8    0
art_table   32       96    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     1389    0       15    45     0    45    45     0     8    0
ffsino     240     1389    0       15    81     0    81    81     0     8    0
nchpl      144     1576    0       44    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    3453    0     3453     1     0     1     1     0     8    1
vmpool     520        1    0        0     1     0     1     1     0     8    0
scxspl     192     2380    0     2380     2     1     1     2     0     8    1
plimitpl   152       13    0        8     1     0     1     1     0     8    0
sigapl     432      175    0      165     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     128      116    0      107     1     0     1     1     0     8    0
fdescpl    424      176    0      165     2     0     2     2     0     8    0
filepl     120      836    0      790     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       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      165    0      165     1     0     1     1     0     8    1
processpl  864      190    0      165     4     0     4     4     0     8    0
procpl     632      190    0      165     3     0     3     3     0     8    0
sockpl     384       64    0       48     2     0     2     2     0     8    0
mcl4k      4096      10    0       10     1     0     1     1     0     8    1
mcl2k      2048    5765    0     5733     7     1     6     7     0     8    1
mtagpl      80        2    0        2     1     1     0     1     0     8    0
mbufpl     256     9858    0     9811     7     2     5     6     0     8    1
bufpl      256     2046    0      240   113     0   113   113     0     8    0
anonpl      16    18942    0    15780    15     2    13    13     0    62    0
amapchunkpl 152     590    0      427     7     0     7     7     0   158    0
amappl16   192       69    0       65     1     0     1     1     0     8    0
amappl14   176       35    0       31     1     0     1     1     0     8    0
amappl12   160        5    0        5     1     0     1     1     0     8    1
amappl11   152       43    0       32     1     0     1     1     0     8    0
amappl10   144        1    0        1     1     1     0     1     0     8    0
amappl9    136      364    0      363     1     0     1     1     0     8    0
amappl8    128       83    0       79     1     0     1     1     0     8    0
amappl7    120       15    0       14     1     0     1     1     0     8    0
amappl6    112       42    0       38     1     0     1     1     0     8    0
amappl5    104      163    0      152     1     0     1     1     0     8    0
amappl4     96      394    0      372     1     0     1     1     0     8    0
amappl3     88      104    0       98     1     0     1     1     0     8    0
amappl2     80      693    0      644     2     0     2     2     0     8    0
amappl1     72    11944    0    11562    16     7     9    16     0     8    0
amappl      80      353    0      333     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      177    0      165     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24      177    0      165     1     0     1     1     0     8    0
vmmpekpl   168     5295    0     5281     1     0     1     1     0     8    0
vmmpepl    168    25370    0    24630    48     9    39    48     0   357    5
vmsppl     272      175    0      165     1     0     1     1     0     8    0
pdppl      4096     360    0      330     5     0     5     5     0     8    0
pvpl        32    72235    0    67447    39     0    39    39     0   265    0
pmappl     200      176    0      165     1     0     1     1     0     8    0
extentpl    40       46    0       29     1     0     1     1     0     8    0
phpool     112      229    0        5     7     0     7     7     0     8    0

Crashes (98):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/24 16:53 openbsd 978220ac0b15 598ca6c8 .config console log report syz C ci-openbsd-main
2019/11/24 15:41 openbsd 978220ac0b15 598ca6c8 .config console log report ci-openbsd-main
2019/11/21 08:47 openbsd ddfcd1cc9cf3 8098ea0f .config console log report ci-openbsd-main
2019/11/20 00:25 openbsd 593a100ba7e7 b7a277d2 .config console log report ci-openbsd-multicore
2019/11/19 17:11 openbsd 30d546f475f9 432c7650 .config console log report ci-openbsd-multicore
2019/11/19 05:47 openbsd d2a7ef3889e2 5bc70212 .config console log report ci-openbsd-main
2019/11/19 02:14 openbsd d2a7ef3889e2 5bc70212 .config console log report ci-openbsd-multicore
2019/11/18 23:35 openbsd d2a7ef3889e2 5bc70212 .config console log report ci-openbsd-main
2019/11/18 21:17 openbsd d2a7ef3889e2 5bc70212 .config console log report ci-openbsd-multicore
2019/11/18 17:26 openbsd 0f6aa5032768 1daed50a .config console log report ci-openbsd-main
2019/11/18 13:40 openbsd 0f6aa5032768 1daed50a .config console log report ci-openbsd-multicore
2019/11/18 09:36 openbsd 0f6aa5032768 1daed50a .config console log report ci-openbsd-multicore
2019/11/18 07:30 openbsd 4022b8731182 d5696d51 .config console log report ci-openbsd-multicore
2019/11/17 05:12 openbsd e8d9fd7d60d7 d5696d51 .config console log report ci-openbsd-main
2019/11/17 03:11 openbsd e8d9fd7d60d7 d5696d51 .config console log report ci-openbsd-main
2019/11/17 01:18 openbsd d8449269f3d4 d5696d51 .config console log report ci-openbsd-multicore
2019/11/16 22:18 openbsd b78dbe0757a3 d5696d51 .config console log report ci-openbsd-multicore
2019/11/16 16:46 openbsd b78dbe0757a3 d5696d51 .config console log report ci-openbsd-multicore
2019/11/16 15:14 openbsd b78dbe0757a3 d5696d51 .config console log report ci-openbsd-main
2019/11/16 13:37 openbsd b78dbe0757a3 d5696d51 .config console log report ci-openbsd-main
2019/11/16 12:01 openbsd b78dbe0757a3 d5696d51 .config console log report ci-openbsd-multicore
2019/11/16 08:04 openbsd c982058ecee1 cdac920b .config console log report ci-openbsd-main
2019/11/16 00:48 openbsd c982058ecee1 cdac920b .config console log report ci-openbsd-multicore
2019/11/15 13:23 openbsd 096d667cd04e 79248ee8 .config console log report ci-openbsd-multicore
2019/11/15 11:37 openbsd 096d667cd04e 79248ee8 .config console log report ci-openbsd-multicore
2019/11/15 06:48 openbsd 3d133dcfcb5d a24fe792 .config console log report ci-openbsd-main
2019/11/15 01:19 openbsd 3d133dcfcb5d a24fe792 .config console log report ci-openbsd-main
2019/11/14 17:15 openbsd 9d8a210628dc 5d15a967 .config console log report ci-openbsd-main
2019/11/14 12:01 openbsd 9d8a210628dc 5d15a967 .config console log report ci-openbsd-multicore
2019/11/14 10:15 openbsd 9d8a210628dc 5d15a967 .config console log report ci-openbsd-multicore
2019/11/13 22:21 openbsd 39b7db2742d3 048f2d49 .config console log report ci-openbsd-main
2019/11/13 14:52 openbsd 16e245ae7f37 048f2d49 .config console log report ci-openbsd-multicore
2019/11/13 11:36 openbsd 16e245ae7f37 048f2d49 .config console log report ci-openbsd-main
2019/11/13 10:12 openbsd 16e245ae7f37 048f2d49 .config console log report ci-openbsd-main
2019/11/13 04:25 openbsd f0c2caef18b3 048f2d49 .config console log report ci-openbsd-main
2019/11/12 21:16 openbsd f0c2caef18b3 048f2d49 .config console log report ci-openbsd-main
2019/11/12 06:49 openbsd 32906ae91db3 048f2d49 .config console log report ci-openbsd-multicore
2019/11/12 04:04 openbsd 32906ae91db3 048f2d49 .config console log report ci-openbsd-main
2019/11/12 01:03 openbsd 1511e2d13702 377d77fa .config console log report ci-openbsd-multicore
2019/11/11 18:19 openbsd 1511e2d13702 377d77fa .config console log report ci-openbsd-multicore
2019/11/11 17:12 openbsd 1511e2d13702 377d77fa .config console log report ci-openbsd-multicore
2019/11/11 14:57 openbsd 864e97e9f9ba dc438b91 .config console log report ci-openbsd-multicore
2019/11/11 11:55 openbsd 864e97e9f9ba dc438b91 .config console log report ci-openbsd-main
2019/11/11 09:25 openbsd 864e97e9f9ba dc438b91 .config console log report ci-openbsd-main
2019/11/11 03:24 openbsd 58a0869c7088 dc438b91 .config console log report ci-openbsd-multicore
2019/11/11 02:43 openbsd 58a0869c7088 dc438b91 .config console log report ci-openbsd-main
2019/11/11 02:21 openbsd 58a0869c7088 dc438b91 .config console log report ci-openbsd-multicore
2019/11/10 22:03 openbsd 58a0869c7088 dc438b91 .config console log report ci-openbsd-main
2019/10/03 07:43 openbsd c722278fddec 2e29b534 .config console log report ci-openbsd-multicore
* Struck through repros no longer work on HEAD.