# Reload rules cause kernel panic or reboot



## val (Apr 12, 2012)

Hi to all!

I have some annoying problem with pf


```
FreeBSD ori.local 9.0-STABLE FreeBSD 9.0-STABLE #5: Wed Apr 11 11:51:05 CET 2012     root@ori.local:/usr/obj/usr/src/sys/ORI  i386
```

I have large table in pf (blocked), which consist about 250,000 ips

During reloading rules I've kernel panic or just silent reboot


```
CPU: Intel(R) XEON(TM) CPU 1.80GHz (1794.74-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0xf24  Family = f  Model = 2  Stepping = 4
 Features=0x3febfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM>
real memory  = 1073741824 (1024 MB)
avail memory = 1031688192 (983 MB)
```

limits are:

```
cputime              infinity secs
  filesize             infinity kB
  datasize               524288 kB
  stacksize               65536 kB
  coredumpsize         infinity kB
  memoryuse            infinity kB
  memorylocked         infinity kB
  maxprocesses             5547
  openfiles               11095
  sbsize               infinity bytes
  vmemoryuse           infinity kB
  pseudo-terminals     infinity
  swapuse              infinity kB
```

Ideas?


----------



## SirDice (Apr 12, 2012)

val said:
			
		

> During reloading rules I've kernel panic or just silent reboot


What panics?


----------



## val (Apr 12, 2012)

This is last:


```
Apr 11 21:01:58 orion syslogd: kernel boot file is /boot/kernel/kernel
Apr 11 21:01:58 orion kernel: Sleeping thread (tid 100244, pid 5572) owns a non-sleepable lock
Apr 11 21:01:58 orion kernel: panic: sleeping thread
Apr 11 21:01:58 orion kernel: cpuid = 0
Apr 11 21:01:58 orion kernel: KDB: stack backtrace:
Apr 11 21:01:58 orion kernel: #0 0xc0b1ef68 at kdb_backtrace+0x48
Apr 11 21:01:58 orion kernel: #1 0xc0aeae4c at panic+0x10c
Apr 11 21:01:58 orion kernel: #2 0xc0b2d122 at propagate_priority+0x192
Apr 11 21:01:58 orion kernel: #3 0xc0b2dd61 at turnstile_wait+0x191
Apr 11 21:01:58 orion kernel: #4 0xc0ad8abf at _mtx_lock_sleep+0xaf
Apr 11 21:01:58 orion kernel: #5 0xc0533f72 at pf_test+0x442
Apr 11 21:01:58 orion kernel: #6 0xc053a52b at pf_check_in+0x3b
Apr 11 21:01:58 orion kernel: #7 0xc0bae6a8 at pfil_run_hooks+0x98
Apr 11 21:01:58 orion kernel: #8 0xc0c05cc4 at ip_input+0x2c4
Apr 11 21:01:58 orion kernel: #9 0xc0bad8fa at netisr_dispatch_src+0x1da
Apr 11 21:01:58 orion kernel: #10 0xc0bada3e at netisr_dispatch+0x1e
Apr 11 21:01:58 orion kernel: #11 0xc0ba31ef at ether_demux+0x19f
Apr 11 21:01:58 orion kernel: #12 0xc0ba349e at ether_nh_input+0x20e
Apr 11 21:01:58 orion kernel: #13 0xc0bad8fa at netisr_dispatch_src+0x1da
Apr 11 21:01:58 orion kernel: #14 0xc0bada3e at netisr_dispatch+0x1e
Apr 11 21:01:58 orion kernel: #15 0xc06f0fb9 at lem_rxeof+0x209
Apr 11 21:01:58 orion kernel: #16 0xc06f2b0d at lem_poll+0xad
Apr 11 21:01:58 orion kernel: #17 0xc0adc05c at netisr_poll+0xbc
```


----------



## SirDice (Apr 12, 2012)

val said:
			
		

> ```
> Apr 11 21:01:58 orion kernel: Sleeping thread (tid 100244, pid 5572) owns a non-sleepable lock
> Apr 11 21:01:58 orion kernel: panic: sleeping thread
> ```


Cool, I'd never seen that one before :e

I did see some references to WITNESS. Did you enable it on your custom kernel?


----------



## val (Apr 12, 2012)

No, nothing like this.


----------



## val (Apr 20, 2012)

pid 5572 belongs to pfctl and crash caused by executing command

`# pfctl -t blocked -T flush && pfctl -f /etc/pf.conf`


----------



## glebius@ (Jun 30, 2012)

In 9-STABLE some ioctl() calls into pf do M_WAITOK malloc, while holding the pf mutex, and I suppose, that could be the cause of panic.

In my pf branch I've fixed all such cases. For details see: http://lists.freebsd.org/pipermail/freebsd-pf/2012-June/006643.html


----------



## Ben (Jul 3, 2012)

@val: You tried Glebius' fix?


----------



## val (Jul 4, 2012)

@Ben: not yet


----------



## Ben (Jul 4, 2012)

I have the same problem seems. As mentioned in the other thread I can kill my server my loading 170.000+ IPs into a local table.


----------

