From patchwork Sat Nov 20 00:43:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12629929 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 EB232C433F5 for ; Sat, 20 Nov 2021 00:47:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 997CA6B007E; Fri, 19 Nov 2021 19:43:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 946F06B0080; Fri, 19 Nov 2021 19:43:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8352A6B0081; Fri, 19 Nov 2021 19:43:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0095.hostedemail.com [216.40.44.95]) by kanga.kvack.org (Postfix) with ESMTP id 74BEB6B007E for ; Fri, 19 Nov 2021 19:43:49 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 33C7E89558 for ; Sat, 20 Nov 2021 00:43:39 +0000 (UTC) X-FDA: 78827460558.06.8B740D5 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf18.hostedemail.com (Postfix) with ESMTP id 159514002088 for ; Sat, 20 Nov 2021 00:43:37 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id B48176137B; Sat, 20 Nov 2021 00:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1637369018; bh=AQ5tlSpHHH8OIRqYCVH8VZh2bPmobVgNxO6sRajN5eY=; h=Date:From:To:Subject:In-Reply-To:From; b=JdLn7IqyymouIK14Ddqjv0m8YtVB6/TRqj4luEsBm13oasqzfiVSpvZHUJ6yf2OZ1 1Ucj2pCX4V4pC+QeHJ98wvmY/8obOc60QrzYcnsV7a8zvWMBpcZNfK8s4sF7rjwDh1 haBGOwECIISotm7z4yNHdghbS/M6KpO9mAuvPX0Y= Date: Fri, 19 Nov 2021 16:43:37 -0800 From: Andrew Morton To: akpm@linux-foundation.org, catalin.marinas@arm.com, cl@linux.com, glommer@parallels.com, gregkh@linuxfoundation.org, iamjoonsoo.kim@lge.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, penberg@kernel.org, rientjes@google.com, rkovhaev@gmail.com, songmuchun@bytedance.com, stable@vger.kernel.org, torvalds@linux-foundation.org, vbabka@suse.cz Subject: [patch 08/15] mm: kmemleak: slob: respect SLAB_NOLEAKTRACE flag Message-ID: <20211120004337.1cGvw42-J%akpm@linux-foundation.org> In-Reply-To: <20211119164248.50feee07c5d2cc6cc4addf97@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 159514002088 X-Stat-Signature: zrk9z3i5wcg4s94cxxwf9gpohm6fjymc Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=JdLn7Iqy; dmarc=none; spf=pass (imf18.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1637369017-519922 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: From: Rustam Kovhaev Subject: mm: kmemleak: slob: respect SLAB_NOLEAKTRACE flag When kmemleak is enabled for SLOB, system does not boot and does not print anything to the console. At the very early stage in the boot process we hit infinite recursion from kmemleak_init() and eventually kernel crashes. kmemleak_init() specifies SLAB_NOLEAKTRACE for KMEM_CACHE(), but kmem_cache_create_usercopy() removes it because CACHE_CREATE_MASK is not valid for SLOB. Let's fix CACHE_CREATE_MASK and make kmemleak work with SLOB Link: https://lkml.kernel.org/r/20211115020850.3154366-1-rkovhaev@gmail.com Fixes: d8843922fba4 ("slab: Ignore internal flags in cache creation") Signed-off-by: Rustam Kovhaev Acked-by: Vlastimil Babka Reviewed-by: Muchun Song Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc: Catalin Marinas Cc: Greg Kroah-Hartman Cc: Glauber Costa Cc: Signed-off-by: Andrew Morton --- mm/slab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/slab.h~mm-kmemleak-slob-respect-slab_noleaktrace-flag +++ a/mm/slab.h @@ -147,7 +147,7 @@ static inline slab_flags_t kmem_cache_fl #define SLAB_CACHE_FLAGS (SLAB_NOLEAKTRACE | SLAB_RECLAIM_ACCOUNT | \ SLAB_TEMPORARY | SLAB_ACCOUNT) #else -#define SLAB_CACHE_FLAGS (0) +#define SLAB_CACHE_FLAGS (SLAB_NOLEAKTRACE) #endif /* Common flags available with current configuration */