Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent memory coalescing if cap-bounds do not span full length on CHERI
(a cherry-pick of commit d8ecfa3 partly from capablevms/bdwgc) Issue #627 (bdwgc). During a GC sweep, coalescing contiguous memory that spans two separate system OS allocations (e.g. using `mmap()`), causes memory leakage in CHERI systems. This is because the capability used to represent such coalesced (expanded) memory regions has memory bounds derived from the original allocation syscall (smaller than the size of the coalesced memory). To prevent a client being given a capability with invalid bounds, such coalescing is prevented. * allchblk.c [CHERI_PURECAP] (GC_freehblk): Call `CAPABILITY_COVERS_RANGE()` for `hbp` and `next` to check if coalescing with the successor is possible; add comment and FIXME item; evaluate `cheri_base_get(hbp)<=ADDR(prev)` to check if coalescing with the predecessor is possible. * include/private/gc_priv.h [CHERI_PURECAP] (CAPABILITY_COVERS_RANGE): New macro. * include/private/gc_priv.h [CHERI_PURECAP] (SPANNING_CAPABILITY): Use `CAPABILITY_COVERS_RANGE()`.
- Loading branch information