linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Muchun Song <songmuchun@bytedance.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	 syzbot <syzbot+f8c45ccc7d5d45fc5965@syzkaller.appspotmail.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>,
	 syzkaller-bugs <syzkaller-bugs@googlegroups.com>
Subject: Re: [syzbot] general protection fault in list_lru_add
Date: Fri, 25 Mar 2022 00:38:50 +0800	[thread overview]
Message-ID: <CAMZfGtVzUZmz7UObNfEgbxue32_2rivajTbiwZQhGkGhDzLthA@mail.gmail.com> (raw)
In-Reply-To: <CACT4Y+Z5y8moL4ph=2uNoeJ1oZDaq9oJjEqHtrh0t0Ef7Oag2w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2826 bytes --]

On Fri, Mar 25, 2022 at 12:18 AM Dmitry Vyukov <dvyukov@google.com> wrote:
>
> On Thu, 24 Mar 2022 at 17:13, Muchun Song <songmuchun@bytedance.com> wrote:
> >
> > On Thu, Mar 24, 2022 at 4:50 PM Dmitry Vyukov <dvyukov@google.com> wrote:
> > >
> > > On Thu, 24 Mar 2022 at 09:44, Muchun Song <songmuchun@bytedance.com> wrote:
> > > >
> > > > On Thu, Mar 24, 2022 at 11:05 AM Linus Torvalds
> > > > <torvalds@linux-foundation.org> wrote:
> > > > >
> > > > > On Wed, Mar 23, 2022 at 7:19 PM Muchun Song <songmuchun@bytedance.com> wrote:
> > > > > >
> > > > > > After this commit, the rules of dentry allocations changed.
> > > > > > The dentry should be allocated by kmem_cache_alloc_lru()
> > > > >
> > > > > Yeah, I looked at that, but I can't find any way there could be other
> > > > > allocations - not only are there strict rules how to initialize
> > > > > everything, but the dentries are free'd using
> > > > >
> > > > >         kmem_cache_free(dentry_cache, dentry);
> > > > >
> > > > > and as a result if they were allocated any other way I would expect
> > > > > things would go south very quickly.
> > > > >
> > > > > The only other thing I could come up with is some breakage in the
> > > > > superblock lifetime so that &dentry->d_sb->s_dentry_lru would have
> > > > > problems, but again, this is *such* core code and not some unusual
> > > > > path, that I would be very very surprised if it wouldn't have
> > > > > triggered other issues long long ago.
> > > > >
> > > > > That's why I'd be more inclined to worry about the list_lru code being
> > > > > somehow broken.
> > > > >
> > > >
> > > > I also have the same concern.  I have been trying for a few hours to
> > > > reproduce this issue, but it didn't oops on my test machine.  And I'll
> > > > continue reproducing this.
> > >
> > > syzbot triggered it 222 times in a day, so it's most likely real:
> > > https://syzkaller.appspot.com/bug?extid=f8c45ccc7d5d45fc5965
> > >
> > > There are 2 reproducers, but they look completely different. May be a race.
> > > You may also try to use syzbot's patch testing feature to get some
> > > additional debug info.
> >
> > Do you know how to tell the syzbot to test the following patch?
> > I found some infos from github, it says "#syz test:", is it like the following?
> > Thanks.
> >
> > #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
> > master
>
> Yes, this is correct. You can now see the request listed here:
> https://syzkaller.appspot.com/bug?extid=f8c45ccc7d5d45fc5965
>

Cool!.

> but the patch was truncated (probably you email client messed
> whitespaces). In such case it's more reliable to attach the patch as
> text file.

Thanks for your reminder.

#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
5abc1e37afa0335c52608d640fd30910b2eeda21

[-- Attachment #2: test.patch --]
[-- Type: application/octet-stream, Size: 822 bytes --]

diff --git a/mm/list_lru.c b/mm/list_lru.c
index c669d87001a6..ddb2ee627d32 100644
--- a/mm/list_lru.c
+++ b/mm/list_lru.c
@@ -67,6 +67,7 @@ list_lru_from_kmem(struct list_lru *lru, int nid, void *ptr,
 	struct list_lru_node *nlru = &lru->node[nid];
 	struct list_lru_one *l = &nlru->lru;
 	struct mem_cgroup *memcg = NULL;
+	int kmemcg_id;
 
 	if (!list_lru_memcg_aware(lru))
 		goto out;
@@ -75,7 +76,13 @@ list_lru_from_kmem(struct list_lru *lru, int nid, void *ptr,
 	if (!memcg)
 		goto out;
 
-	l = list_lru_from_memcg_idx(lru, nid, memcg_kmem_id(memcg));
+	kmemcg_id = memcg_kmem_id(memcg);
+	l = list_lru_from_memcg_idx(lru, nid, kmemcg_id);
+	if (!l) {
+		pr_info("BUG: the memcg(%px)->objcg(%px), kmemcg_id: %d\n",
+			memcg, memcg->objcg, kmemcg_id);
+		BUG();
+	}
 out:
 	if (memcg_ptr)
 		*memcg_ptr = memcg;

  reply	other threads:[~2022-03-24 16:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 22:03 syzbot
     [not found] ` <CAHk-=wjLL3OB8PvFGBLgUs=zip-Q2m1P=UwG+Pw_E8nYDs+MUw@mail.gmail.com>
2022-03-24  2:18   ` Muchun Song
     [not found]     ` <CAHk-=wgW1hEUaQeX41+3w7AGsXkeE1XOXCMndXs3kFp-XjSVzQ@mail.gmail.com>
2022-03-24  8:44       ` Muchun Song
2022-03-24  8:50         ` Dmitry Vyukov
2022-03-24 16:12           ` Muchun Song
2022-03-24 16:18             ` Dmitry Vyukov
2022-03-24 16:38               ` Muchun Song [this message]
2022-03-24 19:44                 ` syzbot
2022-03-24 19:41             ` syzbot
     [not found]               ` <CAHk-=whxaFX4nqnE-SLHTGKyqejvbrhYx5sagcxWd+UWCMf8dg@mail.gmail.com>
     [not found]                 ` <CAHk-=wg++3S5Cvks-4xFCrD7qgZDibc5aMS4Bt=Pemm7FnOBZA@mail.gmail.com>
2022-03-25  1:43                   ` Muchun Song
2022-03-25  4:49                     ` syzbot
2022-03-25  5:47                 ` Fabio M. De Francesco
2022-03-25  9:51 ` Muchun Song
     [not found]   ` <CAHk-=wii1peDbW+eZipUnLmU_STXx6Vm30PiQnjhfUmgYrSd+Q@mail.gmail.com>
2022-03-27  5:27     ` Muchun Song

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=CAMZfGtVzUZmz7UObNfEgbxue32_2rivajTbiwZQhGkGhDzLthA@mail.gmail.com \
    --to=songmuchun@bytedance.com \
    --cc=akpm@linux-foundation.org \
    --cc=dvyukov@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=syzbot+f8c45ccc7d5d45fc5965@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=torvalds@linux-foundation.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