From: "wanghai (M)" <wanghai38@huawei.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
syzbot <syzbot+d0bd96b4696c1ef67991@syzkaller.appspotmail.com>,
Pekka Enberg <penberg@kernel.org>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Dominique Martinet <asmadeus@codewreck.org>,
David Miller <davem@davemloft.net>, <ericvh@gmail.com>,
Jakub Kicinski <kuba@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
<lucho@ionkov.net>, Netdev <netdev@vger.kernel.org>,
syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
<v9fs-developer@lists.sourceforge.net>,
Linux-MM <linux-mm@kvack.org>
Subject: Re: KASAN: invalid-free in p9_client_create (2)
Date: Thu, 28 Jan 2021 19:39:12 +0800 [thread overview]
Message-ID: <c4899073-b7a5-687d-f76f-dc0fd69c3a70@huawei.com> (raw)
In-Reply-To: <CAHk-=whCX0Ab=Z2N-zuKVv7BdBZAUGgP0jQqCg+OJjHmtaOkTA@mail.gmail.com>
在 2021/1/28 3:31, Linus Torvalds 写道:
> [ Participants list changed - syzbot thought this was networking and
> p9, but it really looks entirely like a slub internal bug. I left the
> innocent people on the list just to let them know they are innocent ]
>
> On Wed, Jan 27, 2021 at 6:27 AM syzbot
> <syzbot+d0bd96b4696c1ef67991@syzkaller.appspotmail.com> wrote:
>> The issue was bisected to:
>>
>> commit dde3c6b72a16c2db826f54b2d49bdea26c3534a2
>> Author: Wang Hai <wanghai38@huawei.com>
>> Date: Wed Jun 3 22:56:21 2020 +0000
>>
>> mm/slub: fix a memory leak in sysfs_slab_add()
>>
>> BUG: KASAN: double-free or invalid-free in slab_free mm/slub.c:3142 [inline]
>> BUG: KASAN: double-free or invalid-free in kmem_cache_free+0x82/0x350 mm/slub.c:3158
> The p9 part of this bug report seems to be a red herring.
>
> The problem looks like it's simply the kmem_cache failure case, ie:
>
> - mm/slab_common.c: create_cache(): if the __kmem_cache_create()
> fails, it does:
>
> out_free_cache:
> kmem_cache_free(kmem_cache, s);
>
> - but __kmem_cache_create() - at least for slub() - will have done
>
> sysfs_slab_add(s) .. fails ..
> -> kobject_del(&s->kobj); .. which frees s ...
>
> so the networking and p9 are fine, and the only reason p9 shows up in
> the trace is that apparently it causes that failure in
> kobject_init_and_add() for whatever reason, and that then exposes the
> problem.
>
> So the added kobject_put() really looks buggy in this situation, and
> the memory leak that that commit dde3c6b72a16 ("mm/slub: fix a memory
> leak in sysfs_slab_add()") fixes is now a double free.
>
> And no, I don't think you can just remove the kmem_cache_free() in
> create_cache(), because _other_ error cases of __kmem_cache_create()
> do not free this.
>
> Wang Hai - comments? I'm inclined to revert that commit for now unless
> somebody can come up with a proper fix..
>
> Linus
> .
Hi, Linus.
I'm sorry for introducing this bug, and I agree to revert it.
I've just sent the revert patch.
https://lore.kernel.org/patchwork/patch/1372475/
Thanks,
Wang Hai
prev parent reply other threads:[~2021-01-28 11:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <000000000000672eda05b9e291ff@google.com>
2021-01-27 19:31 ` Linus Torvalds
2021-01-28 11:39 ` wanghai (M) [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=c4899073-b7a5-687d-f76f-dc0fd69c3a70@huawei.com \
--to=wanghai38@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=asmadeus@codewreck.org \
--cc=davem@davemloft.net \
--cc=ericvh@gmail.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lucho@ionkov.net \
--cc=netdev@vger.kernel.org \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=syzbot+d0bd96b4696c1ef67991@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=torvalds@linux-foundation.org \
--cc=v9fs-developer@lists.sourceforge.net \
/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