Re: [PATCH 0/5] mm: poison critical mm/ structs

From: Sasha Levin
Date: Wed Oct 08 2014 - 12:44:30 EST


On 10/07/2014 06:16 PM, Dave Hansen wrote:
> On 10/02/2014 07:58 AM, Sasha Levin wrote:
>>>> What does this add on top of slab poisoning? Some checks in some
>>>> mm places while the object is active, I guess: why not base those
>>>> on slab poisoning? And add them in as appropriate to the problem
>>>> at hand, when a problem is seen.
>> The extra you're getting is detecting corruption that happened
>> inside the object rather than around it.
>
> Isn't this more akin to redzoning that poisoning?
>
> I'm not sure I follow the logic here. The poison is inside the object,
> but it's now at the edges. With slub at least, you get a redzone right
> after the object(s):
>
> { OBJ } | REDZONE | { OBJ } | REDZONE | ...
>
> With this patch, you'd get something along these lines:
>
> { POISON | OBJ | POISON } { POISON | OBJ | POISON } ...
>
> So if somebody overflows OBJ, they'll hit the redzone/poison in either
> case. If they're randomly scribbling on memory, their likelihood of
> hitting the redzone/poison is proportional to the size of the
> redzone/poison.
>
> The only place this really helps is if someone overflows from a
> non-redzoned page or structure in to the beginning of a slub redzoned
> one. The fact that the redzone is at the end means we'll miss it.
>
> But, all that means is that we should probably add redzones to the
> beginning of slub objects, not just the end. That doesn't help us with
> 'struct page' of course, but it does for the mm_struct and vma.

This patchset is based on an actual issue we're seeing where the vma
gets corrupted without triggering any of the slub redzones.

Testing this patchset locally confirmed that while slub redzones stay
intact, the poison fields get overwritten - so now we're able to catch
the corruption after it happened.

I'm not sure what's the scenario that causes that, but once we figure
that out I could have a better response to your question...


Thanks,
Sasha

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/