>Number: 5882
>Category: kernel
>Synopsis: trunk(4): integer divide fault trap
>Confidential: yes
>Severity: serious
>Priority: medium
>Responsible: bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jul 22 02:00:01 GMT 2008
>Closed-Date:
>Last-Modified:
>Originator: Dmitri Alenitchev
>Release: -current
>Organization:
net
>Environment:
System : OpenBSD 4.4
Details : OpenBSD 4.4-beta (GENERIC.MP) #18: Tue Jul 22 05:19:08 MSD 2008
root@zeus:/usr/src/sys/arch/i386/compile/GENERIC.MP
Architecture: OpenBSD.i386
Machine : i386
>Description:
ifconfig up for loadbalance trunk interface without trunkports
enters the ddb
kernel: integer divide fault trap, code=0
Stopped at trunk_lb_start+0x1f: divl 0x22c(%ebx),%eax
ddb{0}>
>How-To-Repeat:
# ifconfig trunk0 create
# ifconfig trunk0 trunkproto loadbalance
# ifconfig trunk0 up
>Fix:
Index: if_trunk.c
===================================================================
RCS file: /cvs/src/sys/net/if_trunk.c,v
retrieving revision 1.46
diff -u -p -u -p -r1.46 if_trunk.c
--- if_trunk.c 15 Jun 2008 06:56:09 -0000 1.46
+++ if_trunk.c 22 Jul 2008 01:10:53 -0000
@@ -1461,6 +1461,11 @@ trunk_lb_start(struct trunk_softc *tr, s
u_int32_t p = 0;
int idx;
+ if (tr->tr_count == 0) {
+ m_freem(m);
+ return (EINVAL);
+ }
+
p = trunk_hashmbuf(m, lb->lb_key);
if ((idx = p % tr->tr_count) >= TRUNK_MAX_PORTS) {
m_freem(m);
..or:
Index: if_trunk.c
===================================================================
RCS file: /cvs/src/sys/net/if_trunk.c,v
retrieving revision 1.46
diff -u -p -u -p -r1.46 if_trunk.c
--- if_trunk.c 15 Jun 2008 06:56:09 -0000 1.46
+++ if_trunk.c 22 Jul 2008 01:08:52 -0000
@@ -1462,7 +1462,7 @@ trunk_lb_start(struct trunk_softc *tr, s
int idx;
p = trunk_hashmbuf(m, lb->lb_key);
- if ((idx = p % tr->tr_count) >= TRUNK_MAX_PORTS) {
+ if (tr->tr_count == 0 || ((idx = p % tr->tr_count) >= TRUNK_MAX_PORTS)) {
m_freem(m);
return (EINVAL);
}
OpenBSD 4.4-beta (GENERIC.MP) #18: Tue Jul 22 05:19:08 MSD 2008
root@zeus:/usr/src/sys/arch/i386/compile/GENERIC.MP
cpu0: Intel Pentium III ("GenuineIntel" 686-class) 1.01 GHz
cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE
real mem = 267988992 (255MB)
avail mem = 250855424 (239MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 06/18/02, BIOS32 rev. 0 @ 0xf0b20, SMBIOS rev. 2.3 @ 0xf2ab0 (49 entries)
bios0: vendor Award Software, Inc. version "ASUS CUV4X-D ACPI BIOS Revision 1016" date 06/18/2002
bios0: ASUSTeK Computer INC. CUV4X-D
acpi0 at bios0: rev 0
acpi0: tables DSDT FACP BOOT APIC
acpi0: wakeup devices PCI1(S4) UAR1(S4) UAR2(S4) USB0(S4) USB1(S4) PCI0(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 11, 24 pins
cpu0 at mainbus0: apid 3 (boot processor)
cpu0: apic clock running at 133MHz
cpu1 at mainbus0: apid 0 (application processor)
cpu1: Intel Pentium III ("GenuineIntel" 686-class) 1.01 GHz
cpu1: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (PCI1)
acpicpu0 at acpi0
acpicpu1 at acpi0
acpibtn0 at acpi0: PWRB
bios0: ROM list: 0xc0000/0x10000
pci0 at mainbus0 bus 0: configuration mode 1 (no bios)
pchb0 at pci0 dev 0 function 0 "VIA VT82C691 PCI" rev 0xc4
ppb0 at pci0 dev 1 function 0 "VIA VT82C598 AGP" rev 0x00
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 "NVIDIA Riva TNT2" rev 0x15
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
agp0 at vga1: v2, aperture at 0xfc000000, size 0x10000000
pcib0 at pci0 dev 4 function 0 "VIA VT82C686 ISA" rev 0x40
pciide0 at pci0 dev 4 function 1 "VIA VT82C571 IDE" rev 0x06: ATA100, channel 0 configured to compatibility, channel 1 configured to compatibility
wd0 at pciide0 channel 0 drive 0: <ST340810A>
wd0: 16-sector PIO, LBA, 38166MB, 78165360 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
atapiscsi0 at pciide0 channel 1 drive 0
scsibus0 at atapiscsi0: 2 targets, initiator 7
cd0 at scsibus0 targ 0 lun 0: <MITSUMI, CR-48XATE, 1.0E> ATAPI 5/cdrom removable
cd0(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 2
uhci0 at pci0 dev 4 function 2 "VIA VT83C572 USB" rev 0x16: apic 2 int 5 (irq 5)
uhci1 at pci0 dev 4 function 3 "VIA VT83C572 USB" rev 0x16: apic 2 int 5 (irq 5)
viaenv0 at pci0 dev 4 function 4 "VIA VT82C686 SMBus" rev 0x40: HWM disabled
uhci2 at pci0 dev 9 function 0 "VIA VT83C572 USB" rev 0x62: apic 2 int 19 (irq 9)
uhci3 at pci0 dev 9 function 1 "VIA VT83C572 USB" rev 0x62: apic 2 int 16 (irq 11)
ehci0 at pci0 dev 9 function 2 "VIA VT6202 USB" rev 0x65: apic 2 int 17 (irq 10)
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "VIA EHCI root hub" rev 2.00/1.00 addr 1
vr0 at pci0 dev 13 function 0 "VIA VT6105 RhineIII" rev 0x86: apic 2 int 19 (irq 9), address 00:0d:88:65:d6:02
ukphy0 at vr0 phy 1: Generic IEEE 802.3u media interface, rev. 4: OUI 0x004063, model 0x0034
isa0 at pcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pmsi0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pmsi0 mux 0
pcppi0 at isa0 port 0x61
midi0 at pcppi0: <PC speaker>
spkr0 at pcppi0
lpt0 at isa0 port 0x378/4 irq 7
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
usb1 at uhci0: USB revision 1.0
uhub1 at usb1 "VIA UHCI root hub" rev 1.00/1.00 addr 1
usb2 at uhci1: USB revision 1.0
uhub2 at usb2 "VIA UHCI root hub" rev 1.00/1.00 addr 1
usb3 at uhci2: USB revision 1.0
uhub3 at usb3 "VIA UHCI root hub" rev 1.00/1.00 addr 1
usb4 at uhci3: USB revision 1.0
uhub4 at usb4 "VIA UHCI root hub" rev 1.00/1.00 addr 1
mtrr: Pentium Pro MTRR support
softraid0 at root
root on wd0a swap on wd0b dump on wd0b
>Release-Note:
>Audit-Trail:
>Unformatted: