Re: [PATCH] mm: Add additional consistency check
From: Michal Hocko
Date: Tue Apr 11 2017 - 14:56:05 EST
On Tue 11-04-17 13:44:02, Cristopher Lameter wrote:
> 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.
which doesn't make it a valid decision. We just overuse BUG*
> 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.
I didn't say anything like that. Hence the proposed patch which still
needs some more thinking and evaluation.
--
Michal Hocko
SUSE Labs