Linux MM tree latest commits
 help / color / mirror / Atom feed
From: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <aryabinin@virtuozzo.com>, <dvyukov@google.com>,
	<glider@google.com>, <guangye.yang@mediatek.com>,
	<matthias.bgg@gmail.com>, <miles.chen@mediatek.com>,
	<mm-commits@vger.kernel.org>, <nicholas.tang@mediatek.com>,
	<qcai@redhat.com>, <qiang.zhang@windriver.com>,
	<sfr@canb.auug.org.au>
Subject: Re: [merged] kasan-fix-object-remain-in-offline-per-cpu-quarantine.patch removed from -mm tree
Date: Tue, 15 Dec 2020 17:06:57 +0800	[thread overview]
Message-ID: <1608023217.31376.35.camel@mtksdccf07> (raw)
In-Reply-To: <20201214101957.51e0e05d2b7bf5d2f9707bd2@linux-foundation.org>

On Mon, 2020-12-14 at 10:19 -0800, Andrew Morton wrote:
> On Mon, 14 Dec 2020 13:46:50 +0800 Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com> wrote:
> 
> > On Sat, 2020-12-12 at 22:05 -0800, akpm@linux-foundation.org wrote:
> > > The patch titled
> > >      Subject: kasan: fix object remaining in offline per-cpu quarantine
> > > has been removed from the -mm tree.  Its filename was
> > >      kasan-fix-object-remain-in-offline-per-cpu-quarantine.patch
> > > 
> > > This patch was dropped because it was merged into mainline or a subsystem tree
> > > 
> > 
> > Hi Andrew,
> > 
> > Sorry to bother.
> > This patch has dependency with two patches of Andrey's patch series as
> > below.
> > "kasan: rename get_alloc/free_info"
> > "kasan: sanitize objects when metadata doesnt fit"
> 
> Are you sure?  Please check 5.10 and if there are problems there,
> please propose a standalone fix.
> 

Yes.

Andrey's patch has the return value and return false.
Return false will make slab allocator free the object and qlink_free()
also free the object, so Qiang remove the qlink_free() to resolve the
double free as below.
https://lore.kernel.org/linux-mm/20201204102206.20237-1-qiang.zhang@windriver.com/

 	q = this_cpu_ptr(&cpu_quarantine);
 	if (q->offline) {
-		qlink_free(&meta->quarantine_link, cache); // free once
 		local_irq_restore(flags);
 		return false;  // free twice
 	}


But if removing qlink_free() without Andrey's patch, this 
object will not be freed. It will cause memory leak as below.

 	q = this_cpu_ptr(&cpu_quarantine);
 	if (q->offline) {
 		local_irq_restore(flags);
 		return;
 	}

Thus, before applying Andrey's patch, we still need qlink_free().
I will prepare a standalone fix to add qlink_free() back.

Thanks.


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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-13  6:05 [merged] kasan-fix-object-remain-in-offline-per-cpu-quarantine.patch removed from -mm tree akpm
2020-12-14  5:46 ` Kuan-Ying Lee
2020-12-14 18:19   ` Andrew Morton
2020-12-15  9:06     ` Kuan-Ying Lee [this message]
2020-12-17 13:50       ` Kuan-Ying Lee

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=1608023217.31376.35.camel@mtksdccf07 \
    --to=kuan-ying.lee@mediatek.com \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=guangye.yang@mediatek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=miles.chen@mediatek.com \
    --cc=mm-commits@vger.kernel.org \
    --cc=nicholas.tang@mediatek.com \
    --cc=qcai@redhat.com \
    --cc=qiang.zhang@windriver.com \
    --cc=sfr@canb.auug.org.au \
    /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