]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commit
xen/xmalloc: XMEM_POOL_POISON improvements
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 20 Oct 2023 19:34:29 +0000 (20:34 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 21 Dec 2023 12:19:40 +0000 (12:19 +0000)
commitb74c735f88275f8ae09521c452e8819832b51a97
treecb4980288219064196c396fb939073c2bf33650f
parent3909fb4692dfbf7e46c0bcc37b0a3b943a034da9
xen/xmalloc: XMEM_POOL_POISON improvements

When in use, the spew:

  (XEN) Assertion '!memchr_inv(b->ptr.buffer + MIN_BLOCK_SIZE, POISON_BYTE, (b->size & BLOCK_SIZE_MASK) - MIN_BLOCK_SIZE)' failed at common/xmalloc_tlsf.c:246

is unweidly and likely meaningless to non-Xen developers.  Therefore:

 * Switch to IS_ENABLED().  There's no need for full #ifdef-ary.
 * Pull memchr_inv() out into the if(), and provide an error message which
   clearly states that corruption has been found.
 * XMEM_POOL_POISON can be enabled in release builds.  Use printk()+BUG() so
   it doesn't silently stop working when assertions are compiled out.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
xen/common/xmalloc_tlsf.c