-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Another unexpected behavior in markus allocator #3
Comments
Thanks Insu! This was a curious one. The oversized alloc to uint(-1) causes the allocator to fail on sbrk. In the default Boehm Allocator setup, this then causes it to both a) try mmap, and b) lock in to mmap for all future allocations, regardless of whether mmap worked. Part b) is what causes this bug. For some reason (I'm not sure if this is a MarkUs issue or a BoehmGC issue) the allocations in that new Mmap space (rather than the contiguous region of Sbrked space, which itself can be mmaped and munmapped freely, and still be checked) will free themselves even with a dangling pointer. Since this switch over to Mmap isn't particularly intended behaviour (and isn't used in the current version without an attempt at an oversized allocation), I've simply disabled that feature. In the fixed version, the allocation of p[2] now uses different memory from p[1], as the virtual address space it resides in is still unavailable due to the dangling pointer. As for the memset, this is intended functionality: you've gone past the bounds of p[2]'s 350500-sized allocation, which is a spatial safety bug (and more directly, undefined behaviour, which is why MarkUs is able to throw a segmentation fault). The MarkUs allocator is still allowed to reuse that space if it wishes -- but since it correctly believes nobody else should have access to it at present, it leaves the virtual address space munmapped. Cheers, |
Thanks for your quick fix! |
Hi. Similar to #1, we found that markus still allows reclamation.
Moreover, the reclaimed memory is not fully accessible,
which violates the convention of an allocator, I believe.
The text was updated successfully, but these errors were encountered: