Multi-zone malloc(9)
Ivan Voras
ivoras at freebsd.org
Fri Jul 23 13:47:30 UTC 2010
On 07/22/10 18:54, mdf at FreeBSD.org wrote:
> Occasionally we run into use-after-free and malloc'd buffer overrun
> scenarios. When this happens it can be rather difficult to determine
> what code is at fault, since e.g. every 64 byte allocation, regardless
> of malloc type, comes from the same UMA zone. This means that an
> overflow in M_TEMP will affect M_DEVBUF, etc. Adding multiple uma
> zones for each bucket size means that we can hash on the malloc type's
> shortdesc field so that there are fewer collisions and misused memory
> from one malloc type only affects a subset of other malloc types.
To what extent does something like this help? As I read it, you still
have the problem of overflows from one allocation trashing data in some
other random allocation, but now you also have to track which hash
bucket is it in while debugging?
And would this interfere with possible NUMA efforts? (because it sort of
looks similar - hashing allocations to "zones", which in NUMA case would
be per-CPU).
More information about the freebsd-arch
mailing list