From: Maria Matejka Date: Thu, 27 May 2021 08:35:33 +0000 (+0200) Subject: Fixed memory poisoning in slab X-Git-Tag: 3.0-alpha0~136 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=923a6644b206f70435c3d01b93b6880701938b49;p=thirdparty%2Fbird.git Fixed memory poisoning in slab --- diff --git a/lib/slab.c b/lib/slab.c index b0a01ae79..8d16c4330 100644 --- a/lib/slab.c +++ b/lib/slab.c @@ -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);