https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209475

--- Comment #22 from fehmi noyan isi <fnoyan...@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 comments)

if ((V_pf_idhash =  mallocarray(pf_hashsize, sizeof(pf_idhash), M_PFHASH,
M_WAITOK|M_ZERO)) == NULL) {
V_pf_idhash = 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 overflow
issues, the fallback mallocarray(...,M_WAITOK) calls still block in case too
much memory is requested. 

>> Memory allocation is very complicated and it's basically impossible to 
>> predict if there'd be enough free memory to satisfy a request without 
>> actually 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?

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-pf@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-pf
To unsubscribe, send any mail to "freebsd-pf-unsubscr...@freebsd.org"

Reply via email to