Re: [PATCH] mm: Add additional consistency check

From: Christoph Lameter
Date: Tue Apr 11 2017 - 14:44:10 EST


On Tue, 11 Apr 2017, Michal Hocko wrote:

> > So we are already handling that condition. Why change things? Add a BUG_ON
> > if you want to make SLAB consistent.
>
> I hate to repeat myself but let me do it for the last time in this
> thread. BUG_ON for something that is recoverable is completely
> inappropriate. And I consider kfree with a bogus pointer something that
> we can easily recover from. There are other cases where the internal
> state of the allocator is compromised to the point where continuing is
> not possible and BUGing there is acceptable but kfree(garbage) is not
> that case.

kfree(garbage) by the core kernel has so far been taken as a sign of
severe memory corruption and the kernels have been oopsing when this
occurred. This has been that way for a decade or so. kfree() is used by
the allocators and various other core kernel components. If the metadata
of the core kernel is compromised then it is safest to stop right there.

If you want to change things then someone has to do some work. What you
are saying is not the way things are implemented. Sorry.

Making both allocators consistent is ok with me and is a improvement of
the code.