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>, <walter-zh.wu@mediatek.com>
Subject: Re: [merged] kasan-fix-object-remain-in-offline-per-cpu-quarantine.patch removed from -mm tree
Date: Thu, 17 Dec 2020 21:50:09 +0800 [thread overview]
Message-ID: <1608213009.31376.85.camel@mtksdccf07> (raw)
In-Reply-To: <1608023217.31376.35.camel@mtksdccf07>
On Tue, 2020-12-15 at 17:06 +0800, Kuan-Ying Lee wrote:
> 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.
>
Hi Andrew,
I upload the v2 standalone fixup patch to fix the memory leak issue as
below.
https://marc.info/?l=linux-mm&m=160820751825252&w=2
I think this slab memory leak issue is important. It's because when we
do kmem_cache_destroy, it will report object remaining error.
Add this v2 patch to mm-tree, it will have conflicts with
Andrey's patches as below.
"kasan: rename get_alloc/free_info"
"kasan: sanitize objects when metadata doesnt fit"
I think this standalone fixup patch should be added before Andrey's
patch in mm-tree. Because only merging this standalone fix patch to 5.10
stable, we can resolve this leak issue instead of merging the whole
patchset of Andrey's patch to 5.10 stable.
However, merging the fixup patch into mm-tree will cause some conflicts
in mm-tree.
Please help to fix the conflicts.
And I think the conflict between standalone fixup patch and
Andrey's patches will be fixed as below.
I think this patch "kasan: rename get_alloc/free_info" need to rename
the "info" to "meta" as below.
- qlink_free(&info->quarantine_link, cache);
+ qlink_free(&meta->quarantine_link, cache);
This patch "kasan: sanitize objects when metadata doesnt fit" need to
remove the qlink_free() and add return false as below.
q = this_cpu_ptr(&cpu_quarantine);
if (q->offline) {
- qlink_free(&meta->quarantine_link, cache);
local_irq_restore(flags);
- return;
+ return false;
}
Thanks a lot.
prev parent reply other threads:[~2020-12-17 13:51 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
2020-12-17 13:50 ` Kuan-Ying Lee [this message]
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=1608213009.31376.85.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 \
--cc=walter-zh.wu@mediatek.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