[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
Thu Feb 8 12:40:35 UTC 2018
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209475
fehmi noyan isi <fnoyanisi at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #176410|0 |1
is obsolete| |
--- Comment #24 from fehmi noyan isi <fnoyanisi at yahoo.com> ---
Created attachment 190429
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=190429&action=edit
patch that uses mallocarray(9) and printf(9)
I have been tied by other commitments, so could not send this patch, which I
wrote about a a week or so ago.
This patch attempts to allocate requested memory by using mallocarray(9) with
NO_WAIT flag and if the call fails, it falls back and makes another
mallocarray(9) call. Second call, however, is done by using the default
PF_HASHSIZ value and M_WAITOK flag.
Please note, even with this patch, pf.ko still crashes during initialisation
phase if you set the value of net.pf.states_hashsize sysctl tunable large
enough to consume all physical memory, something like 2147483648 on a machine
with 512MB RAM (this check has been opted out during the discussions).
The patch also adds some logging mechanism, by using printf(9), in case any of
the mallocarray(9) calls fails.
The patch was generated the pf.c found in 12.0-CURRENT
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-pf
mailing list