Date: Sat, 27 Jan 2018 09:39:54 +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-puFZ3MMMFi@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 --- Comment #22 from fehmi noyan isi <fnoyanisi@yahoo.com> --- Hi there. I patched pf_initialize() in head (r328383, which has mallocarray= (9)) by implementing a fallback mallocarray(9) call (as discussed in the commen= ts) if ((V_pf_idhash =3D mallocarray(pf_hashsize, sizeof(pf_idhash), M_PFHASH, M_WAITOK|M_ZERO)) =3D=3D NULL) { V_pf_idhash =3D mallocarray(PH_HASHSIZ, sizeof(pf_idhash), M_PFHASH, M_NOWAIT|M_ZERO) } // and all other malloc(9) calls Although, this change prevents the initialisation process against any overf= low issues, the fallback mallocarray(...,M_WAITOK) calls still block in case too much memory is requested.=20 >> Memory allocation is very complicated and it's basically impossible to p= redict if there'd be enough free memory to satisfy a request without actual= ly doing it. Moreover, it'd always be susceptible to races. Based on Kristof's comment above, shall we assume this is as far as we can = go? --=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-puFZ3MMMFi>