HomeFreeBSD

malloc: Fix DEBUG_REDZONE for contigmalloc()

Description

malloc: Fix DEBUG_REDZONE for contigmalloc()

When free() was adapted to support allocations originating from
contigmalloc(), redzone(9) support was not included. redzone(9)
involves adjusting the pointer to freed memory before looking up the
slab cookie, so it's not straightforward to make contigmalloc() opt out
of redzone support.

Thus, augment contigmalloc() to support redzone.

Reported by: glebius
Tested by: dhw
MFC after: 2 weeks
Fixes: 9e6544dd6e02 ("malloc(9): extend contigmalloc(9) by a "slab cookie"")

(cherry picked from commit 74361d693aec892b01c1553bda7176f8d341b2ff)

Details

Provenance
markjAuthored on Mar 23 2025, 1:42 PM
Parents
rG85ff908020d0: netinet: Fix getcred sysctl handlers to do nothing if no input is given
Branches
Unknown
Tags
Unknown