From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753414AbdDDLa2 (ORCPT ); Tue, 4 Apr 2017 07:30:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:46050 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753306AbdDDLa1 (ORCPT ); Tue, 4 Apr 2017 07:30:27 -0400 Date: Tue, 4 Apr 2017 13:30:23 +0200 From: Michal Hocko To: Kees Cook Cc: Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: Add additional consistency check Message-ID: <20170404113022.GC15490@dhcp22.suse.cz> References: <20170331164028.GA118828@beast> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170331164028.GA118828@beast> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 31-03-17 09:40:28, Kees Cook wrote: > As found in PaX, this adds a cheap check on heap consistency, just to > notice if things have gotten corrupted in the page lookup. > > Signed-off-by: Kees Cook NAK without a proper changelog. Seriously, we do not blindly apply changes from other projects without a deep understanding of all consequences. > --- > mm/slab.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/mm/slab.h b/mm/slab.h > index 65e7c3fcac72..64447640b70c 100644 > --- a/mm/slab.h > +++ b/mm/slab.h > @@ -384,6 +384,7 @@ static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x) > return s; > > page = virt_to_head_page(x); > + BUG_ON(!PageSlab(page)); > cachep = page->slab_cache; > if (slab_equal_or_root(cachep, s)) > return cachep; > -- > 2.7.4 > > > -- > Kees Cook > Pixel Security > > -- > 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 -- Michal Hocko SUSE Labs From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f199.google.com (mail-wr0-f199.google.com [209.85.128.199]) by kanga.kvack.org (Postfix) with ESMTP id 2A0486B039F for ; Tue, 4 Apr 2017 07:30:28 -0400 (EDT) Received: by mail-wr0-f199.google.com with SMTP id r71so28064052wrb.17 for ; Tue, 04 Apr 2017 04:30:28 -0700 (PDT) Received: from mx2.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id f5si24118258wrf.78.2017.04.04.04.30.26 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 04 Apr 2017 04:30:26 -0700 (PDT) Date: Tue, 4 Apr 2017 13:30:23 +0200 From: Michal Hocko Subject: Re: [PATCH] mm: Add additional consistency check Message-ID: <20170404113022.GC15490@dhcp22.suse.cz> References: <20170331164028.GA118828@beast> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170331164028.GA118828@beast> Sender: owner-linux-mm@kvack.org List-ID: To: Kees Cook Cc: Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org On Fri 31-03-17 09:40:28, Kees Cook wrote: > As found in PaX, this adds a cheap check on heap consistency, just to > notice if things have gotten corrupted in the page lookup. > > Signed-off-by: Kees Cook NAK without a proper changelog. Seriously, we do not blindly apply changes from other projects without a deep understanding of all consequences. > --- > mm/slab.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/mm/slab.h b/mm/slab.h > index 65e7c3fcac72..64447640b70c 100644 > --- a/mm/slab.h > +++ b/mm/slab.h > @@ -384,6 +384,7 @@ static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x) > return s; > > page = virt_to_head_page(x); > + BUG_ON(!PageSlab(page)); > cachep = page->slab_cache; > if (slab_equal_or_root(cachep, s)) > return cachep; > -- > 2.7.4 > > > -- > Kees Cook > Pixel Security > > -- > 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 -- Michal Hocko SUSE Labs -- 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