From: Gerd Knorr <kraxel@suse.de>
To: Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: xen-devel@lists.xensource.com, Steven Hand <Steven.Hand@cl.cam.ac.uk>
Subject: Re: bug: slab corruption (net backend?)
Date: 07 Jul 2005 14:48:58 +0200 [thread overview]
Message-ID: <87fyuqhjd1.fsf@bytesex.org> (raw)
In-Reply-To: <20050707122242.GA31229@bytesex>
Hi,
seems the copy code in netback may triggers this:
[ ... ]
kfree: dc81a000
kmem_cache_alloc: dc81a000
netif_be_start_xmit: copy skb dc927238/db78a022 -> nskb dc83cb30/dc81a010
kmem_cache_alloc: dcf5f000
kfree: db78a000
kfree: dc81a000
Slab corruption: start=dc81a000, i=0, len=4096
Slab name: xen-skb
000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
With the debug patch below
Gerd
Index: linux-2.6.11/mm/slab.c
===================================================================
--- linux-2.6.11.orig/mm/slab.c 2005-03-02 08:38:38.000000000 +0100
+++ linux-2.6.11/mm/slab.c 2005-07-07 14:11:17.000000000 +0200
@@ -1007,6 +1007,9 @@ static void print_objinfo(kmem_cache_t *
int i, size;
char *realobj;
+ if (cachep->name) {
+ printk(KERN_ERR "Slab name: %s\n", cachep->name);
+ }
if (cachep->flags & SLAB_RED_ZONE) {
printk(KERN_ERR "Redzone: 0x%lx/0x%lx.\n",
*dbg_redzone1(cachep, objp),
@@ -1049,8 +1052,8 @@ static void check_poison_obj(kmem_cache_
/* Mismatch ! */
/* Print header */
if (lines == 0) {
- printk(KERN_ERR "Slab corruption: start=%p, len=%d\n",
- realobj, size);
+ printk(KERN_ERR "Slab corruption: start=%p, i=%d, len=%d\n",
+ realobj, i, size);
print_objinfo(cachep, objp, 0);
}
/* Hexdump the affected line */
@@ -2294,9 +2297,17 @@ static inline void __cache_free (kmem_ca
* Allocate an object from this cache. The flags are only relevant
* if the cache has no available objects.
*/
+
+extern kmem_cache_t *skbuff_cachep; /* in arch/xen/kernel/skbuff.c */
+
void * kmem_cache_alloc (kmem_cache_t *cachep, int flags)
{
- return __cache_alloc(cachep, flags);
+ void *rc = __cache_alloc(cachep, flags);
+
+ if (skbuff_cachep == cachep) {
+ printk("%s: %p\n", __FUNCTION__, rc);
+ }
+ return rc;
}
EXPORT_SYMBOL(kmem_cache_alloc);
@@ -2530,6 +2541,9 @@ void kmem_cache_free (kmem_cache_t *cach
{
unsigned long flags;
+ if (skbuff_cachep == cachep) {
+ printk("%s: %p\n", __FUNCTION__, objp);
+ }
local_irq_save(flags);
__cache_free(cachep, objp);
local_irq_restore(flags);
@@ -2575,6 +2589,9 @@ void kfree (const void *objp)
local_irq_save(flags);
kfree_debugcheck(objp);
c = GET_PAGE_CACHE(virt_to_page(objp));
+ if (skbuff_cachep == c) {
+ printk("%s: %p\n", __FUNCTION__, objp);
+ }
__cache_free(c, (void*)objp);
local_irq_restore(flags);
}
Index: linux-2.6.11/arch/xen/kernel/skbuff.c
===================================================================
--- linux-2.6.11.orig/arch/xen/kernel/skbuff.c 2005-07-07 11:04:31.000000000 +0200
+++ linux-2.6.11/arch/xen/kernel/skbuff.c 2005-07-07 14:09:37.000000000 +0200
@@ -27,6 +27,8 @@ EXPORT_SYMBOL(__dev_alloc_skb);
struct sk_buff *__dev_alloc_skb(unsigned int length, int gfp_mask)
{
struct sk_buff *skb;
+
+ BUG_ON(length+16 > PAGE_SIZE);
skb = alloc_skb_from_cache(skbuff_cachep, length + 16, gfp_mask);
if ( likely(skb != NULL) )
skb_reserve(skb, 16);
Index: linux-2.6.11/drivers/xen/netback/netback.c
===================================================================
--- linux-2.6.11.orig/drivers/xen/netback/netback.c 2005-07-07 11:04:31.000000000 +0200
+++ linux-2.6.11/drivers/xen/netback/netback.c 2005-07-07 14:12:51.000000000 +0200
@@ -151,6 +151,8 @@ int netif_be_start_xmit(struct sk_buff *
struct sk_buff *nskb = dev_alloc_skb(hlen + skb->len);
if ( unlikely(nskb == NULL) )
goto drop;
+ printk("%s: copy skb %p/%p -> nskb %p/%p\n", __FUNCTION__,
+ skb, skb->data, nskb, nskb->data);
skb_reserve(nskb, hlen);
__skb_put(nskb, skb->len);
if (skb_copy_bits(skb, -hlen, nskb->data - hlen, skb->len + hlen))
next prev parent reply other threads:[~2005-07-07 12:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-07 9:41 bug: slab corruption (net backend?) Gerd Knorr
2005-07-07 10:11 ` Steven Hand
2005-07-07 11:35 ` Gerd Knorr
2005-07-07 12:05 ` Keir Fraser
2005-07-07 12:22 ` Gerd Knorr
2005-07-07 12:48 ` Gerd Knorr [this message]
2005-07-07 13:17 ` Gerd Knorr
2005-07-07 14:05 ` Keir Fraser
2005-07-07 14:18 ` Gerd Knorr
2005-07-07 14:41 ` Gerd Knorr
2005-07-07 16:06 ` Nivedita Singhvi
2005-07-11 13:25 ` Gerd Knorr
2005-07-11 13:37 ` Keir Fraser
2005-07-11 14:29 ` Bin Ren
2005-07-07 15:54 ` Gerd Knorr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fyuqhjd1.fsf@bytesex.org \
--to=kraxel@suse.de \
--cc=Keir.Fraser@cl.cam.ac.uk \
--cc=Steven.Hand@cl.cam.ac.uk \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.