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 6C62AC54EE9 for ; Thu, 8 Sep 2022 17:10:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B5F18D0002; Thu, 8 Sep 2022 13:10:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 065C16B0073; Thu, 8 Sep 2022 13:10:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E6EE38D0002; Thu, 8 Sep 2022 13:10:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D9EF66B0072 for ; Thu, 8 Sep 2022 13:10:29 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id BB50A120B4B for ; Thu, 8 Sep 2022 17:10:29 +0000 (UTC) X-FDA: 79889556978.13.AF736E6 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf12.hostedemail.com (Postfix) with ESMTP id 2D58F40092 for ; Thu, 8 Sep 2022 17:10:29 +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 57723B821BC; Thu, 8 Sep 2022 17:10:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE0E5C433C1; Thu, 8 Sep 2022 17:10:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662657026; bh=+ndjqbnn8RdcVz/H0jHr0miA6uQqJW3ZIyD4RPuom7w=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=KqryAns6Xc8VYhYGOAr+/dSGhyUktooM6NXx6TloO+5+1A2VMD9xxyenFl3/8mrkm aHOYxxnDHdr+m2WyI0ZCSvfoF+OrwdVtvK+iS6Hm6WanILQimN0gZ5/2Ahp9+SPnPo VIVOLCGAgML/dBGRjN7tlAAYO9rPS8eLRMKd8sdM= Subject: Patch "Revert "mm: kmemleak: take a full lowmem check in kmemleak_*_phys()"" has been added to the 5.4-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:22 +0200 In-Reply-To: <20220906070309.18809-1-yee.lee@mediatek.com> Message-ID: <166265702215155@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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662657029; a=rsa-sha256; cv=none; b=lU8UAud3A1T2rTHew9ffoE5xAFRfqnuqUqh6GA1L9HFFL2Hks/1Gk16esrMG8azqfM4etj u99365Nc13u7+XxHMGBuBrOuEgwRxYGFdB/OdKnq5gqma2VT9VmvD0Y0v/zEvI6ae5tB3Z j5WtsYzy4OmlWogMz50Wc5UzxoHk7fE= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=KqryAns6; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf12.hostedemail.com: domain of gregkh@linuxfoundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662657029; 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=9fZI48YT/rWobQE1da9nanJ7KWGMx2qJJ30ID+iyUMo=; b=PvvdKCzwXubY1O06drPbSaHr0AeuuGhQdvR/k6fwQL2ch5NJtd4/wY1iU39uDOn0Z1/dTl CXPohxxXGwgt6QuAcJ5vdjb/M+OvDynn0qV7hmp6bcZBsY9JpTNdh7fY1X//wz8rWe5ua1 BqF4mXQsK/2A60AxJK6lSA6IV0+Ttxs= X-Stat-Signature: we6awsmp6dwssao88m6ngynz17p1hq17 X-Rspamd-Queue-Id: 2D58F40092 X-Rspam-User: Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=KqryAns6; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf12.hostedemail.com: domain of gregkh@linuxfoundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org X-Rspamd-Server: rspam12 X-HE-Tag: 1662657029-720672 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.4-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.4 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 @@ -1123,7 +1123,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); @@ -1137,7 +1137,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); @@ -1149,7 +1149,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); @@ -1161,7 +1161,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.4/revert-mm-kmemleak-take-a-full-lowmem-check-in-kmemleak_-_phys.patch