[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 3/3] xmalloc: add a Kconfig option to poison free pool memory



> -----Original Message-----
> From: Jan Beulich <JBeulich@xxxxxxxx>
> Sent: 03 July 2019 11:07
> To: Paul Durrant <Paul.Durrant@xxxxxxxxxx>
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx; Julien Grall <julien.grall@xxxxxxx>; 
> Andrew Cooper
> <Andrew.Cooper3@xxxxxxxxxx>; George Dunlap <George.Dunlap@xxxxxxxxxx>; Ian 
> Jackson
> <Ian.Jackson@xxxxxxxxxx>; Stefano Stabellini <sstabellini@xxxxxxxxxx>; Konrad 
> Rzeszutek Wilk
> <konrad.wilk@xxxxxxxxxx>; Tim (Xen.org) <tim@xxxxxxx>; Wei Liu <wl@xxxxxxx>
> Subject: Re: [PATCH 3/3] xmalloc: add a Kconfig option to poison free pool 
> memory
> 
> On 02.07.2019 18:38, Paul Durrant wrote:
> > --- a/xen/Kconfig.debug
> > +++ b/xen/Kconfig.debug
> > @@ -105,6 +105,13 @@ config DEBUG_TRACE
> >       either directly to the console or are printed to console in case of
> >       a system crash.
> >
> > +config POOL_POISON
> 
> May I suggest this to become XMEM_POOL_POISON, to parallel the names
> of the involved functions?
> 

Sure.

> > @@ -240,6 +244,10 @@ static inline void EXTRACT_BLOCK(struct bhdr *b, 
> > struct xmem_pool *p, int fl,
> >           }
> >       }
> >       b->ptr.free_ptr = (struct free_ptr) {NULL, NULL};
> > +#ifdef CONFIG_POOL_POISON
> > +    for ( i = MIN_BLOCK_SIZE; i < (b->size & BLOCK_SIZE_MASK); i++ )
> > +        ASSERT(b->ptr.buffer[i] == 0xAA);
> > +#endif /* CONFIG_POOL_POISON */
> 
> May I further suggest that we clone Linux'es memchr_inv() for this
> purpose (perhaps with a more simplistic implementation along the
> lines of memchr())? We should then also use it in check_one_page().
> 

Yes, that sounds like a worthy thing to do.

  Paul

> Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.