Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752848AbdDKQQr (ORCPT ); Tue, 11 Apr 2017 12:16:47 -0400 Received: from resqmta-ch2-12v.sys.comcast.net ([69.252.207.44]:37320 "EHLO resqmta-ch2-12v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750721AbdDKQQq (ORCPT ); Tue, 11 Apr 2017 12:16:46 -0400 Date: Tue, 11 Apr 2017 11:16:42 -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: <20170411141956.GP6729@dhcp22.suse.cz> Message-ID: References: <20170404113022.GC15490@dhcp22.suse.cz> <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> Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfOrWcs2aTEuXcM00wl1CulXFMwTVhJvcqnSy0/gz1B8Rss1dPXhHAJv1eZCzlgZZBGuYbRTQJmqV2b/1fmMCs8tNQuInmNieew7CkNt7lJZCDJaf1i5U RMRzQZEnjrOUVVqzdMgujuzRtatHtgPqlulpI9aD/ZukmznyiZyMThFFia6VHfJKg1x8xq6wdwy7IyhnFVkuFCJxcM65Xgx9jHcQwK/YiOqw71UItSzsZZfY NegIdpt/3F8h+S1vOnj+B6snatbSiJGrVkY2C5lYlI7ZoE0XV5ED51j7FClefUminlqt0RC2aPfKxnFjHvujkc7HTnrOn5Qd0/Bu34lA3uGUnOb1SJ6Aq3I3 ZaNHyXdw5CL3dm/N8TgXF6C3H4pmjqOUHuaLiJw3xqytUKzqmt4= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 638 Lines: 21 On Tue, 11 Apr 2017, Michal Hocko wrote: > static inline void *index_to_obj(struct kmem_cache *cache, struct page *page, > @@ -3813,14 +3818,18 @@ void kfree(const void *objp) > { > struct kmem_cache *c; > unsigned long flags; > + struct page *page; > > trace_kfree(_RET_IP_, objp); > > if (unlikely(ZERO_OR_NULL_PTR(objp))) > return; > + page = virt_to_head_page(obj); > + if (CHECK_DATA_CORRUPTION(!PageSlab(page))) There is a flag SLAB_DEBUG_OBJECTS that is available for this check. Consistency checks are configuraable in the slab allocator. Mentioned that before and got this lecture about data consistency checks.