From: Qian Cai <cai@lca.pw>
To: Kees Cook <keescook@chromium.org>
Cc: akpm@linux-foundation.org, glider@google.com, cl@linux.com,
penberg@kernel.org, rientjes@google.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] slub: play init_on_free=1 well with SLAB_RED_ZONE
Date: Fri, 21 Jun 2019 08:55:45 -0400 [thread overview]
Message-ID: <1561121745.5154.37.camel@lca.pw> (raw)
In-Reply-To: <201906201818.6C90BC875@keescook>
On Thu, 2019-06-20 at 18:19 -0700, Kees Cook wrote:
> 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.)
>
I suppose Alexander is going to revise the series anyway, so he can probably
take care of the issue here in the new version as well. Something like this,
memset(object, 0, s->object_size);
memset(object, 0, s->size - s->inuse);
next prev parent reply other threads:[~2019-06-21 12:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-20 19:28 Qian Cai
2019-06-21 1:14 ` Kees Cook
2019-06-21 1:19 ` Kees Cook
2019-06-21 12:55 ` Qian Cai [this message]
2019-06-25 16:16 ` Alexander Potapenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1561121745.5154.37.camel@lca.pw \
--to=cai@lca.pw \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=glider@google.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox