Hi Andrew,

On 20/12/2023 21:47, Andrew Cooper wrote:
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.

Signed-off-by: Andrew Cooper <[email protected]>

With one remark:

Reviewed-by: Julien Grall <[email protected]>

---
CC: George Dunlap <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Wei Liu <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau MonnĂ© <[email protected]>

Observations from the debugging of:
   https://github.com/Dasharo/dasharo-issues/issues/488

v2:
  * Switch to printk()+BUG()

I would suggest to add a sentence about the switch to printk() + BUG() in the commit message. Maybe:

"CONFIG_XMEM_POOL_POISON can be enabled even on production build. So we should switch from ASSERT() to BUG()."

Cheers,

--
Julien Grall

Reply via email to