linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Eugeniu Rosca <erosca@de.adit-jv.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Eugeniu Rosca <erosca@de.adit-jv.com>,
	Dongli Zhang <dongli.zhang@oracle.com>, <linux-mm@kvack.org>,
	<stable@vger.kernel.org>, Eugeniu Rosca <roscaeugeniu@gmail.com>
Subject: Re: [PATCH] mm: slub: fix conversion of freelist_corrupted()
Date: Wed, 12 Aug 2020 11:06:18 +0200	[thread overview]
Message-ID: <20200812090618.GA11872@lxhi-065.adit-jv.com> (raw)
In-Reply-To: <20200811134909.536004dcfc4c78204313dcd2@linux-foundation.org>

Dear Andrew,

On Tue, Aug 11, 2020 at 01:49:09PM -0700, Andrew Morton wrote:
> On Tue, 11 Aug 2020 14:46:56 +0200 Eugeniu Rosca <erosca@de.adit-jv.com> wrote:
> 
> > Commit 52f23478081ae0 ("mm/slub.c: fix corrupted freechain in
> > deactivate_slab()") suffered an update when picked up from LKML [1].
> > 
> > Specifically, relocating 'freelist = NULL' into 'freelist_corrupted()'
> > created a no-op statement. Fix it by sticking to the behavior intended
> > in the original patch [1]. Prefer the lowest-line-count solution.
> > 
> > [1] https://lore.kernel.org/linux-mm/20200331031450.12182-1-dongli.zhang@oracle.com/
> > 
> > ...
> >
> > --- a/mm/slub.c
> > +++ b/mm/slub.c
> > @@ -677,7 +677,6 @@ static bool freelist_corrupted(struct kmem_cache *s, struct page *page,
> >  	if ((s->flags & SLAB_CONSISTENCY_CHECKS) &&
> >  	    !check_valid_pointer(s, page, nextfree)) {
> >  		object_err(s, page, freelist, "Freechain corrupt");
> > -		freelist = NULL;
> >  		slab_fix(s, "Isolate corrupted freechain");
> >  		return true;
> >  	}
> > @@ -2184,8 +2183,10 @@ static void deactivate_slab(struct kmem_cache *s, struct page *page,
> >  		 * 'freelist' is already corrupted.  So isolate all objects
> >  		 * starting at 'freelist'.
> >  		 */
> > -		if (freelist_corrupted(s, page, freelist, nextfree))
> > +		if (freelist_corrupted(s, page, freelist, nextfree)) {
> > +			freelist = NULL;
> >  			break;
> > +		}
> >  
> >  		do {
> >  			prior = page->freelist;
> 
> Looks right.
> 
> What are the runtime effects of this change?  In other words, what are
> the end user visible effects of the present defect?

Thank you for the prompt feedback.

The issue popped up as a result of static analysis and code review.
Therefore, I lack any specific runtime behavior example being fixed.
Nevertheless, I think this does not diminish the concern expressed in
the description of the patch.

-- 
Best regards,
Eugeniu Rosca


  reply	other threads:[~2020-08-12  9:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11 12:46 Eugeniu Rosca
2020-08-11 20:49 ` Andrew Morton
2020-08-12  9:06   ` Eugeniu Rosca [this message]
2020-08-14  6:57 ` Dongli Zhang
2020-08-14  7:46   ` Eugeniu Rosca
2020-08-14 19:43     ` Dongli Zhang

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=20200812090618.GA11872@lxhi-065.adit-jv.com \
    --to=erosca@de.adit-jv.com \
    --cc=akpm@linux-foundation.org \
    --cc=dongli.zhang@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=roscaeugeniu@gmail.com \
    --cc=stable@vger.kernel.org \
    /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