syzbot


panic: unhandled af (2)

Status: fixed on 2020/06/28 14:37
Reported-by: syzbot+6fef0091252d57113bfb@syzkaller.appspotmail.com
Fix commit: 38e8113e1d44 state import should accept AF_INET/AF_INET6 only
First crash: 914d, last: 888d
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
openbsd panic: unhandled af C 21 1062d 1064d 3/3 fixed on 2020/01/09 12:20
openbsd panic: unhandled af (3) syz 7 876d 885d 0/3 closed as invalid on 2020/10/03 07:42
openbsd panic: unhandled af (4) syz 11 314d 343d 3/3 fixed on 2022/01/25 13:33

Sample crash report:
login: panic: unhandled af 22
Stopped at      db_enter+0x18:  addq    $0x8,%rsp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
 399491   4160      0         0x2      0x480    1  syz-executor2422
*397338   3323      0     0x14000      0x200    0K softnet
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic(ffffffff82208938) at panic+0x15c sys/kern/subr_prf.c:207
unhandled_af(16) at unhandled_af+0x16
pf_build_tcp(ffffffff82652468,16,fffffd806e6b8860,fffffd806e6b8850,0,0) at pf_build_tcp+0x3c8
pf_remove_state(fffffd806ed39000) at pf_remove_state+0x9a pf_send_tcp sys/net/pf.c:2892 [inline]
pf_remove_state(fffffd806ed39000) at pf_remove_state+0x9a sys/net/pf.c:1382
pf_purge_expired_states(2) at pf_purge_expired_states+0x1ed
pf_purge(ffffffff826a96d8) at pf_purge+0x3f sys/net/pf.c:1278
taskq_thread(ffff80000002b080) at taskq_thread+0x9c sys/kern/kern_task.c:369
end trace frame: 0x0, count: 7
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
unhandled af 22
ddb{0}> trace
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic(ffffffff82208938) at panic+0x15c sys/kern/subr_prf.c:207
unhandled_af(16) at unhandled_af+0x16
pf_build_tcp(ffffffff82652468,16,fffffd806e6b8860,fffffd806e6b8850,0,0) at pf_build_tcp+0x3c8
pf_remove_state(fffffd806ed39000) at pf_remove_state+0x9a pf_send_tcp sys/net/pf.c:2892 [inline]
pf_remove_state(fffffd806ed39000) at pf_remove_state+0x9a sys/net/pf.c:1382
pf_purge_expired_states(2) at pf_purge_expired_states+0x1ed
pf_purge(ffffffff826a96d8) at pf_purge+0x3f sys/net/pf.c:1278
taskq_thread(ffff80000002b080) at taskq_thread+0x9c sys/kern/kern_task.c:369
end trace frame: 0x0, count: -8
ddb{0}> show registers
rdi                                0
rsi                              0x1
rbp               0xffff800020e39b80
rbx               0xffff800020e39c30
rdx                             0x8b
rcx                              0x2
rax                              0x1
r8                0xffffffff814a3bdf    kprintf+0x16f
r9                               0x1
r10                              0x2
r11               0xe71589ee515710c4
r12                     0x3000000008
r13               0xffff800020e39b90
r14                            0x100
r15                              0x1
rip               0xffffffff81bf1358    db_enter+0x18
cs                               0x8
rflags                         0x246
rsp               0xffff800020e39b70
ss                              0x10
db_enter+0x18:  addq    $0x8,%rsp
ddb{0}> show proc
PROC (softnet) pid=397338 stat=onproc
    flags process=14000<NOZOMBIE,SYSTEM> proc=200<SYSTEM>
    pri=32, usrpri=50, nice=20
    forw=0xffffffffffffffff, list=0xffff800020e189c0,0xffff800020e184f0
    process=0xffff800020e1a000 user=0xffff800020e34000, vmspace=0xffffffff826b1ea8
    estcpu=0, cpticks=0, pctcpu=0.0
    user=0, sys=0, intr=0
ddb{0}> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
  4160  399491  44996      0  7       0x482                syz-executor2422
 44996  177244  33823      0  3    0x10008a  pause         ksh
 33823  472295  22604      0  3        0x92  select        sshd
 63740  440271      1      0  3    0x100083  ttyin         getty
 22604   86554      1      0  3        0x80  select        sshd
 85895  116923  86050     74  3    0x100092  bpf           pflogd
 86050  464412      1      0  3        0x80  netio         pflogd
 33036  365794  32403     73  3    0x100090  kqread        syslogd
 32403  291365      1      0  3    0x100082  netio         syslogd
 46088  303383      1     77  3    0x100090  poll          dhclient
 48958   97392      1      0  3        0x80  poll          dhclient
 28834  110829      0      0  3     0x14200  bored         smr
 74193  392404      0      0  3     0x14200  pgzero        zerothread
 96076  398861      0      0  3     0x14200  aiodoned      aiodoned
  5242  330060      0      0  3     0x14200  syncer        update
 89163  207880      0      0  3     0x14200  cleaner       cleaner
 14696  524226      0      0  3     0x14200  reaper        reaper
 91349   15455      0      0  3     0x14200  pgdaemon      pagedaemon
 87020  511568      0      0  3     0x14200  bored         crynlk
 95623  321451      0      0  3     0x14200  bored         crypto
 70111  395081      0      0  3  0x40014200  acpi0         acpi0
 40786  500454      0      0  3  0x40014200                idle1
* 3323  397338      0      0  7     0x14200                softnet
  2878  140328      0      0  3     0x14200  bored         systqmp
 67755  458837      0      0  3     0x14200  bored         systq
 15615  479380      0      0  3  0x40014200  bored         softclock
 55884   72165      0      0  3  0x40014200                idle0
     1  121876      0      0  3        0x82  wait          init
     0       0     -1      0  3     0x10200  scheduler     swapper
ddb{0}> show all locks
Process 3323 (softnet) thread 0xffff800020e18750 (397338)
exclusive rwlock netlock r = 0 (0xffffffff82507458)
#0  witness_lock+0x4c7 stacktrace_save sys/sys/stacktrace.h:36 [inline]
#0  witness_lock+0x4c7 sys/kern/subr_witness.c:1164
#1  pf_purge+0x27 sys/net/pf.c:1273
#2  taskq_thread+0x9c sys/kern/kern_task.c:369
#3  proc_trampoline+0x1c
exclusive kernel_lock &kernel_lock r = 0 (0xffffffff82691818)
#0  witness_lock+0x4c7 stacktrace_save sys/sys/stacktrace.h:36 [inline]
#0  witness_lock+0x4c7 sys/kern/subr_witness.c:1164
#1  pf_purge+0x1b sys/net/pf.c:1264
#2  taskq_thread+0x9c sys/kern/kern_task.c:369
#3  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    30      8K       8K  78643K        31        0
       counters    39     33K      33K  78643K        39        0
       ioctlops     0      0K       4K  78643K      1584        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    60      3K       4K  78643K       913        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      1671        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        5    0        5     2     1     1     1     0     8    1
tcpcb      544        8    0        5     1     0     1     1     0     8    0
inpcb      280       29    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       10    0        0     1     0     1     1     0     8    0
pfstkey    112      126    0      116     1     0     1     1     0     8    0
pfstate    328      126    0      116     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    3894    0     3894     2     1     1     1     0     8    1
percpumem   16       30    0        0     1     0     1     1     0     8    0
scxspl     192     2974    0     2974     9     2     7     7     0     8    7
plimitpl   152       14    0        8     1     0     1     1     0     8    0
sigapl     424      337    0      309     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      322    0      309     3     0     3     3     0     8    0
filepl     152     1078    0     1030     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      309    0      308     2     1     1     1     0     8    0
processpl  984      337    0      308     4     0     4     4     0     8    0
procpl     624      337    0      308     3     0     3     3     0     8    0
sockpl     400       73    0       55     2     0     2     2     0     8    0
mcl4k      4096       4    0        0     1     0     1     1     0     8    0
mcl2k      2048      89    0        0    10     0    10    10     0     8    0
mtagpl      80        1    0        0     1     0     1     1     0     8    0
mbufpl     256      116    0        0     6     0     6     6     0     8    0
bufpl      280     1890    0       91   129     0   129   129     0     8    0
anonpl      16    19919    0    18707     8     3     5     7     0   124    0
amapchunkpl 152     642    0      604     2     0     2     2     0   158    0
amappl16   192      198    0      195     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        9    0        9     1     1     0     1     0     8    0
amappl11   152       49    0       34     1     0     1     1     0     8    0
amappl10   144        8    0        6     1     0     1     1     0     8    0
amappl9    136      225    0      223     1     0     1     1     0     8    0
amappl8    128      232    0      231     1     0     1     1     0     8    0
amappl7    120       94    0       85     1     0     1     1     0     8    0
amappl6    112       14    0       14     2     2     0     1     0     8    0
amappl5    104      261    0      246     1     0     1     1     0     8    0
amappl4     96      462    0      436     1     0     1     1     0     8    0
amappl3     88       96    0       90     1     0     1     1     0     8    0
amappl2     80      748    0      697     3     1     2     2     0     8    0
amappl1     72    14370    0    13958    15     5    10    15     0     8    0
amappl      80      526    0      505     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      322    0      309     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24      322    0      309     1     0     1     1     0     8    0
vmmpekpl   168     5690    0     5668     2     0     2     2     0     8    0
vmmpepl    168    30947    0    30131    50    11    39    48     0   357    0
vmsppl     368      321    0      309     2     0     2     2     0     8    0
pdppl      4096     652    0      618     6     0     6     6     0     8    0
pvpl        32    81835    0    78897    34     6    28    28     0   265    3
pmappl     232      321    0      309     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(ffffffff82208938) at panic+0x15c sys/kern/subr_prf.c:207
unhandled_af(16) at unhandled_af+0x16
pf_build_tcp(ffffffff82652468,16,fffffd806e6b8860,fffffd806e6b8850,0,0) at pf_build_tcp+0x3c8
pf_remove_state(fffffd806ed39000) at pf_remove_state+0x9a pf_send_tcp sys/net/pf.c:2892 [inline]
pf_remove_state(fffffd806ed39000) at pf_remove_state+0x9a sys/net/pf.c:1382
pf_purge_expired_states(2) at pf_purge_expired_states+0x1ed
pf_purge(ffffffff826a96d8) at pf_purge+0x3f sys/net/pf.c:1278
taskq_thread(ffff80000002b080) at taskq_thread+0x9c sys/kern/kern_task.c:369
end trace frame: 0x0, count: -8
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
__mp_lock(ffffffff82691610) at __mp_lock+0x127 __mp_lock_spin sys/kern/kern_lock.c:116 [inline]
__mp_lock(ffffffff82691610) at __mp_lock+0x127 sys/kern/kern_lock.c:147
__mp_acquire_count(ffffffff82691610,1) at __mp_acquire_count+0x51 sys/kern/kern_lock.c:227
mi_switch() at mi_switch+0x392 sys/kern/sched_bsd.c:435
sleep_finish(ffff800020f13510,1) at sleep_finish+0x113 sys/kern/kern_synch.c:418
sleep_finish_all(ffff800020f13510,1) at sleep_finish_all+0x32 sleep_finish_timeout sys/kern/kern_synch.c:447 [inline]
sleep_finish_all(ffff800020f13510,1) at sleep_finish_all+0x32 sys/kern/kern_synch.c:393
tsleep(ffffffff826116dc,120,ffffffff821ef4d2,2) at tsleep+0x1cc sys/kern/kern_synch.c:155
sys_nanosleep(ffff800020ed0eb0,ffff800020f13640,ffff800020f13690) at sys_nanosleep+0x205 sys/kern/kern_time.c:297
syscall(ffff800020f13710) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:102 [inline]
syscall(ffff800020f13710) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:570
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffe2600, count: 3
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
__mp_lock(ffffffff82691610) at __mp_lock+0x127 __mp_lock_spin sys/kern/kern_lock.c:116 [inline]
__mp_lock(ffffffff82691610) at __mp_lock+0x127 sys/kern/kern_lock.c:147
__mp_acquire_count(ffffffff82691610,1) at __mp_acquire_count+0x51 sys/kern/kern_lock.c:227
mi_switch() at mi_switch+0x392 sys/kern/sched_bsd.c:435
sleep_finish(ffff800020f13510,1) at sleep_finish+0x113 sys/kern/kern_synch.c:418
sleep_finish_all(ffff800020f13510,1) at sleep_finish_all+0x32 sleep_finish_timeout sys/kern/kern_synch.c:447 [inline]
sleep_finish_all(ffff800020f13510,1) at sleep_finish_all+0x32 sys/kern/kern_synch.c:393
tsleep(ffffffff826116dc,120,ffffffff821ef4d2,2) at tsleep+0x1cc sys/kern/kern_synch.c:155
sys_nanosleep(ffff800020ed0eb0,ffff800020f13640,ffff800020f13690) at sys_nanosleep+0x205 sys/kern/kern_time.c:297
syscall(ffff800020f13710) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:102 [inline]
syscall(ffff800020f13710) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:570
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffe2600, count: -12
ddb{1}> 

Crashes (22):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-openbsd-multicore 2020/06/01 17:05 openbsd 235b1081ef99 a0331e89 .config log report syz C
ci-openbsd-multicore 2020/06/27 14:30 openbsd dbf2cc62e98d 032b4239 .config log report
ci-openbsd-multicore 2020/06/25 17:23 openbsd 249524653efe c7b4497a .config log report
ci-openbsd-multicore 2020/06/24 18:00 openbsd e9c5ed46e587 41694dbf .config log report
ci-openbsd-multicore 2020/06/22 13:23 openbsd 54392b432564 c4464494 .config log report
ci-openbsd-multicore 2020/06/22 11:27 openbsd 54392b432564 eabcced4 .config log report
ci-openbsd-main 2020/06/22 07:28 openbsd 54392b432564 eabcced4 .config log report
ci-openbsd-multicore 2020/06/22 03:28 openbsd f5cd887ee666 eabcced4 .config log report
ci-openbsd-multicore 2020/06/20 03:36 openbsd daeab07f9d7e c655ec77 .config log report
ci-openbsd-multicore 2020/06/18 23:25 openbsd e8105163f17b 3ea11d3f .config log report
ci-openbsd-main 2020/06/18 13:53 openbsd e8105163f17b 3ea11d3f .config log report
ci-openbsd-main 2020/06/18 10:34 openbsd ae375af6dd72 d45a4d69 .config log report
ci-openbsd-multicore 2020/06/17 06:06 openbsd 253bdb8e8585 b9f3810b .config log report
ci-openbsd-multicore 2020/06/16 19:31 openbsd 94c0d63c076e 4ea9d964 .config log report
ci-openbsd-multicore 2020/06/15 20:04 openbsd 2207d07413d2 8e3ab941 .config log report
ci-openbsd-main 2020/06/13 06:38 openbsd fe9bb68285b7 f4724dd3 .config log report
ci-openbsd-main 2020/06/10 21:10 openbsd 580f643cb4ef a6f7998d .config log report
ci-openbsd-main 2020/06/09 04:24 openbsd 324b9c791e90 0d60b78a .config log report
ci-openbsd-multicore 2020/06/07 15:14 openbsd dfe2a24332fd 2c2b926c .config log report
ci-openbsd-multicore 2020/06/04 17:20 openbsd 4f408d0e7207 6720fdef .config log report
ci-openbsd-multicore 2020/06/02 05:20 openbsd 0cd4ba86ab5d a0331e89 .config log report
ci-openbsd-multicore 2020/06/01 16:41 openbsd 235b1081ef99 a0331e89 .config log report
* Struck through repros no longer work on HEAD.