public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Aubrey <aubreylee@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix kernel BUGs when enable SLOB allocator
Date: Tue, 27 Jun 2006 03:44:52 +1000	[thread overview]
Message-ID: <44A01D14.5060708@yahoo.com.au> (raw)
In-Reply-To: <6d6a94c50606260551n666a62d0ue578ce3c70fae1@mail.gmail.com>

Aubrey wrote:
> Hi all,
> 
> When enable the SLOB allocator on a nommu system(uClinux), the
> following bug occurs when remove a large file.
> =========================================================
> root:~> cp /bin/busybox /busy
> root:~> ls -l /bin/busybox /busy
> -rwxr-xr-x    1 0        0          423904 /bin/busybox
> -rwxr-xr-x    1 0        0          423904 /busy
> root:~> md5sum /bin/busybox
> 7db253a2259ab71bc854c9e5dac544d6  /bin/busybox
> root:~> md5sum /busy
> 7db253a2259ab71bc854c9e5dac544d6  /busy
> root:~> rm /busy
> kernel BUG at mm/nommu.c:124!
> Kernel panic - not syncing: BUG!
> =========================================================
> 
> The root cause is the slob allocator get the pages but does not set
> the PageSlab bit.
> So when kobjsize is called, the bug occurs.
> 
> My patch found a simple way to fix the issue. When SLOB is enabled, we
> don't need to set the PageSlab bit, and don't need to check the
> PageSlab bit(PageSlab(page)) in the kobjsize routine call.
> 
> Signed-off-by: Aubrey Li <aubrey.adi@gmail.com>
> 
> ------
> diff --git a/mm/nommu.c b/mm/nommu.c
> index 029fada..8a54391 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -18,7 +18,9 @@ #include <linux/swap.h>
> #include <linux/file.h>
> #include <linux/highmem.h>
> #include <linux/pagemap.h>
> -#include <linux/slab.h>
> +#ifdef CONFIG_SLAB
> +# include <linux/slab.h>
> +#endif
> #include <linux/vmalloc.h>
> #include <linux/ptrace.h>
> #include <linux/blkdev.h>
> @@ -112,7 +114,9 @@ unsigned int kobjsize(const void *objp)
>        if (!objp || !((page = virt_to_page(objp))))
>                return 0;
> 
> +#ifdef CONFIG_SLAB
>        if (PageSlab(page))
> +#endif
>                return ksize(objp);

Then what if objp isn't a slob object?

I think the better fix would be to make slob set PageSlab.

-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

  reply	other threads:[~2006-06-26 17:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26 12:51 [PATCH] Fix kernel BUGs when enable SLOB allocator Aubrey
2006-06-26 17:44 ` Nick Piggin [this message]
2006-06-27  1:54   ` Aubrey

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=44A01D14.5060708@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=aubreylee@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox