Changing pf to use kmalloc instead of zalloc

Jan Lentfer Jan.Lentfer at
Sun Jan 23 01:25:33 PST 2011

I updated and rebased my branch at
so everything is in one patch/diff and no intermediate stuff anymore.
pf.ko loads and I can load the ruleset, etc. It looks all good, until...

1) I hit a reproducable page fault panic in pf_state_key_detach().

#0  _get_mycpu (di=0xc06f1b80) at ./machine/thread.h:83
#1  md_dumpsys (di=0xc06f1b80) at 
#2  0xc0312d26 in dumpsys () at 
#3  0xc03132e6 in boot (howto=260) at 
#4  0xc031358d in panic (fmt=0xc05bb9e4 "%s") at 
#5  0xc056e2a2 in trap_fatal (frame=0xd3576cd8, eva=<value optimized 
out>) at /home/lentferj/repo/src/sys/platform/pc32/i386/trap.c:1116
#6  0xc056e3d8 in trap_pfault (frame=0xd3576cd8, usermode=0, 
eva=1767862949) at 
#7  0xc056e931 in trap (frame=0xd3576cd8) at 
#8  0xc05566a7 in calltrap () at 
#9  0xd35f5a3d in pf_state_key_detach (s=0xd303b9c8, idx=1) at 
#10 0xd35f5a9e in pf_detach_state (s=0xd303b9c8) at 
#11 0xd35f6ace in pf_unlink_state (cur=0xd303b9c8) at 
#12 0xd35f6e0a in pf_purge_expired_states (maxcheck=2, waslocked=1) at 
#13 0xd35f6f2b in pf_purge_thread (v=0x0) at 
#14 0xc0305bf4 in suspend_kproc (td=Cannot access memory at address 0x8
) at /home/lentferj/repo/src/sys/kern/kern_kthread.c:189
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

2) I kldunload pf.ko
malloc_uninit: 208 bytes of 'pfstatepl' still allocated on cpu 4
malloc_uninit: 896 bytes of 'pfrulepl' still allocated on cpu 4
I am currently uploading the dump to leaf 
lentferj/crash/dump_pf_kmalloc.tar.bz2, just in case someone wants to 
take a look (PLEASE!! :) ).


More information about the Kernel mailing list