Date: Tue, 13 Feb 2018 11:54:04 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-pf@FreeBSD.org Subject: [Bug 209475] pf didn't check if enough free RAM for net.pf.states_hashsize Message-ID: <bug-209475-17777-VkZ4SR0ZFR@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-209475-17777@https.bugs.freebsd.org/bugzilla/> References: <bug-209475-17777@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D209475 fehmi noyan isi <fnoyanisi@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190429|0 |1 is obsolete| | --- Comment #28 from fehmi noyan isi <fnoyanisi@yahoo.com> --- Created attachment 190574 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D190574&action= =3Dedit 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) rath= er than directly using PH_HASHSIZ in the mallocarray(9) call. I tried the patch on a 512MB VM running FreeBSD-12.0CURRENT and verified th= at PF initialisation went okay. A log message indicating the memory allocation issue is present in /var/log/messages (and in the console). root@test-vm:~ # uname -a FreeBSD test-vm 12.0-CURRENT FreeBSD 12.0-CURRENT #13: Wed Feb 14 13:28:52 = NZDT 2018 root@test-vm:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 root@test-vm:~ # cat /boot/loader.conf net.pf.states_hashsize=3D"2147483648" root@test-vm:~ # sysctl hw.realmem hw.realmem: 536805376 root@test-vm:~ # kldstat Id Refs Address Size Name 1 1 0xffffffff80200000 20bf2d0 kernel root@test-vm:~ # service pf onestart Enabling pf. root@test-vm:~ # kldstat Id Refs Address Size Name 1 3 0xffffffff80200000 20bf2d0 kernel 2 1 0xffffffff82419000 33590 pf.ko root@test-vm:~ # grep pf_initialize /var/log/messages Feb 14 13:40:20 test-vm kernel: pf_initialize : Not enough memory for 85899345920 bytes. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-209475-17777-VkZ4SR0ZFR>