Re: [RFC] [PATCH] cpuset operations causes Badness at mm/slab.c:777 warning

Andrew Morton
2007-06-01T22:17:23Z

On Fri, 1 Jun 2007 14:45:27 -0700 (PDT)
Christoph Lameter <clameter@sgi.com> wrote:

> On Fri, 1 Jun 2007, Andrew Morton wrote:
>
> > Poisoning and redzoning could have caught that.
>
> Redzoning would not have caught it. This was a kmalloc allocation and
> SLAB always gave them 32 bytes to play with. Only writes more than 32
> bytes behind would have been caught.
>
> Poisoning is only applicable to unallocated objects and these were
> allocated.

Nope and nope.

This is a special case where the user asked for zero bytes and the kernel
gave him 8 (or 32) bytes instead.

If slab was smart enough, it would have poisoned those 8 bytes to some
known pattern, and then checked that they still had that pattern when the
memory got freed again.

But it isn't smart enough, so the bug went undetected.

As I said, it's specific to the kmalloc(0) problem, and we're fixing that
by other means anyway.