syzbot


kernel: integer divide fault trap, code=NUM (2)

Status: fixed on 2022/02/10 05:39
Reported-by: syzbot+e720e3bab51366d7b667@syzkaller.appspotmail.com
Fix commit: 43496f5abc1b let pfattach() to also initialize pf_default_rule_new to avoid div-by-zero in pf_purge()
First crash: 1007d, last: 1003d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
openbsd kernel: integer divide fault trap, code=NUM syz 2 1067d 1067d 3/3 fixed on 2021/12/16 13:42
openbsd kernel: integer divide fault trap, code=NUM (3) C 157 801d 823d 3/3 fixed on 2022/08/31 00:45
openbsd kernel: integer divide fault trap, code=NUM (4) C 6 510d 566d 3/3 fixed on 2023/06/23 19:30

Sample crash report:
login: kernel: integer divide fault trap, code=0
Stopped at      pf_purge+0x1e:  divl    __kernel_phys_base+0x50f7dc,%eax
ddb> 
ddb> set $lines = 0
ddb> set $maxwidth = 0
ddb> show panic
the kernel did not panic
ddb> trace
pf_purge(ffffffff829ef470) at pf_purge+0x1e sys/net/pf.c:1302
taskq_thread(ffffffff829612f0) at taskq_thread+0x9b sys/kern/kern_task.c:449
end trace frame: 0x0, count: -2
ddb> show registers
rdi               0xffffffff829ef470    pf_npurge
rsi                                0
rbp               0xffff80002159a070
rbx                                0
rdx                                0
rcx               0xffffffff829ef470    pf_npurge
rax                                0
r8                                 0
r9                                 0
r10               0x7cce906471fec3c5
r11                 0x2962acd8685eb6
r12               0xffff80002159a080
r13               0xffff8000ffffc7d0
r14               0xffffffff829ef470    pf_npurge
r15               0xffff80002159a0b0
rip               0xffffffff814e191e    pf_purge+0x1e
cs                               0x8
rflags                       0x10246    __ALIGN_SIZE+0xf246
rsp               0xffff80002159a040
ss                              0x10
pf_purge+0x1e:  divl    __kernel_phys_base+0x50f7dc,%eax
ddb> show proc
PROC (systq) pid=486080 stat=onproc
    flags process=14000<NOZOMBIE,SYSTEM> proc=200<SYSTEM>
    pri=32, usrpri=50, nice=20
    forw=0xffffffffffffffff, list=0xffff8000ffffe540,0xffff8000ffffe2b0
    process=0xffff8000ffffc3e8 user=0xffff800021595000, vmspace=0xffffffff82a8bd58
    estcpu=0, cpticks=0, pctcpu=0.0
    user=0, sys=0, intr=0
ddb> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
 87640  512776  38841      0  2       0x482                syz-executor1508
 38841  194372  77240      0  3    0x10008a  sigsusp       ksh
 77240  168887  41609      0  3        0x9a  kqread        sshd
  9755   87800      1      0  3    0x100083  ttyin         getty
 41609  461799      1      0  3        0x88  kqread        sshd
 55987  370472  30480     73  3    0x100090  kqread        syslogd
 30480  102493      1      0  3    0x100082  netio         syslogd
 34264  139278      1      0  3    0x100080  kqread        resolvd
 99466   97466   1365     77  3    0x100092  kqread        dhcpleased
 14614   63462   1365     77  3    0x100092  kqread        dhcpleased
  1365  161371      1      0  3        0x80  kqread        dhcpleased
 18888   52477      0      0  3     0x14200  bored         smr
 16972  151089      0      0  3     0x14200  pgzero        zerothread
 42276  388180      0      0  3     0x14200  aiodoned      aiodoned
 40906  135911      0      0  3     0x14200  syncer        update
 29798  148818      0      0  3     0x14200  cleaner       cleaner
 28202   30188      0      0  3     0x14200  reaper        reaper
 81867  446175      0      0  3     0x14200  pgdaemon      pagedaemon
 68682  370391      0      0  3     0x14200  bored         viomb
 66486  319836      0      0  3  0x40014200  acpi0         acpi0
 42179  327995      0      0  3     0x14200  bored         softnet
 90321  148530      0      0  3     0x14200  bored         systqmp
*29397  486080      0      0  7     0x14200                systq
 84887  244654      0      0  3  0x40014200  bored         softclock
 50063  502384      0      0  3  0x40014200                idle0
     1  364530      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
         devbuf 10133   6381K    6412K  78643K     11223        0
            pcb    13      8K       8K  78643K        13        0
         rtable    62      2K       2K  78643K       108        0
         ifaddr    24      7K       7K  78643K        24        0
       counters    19     16K      16K  78643K        19        0
       ioctlops     0      0K       2K  78643K        25        0
          mount     1      1K       1K  78643K         1        0
            log     0      0K       0K  78643K         5        0
         vnodes  1166     73K      73K  78643K      1179        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      0K       0K  78643K         2        0
            sem     2      0K       0K  78643K         2        0
        dirhash    12      2K       2K  78643K        12        0
           ACPI  1697    195K     286K  78643K     12548        0
      file desc     1      0K       0K  78643K         1        0
           proc    55     54K      55K  78643K       226        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    25    122K     122K  78643K        25        0
           exec     0      0K       2K  78643K       391        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    71      3K       5K  78643K      1906        0
       UVM aobj     3      2K       2K  78643K         3        0
        memdesc     1      4K       4K  78643K         1        0
    crypto data     1      1K       1K  78643K         1        0
            NDP     3      0K       0K  78643K         3        0
           temp    19   4678K    4741K  78643K      3198        0
         kqueue    11     16K      18K  78643K        24        0
      SYN cache     2     16K      16K  78643K         2        0
ddb> show all pools
Name      Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg Maxpg Idle
rtpcb      120       17    0       14     1     0     1     1     0     8    0
rtentry    112       23    0        1     1     0     1     1     0     8    0
unpcb      136       33    0       20     1     0     1     1     0     8    0
syncache   296        5    0        5     1     0     1     1     0     8    1
tcpcb      736        8    0        5     1     0     1     1     0     8    0
arp         88        2    0        0     1     0     1     1     0     8    0
inpcb      304       25    0       19     1     0     1     1     0     8    0
art_heap8  4096       1    0        0     1     0     1     1     0     8    0
art_heap4  256       96    0        0     6     0     6     6     0     8    0
art_table   32       97    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     1415    0       38    87     0    87    87     0     8    0
ffsino     240     1415    0       38    81     0    81    81     0     8    0
nchpl      144     1590    0       47    58     0    58    58     0     8    0
uvmvnodes   80     1424    0        0    30     0    30    30     0     8    0
vnodes     224     1424    0        0    84     0    84    84     0     8    0
namei      1024    4231    0     4231     1     0     1     1     0     8    1
scxspl     216     3606    0     3606     3     1     2     2     0     8    2
plimitpl   152       15    0        9     1     0     1     1     0     8    0
sigapl     424      341    0      315     4     0     4     4     0     8    0
knotepl    120     6914    0     6884     2     0     2     2     0     8    1
kqueuepl   184       20    0       13     1     0     1     1     0     8    0
pipepl     304       79    0       76     1     0     1     1     0     8    0
fdescpl    432      328    0      315     2     0     2     2     0     8    0
filepl     120     1110    0     1057     2     0     2     2     0     8    0
lockfpl    104        6    0        4     1     0     1     1     0     8    0
lockfspl    48        4    0        2     1     0     1     1     0     8    0
sessionpl  144       17    0        9     1     0     1     1     0     8    0
pgrppl      48       17    0        9     1     0     1     1     0     8    0
ucredpl     96       64    0       54     1     0     1     1     0     8    0
zombiepl   144      315    0      314     1     0     1     1     0     8    0
processpl  1000     341    0      314     4     0     4     4     0     8    0
procpl     672      341    0      314     3     0     3     3     0     8    0
sockpl     448       75    0       53     3     0     3     3     0     8    0
mcl8k      8192       9    0        9     1     0     1     1     0     8    1
mcl4k      4096       5    0        5     1     0     1     1     0     8    1
mcl2k      2048    5661    0     5633     6     0     6     6     0     8    2
mtagpl      96        3    0        3     1     1     0     1     0     8    0
mbufpl     256    10466    0    10400     6     0     6     6     0     8    1
bufpl      288     1935    0       86   133     0   133   133     0     8    0
anonpl      24    38749    0    36701    15     1    14    15     0   188    1
amapchunkpl 152    3715    0     3590     7     1     6     7     0   158    0
amappl16   200       76    0       76     1     0     1     1     0     8    1
amappl15   192       59    0       56     1     0     1     1     0     8    0
amappl13   176       32    0       31     1     0     1     1     0     8    0
amappl12   168       15    0       15     1     0     1     1     0     8    1
amappl11   160       41    0       29     1     0     1     1     0     8    0
amappl10   152        5    0        5     1     0     1     1     0     8    1
amappl9    144      434    0      432     1     0     1     1     0     8    0
amappl8    136      340    0      337     1     0     1     1     0     8    0
amappl7    128       60    0       57     1     0     1     1     0     8    0
amappl6    120      106    0       93     1     0     1     1     0     8    0
amappl5    112      243    0      234     1     0     1     1     0     8    0
amappl4    104      579    0      559     1     0     1     1     0     8    0
amappl3     96      110    0      101     1     0     1     1     0     8    0
amappl2     88      337    0      301     1     0     1     1     0     8    0
amappl1     80     8226    0     7873     9     0     9     9     0     8    1
amappl      88     1653    0     1597     2     0     2     2     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        2    0        0     1     0     1     1     0     8    0
uaddrrnd    24      328    0      315     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24      328    0      315     1     0     1     1     0     8    0
vmmpekpl   168     5976    0     5960     1     0     1     1     0     8    0
vmmpepl    168    25277    0    24514    38     0    38    38     0   357    1
vmsppl     272      327    0      315     2     1     1     2     0     8    0
rwobjpl     24     8931    0     6997    12     0    12    12     0     8    0
pdppl      4096     662    0      630    46    12    34    40     0     8    2
pvpl        32   124798    0   121012    35     0    35    35     0   265    3
pmappl     216      327    0      315     1     0     1     1     0     8    0
extentpl    40       58    0       38     1     0     1     1     0     8    0
phpool     112      381    0       15    11     0    11    11     0     8    0
ddb> machine ddbcpu 0
No such command
ddb> trace
pf_purge(ffffffff829ef470) at pf_purge+0x1e sys/net/pf.c:1302
taskq_thread(ffffffff829612f0) at taskq_thread+0x9b sys/kern/kern_task.c:449
end trace frame: 0x0, count: -2
ddb> machine ddbcpu 1
No such command
ddb> trace
pf_purge(ffffffff829ef470) at pf_purge+0x1e sys/net/pf.c:1302
taskq_thread(ffffffff829612f0) at taskq_thread+0x9b sys/kern/kern_task.c:449
end trace frame: 0x0, count: -2
ddb> 

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/02/08 15:20 openbsd 07ec8e14730f 0b33604d .config console log report syz C ci-openbsd-main kernel: integer divide fault trap, code=NUM
2022/02/09 01:54 openbsd 07ec8e14730f 0b33604d .config console log report ci-openbsd-main kernel: integer divide fault trap, code=NUM
2022/02/09 01:52 openbsd 07ec8e14730f 0b33604d .config console log report ci-openbsd-main kernel: integer divide fault trap, code=NUM
2022/02/08 21:03 openbsd 07ec8e14730f 0b33604d .config console log report ci-openbsd-main kernel: integer divide fault trap, code=NUM
2022/02/08 17:34 openbsd 07ec8e14730f 0b33604d .config console log report ci-openbsd-main kernel: integer divide fault trap, code=NUM
2022/02/08 17:18 openbsd 07ec8e14730f 0b33604d .config console log report ci-openbsd-main kernel: integer divide fault trap, code=NUM
2022/02/08 14:39 openbsd 07ec8e14730f 0b33604d .config console log report ci-openbsd-main kernel: integer divide fault trap, code=NUM
2022/02/05 21:37 openbsd b807ad8bb125 a7dab638 .config console log report ci-openbsd-main kernel: integer divide fault trap, code=NUM
* Struck through repros no longer work on HEAD.