KASAN: invalid memory access in bioioctl

Status: upstream: reported on 2026/07/11 04:19
Reported-by: syzbot+e2102b7959dcc73c7444@syzkaller.appspotmail.com
Fix commit: Merge remote-tracking branch 'origin/master' into tick-merge
Patched on: [ci-openbsd-kasan], missing on: [ci-openbsd-main ci-openbsd-multicore ci-openbsd-setuid]
First crash: 49d, last: 48d

Sample crash report:
panic: Caught invalid memory access at ffff8000387085e0 size 8 op 0
Stopped at      db_enter+0x17:  popq    %rbp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
* 23448   6499      0           0  0x4000000    0K syz-executor
 385472  67180      0         0x2        0x1    1  syz-executor
db_enter() at db_enter+0x17 sys/arch/amd64/amd64/db_interface.c:457
panic(ffffffff846334c7) at panic+0x270 sys/kern/subr_prf.c:198
__asan_load8_noabort(ffff8000387085e0) at __asan_load8_noabort+0xde kasan_shadow_check sys/kern/subr_kasan.c:-1 [inline]
__asan_load8_noabort(ffff8000387085e0) at __asan_load8_noabort+0xde sys/kern/subr_kasan.c:1038
bioioctl(4f14,8004667c,ffff8000387085e0,81,ffff800045feed20) at bioioctl+0x130 sys/dev/bio.c:111
VOP_IOCTL(ffff8000018256c0,8004667c,ffff8000387085e0,81,ffff8000001196e8,ffff800045feed20) at VOP_IOCTL+0x131 sys/kern/vfs_vops.c:264
vn_ioctl(ffff800001ae49a0,8004667c,ffff8000387085e0,ffff800045feed20) at vn_ioctl+0x18c sys/kern/vfs_vnops.c:537
sys_fcntl(ffff800045feed20,ffff800038708850,ffff8000387087c0) at sys_fcntl+0x9ee sys/kern/kern_descrip.c:-1
syscall(ffff800038708850) at syscall+0x1089 mi_syscall sys/sys/syscall_mi.h:176 [inline]
syscall(ffff800038708850) at syscall+0x1089 sys/arch/amd64/amd64/trap.c:783
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7bc9a72cd80, 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{0}> 
ddb{0}> set $lines = 0
ddb{0}> set $maxwidth = 0
ddb{0}> show panic
*cpu0: Caught invalid memory access at ffff8000387085e0 size 8 op 0
ddb{0}> trace
db_enter() at db_enter+0x17 sys/arch/amd64/amd64/db_interface.c:457
panic(ffffffff846334c7) at panic+0x270 sys/kern/subr_prf.c:198
__asan_load8_noabort(ffff8000387085e0) at __asan_load8_noabort+0xde kasan_shadow_check sys/kern/subr_kasan.c:-1 [inline]
__asan_load8_noabort(ffff8000387085e0) at __asan_load8_noabort+0xde sys/kern/subr_kasan.c:1038
bioioctl(4f14,8004667c,ffff8000387085e0,81,ffff800045feed20) at bioioctl+0x130 sys/dev/bio.c:111
VOP_IOCTL(ffff8000018256c0,8004667c,ffff8000387085e0,81,ffff8000001196e8,ffff800045feed20) at VOP_IOCTL+0x131 sys/kern/vfs_vops.c:264
vn_ioctl(ffff800001ae49a0,8004667c,ffff8000387085e0,ffff800045feed20) at vn_ioctl+0x18c sys/kern/vfs_vnops.c:537
sys_fcntl(ffff800045feed20,ffff800038708850,ffff8000387087c0) at sys_fcntl+0x9ee sys/kern/kern_descrip.c:-1
syscall(ffff800038708850) at syscall+0x1089 mi_syscall sys/sys/syscall_mi.h:176 [inline]
syscall(ffff800038708850) at syscall+0x1089 sys/arch/amd64/amd64/trap.c:783
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7bc9a72cd80, count: -9
ddb{0}> show registers
rdi                                0
rsi                              0x1
rbp               0xffff800038707fb0
rbx               0xffff800038708020
rdx                                0
rcx               0xffffffff853a2ff0    cpu_info_full_primary+0x1ff0
rax               0xffff80000016f180
r8                 0x101010101010101
r9                0x8080808080808080
r10               0xffff800038707d98
r11               0xffffffff814e1f30    x86_bus_space_io_read_1
r12               0xffffffff846334c7    db_machine_command_table+0x9b027
r13               0xffffffff853a3c08    cpu_info_full_primary+0x2c08
r14               0xffffffff853a3e07    cpu_info_full_primary+0x2e07
r15                              0x1
rip               0xffffffff81006567    db_enter+0x17
cs                               0x8
rflags                         0x246
rsp               0xffff800038707fb0
ss                              0x10
db_enter+0x17:  popq    %rbp
ddb{0}> show proc
PROC (syz-executor) tid=23448 pid=6499 tcnt=2 stat=onproc
    flags process=0 proc=4000000<THREAD>
    runpri=32, usrpri=84, slppri=32, nice=20
    wchan=0x0, wmesg=, ps_single=0x0 scnt=0 ecnt=0
    forw=0xffffffffffffffff, list=0xffff800045fee558,0xffff800045fefa28
    process=0xffff800045ff3040 user=0xffff8000386fd000, vmspace=0xffff800001acd7b8
    estcpu=34, cpticks=14, pctcpu=0.0, user=0, sys=14, intr=0
ddb{0}> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
 13223  148695  57376      0  2           0                syz-executor
 13223  505639  57376      0  3   0x4000080  sbwait        syz-executor
 13223  206277  57376      0  2   0x4000000                syz-executor
 49424  359566   7543      0  2           0                syz-executor
 49424  236861   7543      0  3   0x4000080  fsleep        syz-executor
  7826  314726  67180      0  2           0                syz-executor
  7826  327272  67180      0  3   0x4000080  fsleep        syz-executor
  7826  165803  67180      0  3   0x4000080  sbwait        syz-executor
 36495   45520  76134      0  2        0x10                syz-executor
 36495  139412  76134      0  3   0x4000090  fsleep        syz-executor
  6499  138470  93397      0  2           0                syz-executor
* 6499   23448  93397      0  7   0x4000000                syz-executor
 80513  162146  54220      0  2       0xc80                syz-executor
 80513   78978  54220      0  3   0x4000080  kqpoll        syz-executor
 80513  296065  54220      0  3   0x4000080  fsleep        syz-executor
 31674   64458      0      0  3     0x14200  acct          acct
 26442  394869      0      0  3     0x14280  nfsidl        nfsio
  7515  210689      0      0  3     0x14280  nfsidl        nfsio
 17381  416213      0      0  3     0x14280  nfsidl        nfsio
 57431  334233      0      0  3     0x14280  nfsidl        nfsio
 60305   90462      0      0  3     0x14280  nfsidl        nfsio
 74378  357314      0      0  3     0x14280  nfsidl        nfsio
 35803  224896      0      0  3     0x14280  nfsidl        nfsio
 30264    7096      0      0  3     0x14280  nfsidl        nfsio
 75047  289078      0      0  3     0x14280  nfsidl        nfsio
 13791  235113      0      0  3     0x14280  nfsidl        nfsio
 43110   89901      0      0  3     0x14280  nfsidl        nfsio
 74549  196014      0      0  3     0x14280  nfsidl        nfsio
 44260  145218      0      0  3     0x14280  nfsidl        nfsio
  1479  123860      0      0  3     0x14280  nfsidl        nfsio
 59098  219448      0      0  3     0x14280  nfsidl        nfsio
 44932  416695      0      0  3     0x14280  nfsidl        nfsio
 51435  286553      0      0  3     0x14280  nfsidl        nfsio
 91479   54160      0      0  3     0x14280  nfsidl        nfsio
 30712  143452      0      0  3     0x14280  nfsidl        nfsio
 93055  390094      0      0  3     0x14280  nfsidl        nfsio
 54488   63118      1      0  3        0x80  nanoslp       init
 57376  476906  27753      0  2       0xc82                syz-executor
 67180  385472  27753      0  7         0x3                syz-executor
 95303  492556  27753      0  3        0x82  wait          syz-executor
 76134   71037  27753      0  2       0xc82                syz-executor
 54220  241080  27753      0  2       0xc82                syz-executor
 23130  407125  27753      0  2       0xc82                syz-executor
 93397  115118  27753      0  2       0xc82                syz-executor
  7543  180872  27753      0  2       0xc82                syz-executor
 27753  223411      1      0  3        0x82  kqread        syz-executor
 44557  237406      1     74  2   0x1100092                pflogd
 83600  495733      1     73  2   0x1100090                syslogd
 66199  215558      0      0  3     0x14200  bored         smr
 55535  496869      0      0  2     0x14200                zerothread
 21698  488435      0      0  3     0x14200  aiodoned      aiodoned
 10006  523772      0      0  3     0x14200  syncer        update
 80252  353621      0      0  3     0x14200  cleaner       cleaner
 25046  422631      0      0  3     0x14200  reaper        reaper
 32531  463842      0      0  3     0x14200  pgdaemon      pagedaemon
 38728  172446      0      0  3     0x14200  bored         viomb
 45537  519155      0      0  3  0x40014200  acpi0         acpi0
 46858   49433      0      0  3  0x40014200                idle1
 29392  248025      0      0  3     0x14200  bored         softnet1
 64073  517600      0      0  3     0x14200  bored         softnet0
 36618  452788      0      0  3     0x14200  bored         systqmp
 74333  195334      0      0  3     0x14200  bored         systq
 20551  241257      0      0  2     0x14200                softclockmp
 11053  312160      0      0  3  0x40014200  tmoslp        softclock
 49377  116740      0      0  3  0x40014200                idle0
     1  419680      0      0  3        0x82  wait          init
     0       0     -1      0  3     0x10200  scheduler     swapper
ddb{0}> show all locks
ddb{0}> show malloc
           Type InUse  MemUse  HighUse   Limit  Requests Type Lim
         devbuf 11056  12310K   12470K 166960K     12297        0
            pcb    17     24K      24K 166960K        31        0
         rtable   243     13K      13K 166960K       357        0
             pf    34     22K      24K 166960K        54        0
         ifaddr    43     12K      12K 166960K        46        0
        ifgroup    55      2K       2K 166960K        60        0
         sysctl     4      1K      13K 166960K        41        0
       counters    70     42K      43K 166960K        72        0
       ioctlops     0      0K       4K 166960K      1497        0
            iov     0      0K      16K 166960K        12        0
          mount     1      1K       1K 166960K         1        0
            log     0      0K       0K 166960K         4        0
         vnodes  1392     89K      90K 166960K      1560        0
      UFS quota     1     36K      36K 166960K         1        0
      UFS mount     5     44K      44K 166960K         5        0
            shm     3    332K     340K 166960K        24        0
         VM map     2      1K       1K 166960K         2        0
            sem    12      0K       0K 166960K        12        0
        dirhash    12      2K       2K 166960K        12        0
           ACPI  1734    201K     292K 166960K     11964        0
      file desc    18     65K      97K 166960K       311        0
          sigio     0      0K       0K 166960K         3        0
           proc    11     30K     193K 166960K       572        0
        subproc    72      9K       9K 166960K        72        0
    NFS srvsock     1      0K       0K 166960K         1        0
     NFS daemon     1     20K      20K 166960K         1        0
       in_multi    99      7K       7K 166960K        99        0
    ether_multi     1      0K       0K 166960K         1        0
            mrt     0      0K       0K 166960K        14        0
    ISOFS mount     1     36K      36K 166960K         1        0
  MSDOSFS mount     1     20K      20K 166960K         1        0
           ttys    55    384K     384K 166960K        55        0
           exec     0      0K       2K 166960K       422        0
   fusefs mount     1     36K      36K 166960K         1        0
            tdb     3      1K       1K 166960K         3        0
        VM swap     8     62K      64K 166960K        10        0
       UVM amap   164    134K     264K 166960K      4617        0
       UVM aobj    24      4K       4K 166960K        25        0
     pinsyscall    23     46K     105K 166960K      1472        0
        memdesc     1      4K       4K 166960K         1        0
    crypto data     1      1K       1K 166960K         1        0
    ip6_options     0      0K       0K 166960K         1        0
            NDP    12      0K       1K 166960K        29        0
           temp    43   9171K    9182K 166960K      7296        0
         kqueue     3      9K      52K 166960K        53        0
      SYN cache     2     16K      16K 166960K         2        0
ddb{0}> show all pools
Name      Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle
plcache    128       28    0        0     1     0     1     1     0     8    0
rtpcb      120       34    0       34     1     0     1     1     0     8    1
rtentry    176      114    0        1     6     0     6     6     0     8    0
unpcb      144      332    0      323     5     0     5     5     0     8    4
syncache   336        4    0        4     2     2     0     1     0     8    0
tcpcb      736       27    0       25     1     0     1     1     0     8    0
arp        136       19    0        0     1     0     1     1     0     8    0
inpcb      328      165    0      161     1     0     1     1     0     8    0
nd6        152       26    0        0     1     0     1     1     0     8    0
kcovpl      48        8    0        0     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
pfstitem    24       29    0        1     1     0     1     1     0     8    0
pfstkey    128       29    0        1     1     0     1     1     0     8    0
pfstate    448       29    0        1     4     0     4     4     0     8    0
pfrule     1360      22    0       17     2     1     1     2     0     8    0
art_heap8  4096       1    0        0     1     0     1     1     0     8    0
art_heap4  256      457    0        0    29     0    29    29     0     8    0
art_table   40      458    0        0     5     0     5     5     0     8    0
art_node    32      114    0       11     1     0     1     1     0     8    0
semupl     112        3    0        3     1     0     1     1     0     8    1
semapl      72       10    0        0     1     0     1     1     0     8    0
shmpl      112       22    0        1     1     0     1     1     0     8    0
dirhash    1024      17    0        0     3     0     3     3     0     8    0
dino2pl    256     1862    0      381    93     0    93    93     0     8    0
ffsino     296     1862    0      381   114     0   114   114     0     8    0
nchpl      144     2295    0      589    64     0    64    64     0     8    0
vnodes     216     2115    0        0   118     0   118   118     0     8    0
namei      1024    7595    0     7595     1     0     1     1     0     8    1
percpumem   16       52    0        1     1     0     1     1     0     8    0
kstatmem   264       29    0        2     2     0     2     2     0     8    0
scxspl     216     8498    0     8498    11     3     8     8     1     8    8
plimitpl   152       41    0       30     1     0     1     1     0     8    0
sigapl     424      651    0      592     7     0     7     7     0     8    0
knotepl    120      117    0        0     4     0     4     4     0     8    0
kqueuepl   224       74    0       70     1     0     1     1     0     8    0
pipepl     344      260    0      232     9     0     9     9     0     8    6
fdescpl    528      614    0      592     3     0     3     3     0     8    0
filepl     160     3157    0     2961    21     4    17    21     0     8    8
lockfpl    104       80    0       80     1     0     1     1     0     8    1
lockfspl    48       35    0       35     1     0     1     1     0     8    1
sessionpl  144       33    0       28     1     0     1     1     0     8    0
pgrppl      48       45    0       32     1     0     1     1     0     8    0
ucredpl    104      277    0      268     1     0     1     1     0     8    0
zombiepl   144      594    0      592     1     0     1     1     0     8    0
processpl  1232     651    0      592     5     0     5     5     0     8    0
procpl     664      957    0      889     7     0     7     7     0     8    0
sosppl     176        5    0        5     2     1     1     1     0     8    1
sockpl     752      534    0      521    15     5    10    15     0     8    8
mcl64k     65536      3    0        0     1     0     1     1     0     8    0
mcl8k      8192       2    0        0     1     0     1     1     0     8    0
mcl4k      4096     123    0        0    16     0    16    16     0     8    0
mcl2k      2048      18    0        0     3     0     3     3     0     8    0
mextrefs    64       16    0        0     1     0     1     1     0     8    0
mtagpl      96        3    0        0     1     0     1     1     0     8    0
mbufpl     256      186    0        0    12     0    12    12     0     8    0
bufpl      272     2773    0      106   178     0   178   178     0     8    0
anonpl      32     6211    0        0    50     0    50    50     0   222    0
amapchunkpl 152   13539    0    13106    21     1    20    21     0   158    2
amappl16   200     2246    0     2217    18     3    15    15     0     8   10
amappl15   192        4    0        4     1     1     0     1     0     8    0
amappl14   184      437    0      437     1     0     1     1     0     8    1
amappl13   176      127    0      125     1     0     1     1     0     8    0
amappl12   168      865    0      845     2     0     2     2     0     8    0
amappl11   160        4    0        4     2     1     1     1     0     8    1
amappl10   152       97    0       93     1     0     1     1     0     8    0
amappl9    144      274    0      274     1     1     0     1     0     8    0
amappl8    136      123    0      122     1     0     1     1     0     8    0
amappl7    128      156    0      151     1     0     1     1     0     8    0
amappl6    120      161    0      160     1     0     1     1     0     8    0
amappl5    112       94    0       92     1     0     1     1     0     8    0
amappl4    104      363    0      355     1     0     1     1     0     8    0
amappl3     96     2701    0     2606     4     1     3     4     0     8    0
amappl2     88      546    0      531     2     0     2     2     0     8    0
amappl1     80    11187    0    11023    16     3    13    15     0     8    1
amappl      88     3857    0     3714     4     0     4     4     0    92    0
uvmvnodes   80      108    0        0     3     0     3     3     0     8    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       24    0        1     1     0     1     1     0     8    0
uaddrrnd    24      614    0      592     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24      614    0      592     1     0     1     1     0     8    0
vmmpekpl   168     7474    0     7441     2     0     2     2     0     8    0
vmmpepl    168    48067    0    47015    89     2    87    89     0   357   29
vmsppl     488      613    0      592     5     0     5     5     0     8    1
rwobjpl     80    16971    0    16436    25     1    24    25     0     8    1
pdppl      4096    1237    0     1184    99    46    53    89     0     8    0
pvpl        32    10705    0        0    87     0    87    87     0   265    0
pmappl     256      613    0      592     3     0     3     3     0     8    0
extentpl    40       46    0       28     1     0     1     1     0     8    0
phpool     112      452    0       51    12     0    12    12     0     8    0
ddb{0}> machine ddbcpu 0
Invalid cpu 0
ddb{0}> trace
db_enter() at db_enter+0x17 sys/arch/amd64/amd64/db_interface.c:457
panic(ffffffff846334c7) at panic+0x270 sys/kern/subr_prf.c:198
__asan_load8_noabort(ffff8000387085e0) at __asan_load8_noabort+0xde kasan_shadow_check sys/kern/subr_kasan.c:-1 [inline]
__asan_load8_noabort(ffff8000387085e0) at __asan_load8_noabort+0xde sys/kern/subr_kasan.c:1038
bioioctl(4f14,8004667c,ffff8000387085e0,81,ffff800045feed20) at bioioctl+0x130 sys/dev/bio.c:111
VOP_IOCTL(ffff8000018256c0,8004667c,ffff8000387085e0,81,ffff8000001196e8,ffff800045feed20) at VOP_IOCTL+0x131 sys/kern/vfs_vops.c:264
vn_ioctl(ffff800001ae49a0,8004667c,ffff8000387085e0,ffff800045feed20) at vn_ioctl+0x18c sys/kern/vfs_vnops.c:537
sys_fcntl(ffff800045feed20,ffff800038708850,ffff8000387087c0) at sys_fcntl+0x9ee sys/kern/kern_descrip.c:-1
syscall(ffff800038708850) at syscall+0x1089 mi_syscall sys/sys/syscall_mi.h:176 [inline]
syscall(ffff800038708850) at syscall+0x1089 sys/arch/amd64/amd64/trap.c:783
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7bc9a72cd80, count: -9
ddb{0}> 

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/07/11 13:47 https://github.com/blackgnezdo/openbsd-src.git syzbot-kasan 275dedaf93b0 d78ea535 .config console log report [disk image] [bsd.gdb] [kernel image] ci-openbsd-kasan KASAN: invalid memory access in bioioctl
2026/07/11 13:16 https://github.com/blackgnezdo/openbsd-src.git syzbot-kasan 275dedaf93b0 d78ea535 .config console log report [disk image] [bsd.gdb] [kernel image] ci-openbsd-kasan KASAN: invalid memory access in bioioctl
2026/07/11 13:15 https://github.com/blackgnezdo/openbsd-src.git syzbot-kasan 275dedaf93b0 d78ea535 .config console log report [disk image] [bsd.gdb] [kernel image] ci-openbsd-kasan KASAN: invalid memory access in bioioctl
2026/07/11 13:15 https://github.com/blackgnezdo/openbsd-src.git syzbot-kasan 275dedaf93b0 d78ea535 .config console log report [disk image] [bsd.gdb] [kernel image] ci-openbsd-kasan KASAN: invalid memory access in bioioctl
2026/07/11 13:09 https://github.com/blackgnezdo/openbsd-src.git syzbot-kasan 275dedaf93b0 d78ea535 .config console log report [disk image] [bsd.gdb] [kernel image] ci-openbsd-kasan KASAN: invalid memory access in bioioctl
2026/07/11 10:39 https://github.com/blackgnezdo/openbsd-src.git syzbot-kasan 275dedaf93b0 d78ea535 .config console log report [disk image] [bsd.gdb] [kernel image] ci-openbsd-kasan KASAN: invalid memory access in bioioctl
2026/07/11 09:48 https://github.com/blackgnezdo/openbsd-src.git syzbot-kasan 275dedaf93b0 d78ea535 .config console log report [disk image] [bsd.gdb] [kernel image] ci-openbsd-kasan KASAN: invalid memory access in bioioctl
2026/07/11 04:18 https://github.com/blackgnezdo/openbsd-src.git syzbot-kasan 275dedaf93b0 d78ea535 .config console log report [disk image] [bsd.gdb] [kernel image] ci-openbsd-kasan KASAN: invalid memory access in bioioctl
* Struck through repros no longer work on HEAD.