mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-19 10:25:38 +03:00
Implement use-after-free detection using junk and stash.
On deallocation, sampled pointers (specially aligned) get junked and stashed into tcache (to prevent immediate reuse). The expected behavior is to have read-after-free corrupted and stopped by the junk-filling, while write-after-free is checked when flushing the stashed pointers.
This commit is contained in:
parent
06aac61c4b
commit
b75822bc6e
22 changed files with 793 additions and 42 deletions
|
|
@ -26,6 +26,12 @@ do_arena_create(ssize_t dirty_decay_ms, ssize_t muzzy_decay_ms) {
|
|||
|
||||
static inline void
|
||||
do_arena_destroy(unsigned arena_ind) {
|
||||
/*
|
||||
* For convenience, flush tcache in case there are cached items.
|
||||
* However not assert success since the tcache may be disabled.
|
||||
*/
|
||||
mallctl("thread.tcache.flush", NULL, NULL, NULL, 0);
|
||||
|
||||
size_t mib[3];
|
||||
size_t miblen = sizeof(mib)/sizeof(size_t);
|
||||
expect_d_eq(mallctlnametomib("arena.0.destroy", mib, &miblen), 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue