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 1360AC54EE9 for ; Thu, 8 Sep 2022 17:09:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A7A218D0003; Thu, 8 Sep 2022 13:09:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A293B6B0073; Thu, 8 Sep 2022 13:09:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F1568D0003; Thu, 8 Sep 2022 13:09:40 -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 7EBC06B0072 for ; Thu, 8 Sep 2022 13:09:40 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5F3751C5BFA for ; Thu, 8 Sep 2022 17:09:40 +0000 (UTC) X-FDA: 79889554920.19.68F24AE Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf06.hostedemail.com (Postfix) with ESMTP id 0F01A180074 for ; Thu, 8 Sep 2022 17:09:39 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 67A8C61D3F; Thu, 8 Sep 2022 17:09:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75001C433D6; Thu, 8 Sep 2022 17:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662656978; bh=3GZRGxLLZRztPVAGWhplbSuis+mMuxh3aToQhmMvIY8=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=nT0WsAJj3p60wbZnoBDHlA5ujIe5KybnopQrg0qQ6p4Yw1qNIhLRHRG58gZH+u9QA QtE60ZzF29JKLhKi/cYVbP9UqOlnw8qXcqfRDjjvk7DX4XwyCK/0xCwuPKCe4Io2zS hSXOAQyVgksvVYLEbe5Q7LBl54Vw6v19i5uLkbYM= Subject: Patch "Revert "mm: kmemleak: take a full lowmem check in kmemleak_*_phys()"" has been added to the 4.14-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:09:52 +0200 In-Reply-To: <20220906070309.18809-1-yee.lee@mediatek.com> Message-ID: <1662656992781@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=1662656980; a=rsa-sha256; cv=none; b=Bilfk3LKvpY+NoWfCA8GDZrOzbADSwbCkCnBaY13bSWldNVvPHczhy1MulO5UWkxkh4wOv eAkdaPhd43v6il7aZ2GVKL+c1yhydXzSxuuNuc9BANjGqh/zBSuT0okRkR2vggnMa9xP6y riUsqOqJ+36UXMDWJZ4/bQm3gboCeHU= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=nT0WsAJj; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf06.hostedemail.com: domain of gregkh@linuxfoundation.org designates 139.178.84.217 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=1662656980; 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=X7JWtddcTTPIGmwr0Vk6WfcSPYqsivKkidB8+MMgtwc=; b=01OAh2JluP/OnCUsfmVNeVU4wE3pVaXoY6dL5jkRR9Yo1XrFtTP4b3lEmDkyXb3gRSwXUN KA337auK66PsXtMdN1jHwvYIX4wWI6EpXU3uwwq3CFrAZkKmhpIcG4s5uYGrV5Tvd2U5Tm 2lkVCHKvgyzJAwGYJBAOxv9gEbMc52o= X-Stat-Signature: mrykmta1mxsnukcd54cm16ja34hybpsi X-Rspamd-Queue-Id: 0F01A180074 X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=nT0WsAJj; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf06.hostedemail.com: domain of gregkh@linuxfoundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org X-Rspamd-Server: rspam12 X-HE-Tag: 1662656979-27441 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 4.14-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-4.14 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 @@ -1192,7 +1192,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); @@ -1203,7 +1203,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); @@ -1214,7 +1214,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); @@ -1225,7 +1225,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-4.14/revert-mm-kmemleak-take-a-full-lowmem-check-in-kmemleak_-_phys.patch