# Kernel panic restarting netif service



## onawhim (Jul 11, 2017)

I got this kernel panic while running `service netif restart`:


```
Jul 11 06:05:22 t420 kernel: iwn0: iwn_read_firmware: ucode rev=0x271f0501
Jul 11 06:05:22 t420 kernel:
Jul 11 06:05:22 t420 kernel:
Jul 11 06:05:22 t420 kernel: Fatal trap 12: page fault while in kernel mode
Jul 11 06:05:22 t420 kernel: cpuid = 2; apic id = 02
Jul 11 06:05:22 t420 kernel: fault virtual address   = 0x0
Jul 11 06:05:22 t420 kernel: fault code       = supervisor read data, page not present
Jul 11 06:05:22 t420 kernel: instruction pointer   = 0x20:0xffffffff80c1fde5
Jul 11 06:05:22 t420 kernel: stack pointer           = 0x28:0xfffffe023324a6e0
Jul 11 06:05:22 t420 kernel: frame pointer           = 0x28:0xfffffe023324a7b0
Jul 11 06:05:22 t420 kernel: code segment       = base 0x0, limit 0xfffff, type 0x1b
Jul 11 06:05:22 t420 kernel: = DPL 0, pres 1, long 1, def32 0, gran 1
Jul 11 06:05:22 t420 kernel: processor eflags   = interrupt enabled, resume, IOPL = 0
Jul 11 06:05:22 t420 kernel: current process       = 32192 (ifconfig)
Jul 11 06:05:22 t420 kernel: trap number       = 12
Jul 11 06:05:22 t420 kernel: panic: page fault
Jul 11 06:05:22 t420 kernel: cpuid = 2
Jul 11 06:05:22 t420 kernel: KDB: stack backtrace:
Jul 11 06:05:22 t420 kernel: #0 0xffffffff80b24077 at kdb_backtrace+0x67
Jul 11 06:05:22 t420 kernel: #1 0xffffffff80ad93e2 at vpanic+0x182
Jul 11 06:05:22 t420 kernel: #2 0xffffffff80ad9253 at panic+0x43
Jul 11 06:05:22 t420 kernel: #3 0xffffffff80fa0d31 at trap_fatal+0x351
Jul 11 06:05:22 t420 kernel: #4 0xffffffff80fa0f23 at trap_pfault+0x1e3
Jul 11 06:05:22 t420 kernel: #5 0xffffffff80fa04cc at trap+0x26c
Jul 11 06:05:22 t420 kernel: #6 0xffffffff80f84141 at calltrap+0x8
Jul 11 06:05:22 t420 kernel: #7 0xffffffff80bdcf6c at ifioctl+0x133c
Jul 11 06:05:22 t420 kernel: #8 0xffffffff80b41ab4 at kern_ioctl+0x2d4
Jul 11 06:05:22 t420 kernel: #9 0xffffffff80b41771 at sys_ioctl+0x171
Jul 11 06:05:22 t420 kernel: #10 0xffffffff80fa168e at amd64_syscall+0x4ce
Jul 11 06:05:22 t420 kernel: #11 0xffffffff80f8442b at Xfast_syscall+0xfb
Jul 11 06:05:22 t420 kernel: Uptime: 1d18h15m0s
Jul 11 06:05:22 t420 kernel: Dumping 1565 out of 8042 MB:..2%..11%..21%..31%..41%..51%..61%..71%..81%..91%Copyright (c) 1992-2016 The FreeBSD Project.
```

I also see the core dump .... but it's only 1.5 G:

```
[cosmin@t420 /var/crash]$ ls -la
total 4584560
drwxr-x---   2 root  wheel         512 Jul 11 06:06 ./
drwxr-xr-x  25 root  wheel         512 Jul 11 01:03 ../
-rw-r--r--   1 root  wheel           2 Jul 11 06:05 bounds
-rw-------   1 root  wheel         458 Jul  6 20:27 info.0
-rw-------   1 root  wheel         440 Jul 11 06:05 info.1
lrwxr-xr-x   1 root  wheel           6 Jul 11 06:06 info.last@ -> info.1
-rw-r--r--   1 root  wheel           5 Sep 28  2016 minfree
-rw-------   1 root  wheel   817139712 Jul  6 20:27 vmcore.0
-rw-------   1 root  wheel  1641267200 Jul 11 06:06 vmcore.1
lrwxr-xr-x   1 root  wheel           8 Jul 11 06:06 vmcore.last@ -> vmcore.1
[cosmin@t420 /var/crash]$ du -hs vmcore.1
1.5G   vmcore.1
```

I'm mostly posting this here in case others have seen this.  My laptop is a Lenovo ThinkPad T420.

Running the following kernel:


```
$ uname -a
FreeBSD t420 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 01:43:23 UTC 2016     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
```

I'm not sure how far I can go in finding the root cause...


----------



## ralphbsz (Jul 11, 2017)

Did you select the correct firmware model for the iwn(4) driver (see the man page)?  Are your firmware file in good condition and not damaged (those are the various /boot/iwn*fw.ko files)?  You could check the files against a known good install (mine is 11-0-RELEASE-p9):

```
> cksum /boot/kernel/iwn*fw.ko
864835253 342784 /boot/kernel/iwn1000fw.ko
1902818926 342824 /boot/kernel/iwn100fw.ko
67835993 694932 /boot/kernel/iwn105fw.ko
743539544 706484 /boot/kernel/iwn135fw.ko
4184513598 704212 /boot/kernel/iwn2000fw.ko
916866176 715740 /boot/kernel/iwn2030fw.ko
226690453 196320 /boot/kernel/iwn4965fw.ko
651679260 345964 /boot/kernel/iwn5000fw.ko
3291645242 342668 /boot/kernel/iwn5150fw.ko
1804919196 459884 /boot/kernel/iwn6000fw.ko
2352509262 682636 /boot/kernel/iwn6000g2afw.ko
1123696369 687836 /boot/kernel/iwn6000g2bfw.ko
1918941436 478120 /boot/kernel/iwn6050fw.ko
```

Why do I ask?  Because the panic happened right after the iwn(4) driver read the firmware (first line in your kernel log).  But both guesses are long shots.

Also try upgrading to a newer release (I like to use `freebsd-update`, other people have different tastes, check the manual), on the off chance that this problem has been fixed already.  If this doesn't help, file a bug report, because a kernel panic is always a bug.


----------

