[Bug 209475] pf didn't check if enough free RAM for net.pf.states_hashsize
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Tue Feb 13 11:54:06 UTC 2018
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209475
fehmi noyan isi <fnoyanisi at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #190429|0 |1
is obsolete| |
--- Comment #28 from fehmi noyan isi <fnoyanisi at yahoo.com> ---
Created attachment 190574
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=190574&action=edit
patch with mallocarray(9), printf(9) and a single fallback block
Attached is the latest patch with a single fallback block which is executed
depending on the return values from mallcoarray(... | M_NOWAIT) calls. The code
sets the value of respective variable that is passed to mallocarray(9) rather
than directly using PH_HASHSIZ in the mallocarray(9) call.
I tried the patch on a 512MB VM running FreeBSD-12.0CURRENT and verified that
PF initialisation went okay. A log message indicating the memory allocation
issue is present in /var/log/messages (and in the console).
root at test-vm:~ # uname -a
FreeBSD test-vm 12.0-CURRENT FreeBSD 12.0-CURRENT #13: Wed Feb 14 13:28:52 NZDT
2018 root at test-vm:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
root at test-vm:~ # cat /boot/loader.conf
net.pf.states_hashsize="2147483648"
root at test-vm:~ # sysctl hw.realmem
hw.realmem: 536805376
root at test-vm:~ # kldstat
Id Refs Address Size Name
1 1 0xffffffff80200000 20bf2d0 kernel
root at test-vm:~ # service pf onestart
Enabling pf.
root at test-vm:~ # kldstat
Id Refs Address Size Name
1 3 0xffffffff80200000 20bf2d0 kernel
2 1 0xffffffff82419000 33590 pf.ko
root at test-vm:~ # grep pf_initialize /var/log/messages
Feb 14 13:40:20 test-vm kernel: pf_initialize : Not enough memory for
85899345920 bytes.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-pf
mailing list