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

Re: [Xen-devel] [PATCH v2] xmalloc: add support for checking the pool integrity


  • To: "Jan Beulich" <JBeulich@xxxxxxxx>
  • From: Mihai DonÈu <mdontu@xxxxxxxxxxxxxxx>
  • Date: Mon, 8 Dec 2014 18:00:01 +0200
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Comment: DomainKeys? See http://domainkeys.sourceforge.net/
  • Delivery-date: Mon, 08 Dec 2014 16:00:07 +0000
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=bitdefender.com; b=Jdjx00K/9waeaZd05l2ZEbsjYcVwl7arRf1eopMvAi6MzjXSjKnfXnMLc1zDzpnN5d9j5pmUjoXTfsfVrj+docljLS6ZSS1VGlR0NQ/TvvU5lTxPQC5Cx5IEb8UkxRRHp32wzJ7tsBdmXg/jzumZ48tK+2qlTC3kLgAbrQjXJR6LVTnjh6XiH9KT2okKt5ZFFvpvwqWhzYmHrIIS/iZwz1rK6v3+r18H62bia54t9aFibc4gz5afc5dR/evjMdmaz+k8M+Qz5XMyaX2H07Okf1jtB3X7AVVbR4KxpFQz9fOsijVHDXItg8BZ6ElcQsEtgumTOu7CNesTXdOsaRctKA==; h=Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:Organization:MIME-Version:Content-Type:Content-Transfer-Encoding:X-BitDefender-Scanner:X-BitDefender-Spam:X-BitDefender-SpamStamp:X-BitDefender-CF-Stamp;
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

On Monday 08 December 2014 10:18:01 Jan Beulich wrote:
> >>> On 08.12.14 at 03:30, <mdontu@xxxxxxxxxxxxxxx> wrote:
> > +#ifndef NDEBUG
> > +static bool_t xmem_pool_check_size(const struct bhdr *b, int fl, int sl)
> > +{
> > +    while ( b )
> > +    {
> > +        int __fl;
> > +        int __sl;
> > +
> > +        MAPPING_INSERT(b->size, &__fl, &__sl);
> > +        if ( __fl != fl || __sl != sl )
> > +        {
> > +            printk(XENLOG_ERR "xmem_pool: for block %p size = %u, { fl = 
> > %d, sl = %d } should be { fl = %d, sl = %d }\n",
> 
> Quoting my reply to v1: "Long line. Only the format message alone
> is allowed to exceed 80 characters."
> 

Just so I don't send another faulty patch, you would see that printk()
being:

  printk(XENLOG_ERR
         "xmem_pool: for block %p size = %u, { fl = %d, sl = %d } should be { 
fl = %d, sl = %d }\n",
         b, b->size, fl, sl, __fl, __sl);

?

> Also with there potentially being multiple pools, shouldn't all of the
> log messages the patch issues be extended to allow identifying the
> offending one?
> 

I think I can insert the pool name in that message too. Something like:

  printk(XENLOG_ERR
         "xmem_pool: %s: for block [...]\n",
         pool->name, b, b->size [...]);

would do? A quick preview:

[2014-12-04 15:41:23] (XEN) [ 1374.507125] xmem_pool: xmalloc: for block 
ffff8304004fb9b0 size = 0, { fl = 3, sl = 9 } should be { fl = 0, sl = 0 }
[2014-12-04 15:41:23] (XEN) [ 1374.507127] xmem_pool: xmalloc: the TLSF chunk 
matrix is corrupted

> > +bool_t __xmem_pool_check(const char *file, int line, struct xmem_pool 
> > *pool)
> > +{
> > +    return __xmem_pool_check_unlocked(file, line, pool ? pool : xenpool);
> 
> For brevity, the shorter "pool ?: xenpool" is generally preferable. The
> only place using this is not allowed are the public headers.
> 

Will do.

Thank you,

-- 
Mihai DONÈU

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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