From patchwork Mon Nov 15 02:08:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rustam Kovhaev X-Patchwork-Id: 12618529 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B69CBC433F5 for ; Mon, 15 Nov 2021 02:09:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 46DC760F21 for ; Mon, 15 Nov 2021 02:09:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 46DC760F21 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 63E906B007B; Sun, 14 Nov 2021 21:09:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5ED8D6B007D; Sun, 14 Nov 2021 21:09:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DD1F6B007E; Sun, 14 Nov 2021 21:09:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 427046B007B for ; Sun, 14 Nov 2021 21:09:17 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D9276181AEF30 for ; Mon, 15 Nov 2021 02:09:16 +0000 (UTC) X-FDA: 78809532354.10.5AEF5C7 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf06.hostedemail.com (Postfix) with ESMTP id 8F0B2801A8A0 for ; Mon, 15 Nov 2021 02:09:16 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id y8so7680571plg.1 for ; Sun, 14 Nov 2021 18:09:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=B9nY7cWKAIhZGQnOhoXi5S1L7WhmbmRLPB1yc4lvRQA=; b=Pyvh5FPNF3sjKEXjyhnlXyoBDFGRCx7Tu4hzLTI+I5pPFA9W7Tl0zMbYSav03oIYz/ 26OtdtCvyeML/LRj4LACoOAt6LNUlqDhym1DFcZStqiaZ8G+yodZ0I+8HgitKBFxJhWt x+gt13EZX+x0nrYE3gatvMYgxY9+R4hsUxrUFiPK7d5v9VUYXDpa3wLunf3QQdWZppD5 LcDdD5Ko+STHIMMN02IrPsLlaQclOWV6qXyqudNgcfqH5UD5GpsLzUBvk65UkJ9oC1Lw qzuKVBEjHWvI1KtfDShTaIRHN3NpICSwnoUDMuKYl5sCkaQ+ChIwBART4awIxBSUjn3S 3WHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=B9nY7cWKAIhZGQnOhoXi5S1L7WhmbmRLPB1yc4lvRQA=; b=Wywjf1tPMSvmKSK3GEbn0kAPgCgxd3Zl4tstJbWKbSHFk6R+W5iXXQZrV3Ahw/wCE2 Tk1gaj9AAcbUdG++fy+BSZmBh3gce0ysNlIprhLmAhdH5faE78XchjL4P7XEK/tcb12k 3PRFIbgqW1uMUvLfbNATGfqmudrkM/vK1c1SQzuzBuSyVjLIsqehM6nuia3P2ssZ9uS1 kAYmTodQgBsnfk2QGggilOnOFFPUtxB075cAnZ1Bu4bqRaoM1p+cxGYNwT66ZOHbURqs smpc3Q7RR5B7dFNMbb3Q0O9cP+gNNVqNQAL2/YL/fNizlzcsOL50ZkyuGKrY/ZRNcYYq dNYw== X-Gm-Message-State: AOAM533f3LJe9IPF5/q7mlluyj7+lBLSr86uE+zEn6Xgs7Rbi6aNo2e+ t+4Z+YVb5wgxVxfDzU/CZtQ= X-Google-Smtp-Source: ABdhPJzf56Xg78TaAdHf7Q5OuVI0h1WZDh06v4x4iik2haMhze2vUBe/zyJC9+RukAVSuMlyTv96xw== X-Received: by 2002:a17:90b:1b4b:: with SMTP id nv11mr60425618pjb.131.1636942155385; Sun, 14 Nov 2021 18:09:15 -0800 (PST) Received: from nuc10.amust.local (d50-92-229-34.bchsia.telus.net. [50.92.229.34]) by smtp.gmail.com with ESMTPSA id mv22sm10501306pjb.36.2021.11.14.18.09.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Nov 2021 18:09:15 -0800 (PST) From: Rustam Kovhaev To: vbabka@suse.cz, cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, catalin.marinas@arm.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, gregkh@linuxfoundation.org, Rustam Kovhaev Subject: [PATCH] mm: kmemleak: slob: respect SLAB_NOLEAKTRACE flag Date: Sun, 14 Nov 2021 18:08:50 -0800 Message-Id: <20211115020850.3154366-1-rkovhaev@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 8F0B2801A8A0 X-Stat-Signature: pe7zzsx8jd4gt7y3bpj8fshgnopdhmyd Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Pyvh5FPN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf06.hostedemail.com: domain of rkovhaev@gmail.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=rkovhaev@gmail.com X-HE-Tag: 1636942156-575533 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: 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 Fixes: d8843922fba4 ("slab: Ignore internal flags in cache creation") Signed-off-by: Rustam Kovhaev Acked-by: Vlastimil Babka Reviewed-by: Muchun Song --- mm/slab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slab.h b/mm/slab.h index 58c01a34e5b8..56ad7eea3ddf 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -147,7 +147,7 @@ static inline slab_flags_t kmem_cache_flags(unsigned int object_size, #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 */