Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752922AbdDKSDI (ORCPT ); Tue, 11 Apr 2017 14:03:08 -0400 Received: from resqmta-ch2-12v.sys.comcast.net ([69.252.207.44]:59762 "EHLO resqmta-ch2-12v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751992AbdDKSDE (ORCPT ); Tue, 11 Apr 2017 14:03:04 -0400 Date: Tue, 11 Apr 2017 13:03:01 -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: <20170411164134.GA21171@dhcp22.suse.cz> Message-ID: References: <20170404151600.GN15132@dhcp22.suse.cz> <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> Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfHZm03c2Uvcd2T5v0l3YGrWzXYoSsYKSMVWEy9Y+X90GAtbKYSrHWak5pAq+WvW2JHPdl/5xucbxEgJPJuygu617+sskmi4KLwddbAZ5I8bq4FgBwHS5 bF7KrQM+lS8UMNN9AaUGLIldVg/HHr/BfQX0xd7BidGYOrRRHZHfAu0iaSi7G4x08dSDZ6pxPQ3ImPfOHTbjNAJyMaPMh+8gmYpjA3NjIIRgfqgBLvvTKj/x QEYeeNgCL3PoRES3rYpZiadL0dlXev5UTk8oShccsyOmUD++vPW+XynemoXQEWVPkbN/UhTlp0hHmzK7Tqj1Yo4QPYnDorPxKCg7HiVDhwrJlEkuqGJy6SRb FcBFPaEToafOTCVoqrjLuTPEowwOU2p4oemKPqTBfOKDfTGjAzY= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 920 Lines: 20 On Tue, 11 Apr 2017, Michal Hocko wrote: > > > > There is a flag SLAB_DEBUG_OBJECTS that is available for this check. > > Which is way too late, at least for the kfree path. page->slab_cache > on anything else than PageSlab is just a garbage. And my understanding > of the patch objective is to stop those from happening. We are looking here at SLAB. SLUB code can legitimately have a compound page there because large allocations fallback to the page allocator. Garbage would be attempting to free a page that has !PageSLAB set but also is no compound page. That condition is already checked in kfree() with a BUG_ON() and that BUG_ON has been there for a long time. Certainly we can make SLAB consistent if there is no check there already. Slab just attempts a free on that object which will fail too. So we are already handling that condition. Why change things? Add a BUG_ON if you want to make SLAB consistent.