syzbot


assert "TAILQ_EMPTY(&ifp->if_addrhooks)" failed in if.c

Status: fixed on 2019/11/19 08:59
Reported-by: syzbot+2b26012b9ea93834723e@syzkaller.appspotmail.com
Fix commit: 9e254176dfa1 take care to avoid a race when creating the same interface.
First crash: 1111d, last: 1109d
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
openbsd assert "TAILQ_EMPTY(&ifp->if_addrhooks)" failed in if.c (2) 1 334d 334d 3/3 fixed on 2021/12/30 10:09

Sample crash report:
login: oLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLoLpanic: kernel diagnostic assertion "TAILQ_EMPTY(&ifp->if_addrhooks)" failed: file "/syzkaller/managers/multicore/kernel/sys/net/if.c", line 1177
Stopped at      db_enter+0x18:  addq    $0x8,%rsp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
 346032   9221      0     0x14000      0x200    1  reaper
db_enter() at db_enter+0x18 sys/arch/amd64/amd64/db_interface.c:398
panic() at panic+0x15c sys/kern/subr_prf.c:207
__assert(ffffffff8220ac8a,ffffffff822362bf,499,ffffffff821f282c) at __assert+0x2b sys/kern/subr_prf.c:154
if_detach(ffff800000a9c000) at if_detach+0x618 sys/net/if.c:1178
tun_clone_destroy(ffff800000a9c000) at tun_clone_destroy+0x1c7 sys/net/if_tun.c:278
spec_close(ffff800022b73a60) at spec_close+0x311 sys/kern/spec_vnops.c:555
VOP_CLOSE(fffffd80658660d8,2,fffffd807f7c67e0,ffff800020ab1b40) at VOP_CLOSE+0xc0 sys/kern/vfs_vops.c:175
vn_closefile(fffffd8068df7e58,ffff800020ab1b40) at vn_closefile+0xd8 vn_close sys/kern/vfs_vnops.c:298 [inline]
vn_closefile(fffffd8068df7e58,ffff800020ab1b40) at vn_closefile+0xd8 sys/kern/vfs_vnops.c:610
fdrop(fffffd8068df7e58,ffff800020ab1b40) at fdrop+0xc2 sys/kern/kern_descrip.c:1273
closef(fffffd8068df7e58,ffff800020ab1b40) at closef+0x11d sys/kern/kern_descrip.c:1257
fdfree(ffff800020ab1b40) at fdfree+0x101 sys/kern/kern_descrip.c:1189
exit1(ffff800020ab1b40,0,1) at exit1+0x32f sys/kern/kern_exit.c:196
sys_exit(ffff800020ab1b40,ffff800022b73cf0,ffff800022b73d40) at sys_exit+0x17 sys/kern/kern_exit.c:94
syscall(ffff800022b73dc0) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline]
syscall(ffff800022b73dc0) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555
end trace frame: 0xffff800022b73e40, count: 0
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
kernel diagnostic assertion "TAILQ_EMPTY(&ifp->if_addrhooks)" failed: file "/syzkaller/managers/multicore/kernel/sys/net/if.c", line 1177
ddb{0}> 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
__assert(ffffffff8220ac8a,ffffffff822362bf,499,ffffffff821f282c) at __assert+0x2b sys/kern/subr_prf.c:154
if_detach(ffff800000a9c000) at if_detach+0x618 sys/net/if.c:1178
tun_clone_destroy(ffff800000a9c000) at tun_clone_destroy+0x1c7 sys/net/if_tun.c:278
spec_close(ffff800022b73a60) at spec_close+0x311 sys/kern/spec_vnops.c:555
VOP_CLOSE(fffffd80658660d8,2,fffffd807f7c67e0,ffff800020ab1b40) at VOP_CLOSE+0xc0 sys/kern/vfs_vops.c:175
vn_closefile(fffffd8068df7e58,ffff800020ab1b40) at vn_closefile+0xd8 vn_close sys/kern/vfs_vnops.c:298 [inline]
vn_closefile(fffffd8068df7e58,ffff800020ab1b40) at vn_closefile+0xd8 sys/kern/vfs_vnops.c:610
fdrop(fffffd8068df7e58,ffff800020ab1b40) at fdrop+0xc2 sys/kern/kern_descrip.c:1273
closef(fffffd8068df7e58,ffff800020ab1b40) at closef+0x11d sys/kern/kern_descrip.c:1257
fdfree(ffff800020ab1b40) at fdfree+0x101 sys/kern/kern_descrip.c:1189
exit1(ffff800020ab1b40,0,1) at exit1+0x32f sys/kern/kern_exit.c:196
sys_exit(ffff800020ab1b40,ffff800022b73cf0,ffff800022b73d40) at sys_exit+0x17 sys/kern/kern_exit.c:94
syscall(ffff800022b73dc0) at syscall+0x4a4 mi_syscall sys/sys/syscall_mi.h:92 [inline]
syscall(ffff800022b73dc0) at syscall+0x4a4 sys/arch/amd64/amd64/trap.c:555
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffbeac0, count: -15
ddb{0}> show registers
rdi                                0
rsi                              0x1
rbp               0xffff800022b73860
rbx               0xffff800022b73910
rdx               0xffff800020ab1b40
rcx                                0
rax                                0
r8                0xffffffff81aac14f    kprintf+0x16f
r9                               0x1
r10                             0x25
r11               0x9be3dd7b148b698e
r12                     0x3000000008
r13               0xffff800022b73870
r14                            0x100
r15                              0x1
rip               0xffffffff8211e9c8    db_enter+0x18
cs                               0x8
rflags                         0x246
rsp               0xffff800022b73850
ss                              0x10
db_enter+0x18:  addq    $0x8,%rsp
ddb{0}> show proc
PROC (syz-executor.0) pid=409640 stat=onproc
    flags process=1008<EXITING,SINGLEEXIT> proc=2000<WEXIT>
    pri=32, usrpri=86, nice=20
    forw=0xffffffffffffffff, list=0xffff800020ab0018,0xffffffff826602c8
    process=0xffff800020adc000 user=0xffff800022b6e000, vmspace=0xfffffd807f008730
    estcpu=36, cpticks=4, pctcpu=0.0
    user=0, sys=1, intr=0
ddb{0}> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
 65309  332672      0      0  3     0x14200  bored         sosplice
 97409  121722  51614      0  3        0x82  nanosleep     syz-executor.1
 21025  244560  51614      0  3        0x82  nanosleep     syz-executor.0
 51614   24729  58424      0  3        0x82  thrsleep      syz-fuzzer
 51614  254343  58424      0  3   0x4000082  thrsleep      syz-fuzzer
 51614  241459  58424      0  3   0x4000082  thrsleep      syz-fuzzer
 51614  157190  58424      0  3   0x4000082  thrsleep      syz-fuzzer
 51614   76752  58424      0  3   0x4000082  thrsleep      syz-fuzzer
 51614  318608  58424      0  3   0x4000082  kqread        syz-fuzzer
 51614   53195  58424      0  3   0x4000082  thrsleep      syz-fuzzer
 51614  229283  58424      0  3   0x4000082  thrsleep      syz-fuzzer
 51614  194097  58424      0  3   0x4000082  thrsleep      syz-fuzzer
 51614  184248  58424      0  3   0x4000082  thrsleep      syz-fuzzer
 58424  216516  49690      0  3    0x10008a  pause         ksh
 49690  132520  34751      0  3        0x92  select        sshd
 69089   93885      1      0  3    0x100083  ttyin         getty
 34751   79786      1      0  3        0x80  select        sshd
 17052   38655  31540     74  3    0x100092  bpf           pflogd
 31540   95559      1      0  3        0x80  netio         pflogd
 11518  230922  74479     73  3    0x100090  kqread        syslogd
 74479  433803      1      0  3    0x100082  netio         syslogd
 80110  397266      1     77  3    0x100090  poll          dhclient
 86931  475474      1      0  3        0x80  poll          dhclient
 18780  446400      0      0  3     0x14200  pgzero        zerothread
 27314  432137      0      0  3     0x14200  aiodoned      aiodoned
 56499  479967      0      0  3     0x14200  syncer        update
 97925  158171      0      0  3     0x14200  cleaner       cleaner
  9221  346032      0      0  7     0x14200                reaper
 61040  410083      0      0  3     0x14200  pgdaemon      pagedaemon
 40835   45598      0      0  3     0x14200  bored         crynlk
 22890  500374      0      0  3     0x14200  bored         crypto
 27937   90586      0      0  3  0x40014200  acpi0         acpi0
 63405  141351      0      0  3  0x40014200                idle1
 45044  321900      0      0  2     0x14200                softnet
 50550  287526      0      0  3     0x14200  bored         systqmp
 33050  356029      0      0  3     0x14200  bored         systq
 53970  422107      0      0  3  0x40014200  bored         softclock
  5931   32432      0      0  3  0x40014200                idle0
 30925  408085      0      0  3     0x14200  bored         smr
     1  167589      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 Kern Lim
         devbuf  9503   6412K    7177K  78643K     11730        0        0
            pcb    13      8K       8K  78643K        77        0        0
         rtable    84      3K       3K  78643K       524        0        0
         ifaddr   110     15K      16K  78643K       325        0        0
       counters    39     33K      33K  78643K        39        0        0
       ioctlops     0      0K       4K  78643K      1481        0        0
            iov     0      0K       8K  78643K       267        0        0
          mount     1      1K       1K  78643K         1        0        0
         vnodes  1220     77K      77K  78643K      2090        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     2      1K       1K  78643K         2        0        0
            sem    12      0K       0K  78643K       332        0        0
        dirhash    12      2K       2K  78643K        12        0        0
           ACPI  1809    196K     290K  78643K     12766        0        0
      file desc     5     13K      25K  78643K       933        0        0
           proc    60     63K      95K  78643K       572        0        0
        subproc    32      2K       2K  78643K        34        0        0
    NFS srvsock     1      0K       0K  78643K         1        0        0
     NFS daemon     1     16K      16K  78643K         1        0        0
    ip_moptions     0      0K       0K  78643K       125        0        0
       in_multi    13      0K       2K  78643K        85        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    42    185K     185K  78643K        42        0        0
           exec     0      0K       1K  78643K       333        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    92     21K      21K  78643K      3021        0        0
       UVM aobj    25      2K       2K  78643K        25        0        0
        memdesc     1      4K       4K  78643K         1        0        0
    crypto data     1      1K       1K  78643K         1        0        0
    ip6_options     0      0K       0K  78643K        66        0        0
            NDP    11      0K       0K  78643K        66        0        0
           temp   125   3550K    3617K  78643K     47790        0        0
         kqueue     0      0K       0K  78643K        11        0        0
      SYN cache     2     16K      16K  78643K         2        0        0
ddb{0}> show all pools
Name      Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle
arp         64        6    0        0     1     0     1     1     0     8    0
plcache    128       20    0        0     1     0     1     1     0     8    0
rtpcb       80       35    0       33     1     0     1     1     0     8    0
rtentry    112       45    0       13     2     0     2     2     0     8    0
unpcb      120      383    0      373     1     0     1     1     0     8    0
syncache   264        4    0        4     1     1     0     1     0     8    0
tcpqe       32        5    0        5     1     0     1     1     0     8    1
tcpcb      544      111    0      106     1     0     1     1     0     8    0
inpcb      280      777    0      768     1     0     1     1     0     8    0
nd6         48        4    0        4     1     1     0     1     0     8    0
ppxss      1128      53    0       52     2     1     1     1     0     8    0
pffrag     232       29    0       29     1     0     1     1     0   482    1
pffrnode    88       29    0       29     1     0     1     1     0     8    1
pffrent     40     1305    0     1305     1     0     1     1     0     8    1
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       52    0       17     1     0     1     1     0     8    0
pfstkey    112       52    0       17     2     0     2     2     0     8    0
pfstate    328       52    0       17     4     0     4     4     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      212    0       78    14     4    10    14     0     8    0
art_table   32      213    0       78     2     0     2     2     0     8    0
art_node    16       44    0       14     1     0     1     1     0     8    0
sysvmsgpl   40       14    0       14     1     1     0     1     0     8    0
semapl     112      330    0      320     1     0     1     1     0     8    0
shmpl      112       23    0        0     1     0     1     1     0     8    0
dirhash    1024      17    0        0     3     0     3     3     0     8    0
dino1pl    128     3369    0     1965    46     0    46    46     0     8    0
ffsino     272     3369    0     1965    94     0    94    94     0     8    0
nchpl      144     4834    0     3217    61     1    60    61     0     8    0
uvmvnodes   72     3734    0        0    68     0    68    68     0     8    0
vnodes     208     3734    0        0   197     0   197   197     0     8    0
namei      1024   12713    0    12713     1     0     1     1     0     8    1
percpumem   16       30    0        0     1     0     1     1     0     8    0
scxspl     192    12391    0    12391     5     4     1     4     0     8    1
plimitpl   152       60    0       52     1     0     1     1     0     8    0
sigapl     432     1131    0     1116     3     1     2     3     0     8    0
futexpl     56    15560    0    15560     1     0     1     1     0     8    1
knotepl    112      120    0      101     1     0     1     1     0     8    0
kqueuepl   104      108    0      105     1     0     1     1     0     8    0
pipepl     160      574    0      553     1     0     1     1     0     8    0
fdescpl    488     1132    0     1116     3     0     3     3     0     8    0
filepl     152     6066    0     5957     6     1     5     5     0     8    0
lockfpl    104      357    0      356     1     0     1     1     0     8    0
lockfspl    48      174    0      173     1     0     1     1     0     8    0
sessionpl  112       18    0        7     1     0     1     1     0     8    0
pgrppl      48       18    0        7     1     0     1     1     0     8    0
ucredpl     96     1013    0     1004     1     0     1     1     0     8    0
zombiepl   144     1117    0     1115     1     0     1     1     0     8    0
processpl  896     1148    0     1115     4     0     4     4     0     8    0
procpl     632     2265    0     2222     5     0     5     5     0     8    1
sosppl     128       24    0       24     1     1     0     1     0     8    0
sockpl     384     1196    0     1175     4     0     4     4     0     8    1
mcl64k     65536     20    0        0     3     0     3     3     0     8    0
mcl12k     12288     17    0        0     2     0     2     2     0     8    0
mcl8k      8192      17    0        0     3     1     2     3     0     8    0
mcl4k      4096      18    0        0     3     0     3     3     0     8    0
mcl2k      2048      98    0        0    11     0    11    11     0     8    0
mtagpl      80       39    0        0     1     0     1     1     0     8    0
mbufpl     256      330    0        0    20     0    20    20     0     8    0
bufpl      256     7820    0     1309   407     0   407   407     0     8    0
anonpl      16    88471    0    85193    18     2    16    16     0   124    0
amapchunkpl 152    4070    0     3979     6     2     4     6     0   158    0
amappl16   192     4540    0     4419     9     0     9     9     0     8    2
amappl15   184      434    0      432     1     0     1     1     0     8    0
amappl14   176       63    0       54     1     0     1     1     0     8    0
amappl12   160        6    0        5     2     1     1     1     0     8    0
amappl11   152       50    0       35     1     0     1     1     0     8    0
amappl10   144       14    0        8     1     0     1     1     0     8    0
amappl9    136     1069    0     1064     1     0     1     1     0     8    0
amappl8    128      614    0      595     1     0     1     1     0     8    0
amappl7    120       46    0       41     1     0     1     1     0     8    0
amappl6    112       58    0       49     1     0     1     1     0     8    0
amappl5    104      126    0      113     1     0     1     1     0     8    0
amappl4     96     1374    0     1347     1     0     1     1     0     8    0
amappl3     88      171    0      163     1     0     1     1     0     8    0
amappl2     80     8647    0     8574     3     1     2     3     0     8    0
amappl1     72    29002    0    28568    26    16    10    20     0     8    0
amappl      80     2499    0     2462     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       24    0        0     1     0     1     1     0     8    0
uaddrrnd    24     1132    0     1116     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24     1132    0     1116     1     0     1     1     0     8    0
vmmpekpl   168     9657    0     9619     2     0     2     2     0     8    0
vmmpepl    168   133660    0   132416    88    27    61    80     0   357    2
vmsppl     368     1131    0     1116     2     0     2     2     0     8    0
pdppl      4096    2271    0     2232     6     0     6     6     0     8    0
pvpl        32   353557    0   347092   117    27    90   117     0   265   33
pmappl     232     1131    0     1116     2     1     1     2     0     8    0
extentpl    40       46    0       29     1     0     1     1     0     8    0
phpool     112      573    0        8    17     0    17    17     0     8    0

Crashes (2):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-openbsd-multicore 2019/11/14 08:42 openbsd 9d8a210628dc 5d15a967 .config log report
ci-openbsd-multicore 2019/11/12 16:10 openbsd 32906ae91db3 048f2d49 .config log report
* Struck through repros no longer work on HEAD.