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 DCD98C54EE9 for ; Thu, 8 Sep 2022 17:11:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7E2AC8D0002; Thu, 8 Sep 2022 13:11:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7919D6B0073; Thu, 8 Sep 2022 13:11:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 680B88D0002; Thu, 8 Sep 2022 13:11:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 586196B0072 for ; Thu, 8 Sep 2022 13:11:14 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 2CA72C079B for ; Thu, 8 Sep 2022 17:11:14 +0000 (UTC) X-FDA: 79889558868.13.CAC4817 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf22.hostedemail.com (Postfix) with ESMTP id ABAB1C0096 for ; Thu, 8 Sep 2022 17:11:13 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5D78BB82194; Thu, 8 Sep 2022 17:11:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9857AC433D7; Thu, 8 Sep 2022 17:11:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662657071; bh=B/r9KDe9ulFMbYUz7b7tVXIUdLL4ctpkJrLqDnBCYSE=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=Q4gw4/MKrqw3QEdIY+g1av5vXDeP8+wZPovd2jynOmQGnldZtGphqf0Sy5+1fk160 GYEmlQ2kU60dApBQCuG2hYpI9GehPB/CrY+iqkfcCne3rh3AFRGWIIhpQwOGbgzBrG ueQSw0gVIIWG0KRvhI7deQ31xKZnIo3iH918zYMg= Subject: Patch "Revert "mm: kmemleak: take a full lowmem check in kmemleak_*_phys()"" has been added to the 5.15-stable tree To: akpm@linux-foundation.org,catalin.marinas@arm.com,gregkh@linuxfoundation.org,linux-arm-kernel@lists.infradead.org,linux-mediatek@lists.infradead.org,linux-mm@kvack.org,matthias.bgg@gmail.com,patrick.wang.shcn@gmail.com,yee.lee@mediatek.com Cc: From: Date: Thu, 08 Sep 2022 19:10:55 +0200 In-Reply-To: <20220906070309.18809-1-yee.lee@mediatek.com> Message-ID: <166265705519825@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-stable: commit X-Patchwork-Hint: ignore ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b="Q4gw4/MK"; spf=pass (imf22.hostedemail.com: domain of gregkh@linuxfoundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662657073; a=rsa-sha256; cv=none; b=r5nIhqM5KQT4o8S0NQc/inMTzKd33zSByeYymELLNf3wfFtS9ctEd1VvsUxK9EZJPkKT3M mo0uVWdv5A4sfIzucy19TdJnwvG28qQPb/8thuuuHAaP7jSZxNaDfpdEVuX4r5WNBTWR2b jnWawGJK0RmefVvQs3dbAFxacPYk/lY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662657073; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:dkim-signature; bh=QoNQrYqimd4tFwvatPNgX77sdPmk/2n15KvxW5w9rcs=; b=AcY8GIkWI4G2icfanMHJAOrFACcGjcn5s7Y0VBiJjzKgUdwnX0iJAbJ+6Emvz73GAFfDvb 9d2xGDdj0Bgn/S2bW+PSRVQXhf116HAbJv/LdNFKe+DuKjsftkRLnFhw2ZgYMg/mDV7IaJ 6ck6LGL/FbvkO0ngrfUxHo3jzONC484= X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: ABAB1C0096 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b="Q4gw4/MK"; spf=pass (imf22.hostedemail.com: domain of gregkh@linuxfoundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org X-Stat-Signature: uabjmss56dt38iti5i716mtwixrorpio X-Rspam-User: X-HE-Tag: 1662657073-607838 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: This is a note to let you know that I've just added the patch titled Revert "mm: kmemleak: take a full lowmem check in kmemleak_*_phys()" to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-mm-kmemleak-take-a-full-lowmem-check-in-kmemleak_-_phys.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From yee.lee@mediatek.com Thu Sep 8 19:05:17 2022 From: Date: Tue, 6 Sep 2022 15:03:06 +0800 Subject: Revert "mm: kmemleak: take a full lowmem check in kmemleak_*_phys()" To: Cc: , Yee Lee , , Catalin Marinas , "Andrew Morton" , Matthias Brugger , "open list:MEMORY MANAGEMENT" , "moderated list:ARM/Mediatek SoC support" , "moderated list:ARM/Mediatek SoC support" Message-ID: <20220906070309.18809-1-yee.lee@mediatek.com> From: Yee Lee This reverts commit 23c2d497de21f25898fbea70aeb292ab8acc8c94. Commit 23c2d497de21 ("mm: kmemleak: take a full lowmem check in kmemleak_*_phys()") brought false leak alarms on some archs like arm64 that does not init pfn boundary in early booting. The final solution lands on linux-6.0: commit 0c24e061196c ("mm: kmemleak: add rbtree and store physical address for objects allocated with PA"). Revert this commit before linux-6.0. The original issue of invalid PA can be mitigated by additional check in devicetree. The false alarm report is as following: Kmemleak output: (Qemu/arm64) unreferenced object 0xffff0000c0170a00 (size 128): comm "swapper/0", pid 1, jiffies 4294892404 (age 126.208s) hex dump (first 32 bytes): 62 61 73 65 00 00 00 00 00 00 00 00 00 00 00 00 base............ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<(____ptrval____)>] __kmalloc_track_caller+0x1b0/0x2e4 [<(____ptrval____)>] kstrdup_const+0x8c/0xc4 [<(____ptrval____)>] kvasprintf_const+0xbc/0xec [<(____ptrval____)>] kobject_set_name_vargs+0x58/0xe4 [<(____ptrval____)>] kobject_add+0x84/0x100 [<(____ptrval____)>] __of_attach_node_sysfs+0x78/0xec [<(____ptrval____)>] of_core_init+0x68/0x104 [<(____ptrval____)>] driver_init+0x28/0x48 [<(____ptrval____)>] do_basic_setup+0x14/0x28 [<(____ptrval____)>] kernel_init_freeable+0x110/0x178 [<(____ptrval____)>] kernel_init+0x20/0x1a0 [<(____ptrval____)>] ret_from_fork+0x10/0x20 This pacth is also applicable to linux-5.17.y/linux-5.18.y/linux-5.19.y Cc: Signed-off-by: Yee Lee Signed-off-by: Greg Kroah-Hartman --- mm/kmemleak.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -1125,7 +1125,7 @@ EXPORT_SYMBOL(kmemleak_no_scan); void __ref kmemleak_alloc_phys(phys_addr_t phys, size_t size, int min_count, gfp_t gfp) { - if (PHYS_PFN(phys) >= min_low_pfn && PHYS_PFN(phys) < max_low_pfn) + if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) kmemleak_alloc(__va(phys), size, min_count, gfp); } EXPORT_SYMBOL(kmemleak_alloc_phys); @@ -1139,7 +1139,7 @@ EXPORT_SYMBOL(kmemleak_alloc_phys); */ void __ref kmemleak_free_part_phys(phys_addr_t phys, size_t size) { - if (PHYS_PFN(phys) >= min_low_pfn && PHYS_PFN(phys) < max_low_pfn) + if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) kmemleak_free_part(__va(phys), size); } EXPORT_SYMBOL(kmemleak_free_part_phys); @@ -1151,7 +1151,7 @@ EXPORT_SYMBOL(kmemleak_free_part_phys); */ void __ref kmemleak_not_leak_phys(phys_addr_t phys) { - if (PHYS_PFN(phys) >= min_low_pfn && PHYS_PFN(phys) < max_low_pfn) + if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) kmemleak_not_leak(__va(phys)); } EXPORT_SYMBOL(kmemleak_not_leak_phys); @@ -1163,7 +1163,7 @@ EXPORT_SYMBOL(kmemleak_not_leak_phys); */ void __ref kmemleak_ignore_phys(phys_addr_t phys) { - if (PHYS_PFN(phys) >= min_low_pfn && PHYS_PFN(phys) < max_low_pfn) + if (!IS_ENABLED(CONFIG_HIGHMEM) || PHYS_PFN(phys) < max_low_pfn) kmemleak_ignore(__va(phys)); } EXPORT_SYMBOL(kmemleak_ignore_phys); Patches currently in stable-queue which might be from yee.lee@mediatek.com are queue-5.15/revert-mm-kmemleak-take-a-full-lowmem-check-in-kmemleak_-_phys.patch