[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170411164134.GA21171@dhcp22.suse.cz>
Date: Tue, 11 Apr 2017 18:41:36 +0200
From: Michal Hocko <mhocko@...nel.org>
To: Christoph Lameter <cl@...ux.com>
Cc: Kees Cook <keescook@...omium.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Linux-MM <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: Add additional consistency check
On Tue 11-04-17 11:16:42, Cristopher Lameter wrote:
> 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.
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.
> Consistency checks are configuraable in the slab allocator.
and they have to be compiled in (at least for SLAB) AFAIR.
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists