From mboxrd@z Thu Jan 1 00:00:00 1970 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 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. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-f197.google.com (mail-io0-f197.google.com [209.85.223.197]) by kanga.kvack.org (Postfix) with ESMTP id 53B5B6B03B5 for ; Tue, 11 Apr 2017 14:03:05 -0400 (EDT) Received: by mail-io0-f197.google.com with SMTP id c130so6284948ioe.19 for ; Tue, 11 Apr 2017 11:03:05 -0700 (PDT) Received: from resqmta-ch2-06v.sys.comcast.net (resqmta-ch2-06v.sys.comcast.net. [2001:558:fe21:29:69:252:207:38]) by mx.google.com with ESMTPS id 65si2644316itg.51.2017.04.11.11.03.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Apr 2017 11:03:03 -0700 (PDT) Date: Tue, 11 Apr 2017 13:03:01 -0500 (CDT) From: Christoph Lameter 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 Sender: owner-linux-mm@kvack.org List-ID: To: Michal Hocko Cc: Kees Cook , Andrew Morton , Pekka Enberg , David Rientjes , Joonsoo Kim , Linux-MM , LKML 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. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org