syzbot


panic: uvm_fault_unwire_locked: address not in map (3)

Status: fixed on 2021/12/22 03:26
Reported-by: syzbot+bb2f63f076618e9ed0d3@syzkaller.appspotmail.com
Fix commit: 65315d4d4359 Fix a typo in mlock(2) error path triggering a double-free.
First crash: 1070d, last: 1070d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
openbsd panic: uvm_fault_unwire_locked: address not in map (2) 7 1999d 2127d 0/3 auto-closed as invalid on 2019/10/25 08:37
openbsd panic: uvm_fault_unwire_locked: address not in map C 2 2161d 2161d 3/3 fixed on 2019/01/11 00:09
openbsd panic: uvm_fault_unwire_locked: address not in map (4) C 516 4d18h 965d 0/3 upstream: reported C repro on 2022/04/04 00:45

Sample crash report:
panic: uvm_fault_unwire_locked: address not in map
Stopped at      db_enter+0x18:  addq    $0x8,%rsp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
 213803  54187      0           0          0    0  syz-executor.1
* 95442  54187      0           0  0x4000000    1K syz-executor.1
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:440
panic(ffffffff824f0b3b) at panic+0x177 sys/kern/subr_prf.c:202
uvm_fault_unwire_locked(fffffd806ee3fb88,206313000,206313000) at uvm_fault_unwire_locked+0x371
uvm_map_pageable_wire(fffffd806ee3fb88,fffffd8068242590,fffffd8068245968,12a,0,0) at uvm_map_pageable_wire+0x5b0 sys/uvm/uvm_map.c:2422
sys_mlock(ffff8000fffef7a8,ffff8000246ab8d8,ffff8000246ab930) at sys_mlock+0x184 sys/uvm/uvm_mmap.c:772
syscall(ffff8000246ab9a0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline]
syscall(ffff8000246ab9a0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x2db463da0, count: 8
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}> set $maxwidth = 0
ddb{1}> show panic
*cpu1: uvm_fault_unwire_locked: address not in map
ddb{1}> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:440
panic(ffffffff824f0b3b) at panic+0x177 sys/kern/subr_prf.c:202
uvm_fault_unwire_locked(fffffd806ee3fb88,206313000,206313000) at uvm_fault_unwire_locked+0x371
uvm_map_pageable_wire(fffffd806ee3fb88,fffffd8068242590,fffffd8068245968,12a,0,0) at uvm_map_pageable_wire+0x5b0 sys/uvm/uvm_map.c:2422
sys_mlock(ffff8000fffef7a8,ffff8000246ab8d8,ffff8000246ab930) at sys_mlock+0x184 sys/uvm/uvm_mmap.c:772
syscall(ffff8000246ab9a0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline]
syscall(ffff8000246ab9a0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x2db463da0, count: -7
ddb{1}> show registers
rdi                                0
rsi                              0x1
rbp               0xffff8000246ab680
rbx               0xffff800020d39bff
rdx                             0x8b
rcx                              0x2
rax                             0x33
r8                0xffffffff81535884    kprintf+0x144
r9                               0x1
r10               0x220bb413b377fc62
r11                0x238012f818113f1
r12               0xffff800020d39a00
r13                                0
r14                                0
r15                              0x1
rip               0xffffffff81d4ebf8    db_enter+0x18
cs                               0x8
rflags                         0x246
rsp               0xffff8000246ab670
ss                              0x10
db_enter+0x18:  addq    $0x8,%rsp
ddb{1}> show proc
PROC (syz-executor.1) pid=95442 stat=onproc
    flags process=0 proc=4000000<THREAD>
    pri=32, usrpri=86, nice=20
    forw=0xffffffffffffffff, list=0xffff8000fffeefc8,0xffffffff828b1ea0
    process=0xffff8000ffffadc0 user=0xffff8000246a6000, vmspace=0xfffffd806ee3fb88
    estcpu=36, cpticks=1, pctcpu=0.0
    user=0, sys=1, intr=0
ddb{1}> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
 54187  213803  51459      0  7           0                syz-executor.1
*54187   95442  51459      0  7   0x4000000                syz-executor.1
 96443   74558      0      0  3     0x14200  bored         sosplice
 51459  170029  75467      0  3        0x82  nanoslp       syz-executor.1
 36438  463205  75467      0  3        0x82  nanoslp       syz-executor.0
 75467  436510  70388      0  3        0x82  thrsleep      syz-fuzzer
 75467  384518  70388      0  3   0x4000082  nanoslp       syz-fuzzer
 75467  379337  70388      0  3   0x4000082  kqread        syz-fuzzer
 75467  258236  70388      0  3   0x4000082  thrsleep      syz-fuzzer
 75467  419161  70388      0  3   0x4000082  thrsleep      syz-fuzzer
 75467  397779  70388      0  3   0x4000082  thrsleep      syz-fuzzer
 75467  128578  70388      0  3   0x4000082  thrsleep      syz-fuzzer
 75467  336708  70388      0  3   0x4000082  thrsleep      syz-fuzzer
 70388  295745  50775      0  3    0x10008a  sigsusp       ksh
 50775  188634  83645      0  3        0x9a  kqread        sshd
 57804  270151      1      0  3    0x100083  ttyin         getty
 83645  222394      1      0  3        0x88  kqread        sshd
 17160  257022  22063     74  3    0x100092  bpf           pflogd
 22063   76217      1      0  3        0x80  netio         pflogd
 91983  513671  60794     73  3    0x100090  kqread        syslogd
 60794   22026      1      0  3    0x100082  netio         syslogd
 43309  450689      1      0  3    0x100080  kqread        resolvd
 92285  264757     17     77  3    0x100092  kqread        dhcpleased
  6527  512093     17     77  3    0x100092  kqread        dhcpleased
    17  435653      1      0  3        0x80  kqread        dhcpleased
 35362  336361      0      0  3     0x14200  bored         smr
 26578  382506      0      0  3     0x14200  pgzero        zerothread
  6391  229175      0      0  3     0x14200  aiodoned      aiodoned
 39257  472629      0      0  3     0x14200  syncer        update
 11190  340375      0      0  3     0x14200  cleaner       cleaner
   510   58839      0      0  3     0x14200  reaper        reaper
 52681  288934      0      0  3     0x14200  pgdaemon      pagedaemon
 81427   36205      0      0  3     0x14200  bored         viomb
 70165  284793      0      0  3  0x40014200  acpi0         acpi0
 64448  249772      0      0  3  0x40014200                idle1
 52784  144838      0      0  3     0x14200  bored         softnet
 68794  256428      0      0  3     0x14200  bored         systqmp
 78617  521372      0      0  3     0x14200  bored         systq
 42763   24326      0      0  3  0x40014200  bored         softclock
 49181  176075      0      0  3  0x40014200                idle0
     1  209905      0      0  3        0x82  wait          init
     0       0     -1      0  3     0x10200  scheduler     swapper
ddb{1}> show all locks
Process 54187 (syz-executor.1) thread 0xffff8000fffef7a8 (95442)
exclusive rwlock vmmaplk r = 0 (0xfffffd806ee3fba0)
#0  witness_lock+0x4b0 stacktrace_save sys/sys/stacktrace.h:36 [inline]
#0  witness_lock+0x4b0 sys/kern/subr_witness.c:1182
#1  uvm_map_pageable_wire+0x355 vm_map_unbusy_ln sys/uvm/uvm_map.c:5553 [inline]
#1  uvm_map_pageable_wire+0x355 sys/uvm/uvm_map.c:2403
#2  sys_mlock+0x184 sys/uvm/uvm_mmap.c:772
#3  syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline]
#3  syscall+0x489 sys/arch/amd64/amd64/trap.c:585
#4  Xsyscall+0x128
exclusive kernel_lock &kernel_lock r = 0 (0xffffffff829f2050)
#0  witness_lock+0x4b0 stacktrace_save sys/sys/stacktrace.h:36 [inline]
#0  witness_lock+0x4b0 sys/kern/subr_witness.c:1182
#1  syscall+0x3ef mi_syscall sys/sys/syscall_mi.h:93 [inline]
#1  syscall+0x3ef sys/arch/amd64/amd64/trap.c:585
#2  Xsyscall+0x128
ddb{1}> show malloc
           Type InUse  MemUse  HighUse   Limit  Requests Type Lim
         devbuf 10134   6530K    6918K  78643K     13484        0
            pcb    13     14K      16K  78643K       277        0
         rtable   113      4K       5K  78643K       192        0
         ifaddr    45     11K      11K  78643K        97        0
       counters    44     34K      34K  78643K        66        0
       ioctlops     0      0K       4K  78643K      1634        0
            iov     0      0K      16K  78643K        30        0
          mount     1      1K       1K  78643K         1        0
            log     0      0K       0K  78643K         5        0
         vnodes  1338     84K      84K  78643K      2144        0
      UFS quota     1     32K      32K  78643K         1        0
      UFS mount     5     36K      36K  78643K         5        0
            shm     2      1K       5K  78643K         5        0
         VM map     2      1K       1K  78643K         2        0
            sem    12      0K       0K  78643K        97        0
        dirhash    12      2K       2K  78643K        12        0
           ACPI  1697    195K     286K  78643K     12598        0
      file desc     5     13K      25K  78643K       996        0
          sigio     0      0K       0K  78643K        26        0
           proc    70     87K     111K  78643K       370        0
        subproc    26      1K       1K  78643K        26        0
    NFS srvsock     1      0K       0K  78643K         1        0
     NFS daemon     1     16K      16K  78643K         1        0
    ip_moptions     0      0K       0K  78643K        45        0
       in_multi    33      2K       2K  78643K        80        0
    ether_multi     1      0K       0K  78643K        24        0
            mrt     1      0K       0K  78643K         1        0
    ISOFS mount     1     32K      32K  78643K         1        0
  MSDOSFS mount     1     16K      16K  78643K         1        0
           ttys    49    228K     228K  78643K        49        0
           exec     0      0K       2K  78643K       427        0
            tdb     3      0K       0K  78643K         3        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   229     80K      82K  78643K     14797        0
       UVM aobj    15      5K       5K  78643K        15        0
        memdesc     1      4K       4K  78643K         1        0
    crypto data     1      1K       1K  78643K         1        0
    ip6_options     0      0K       0K  78643K        61        0
            NDP     6      0K       0K  78643K        21        0
           temp    81   4194K    4258K  78643K      5626        0
         kqueue    12     18K      20K  78643K        38        0
      SYN cache     2     16K      16K  78643K         2        0
ddb{1}> show all pools
Name      Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle
plcache    128       22    0        0     1     0     1     1     0     8    0
rtpcb      120       49    0       46     1     0     1     1     0     8    0
rtentry    112       46    0        1     2     0     2     2     0     8    0
unpcb      128      383    0      368     7     6     1     5     0     8    0
syncache   296       17    0       17     5     4     1     1     0     8    1
tcpqe       32       40    0       40     2     1     1     1     0     8    1
tcpcb      736      388    0      384    16    14     2     7     0     8    1
arp        120        6    0        0     1     0     1     1     0     8    0
inpcb      304     1640    0     1633    39    28    11    11     0     8   10
nd6         48        7    0        0     1     0     1     1     0     8    0
pkpcb       40        3    0        3     1     1     0     1     0     8    0
kcovpl      48        2    0        0     1     0     1     1     0     8    0
ppxss      1248       3    0        3     1     1     0     1     0     8    0
pffrag     232        9    0        7     1     0     1     1     0   482    0
pffrnode    88        9    0        7     1     0     1     1     0     8    0
pffrent     40      111    0      109     1     0     1     1     0     8    0
pfosfp      40     1428    0     1005     5     0     5     5     0     8    0
pfosfpen   112     1428    0      714    21     0    21    21     0     8    0
pfrktable  1344       3    0        1     1     0     1     1     0     8    0
pfstitem    24       34    0       22     1     0     1     1     0     8    0
pfstkey    112       34    0       22     1     0     1     1     0     8    0
pfstate    320       34    0       22     2     0     2     2     0     8    0
pfrule     1360      43    0       30     2     0     2     2     0     8    0
art_heap8  4096       1    0        0     1     0     1     1     0     8    0
art_heap4  256      193    0        0    13     0    13    13     0     8    0
art_table   32      194    0        0     2     0     2     2     0     8    0
art_node    16       45    0        4     1     0     1     1     0     8    0
sysvmsgpl   40        7    0        5     2     1     1     1     0     8    0
semapl     112       95    0       85     1     0     1     1     0     8    0
shmpl      112       12    0        0     1     0     1     1     0     8    0
dirhash    1024      17    0        0     3     0     3     3     0     8    0
dino2pl    256     2891    0     1481    89     0    89    89     0     8    0
ffsino     272     2891    0     1481    95     0    95    95     0     8    0
nchpl      144     4688    0     3067    61     0    61    61     0     8    0
uvmvnodes   80     3765    0        0    77     0    77    77     0     8    0
vnodes     224     3765    0        0   222     0   222   222     0     8    0
namei      1024   14421    0    14421     1     0     1     1     0     8    1
percpumem   16       45    0       11     1     0     1     1     0     8    0
vcpupl     2048       3    0        0     1     0     1     1     0     8    0
vmpool     560        3    0        0     1     0     1     1     0     8    0
pfiaddrpl  120        3    0        0     1     0     1     1     0     8    0
scxspl     216    12580    0    12580    11    10     1     8     0     8    1
plimitpl   152       70    0       61     1     0     1     1     0     8    0
sigapl     424     1246    0     1213     4     0     4     4     0     8    0
futexpl     64     7305    0     7305     1     0     1     1     0     8    1
knotepl    112       62    0        0     2     0     2     2     0     8    0
kqueuepl   216      276    0      268     9     8     1     5     0     8    0
pipepl     336      145    0      135     3     2     1     2     0     8    0
fdescpl    496     1231    0     1213     3     0     3     3     0     8    0
filepl     152     8507    0     8399    26    16    10    10     0     8    5
lockfpl    104      173    0      170     1     0     1     1     0     8    0
lockfspl    48       79    0       76     1     0     1     1     0     8    0
sessionpl  144       18    0        7     1     0     1     1     0     8    0
pgrppl      48       18    0        7     1     0     1     1     0     8    0
ucredpl     96      509    0      497     1     0     1     1     0     8    0
zombiepl   144     1213    0     1212     1     0     1     1     0     8    0
processpl  1064    1246    0     1212     3     0     3     3     0     8    0
procpl     672     3294    0     3252     7     2     5     5     0     8    1
sosppl     168       13    0       13     3     3     0     1     0     8    0
sockpl     480     2075    0     2050    80    60    20    20     0     8   16
mcl64k     65536      9    0        0     2     0     2     2     0     8    0
mcl16k     16384      3    0        0     1     0     1     1     0     8    0
mcl12k     12288     10    0        0     1     0     1     1     0     8    0
mcl9k      9216       3    0        0     1     0     1     1     0     8    0
mcl8k      8192      11    0        0     2     0     2     2     0     8    0
mcl4k      4096      17    0        0     3     0     3     3     0     8    0
mcl2k2     2112       3    0        0     1     0     1     1     0     8    0
mcl2k      2048     183    0        0    22     1    21    22     0     8    0
mtagpl      96       74    0        0     2     0     2     2     0     8    0
mbufpl     256      794    0        0    48     0    48    48     0     8    0
bufpl      288     4789    0      167   331     0   331   331     0     8    0
anonpl      24   337229    0   319939   135     8   127   131     0   186   21
amapchunkpl 152   35318    0    34645    35     6    29    31     0   158    0
amappl16   200     3357    0     2824    43    10    33    41     0     8    4
amappl15   192       76    0       71     1     0     1     1     0     8    0
amappl14   184        3    0        1     1     0     1     1     0     8    0
amappl13   176       31    0       29     1     0     1     1     0     8    0
amappl12   168      488    0      486     1     0     1     1     0     8    0
amappl11   160       68    0       49     1     0     1     1     0     8    0
amappl10   152        9    0        6     1     0     1     1     0     8    0
amappl9    144      755    0      750     1     0     1     1     0     8    0
amappl8    136      372    0      334     2     0     2     2     0     8    0
amappl7    128       55    0       48     1     0     1     1     0     8    0
amappl6    120      550    0      540     1     0     1     1     0     8    0
amappl5    112     1200    0     1179     1     0     1     1     0     8    0
amappl4    104      588    0      559     1     0     1     1     0     8    0
amappl3     96      699    0      681     1     0     1     1     0     8    0
amappl2     88     1352    0     1309     4     3     1     3     0     8    0
amappl1     80    24334    0    23888    13     3    10    13     0     8    0
amappl      88    14452    0    14283     5     0     5     5     0    92    0
dma4096    4096       1    0        1     1     1     0     1     0     8    0
dma1024    1024       1    0        0     1     0     1     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      72       14    0        0     1     0     1     1     0     8    0
uaddrrnd    24     1234    0     1213     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24     1234    0     1213     1     0     1     1     0     8    0
vmmpekpl   168    12997    0    12976     3     1     2     2     0     8    0
vmmpepl    168   114160    0   112354   108    20    88    96     0   357    6
vmsppl     368     1233    0     1213     2     0     2     2     0     8    0
rwobjpl     56    33480    0    28382    75     2    73    73     0     8    1
pdppl      4096    2476    0     2429    65    16    49    50     0     8    2
pvpl        32   621288    0   600639   215    18   197   204     0   265   28
pmappl     248     1233    0     1213     2     0     2     2     0     8    0
extentpl    40       57    0       38     1     0     1     1     0     8    0
phpool     112      703    0       35    20     0    20    20     0     8    0
ddb{1}> machine ddbcpu 0
Stopped at      x86_ipi_db+0x1a:        addq    $0x8,%rsp
x86_ipi_db(ffffffff8277fff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:393
x86_ipi_handler() at x86_ipi_handler+0xb7 sys/arch/amd64/amd64/ipi.c:106
Xresume_lapic_ipi() at Xresume_lapic_ipi+0x23
__mp_lock(ffffffff829f1e48) at __mp_lock+0x122 __mp_lock_spin sys/kern/kern_lock.c:116 [inline]
__mp_lock(ffffffff829f1e48) at __mp_lock+0x122 sys/kern/kern_lock.c:147
softintr_dispatch(0) at softintr_dispatch+0x4e sys/arch/amd64/amd64/softintr.c:90
Xsoftclock() at Xsoftclock+0x1f
end of kernel
end trace frame: 0x7f7fffff7fa0, count: 9
ddb{0}> trace
x86_ipi_db(ffffffff8277fff0) at x86_ipi_db+0x1a sys/arch/amd64/amd64/db_interface.c:393
x86_ipi_handler() at x86_ipi_handler+0xb7 sys/arch/amd64/amd64/ipi.c:106
Xresume_lapic_ipi() at Xresume_lapic_ipi+0x23
__mp_lock(ffffffff829f1e48) at __mp_lock+0x122 __mp_lock_spin sys/kern/kern_lock.c:116 [inline]
__mp_lock(ffffffff829f1e48) at __mp_lock+0x122 sys/kern/kern_lock.c:147
softintr_dispatch(0) at softintr_dispatch+0x4e sys/arch/amd64/amd64/softintr.c:90
Xsoftclock() at Xsoftclock+0x1f
end of kernel
end trace frame: 0x7f7fffff7fa0, count: -6
ddb{0}> machine ddbcpu 1
Stopped at      db_enter+0x18:  addq    $0x8,%rsp
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:440
panic(ffffffff824f0b3b) at panic+0x177 sys/kern/subr_prf.c:202
uvm_fault_unwire_locked(fffffd806ee3fb88,206313000,206313000) at uvm_fault_unwire_locked+0x371
uvm_map_pageable_wire(fffffd806ee3fb88,fffffd8068242590,fffffd8068245968,12a,0,0) at uvm_map_pageable_wire+0x5b0 sys/uvm/uvm_map.c:2422
sys_mlock(ffff8000fffef7a8,ffff8000246ab8d8,ffff8000246ab930) at sys_mlock+0x184 sys/uvm/uvm_mmap.c:772
syscall(ffff8000246ab9a0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline]
syscall(ffff8000246ab9a0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x2db463da0, count: 8
ddb{1}> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:440
panic(ffffffff824f0b3b) at panic+0x177 sys/kern/subr_prf.c:202
uvm_fault_unwire_locked(fffffd806ee3fb88,206313000,206313000) at uvm_fault_unwire_locked+0x371
uvm_map_pageable_wire(fffffd806ee3fb88,fffffd8068242590,fffffd8068245968,12a,0,0) at uvm_map_pageable_wire+0x5b0 sys/uvm/uvm_map.c:2422
sys_mlock(ffff8000fffef7a8,ffff8000246ab8d8,ffff8000246ab930) at sys_mlock+0x184 sys/uvm/uvm_mmap.c:772
syscall(ffff8000246ab9a0) at syscall+0x489 mi_syscall sys/sys/syscall_mi.h:102 [inline]
syscall(ffff8000246ab9a0) at syscall+0x489 sys/arch/amd64/amd64/trap.c:585
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x2db463da0, count: -7

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/12/20 00:33 openbsd 0b9027416dbe 44068e19 .config console log report ci-openbsd-multicore panic: uvm_fault_unwire_locked: address not in map
* Struck through repros no longer work on HEAD.