From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CB67C433F5 for ; Thu, 24 Mar 2022 16:18:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DFA2D6B0071; Thu, 24 Mar 2022 12:18:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DA8DF6B0074; Thu, 24 Mar 2022 12:18:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C709B6B0075; Thu, 24 Mar 2022 12:18:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0241.hostedemail.com [216.40.44.241]) by kanga.kvack.org (Postfix) with ESMTP id B815D6B0071 for ; Thu, 24 Mar 2022 12:18:41 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 76EC6A5BC5 for ; Thu, 24 Mar 2022 16:18:41 +0000 (UTC) X-FDA: 79279788042.28.0FE3BD6 Received: from mail-oo1-f43.google.com (mail-oo1-f43.google.com [209.85.161.43]) by imf26.hostedemail.com (Postfix) with ESMTP id DDD3A140042 for ; Thu, 24 Mar 2022 16:18:40 +0000 (UTC) Received: by mail-oo1-f43.google.com with SMTP id i8-20020a4a6f48000000b00324ada4b9d9so851358oof.11 for ; Thu, 24 Mar 2022 09:18:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wvPCDj2XTNMlrGPWwVtye5ut7SMzb+xM6DqJLQvHb50=; b=p8dME+OYbuQou5JQ6WLL6EvTPokbw9NedF7BIxkwAc6oqWuUKkjaJCCq2GZ2GfzSfB gbUqHDUNmTWByxjerMXegradc7/uK4bgsQZcrJupkBAKgwbVLHUr86AvJ3xK6fiR06kC TTbwT/D3L2685E6NVau21m7oyx5evUC25IXsVRdCG8Z2A6IHa95sqqBrgaWYa7tv95/L SgDN6dUD0pymbC46CadKn9w1qU1gminXvvh4I4s1vQ2viSZJcb7vcI5HQnelHoWVFc/Y NArUGQwzkIhjXwkxhDlVomXtmqK2K1NILEttB5MkeUZ2Z9JnUpD1pzmDGWTGjjqbnyR1 lFXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wvPCDj2XTNMlrGPWwVtye5ut7SMzb+xM6DqJLQvHb50=; b=EErVZyDZaykyhtQnpMVX9qNDKsXjA+ke4AnSfnaghBRimP7MkcMivqajD9BLotfM3F 25MIDUvSxWlPLF8J2nvNr4kQz/k67+hHcO+nw7sg/4wAzKUZrsyrIlPNlPrBGRTTPWlE 5Xg3m+UyypXxAlKsavYUM7xfL1zGsXBz5PT1884oJfbkNzzrOBFI0o6/x7bqzp87PtTm fwR4nWnBCBuvTtxtWCqwISyIApZEcvYHxBmiIlUoTRwpWWMrpnlUde+Ki/FYjIC2BO8g V11/suwBd08+Fq7T1KTiU56zFs7LXL+mld6S1F64xVlDCxP/K+UixoO0fJhxo4/KUfob 5eaw== X-Gm-Message-State: AOAM532e3BklKkNeBcuIZv2ktiGzdidjF+9SHbdE64LWnRcmQm45+1Us kdBhCltV9cO03+JGP/JI4/HUwFEGHDBzHofgD4tx1Q== X-Google-Smtp-Source: ABdhPJw4epBS1QQ55tacEXfe2ExBWwbSD38B5hth631QE41Q30ti5s2vLruhg9fANHclMr98ngVFZsuAI6nMg1we0s8= X-Received: by 2002:a4a:1ec1:0:b0:324:76e1:c37f with SMTP id 184-20020a4a1ec1000000b0032476e1c37fmr2254671ooq.53.1648138719873; Thu, 24 Mar 2022 09:18:39 -0700 (PDT) MIME-Version: 1.0 References: <000000000000cabcb505dae9e577@google.com> In-Reply-To: From: Dmitry Vyukov Date: Thu, 24 Mar 2022 17:18:28 +0100 Message-ID: Subject: Re: [syzbot] general protection fault in list_lru_add To: Muchun Song Cc: Linus Torvalds , syzbot , Andrew Morton , Linux Kernel Mailing List , Linux-MM , syzkaller-bugs Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: yfhokwxcaocde6gdiw37tfwrk3a3r6d4 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=p8dME+OY; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf26.hostedemail.com: domain of dvyukov@google.com designates 209.85.161.43 as permitted sender) smtp.mailfrom=dvyukov@google.com X-Rspamd-Queue-Id: DDD3A140042 X-HE-Tag: 1648138720-881284 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, 24 Mar 2022 at 17:13, Muchun Song wrote: > > On Thu, Mar 24, 2022 at 4:50 PM Dmitry Vyukov wrote: > > > > On Thu, 24 Mar 2022 at 09:44, Muchun Song wrote: > > > > > > On Thu, Mar 24, 2022 at 11:05 AM Linus Torvalds > > > wrote: > > > > > > > > On Wed, Mar 23, 2022 at 7:19 PM Muchun Song 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 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. > 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;