diff options
author | Maria Matejka <mq@ucw.cz> | 2021-05-27 10:35:33 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2021-09-10 17:38:22 +0200 |
commit | 923a6644b206f70435c3d01b93b6880701938b49 (patch) | |
tree | 10b0f3b96e248249e8c18266a576a6bcf34a4992 /lib | |
parent | 227e2d5541e86210b383c8e8054805692ad3cf14 (diff) |
Fixed memory poisoning in slab
Diffstat (limited to 'lib')
-rw-r--r-- | lib/slab.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -269,6 +269,9 @@ no_partial: goto okay; } h = alloc_page(); +#ifdef POISON + memset(h, 0xba, get_page_size()); +#endif ASSERT_DIE(SL_GET_HEAD(h) == h); memset(h, 0, s->head_size); add_head(&s->partial_heads, &h->n); @@ -324,7 +327,12 @@ sl_free(slab *s, void *oo) { rem_node(&h->n); if (s->num_empty_heads >= MAX_EMPTY_HEADS) + { +#ifdef POISON + memset(h, 0xde, get_page_size()); +#endif free_page(h); + } else { add_head(&s->empty_heads, &h->n); |