Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753339AbdDKSoI (ORCPT ); Tue, 11 Apr 2017 14:44:08 -0400 Received: from resqmta-ch2-03v.sys.comcast.net ([69.252.207.35]:41702 "EHLO resqmta-ch2-03v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752610AbdDKSoE (ORCPT ); Tue, 11 Apr 2017 14:44:04 -0400 Date: Tue, 11 Apr 2017 13:44:02 -0500 (CDT) From: Christoph Lameter X-X-Sender: cl@east.gentwo.org To: Michal Hocko cc: Kees Cook , Andrew Morton , Pekka Enberg , David Rientjes , Joonsoo Kim , Linux-MM , LKML Subject: Re: [PATCH] mm: Add additional consistency check In-Reply-To: <20170411183035.GD21171@dhcp22.suse.cz> Message-ID: References: <20170404194220.GT15132@dhcp22.suse.cz> <20170404201334.GV15132@dhcp22.suse.cz> <20170411134618.GN6729@dhcp22.suse.cz> <20170411141956.GP6729@dhcp22.suse.cz> <20170411164134.GA21171@dhcp22.suse.cz> <20170411183035.GD21171@dhcp22.suse.cz> Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfEEQqaLRBcc+vXh74zfnzQa6cL+EffIxRoIQO20MIBx+Wf+2ZfF7RDaqNFHlz4SwGcWogA468udDG2BAVTT9PoYD5d6l6rJigc9SOvV2UTva2o9vCegX Q3miOncr2B9nebY/xDdz61JG7W263Pd+TsotWoioC+7CU8xi6tmLsdHH+2+DNZRYlQX+F1cQoROvLQtWrvZKCg4P3mUk3ouyYb/oChz0ZoyOKNpKNvP1aX/J pBqv+3DnYx0rJCkowGrI3tDiAhuumh+9olxn15Ep4MBV1x6REisPXEcca6OmKRqGbZYZShS0uj7GnqeEQ3bwe5zXr+HiCzyR27712NUbSGQ7DS9IksP6MZps SSjjR9hfGRIv8IL5wF7IQkt5P61vsxxpBNzcKRKH6uBCKKj+gRk= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1174 Lines: 27 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.