linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Muchun Song <songmuchun@bytedance.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: syzbot <syzbot+f8c45ccc7d5d45fc5965@syzkaller.appspotmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dmitry Vyukov <dvyukov@google.com>,
	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 09:43:51 +0800	[thread overview]
Message-ID: <CAMZfGtVHSWAzLN+FzOL0MyedcXc5UAaGuc4OufUwkLzWe2KWvQ@mail.gmail.com> (raw)
In-Reply-To: <CAHk-=wg++3S5Cvks-4xFCrD7qgZDibc5aMS4Bt=Pemm7FnOBZA@mail.gmail.com>

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

On Fri, Mar 25, 2022 at 3:47 AM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> On Thu, Mar 24, 2022 at 12:45 PM Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
> >
> > On Thu, Mar 24, 2022 at 12:41 PM syzbot
> > <syzbot+f8c45ccc7d5d45fc5965@syzkaller.appspotmail.com> wrote:
> > >
> > > syzbot has tested the proposed patch and the reproducer did not trigger any issue:
> >
> > Heh, well that's unfortunate.
> >
> > I think the issue is that it triggered a new BUG() that didn't match
> > the previous NULL pointer dereference, so it thinks things are
> > "fixed".
>
> Oh, no, it's because it used the truncated patch that didn't do anything:
>
> > patch:          https://syzkaller.appspot.com/x/patch.diff?x=1208043d700000
>
> and maybe (due to the racy nature) nothing actually happened.
>

It is not easy to reproduce. I'm also trying to reproduce locally.

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

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

diff --git a/mm/list_lru.c b/mm/list_lru.c
index fc938d8ff48f..885ae5d77002 100644
--- a/mm/list_lru.c
+++ b/mm/list_lru.c
@@ -76,6 +76,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 (!lru->mlrus)
 		goto out;
@@ -84,7 +85,12 @@ 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_cache_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);
+	}
 out:
 	if (memcg_ptr)
 		*memcg_ptr = memcg;

  reply	other threads:[~2022-03-25  1:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 22:03 [syzbot] general protection fault in list_lru_add syzbot
2022-03-23 23:11 ` Linus Torvalds
2022-03-24  2:18   ` Muchun Song
2022-03-24  3:05     ` Linus Torvalds
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
2022-03-24 19:44                 ` syzbot
2022-03-24 19:41             ` syzbot
2022-03-24 19:45               ` Linus Torvalds
2022-03-24 19:47                 ` Linus Torvalds
2022-03-25  1:43                   ` Muchun Song [this message]
2022-03-25  4:49                     ` syzbot
2022-03-25  5:47                 ` Fabio M. De Francesco
2022-03-25 12:37                   ` Fabio M. De Francesco
2022-03-25  9:51 ` Muchun Song
2022-03-25 20:29   ` Linus Torvalds
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=CAMZfGtVHSWAzLN+FzOL0MyedcXc5UAaGuc4OufUwkLzWe2KWvQ@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;
as well as URLs for NNTP newsgroup(s).