syzbot


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

Status: fixed on 2023/06/23 19:30
Reported-by: syzbot+a377d5cd833c2343429a@syzkaller.appspotmail.com
Fix commit: 6d14abdcc245 Avoid division by 0 in m_pool_used
First crash: 579d, last: 523d
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 1080d 1080d 3/3 fixed on 2021/12/16 13:42
openbsd kernel: integer divide fault trap, code=NUM (2) C 8 1016d 1020d 3/3 fixed on 2022/02/10 05:39
openbsd kernel: integer divide fault trap, code=NUM (3) C 157 814d 836d 3/3 fixed on 2022/08/31 00:45

Sample crash report:
kernel: integer divide fault trap, code=0
Stopped at      m_pool_used+0x45:       divl    %ecx,%eax
ddb> 
ddb> set $lines = 0
ddb> set $maxwidth = 0
ddb> show panic
the kernel did not panic
ddb> trace
m_pool_used() at m_pool_used+0x45 sys/kern/uipc_mbuf.c:1502
sbchecklowmem() at sbchecklowmem+0x21 sys/kern/uipc_socket2.c:642
tcp_update_sndspace(ffff800000cdcf28) at tcp_update_sndspace+0x43 sys/netinet/tcp_usrreq.c:1527
tcp_output(ffff800000cdcf28) at tcp_output+0x24cc sys/netinet/tcp_output.c:1029
tcp_send(fffffd806e5dbac0,fffffd807f020500,0,0) at tcp_send+0xf5 sys/netinet/tcp_usrreq.c:849
sosend(fffffd806e5dbac0,0,ffff800021674858,0,0,80) at sosend+0x66d
dofilewritev(ffff8000ffff5060,4,ffff800021674858,0,ffff800021674940) at dofilewritev+0x1a0 sys/kern/sys_generic.c:375
sys_write(ffff8000ffff5060,ffff8000216748f0,ffff800021674940) at sys_write+0x87 sys/kern/sys_generic.c:295
syscall(ffff8000216749c0) at syscall+0x4a8 sys/arch/amd64/amd64/trap.c:632
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7e783a53f170, count: -10
ddb> show registers
rdi               0xffff800000cdcf28
rsi                        0x4000000    __kernel_phys_end+0x1200000
rbp               0xffff800021674410
rbx                       0x140003e4
rdx                                0
rcx                                0
rax                        0x2198000    __kernel_phys_base+0x1198000
r8                    0x7f7fffffc000
r9                              0x80
r10               0x96d1b423280e31aa
r11               0x247a440ab14bb97d
r12                           0x43e0    __ALIGN_SIZE+0x33e0
r13               0xfffffd806e5dbac0
r14               0xffff800000cdcf28
r15                           0x43e0    __ALIGN_SIZE+0x33e0
rip               0xffffffff81be7f15    m_pool_used+0x45
cs                               0x8
rflags                       0x10246    __ALIGN_SIZE+0xf246
rsp               0xffff800021674400
ss                              0x10
m_pool_used+0x45:       divl    %ecx,%eax
ddb> show proc
PROC (sshd) pid=112316 stat=onproc
    flags process=12<EXEC,SUGID> proc=0
    pri=24, usrpri=50, nice=20
    forw=0xffffffffffffffff, list=0xffff8000ffff5b40,0xffff8000ffff5328
    process=0xffff8000ffff6010 user=0xffff80002166f000, vmspace=0xfffffd807f013000
    estcpu=0, cpticks=1, pctcpu=0.3
    user=0, sys=0, intr=0
ddb> ps
   PID     TID   PPID    UID  S       FLAGS  WAIT          COMMAND
 85795  492034  95206      0  2           0                syz-executor1998899681
 95206  392157  14604      0  3        0x82  nanoslp       syz-executor1998899681
 14604  519376  68093      0  3    0x10008a  sigsusp       ksh
*68093  112316  44768      0  7        0x12                sshd
 18464  111215      1      0  3    0x100083  ttyin         getty
 44768  489605      1      0  3        0x88  kqread        sshd
 36925  397362  55902     73  3   0x1100090  kqread        syslogd
 55902  429082      1      0  3    0x100082  netio         syslogd
 31121  331257      1      0  3    0x100080  kqread        resolvd
 15262  379982  14146     77  3    0x100092  kqread        dhcpleased
 80039  367478  14146     77  3    0x100092  kqread        dhcpleased
 14146   18566      1      0  3        0x80  kqread        dhcpleased
 99577    2469      0      0  3     0x14200  bored         smr
 86893   33431      0      0  3     0x14200  pgzero        zerothread
 53258  154480      0      0  3     0x14200  aiodoned      aiodoned
 53220  401039      0      0  3     0x14200  syncer        update
  8350  364067      0      0  3     0x14200  cleaner       cleaner
 38262   33716      0      0  3     0x14200  reaper        reaper
 29452  290613      0      0  3     0x14200  pgdaemon      pagedaemon
 23459   94468      0      0  3     0x14200  bored         viomb
 54341  418043      0      0  3  0x40014200  acpi0         acpi0
 42487  316210      0      0  3     0x14200  bored         softnet3
 29693  301725      0      0  3     0x14200  bored         softnet2
 62650  503077      0      0  3     0x14200  bored         softnet1
 92601  103978      0      0  3     0x14200  bored         softnet0
 69325  442951      0      0  3     0x14200  bored         systqmp
 65676  246084      0      0  3     0x14200  bored         systq
 63169  487431      0      0  3  0x40014200  bored         softclock
 78691  291626      0      0  3  0x40014200                idle0
     1  224331      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    58      1K       2K  78643K       112        0
         ifaddr    23     11K      11K  78643K        23        0
       counters    20     16K      16K  78643K        20        0
       ioctlops     0      0K       2K  78643K        21        0
          mount     1      1K       1K  78643K         1        0
            log     0      0K       0K  78643K         4        0
         vnodes  1174     73K      74K  78643K      1187        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     3      0K       0K  78643K         3        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     58K      59K  78643K       246        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       1K  78643K       246        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     8     62K      64K  78643K        10        0
       UVM amap    88      4K       5K  78643K      2170        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    18   5841K    5905K  78643K      2788        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       21    0       18     1     0     1     1     0     8    0
rtentry    112       23    0        1     1     0     1     1     0     8    0
unpcb      144       35    0       22     1     0     1     1     0     8    0
syncache   296        5    0        5     1     0     1     1     0     8    1
tcpqe       32      129    0      129     1     1     0     1     0     8    0
tcpcb      776        8    0        5     1     0     1     1     0     8    0
arp         88        2    0        0     1     0     1     1     0     8    0
inpcb      336       26    0       20     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
semapl     112        1    0        0     1     0     1     1     0     8    0
dirhash    1024      17    0        0     3     0     3     3     0     8    0
dino2pl    256     1422    0       37    87     0    87    87     0     8    0
ffsino     240     1422    0       37    82     0    82    82     0     8    0
nchpl      144     1605    0       47    58     0    58    58     0     8    0
uvmvnodes   80     1431    0        0    30     0    30    30     0     8    0
vnodes     216     1431    0        0    80     0    80    80     0     8    0
namei      1024    4271    0     4271     1     0     1     1     0     8    1
kstatmem   264        6    0        0     1     0     1     1     0     8    0
scxspl     216     4634    0     4634     3     1     2     3     0     8    2
plimitpl   152       16    0       10     1     0     1     1     0     8    0
sigapl     424      313    0      283     4     0     4     4     0     8    0
knotepl    120     3350    0     3320     2     0     2     2     0     8    1
kqueuepl   184       20    0       13     1     0     1     1     0     8    0
pipepl     288       89    0       86     1     0     1     1     0     8    0
fdescpl    432      297    0      283     2     0     2     2     0     8    0
filepl     120     1137    0     1084     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    104       66    0       56     1     0     1     1     0     8    0
zombiepl   144      283    0      283     1     0     1     1     0     8    1
processpl  1008     313    0      283     5     1     4     5     0     8    0
procpl     696      313    0      283     4     1     3     4     0     8    0
sockpl     456       82    0       60     3     0     3     3     0     8    0
mcl8k      8192       9    0        9     2     1     1     1     0     8    1
mcl4k      4096       5    0        5     1     0     1     1     0     8    1
mcl2k      2048   10798    0    10762    28    15    13    28     0     8    7
mtagpl      96        4    0        4     1     1     0     1     0     8    0
mbufpl     256    17446    0    17403    15     5    10    15     0     8    7
bufpl      288     2398    0       92   165     0   165   165     0     8    0
anonpl      24   185765    0   183923    24     1    23    24     0   188   11
amapchunkpl 152    8350    0     8210     7     1     6     7     0   158    0
amappl16   200     5582    0     5582     5     1     4     5     0     8    4
amappl15   192       13    0       13     2     2     0     1     0     8    0
amappl14   184      104    0       95     1     0     1     1     0     8    0
amappl13   176       11    0       11     1     1     0     1     0     8    0
amappl12   168      823    0      810     1     0     1     1     0     8    0
amappl11   160       50    0       40     1     0     1     1     0     8    0
amappl10   152       24    0       24     1     0     1     1     0     8    1
amappl9    144      123    0      123     1     0     1     1     0     8    1
amappl8    136       46    0       44     1     0     1     1     0     8    0
amappl7    128       33    0       28     1     0     1     1     0     8    0
amappl6    120      152    0      140     1     0     1     1     0     8    0
amappl5    112       84    0       77     1     0     1     1     0     8    0
amappl4    104      427    0      400     1     0     1     1     0     8    0
amappl3     96     2261    0     2230     1     0     1     1     0     8    0
amappl2     88      467    0      428     2     1     1     2     0     8    0
amappl1     80     9054    0     8632    11     0    11    11     0     8    0
amappl      88     1899    0     1848     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      297    0      283     1     0     1     1     0     8    0
uaddrbest   32        2    0        0     1     0     1     1     0     8    0
uaddr       24      297    0      283     1     0     1     1     0     8    0
vmmpekpl   168     7001    0     6990     1     0     1     1     0     8    0
vmmpepl    168    34159    0    33227    46     1    45    46     0   357    1
vmsppl     368      296    0      283     2     0     2     2     0     8    0
rwobjpl     24    19077    0    17031    14     1    13    14     0     8    0
pdppl      4096     601    0      566    51    16    35    41     0     8    0
pvpl        32   280085    0   275903    52     1    51    52     0   265   14
pmappl     216      296    0      283     1     0     1     1     0     8    0
extentpl    40       56    0       38     1     0     1     1     0     8    0
phpool     112      449    0       39    12     0    12    12     0     8    0
ddb> machine ddbcpu 0
No such command
ddb> trace
m_pool_used() at m_pool_used+0x45 sys/kern/uipc_mbuf.c:1502
sbchecklowmem() at sbchecklowmem+0x21 sys/kern/uipc_socket2.c:642
tcp_update_sndspace(ffff800000cdcf28) at tcp_update_sndspace+0x43 sys/netinet/tcp_usrreq.c:1527
tcp_output(ffff800000cdcf28) at tcp_output+0x24cc sys/netinet/tcp_output.c:1029
tcp_send(fffffd806e5dbac0,fffffd807f020500,0,0) at tcp_send+0xf5 sys/netinet/tcp_usrreq.c:849
sosend(fffffd806e5dbac0,0,ffff800021674858,0,0,80) at sosend+0x66d
dofilewritev(ffff8000ffff5060,4,ffff800021674858,0,ffff800021674940) at dofilewritev+0x1a0 sys/kern/sys_generic.c:375
sys_write(ffff8000ffff5060,ffff8000216748f0,ffff800021674940) at sys_write+0x87 sys/kern/sys_generic.c:295
syscall(ffff8000216749c0) at syscall+0x4a8 sys/arch/amd64/amd64/trap.c:632
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7e783a53f170, count: -10
ddb> machine ddbcpu 1
No such command
ddb> trace
m_pool_used() at m_pool_used+0x45 sys/kern/uipc_mbuf.c:1502
sbchecklowmem() at sbchecklowmem+0x21 sys/kern/uipc_socket2.c:642
tcp_update_sndspace(ffff800000cdcf28) at tcp_update_sndspace+0x43 sys/netinet/tcp_usrreq.c:1527
tcp_output(ffff800000cdcf28) at tcp_output+0x24cc sys/netinet/tcp_output.c:1029
tcp_send(fffffd806e5dbac0,fffffd807f020500,0,0) at tcp_send+0xf5 sys/netinet/tcp_usrreq.c:849
sosend(fffffd806e5dbac0,0,ffff800021674858,0,0,80) at sosend+0x66d
dofilewritev(ffff8000ffff5060,4,ffff800021674858,0,ffff800021674940) at dofilewritev+0x1a0 sys/kern/sys_generic.c:375
sys_write(ffff8000ffff5060,ffff8000216748f0,ffff800021674940) at sys_write+0x87 sys/kern/sys_generic.c:295
syscall(ffff8000216749c0) at syscall+0x4a8 sys/arch/amd64/amd64/trap.c:632
Xsyscall() at Xsyscall+0x128
end of kernel
end trace frame: 0x7e783a53f170, count: -10

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/17 10:43 openbsd 54e1723ed8a9 f3921d4d .config console log report syz C ci-openbsd-main kernel: integer divide fault trap, code=NUM
2023/06/17 07:50 openbsd 54e1723ed8a9 f3921d4d .config console log report ci-openbsd-main kernel: integer divide fault trap, code=NUM
2023/04/28 06:16 openbsd 1e5b016c5082 6f5b1cc4 .config console log report ci-openbsd-multicore kernel: integer divide fault trap, code=NUM
2023/04/27 23:20 openbsd 1e5b016c5082 6f5b1cc4 .config console log report ci-openbsd-multicore kernel: integer divide fault trap, code=NUM
2023/04/27 22:09 openbsd 1e5b016c5082 6f5b1cc4 .config console log report ci-openbsd-multicore kernel: integer divide fault trap, code=NUM
2023/04/22 12:55 openbsd 1e5b016c5082 2b32bd34 .config console log report ci-openbsd-multicore kernel: integer divide fault trap, code=NUM
* Struck through repros no longer work on HEAD.