Page MenuHomeFreeBSD

malloc: do not redzone-wrap a MemGuard allocation
Needs ReviewPublic

Authored by nick_spun.io on Sun, Oct 11, 5:21 AM.
Tags
None
Referenced Files
F176393215: D60608.id189452.diff
Sun, Oct 18, 12:43 PM
F176390291: D60608.id189452.diff
Sun, Oct 18, 12:04 PM
F176385621: D60608.id189455.diff
Sun, Oct 18, 10:57 AM
F176349752: D60608.id189455.diff
Sun, Oct 18, 3:20 AM
F176347353: D60608.id189455.diff
Sun, Oct 18, 2:51 AM
F176326975: D60608.diff
Sat, Oct 17, 11:02 PM
F176326141: D60608.id189452.diff
Sat, Oct 17, 10:51 PM
F176321800: D60608.id.diff
Sat, Oct 17, 10:03 PM
Subscribers

Details

Reviewers
adrian
Summary

redzone(9) documents that it skips MemGuard allocations, and the free and
realloc paths rely on a MemGuard pointer never being redzone-wrapped. With
DEBUG_MEMGUARD and DEBUG_REDZONE both set, the UMA zone-sampling path broke
this: redzone_setup() shifted the pointer into MemGuard's metadata, so the
later memguard_free() or memguard_realloc() panicked.

Skip redzone setup for a MemGuard address, matching the by-type path and
the documented behavior.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 77993
Build 74876: arc lint + arc unit

Event Timeline

oh holy crap how'd you trip over this?

oh holy crap how'd you trip over this?

I am running sys/amd64/conf/NICK-DEV-EXTRABIGASSDEBUG

I have basically everything enabled on my workstation except of KASAN (since it doesn't play nicely with others and the performance hit is insane)