Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2435288yba; Sun, 7 Apr 2019 19:02:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhRoA0CyrLxziSsaqWJcWShkHgHz70gPxSKIi4t73TAYQwyov/sLK35Xy9Wguo0s8KmXhy X-Received: by 2002:a63:155d:: with SMTP id 29mr24992770pgv.389.1554688935419; Sun, 07 Apr 2019 19:02:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554688935; cv=none; d=google.com; s=arc-20160816; b=MubsPBXYclehbQQxwE+g3ELamwggrg7IG50KXKoascOSWpn5xO2T8aiBh4vwIqywf0 4Q+eyMx8KCQecLac5gsGHcR90gd+5yH2kgCl2s+AEOxeFjxg/nrzTt6QxO5sBk9jiqOe QC2GoEvQCo4rHUXQuVTKdLbAXxHCLtQzqyAsURlbw9ZvfHwCCOx4hE9XnfcFwyU+rfZu a0LbwU1GMItxUibuvdx03AoClukYnwgSxWg5+tSjYvSVtKNYVd8/UPgZDwHCC3YQ3ysw +M7RAajtPY5gTAdVNIBt2ivqTIKqLnUzG+27i/Xb2einCvwOzv+8mxTGK039Hcb/eFFE Wlcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=DLP3NAwsImXCyFEGzPGaWnfGENpKl0W4NenoS/NwlKo=; b=M2mGQePIOsdFk7ErpTfD+lA50cA8LneFgkvCSiIqmOSfQ7mZdy5l7x/5OACalvWhZV LGJzTjvxw/OSKjCDCjV6+9oczRtMWmV4pcaBt7fQlT6TzDDBmVc0AASloeo71vDDVnxE zkcA8XMk3PcefnitfClrRIvjS9nHEjL2c2NtCnwGC8wjFLB4YDmgYX+xkE5kE3FGIy4/ JYoh6Ui5O1D4rc7szahTUNWYremYK/v2knti9yE4dnjFM1ZCnEhqHjl4zqlwOhOohLyH GOCd5yp2TegCnrwifEaF95Fr/fjONT3/wpgXCSanhmVAfUuo7lkLEbzBGOW7nAIfKkA2 CMHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tobin.cc header.s=fm2 header.b=vEETgM2q; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=J+oHpI9r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n129si19402264pgn.580.2019.04.07.19.01.59; Sun, 07 Apr 2019 19:02:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@tobin.cc header.s=fm2 header.b=vEETgM2q; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=J+oHpI9r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726556AbfDHB7z (ORCPT + 99 others); Sun, 7 Apr 2019 21:59:55 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:49809 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726349AbfDHB7z (ORCPT ); Sun, 7 Apr 2019 21:59:55 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 980632201F; Sun, 7 Apr 2019 21:59:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sun, 07 Apr 2019 21:59:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tobin.cc; h=date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=DLP3NAwsImXCyFEGzPGaWnfGENp Kl0W4NenoS/NwlKo=; b=vEETgM2qKwAeqZTyu5/6N8i6o+pHju7yaWcyXNbTvO/ O3WwO5BSK27gbI86VJd/+r+0QwfY3mCoeh3ZfT7I0D7bD5qJBatarpthEK5nxys8 7IyhhL7L/UlFf2D0tZxO/r1WAL7ietshkugAcI9nyfqYZq9FdLeiQ3I5ACrCwXpV PCfgqZTFl367PEIeolnqmwDvaM6DJx24JiDDNctHIE3uzOyfMVMw6mi4KLQepTib 9iEsO5xLpNRt0lev7K7KvmQKXco54H9sOX1CN+RCmb7UBKgGNxDOmc62z7AfgMpW 6wYUQ6fHkubTjveBMeYVi/i6hwLu/CvKONdI4aN7d8A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=DLP3NA wsImXCyFEGzPGaWnfGENpKl0W4NenoS/NwlKo=; b=J+oHpI9r4y1nh7M9QBmbDv xM4qwyjPjQwvkoLL3tjVued5Q1vsShVOurokrbqNedL7xt4iOaAnENG7Q+LDmGN+ bf30Cx2+6/Ij39sGqIGF9VbTFqjPepzUxIWowGWg3Ydgdw4/CgcM0ktbgxd3C8Qr WAy8R9N7YIRuMel+FZjSY2NgOYPD/NMtYi5HS8RNd8mHl7nY0q8nCp26NlVEd0Xi tPpAIbLtqInrxJX4UGTEMs3AXyj2QAGrE+2pESH8ZXeojPV8cb7KH9R/HIcArnvT TIMdE6Dvf8loYpVbMnifwn4340pgzvtYK4L0Nllmpqb9Ryga3FFyx/QNLmgC6LeQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddruddvgdehfeculddtuddrgedutddrtddtmd cutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecufghrlhcuvffnffculd eftddmnecujfgurhepfffhvffukfhfgggtuggjofgfsehttdertdforedvnecuhfhrohhm pedfvfhosghinhcuvedrucfjrghrughinhhgfdcuoehmvgesthhosghinhdrtggtqeenuc fkphepuddvgedrudeiledrudehvddrvddvleenucfrrghrrghmpehmrghilhhfrhhomhep mhgvsehtohgsihhnrdgttgenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost (124-169-152-229.dyn.iinet.net.au [124.169.152.229]) by mail.messagingengine.com (Postfix) with ESMTPA id DEA87E4619; Sun, 7 Apr 2019 21:59:47 -0400 (EDT) Date: Mon, 8 Apr 2019 11:59:17 +1000 From: "Tobin C. Harding" To: Qian Cai Cc: akpm@linux-foundation.org, cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, tj@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] slab: fix a crash by reading /proc/slab_allocators Message-ID: <20190408015917.GA633@eros.localdomain> References: <20190406225901.35465-1-cai@lca.pw> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190406225901.35465-1-cai@lca.pw> X-Mailer: Mutt 1.11.4 (2019-03-13) User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 06, 2019 at 06:59:01PM -0400, Qian Cai wrote: > The commit 510ded33e075 ("slab: implement slab_root_caches list") > changes the name of the list node within "struct kmem_cache" from > "list" to "root_caches_node" Are you sure? It looks to me like it adds a member to the memcg_cache_array diff --git a/include/linux/slab.h b/include/linux/slab.h index a0cc7a77cda2..af1a5bef80f4 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -556,6 +556,8 @@ struct memcg_cache_array { * used to index child cachces during allocation and cleared * early during shutdown. * + * @root_caches_node: List node for slab_root_caches list. + * * @children: List of all child caches. While the child caches are also * reachable through @memcg_caches, a child cache remains on * this list until it is actually destroyed. @@ -573,6 +575,7 @@ struct memcg_cache_params { union { struct { struct memcg_cache_array __rcu *memcg_caches; + struct list_head __root_caches_node; struct list_head children; }; And then defines 'root_caches_node' to be 'memcg_params.__root_caches_node' if we have CONFIG_MEMCG otherwise defines 'root_caches_node' to be 'list' > but leaks_show() still use the "list" I believe it should since 'list' is used to add to slab_caches list. > which causes a crash when reading /proc/slab_allocators. I was unable to reproduce this crash, I built with # CONFIG_MEMCG is not set CONFIG_SLAB=y CONFIG_SLAB_MERGE_DEFAULT=y CONFIG_SLAB_FREELIST_RANDOM=y CONFIG_DEBUG_SLAB=y CONFIG_DEBUG_SLAB_LEAK=y I then booted in Qemu and successfully ran $ cat slab_allocators Perhaps you could post your config? Hope this helps, Tobin.