You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Catch use-after-free bugs in Patina by unmapping unused pool allocator pages.
Solution Overview
Remove the 4K block list.
When allocating a sub 4K block - if no free available, go to the next free block and split it in half to put it in the lower sized block list (i.e. if no 8-byte blocks, grab the next 16-byte block, and allocate the first half, and mark the second half free and put it in the 8-byte list). Repeat until all block lists have been checked.
If no block lists can satisfy allocation, get a new allocation from fallback allocator and split it into two free entries in the 2048 bucket, and rerun 2.
if allocation is > 4K, simply go straight to fallback allocator and allocate whatever number of pages. For simplicity, fallback allocator would always allocate in page-size granularity - for > 4K allocations, that means that the remaining space in the page is just unused.
when free-ing a block, put free signature and length into the BlockListNode, then check from start of containing page to see if you can construct a whole free page.
if you can construct a whole page, remove all constituent blocks from the various free lists (simplified by adding a prev pointer so you can just remove them without finding them in the list) and free the corresponding page back to the fallback_allocator.
Activity
os-d commentedon Oct 14, 2026
Part 1 of this was completed in #1837 , the second and final part is ongoing now.