Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1947574pxb; Fri, 25 Mar 2022 08:26:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQk5icMX85wqjeB7VZ9TFfqQRKL7X+m+reD4xswtRnm8F/D7pw3BbkU4Twry4EG89dMnV2 X-Received: by 2002:aa7:82d9:0:b0:4fa:2c7f:41e with SMTP id f25-20020aa782d9000000b004fa2c7f041emr10894853pfn.1.1648221991930; Fri, 25 Mar 2022 08:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648221991; cv=none; d=google.com; s=arc-20160816; b=b4AX0cSRd9AGGBXclqjX5gm+rZ3zTfMmzERiNbFO5maGE6T76VdRJHOLO6v0ood07q uL8ba0A4Gdu8qAC04uPXMiAgr60hKYMiA5aHhPVRhbq2Y5MJ2D4BdhTVRcegUkCrDi4F irtaDwBAuMzF+z94UMlAOP3Updw4IS2ej3d4g4FaIIiITLSRtNNmXdyLI9enRKebIP6N 2zinw3cM3vx631l0QkFcyyZEpxgwmiFTy+lbW1sv10Dm2xE80cgY7y6pAbT4n4WPLF2t SbTpzWqcqHNBZZdkjI0gk98IioY+h+BebRQNGNoh049fOqrgqPb8zz390LURfsySqkxX jk4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=qD/GtOjGwOlJ7PVUx2PNL/pqrH5OmjHCrCL+mrKUoNs=; b=mmPoV3At/XQ14qS+kw+VhOfb8quMiGKN5n7A4pnzzTU5ACPg8JbMT8B+nndkb8Uqgd URY+Ebcio/FQCaP1alMDrDmqO+4DIzQxhtKOGDgIkEc2HQrY8HGJRBee/3OCoMQ6oc3k BVTNqfbE0nkUrWOYDnCzl1jI4IM8upU46PYVyH1sHKmpz/q+DqIfRm01yc352kVnv3xU oFd0C5ZHOypCyOEWf4WmEFVvam6deTEwvRK30M5gfgEfTjAY6hh+8oPL4UNl4ce3dnrm 2/BssZV+HAppNkW37DDz4y708nPRs8SlrxMUV+wjIV0N/ygDzmIjn9s0fovIlGNaXgl+ cenw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=FWeKjzvO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t207-20020a635fd8000000b003821e168c90si2670001pgb.75.2022.03.25.08.26.17; Fri, 25 Mar 2022 08:26:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=FWeKjzvO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351592AbiCXQOk (ORCPT + 99 others); Thu, 24 Mar 2022 12:14:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345791AbiCXQOh (ORCPT ); Thu, 24 Mar 2022 12:14:37 -0400 Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9614AEA2 for ; Thu, 24 Mar 2022 09:13:04 -0700 (PDT) Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-2e5827a76f4so56100987b3.6 for ; Thu, 24 Mar 2022 09:13:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qD/GtOjGwOlJ7PVUx2PNL/pqrH5OmjHCrCL+mrKUoNs=; b=FWeKjzvOPcv4J6hpCELOZQ5cq/PWnEZySFDbQXiYNSRunZGregPPfCHQ3V1dHGkxLT V1sgoVBVGvr1Y3jtADkZqsHwslTHW6P9ibdTzkg++st+te2PQIG4RmqNPQVBGfnbr1dx h/BPUogr6i28aCYj6pXiYg/our8couw4KZUUdCppB6J/pOQ+9nJcxkZMuyZbrq4gS8Ac VRR7IpdEHtu1QqPoVPpeOC+GF25EEQJ4YcOJO9NPrTsLQyD/JwU4pV7DKMMJ1i753b8F crWlyiN2xaUhUjv9ZVM2fw1t7fvJMRHg/2WEGsb5saCviTbFM8cN1EYbtzQeUBS7/3fj 7KEw== 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=qD/GtOjGwOlJ7PVUx2PNL/pqrH5OmjHCrCL+mrKUoNs=; b=F/RkgnVaG/QrkECtbOH2qyyYf1jk0QF/c7r/zqcpguiIVZuRXY4UfFMsssFhsPlkRb GroB5QjP3slPLWr/zdo+juIAmldWGmeXTSAULhTDzQ6SPIgC861EKKGWhsYUGc0zYxbB +bHA5nKsXHfM3LFilysdJfmRaP3PoRxBlFJfxOt9jZkzyKKK3to1s5clXZH4ibmEdOKJ pY4xO62EA/c9a/5DixF5z002REb7heE7Aygx+Q7PI3wTWWJ822v14wW/2yVb8FYusJZ9 HbwnvvykpfCOVAkb1/bCiKH88tQ3uaksUdLoRbDOOLUj4aPW3lUYzKKHJv/mMU+3Qop6 CHJg== X-Gm-Message-State: AOAM531kyJ9qZMzFszksitE4B9nvHTHaReH4fE30azbr5kktqjOHUI+n 2vQUMKpfOTCfm+ixH2tAt3pTcrwGcYZ6u+Izr5A80w== X-Received: by 2002:a05:690c:827:b0:2e5:a53b:cffc with SMTP id by7-20020a05690c082700b002e5a53bcffcmr5703549ywb.31.1648138383515; Thu, 24 Mar 2022 09:13:03 -0700 (PDT) MIME-Version: 1.0 References: <000000000000cabcb505dae9e577@google.com> In-Reply-To: From: Muchun Song Date: Fri, 25 Mar 2022 00:12:26 +0800 Message-ID: Subject: Re: [syzbot] general protection fault in list_lru_add To: Dmitry Vyukov Cc: Linus Torvalds , syzbot , Andrew Morton , Linux Kernel Mailing List , Linux-MM , syzkaller-bugs Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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;