kernel panic in bpf_mtap

Hal Burch hburch at lumeta.com
Tue Jun 24 09:54:16 PDT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In a 4.8-STABLE kernel (cvsup'd yesterday), I'm getting a kernel panic
early in bpf_mtap.  I use bpf extensively (through the pcap library),
but am now getting panics.  This occurs on code I'm working on,
not by default.

This is happening on my laptop running 4.7 and 4.8, as well as my
desktop running 4.8-RC from March, so it is unlikely this is a hardware
problem.  They are attached to different networks right now.  I can
reproduce the kernel panic with high degree of regularity (>50% of the
times I run a program that takes less than 2 seconds).

Below is the output from a gdb of the kernel core dump.  My read is
the mbuf chain got messed up.  I've tried tracing back the execution
path to figure out where it's being set, but it's a bit opaque to
someone with limited knowledge of the FreeBSD kernel (me).  In case
it matters, the received packet is an ARP request packet (hrd=ARPHRD_ETHER,
format=8, hln=6, pln=4, op=ARPOP_REQUEST).

The panic itself said the panic occured at bpf_mtap+0x18: addl
0xc(%eax),%esi.

Does anyone have any ideas on what might be going on?  It's possible,
perhaps likely, that my software has a bug which is corrupting memory
somehow, but I would not expect that to cause a kernel panic.

Thank you for any help you can provide.

 - Hal

# gdb -k kernel.debug /var/crash/vmcore.0
GNU gdb 4.18 (FreeBSD)
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-freebsd"...Deprecated bfd_read called at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dbxread.c line 2627 in elfstab_build_psymtabs
Deprecated bfd_read called at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dbxread.c line 933 in fill_symbuf

IdlePTD at phsyical address 0x00580000
initial pcb at physical address 0x004ab7c0
panicstr: from debugger
panic messages:
- ---
Fatal trap 12: page fault while in kernel mode
fault virtual address	= 0xe31b
fault code		= supervisor read, page not present
instruction pointer	= 0x8:0xc027eb1c
stack pointer	        = 0x10:0xd18f3e00
frame pointer	        = 0x10:0xd18f3e0c
code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, def32 1, gran 1
processor eflags	= interrupt enabled, resume, IOPL = 0
current process		= 266 (netscan)
interrupt mask		= 
panic: from debugger


Fatal trap 3: breakpoint instruction fault while in kernel mode
instruction pointer	= 0x8:0xc039e5ac
stack pointer	        = 0x10:0xd18f3c14
frame pointer	        = 0x10:0xd18f3c1c
code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, def32 1, gran 1
processor eflags	= interrupt enabled, IOPL = 0
current process		= 266 (netscan)
interrupt mask		= 
panic: from debugger
Uptime: 43m7s

dumping to dev #ad/0x30001, offset 492568
dump ata0: resetting devices .. done
255 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 
- ---
#0  dumpsys () at /usr/src/sys/kern/kern_shutdown.c:487
487		if (dumping++) {
(kgdb) where
#0  dumpsys () at /usr/src/sys/kern/kern_shutdown.c:487
#1  0xc023c7eb in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:316
#2  0xc023cc29 in panic (fmt=0xc03d3ee4 "from debugger")
    at /usr/src/sys/kern/kern_shutdown.c:595
#3  0xc015f855 in db_panic (addr=-1071125732, have_addr=0, count=1, 
    modif=0xd18f3c6c "") at /usr/src/sys/ddb/db_command.c:435
#4  0xc015f7f5 in db_command (last_cmdp=0xc044ce18, cmd_table=0xc044cc58, 
    aux_cmd_tablep=0xc0490d18) at /usr/src/sys/ddb/db_command.c:333
#5  0xc015f8ba in db_command_loop () at /usr/src/sys/ddb/db_command.c:457
#6  0xc01619f7 in db_trap (type=12, code=0) at /usr/src/sys/ddb/db_trap.c:71
#7  0xc039e34e in kdb_trap (type=12, code=0, regs=0xd18f3dc0)
    at /usr/src/sys/i386/i386/db_interface.c:158
#8  0xc03ab778 in trap_fatal (frame=0xd18f3dc0, eva=58139)
    at /usr/src/sys/i386/i386/trap.c:969
#9  0xc03ab451 in trap_pfault (frame=0xd18f3dc0, usermode=0, eva=58139)
    at /usr/src/sys/i386/i386/trap.c:867
#10 0xc03aaff7 in trap (frame={tf_fs = 16, tf_es = -779157488, tf_ds = 16, 
      tf_edi = -779141592, tf_esi = 60, tf_ebp = -779141620, 
      tf_isp = -779141652, tf_ebx = -1058497280, tf_edx = -1050935680, 
      tf_ecx = 14, tf_eax = 58127, tf_trapno = 12, tf_err = 0, 
      tf_eip = -1071125732, tf_cs = 8, tf_eflags = 66054, 
      tf_esp = -1058497280, tf_ss = -1058615294})
    at /usr/src/sys/i386/i386/trap.c:466
#11 0xc027eb1c in bpf_mtap (ifp=0xc15ba000, m=0xd18f3e28)
    at /usr/src/sys/net/bpf.c:1185
#12 0xc0281a2e in ether_input (ifp=0xc15ba000, eh=0xc0e6d002, m=0xc0e89d00)
    at /usr/src/sys/net/if_ethersubr.c:580
#13 0xc032467a in xl_rxeof (sc=0xc15ba000) at /usr/src/sys/pci/if_xl.c:1947
#14 0xc0324d18 in xl_intr (arg=0xc15ba000) at /usr/src/sys/pci/if_xl.c:2156
#15 0xc03b5fcd in intr_mux (arg=0xc0e350a0)
    at /usr/src/sys/i386/isa/intr_machdep.c:582
#16 0xc03b0f8f in i8254_get_timecount (tc=0xc0e3cc00) at machine/cpufunc.h:429
#17 0xc022faaa in microtime (tv=0xd18f3f20)
    at /usr/src/sys/kern/kern_clock.c:500
#18 0xc02420e2 in gettimeofday (p=0xcc25bd40, uap=0xd18f3f80)
    at /usr/src/sys/kern/kern_time.c:312
#19 0xc03aba59 in syscall2 (frame={tf_fs = -1070006225, tf_es = 47, 
      tf_ds = 47, tf_edi = 1, tf_esi = 0, tf_ebp = -1077937840, 
      tf_isp = -779141164, tf_ebx = 1, tf_edx = -1077937912, tf_ecx = 0, 
      tf_eax = 116, tf_trapno = 0, tf_err = 2, tf_eip = 671779276, tf_cs = 31, 
      tf_eflags = 659, tf_esp = -1077937900, tf_ss = 47})
    at /usr/src/sys/i386/i386/trap.c:1175
#20 0xc039f225 in Xint0x80_syscall ()
#21 0x804bd76 in ?? ()
#22 0x804917e in ?? ()
(kgdb) up 11
#11 0xc027eb1c in bpf_mtap (ifp=0xc15ba000, m=0xd18f3e28)
    at /usr/src/sys/net/bpf.c:1185
1185		for (m0 = m; m0 != 0; m0 = m0->m_next)
(kgdb) print m->m_hdr
$1 = {mh_next = 0xc0e89d00, mh_nextpkt = 0x0, mh_data = 0xc0e6d002 "ÿÿÿÿÿÿ", 
  mh_len = 14, mh_type = 17598, mh_flags = -16334}
(kgdb) print m->m_hdr.mh_next->m_hdr
$2 = {mh_next = 0xe30f, mh_nextpkt = 0x0, mh_data = 0xc0e6d010 "", 
  mh_len = 46, mh_type = 1, mh_flags = 3}
(kgdb) print m->m_hdr.mh_next->m_hdr.mh_next->m_hdr
Cannot access memory at address 0xe30f.
(kgdb) print pktlen
$3 = 60
(kgdb)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE++IIxfcACA7bj8yARAvWpAKCIzAqH+sWjHMrOZ13D+TI27UmX2QCfTi1u
PuqOd28rv1/s5rQXxw9Eo3M=
=2dIb
-----END PGP SIGNATURE-----


More information about the freebsd-questions mailing list