[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: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
  • From: Mihai DonÈu <mdontu@xxxxxxxxxxxxxxx>
  • Date: Mon, 8 Dec 2014 18:28:45 +0200
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Jan Beulich <JBeulich@xxxxxxxx>
  • Comment: DomainKeys? See http://domainkeys.sourceforge.net/
  • Delivery-date: Mon, 08 Dec 2014 16:29:13 +0000
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=bitdefender.com; b=GV+0ywV84Did++Yrzwya3KitqEvj5zwHaKzR4eblXVGJ7lJ6xztD32hIYlyZ6ioYdlEivol1R+gf3WBu1xvSLWWNl69ePWDziUJUaPhqpVpqmeyNdvwftck2valnotv9tlXJ1NStCiYfkYmViOeCoaV0Q57WBYtrEKoza+G+42q1CFqVpH3HJtLdvdM+plmikXixIoXDZIdtshovfZV+6yBanGbMMNOF1ljhZ617257jkhE2AFmYtKMd9bJZ25JFM68zsjrzdMrJf8uabVFggSWIoyGCjluuuzv4x7nBPHdAq4Kfx1s7v8ysMvrlbrllAD7hkVZnWTtra1t1S7r4Jg==; 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 16:04:55 Ian Campbell wrote:
> On Mon, 2014-12-08 at 18:00 +0200, Mihai DonÈu wrote:
> > 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);
> > 
> > ?
> 
> The log message here is going to be substantially more than 80
> characters (the format string by itself already is). Could you find a
> more compact representation of the useful info?
> 

Ah! I see. I apologize for being so slow. :-) How about:

printk(XENLOG_ERR "xmem_pool: %s: misplaced block %p:%u ({%d,%d} -> {%d,%d})\n",
       pool->name, b, b->size, fl, sl, __fl, __sl); 

Looks a bit cryptic, but the TLSF itself is pretty complex and for
brave souls wishing to debug it, the message format will be the last
thing on their minds. :-)

Preview:

[2014-12-04 15:41:23] (XEN) [ 1374.507125] xmem_pool: xmalloc: misplaced block 
ffff8304004fb9b0:0 ({3,9} -> {0,0})
[2014-12-04 15:41:23] (XEN) [ 1374.507127] xmem_pool: xmalloc: the TLSF chunk 
matrix is corrupted

Thanks,

-- 
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®.