[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201906201818.6C90BC875@keescook>
Date: Thu, 20 Jun 2019 18:19:27 -0700
From: Kees Cook <keescook@...omium.org>
To: Qian Cai <cai@....pw>
Cc: akpm@...ux-foundation.org, glider@...gle.com, cl@...ux.com,
penberg@...nel.org, rientjes@...gle.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] slub: play init_on_free=1 well with SLAB_RED_ZONE
On Thu, Jun 20, 2019 at 06:14:33PM -0700, Kees Cook wrote:
> On Thu, Jun 20, 2019 at 03:28:01PM -0400, Qian Cai wrote:
> > diff --git a/mm/slub.c b/mm/slub.c
> > index a384228ff6d3..787971d4fa36 100644
> > --- a/mm/slub.c
> > +++ b/mm/slub.c
> > @@ -1437,7 +1437,7 @@ static inline bool slab_free_freelist_hook(struct kmem_cache *s,
> > do {
> > object = next;
> > next = get_freepointer(s, object);
> > - memset(object, 0, s->size);
> > + memset(object, 0, s->object_size);
>
> I think this should be more dynamic -- we _do_ want to wipe all
> of object_size in the case where it's just alignment and padding
> adjustments. If redzones are enabled, let's remove that portion only.
(Sorry, I meant: all of object's "size", not object_size.)
--
Kees Cook
Powered by blists - more mailing lists