From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E756B606A322 for ; Fri, 4 Dec 2026 11:56:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VQ4faqgr Received: by kanga.kvack.org (Postfix) id 046FE6B05BD; Fri, 4 Dec 2026 06:56:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F39F86B05BE; Fri, 4 Dec 2026 06:56:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E50306B05BF; Fri, 4 Dec 2026 06:56:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id BB8F26B05BD for ; Fri, 4 Dec 2026 06:56:45 -0500 (EST) Received: from smtpin10.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 51545A7C13 for ; Fri, 4 Dec 2026 11:56:45 +0000 (UTC) X-FDA: 85506148770.10.8406F3D Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf04.hostedemail.com (Postfix) with ESMTP id 9B8CD40004 for ; Fri, 4 Dec 2026 11:56:43 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=VQ4faqgr; spf=pass (imf04.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796385403; b=U3sJClvMj8x1/KY+4drGBJCejahLxWMnIJEgkrlQH0BRFZVm7Jvlz20aNWTbySqmrtERHS WUo001Qr//8GPsDToKlAbu1OL8ABZskht+Fv9wkCRhvq4lscR8HBxKg93e9LUDZ9fqKP5B tXv/asrCWaQRRcRxyXECc2weR85hwOc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796385403; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=4C6uD1E4aBt2Xq3I9o7lxyrIMNhslnPX9pkFe+EVYks=; b=oYKPpaQqpoRoHHTd0gHlIRvOc/3cy6fNq3e58XHnxJsjAG94G7b8/HjF4UVgOCbUUJLfmK dcMNZ5W2AocnRifiaJgrdpWup485h/tEqb1Cne0JgCKA6LwWux0PRAu1G2zeyFviBIY3M+ YouAUC3gH8k5p3DWCmtDldaz/Q5mhKY= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=VQ4faqgr; spf=pass (imf04.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 7EC3F460AB; Fri, 4 Dec 2026 11:56:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C9801F00897; Fri, 4 Dec 2026 11:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796385402; bh=4C6uD1E4aBt2Xq3I9o7lxyrIMNhslnPX9pkFe+EVYks=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=VQ4faqgrE77aqJzxtJJoHcJ0xiNKr6iZcOCtehkzAHiQT6pbeMt9aCj6hcjgncQiE wragk2B42uwllUQhWy8jQ8R8Ke1EmI9aPTxsSm/q6oR6JNvvvW70msmF48xnYDH6hI 3K8wANZHgJjA4Ov63tFiQ5hxcjDaKz3SiwofY8pmarHQ6oSZAV6zYePCETLUOcEiWx sw4Nk2vq3+QVGv5OOITVwOV2ciK1VrGLSN6ozPqgQt9x5r7FhTgBlqHcmCqXYRgxPX RpxjI9H3uLk4gubboviXQye2WY6/GDeP/qBtOELw7d4fvoBzXYIZqnRQffAU9I2m8r P4Y9jj0HPTUGA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] mm: kmemleak: Keep full physical address for OBJECT_PHYS objects Reply-To: sashiko-reviews@lists.linux.dev To: "Stefan Wiehler" , "Catalin Marinas" , "Andrew Morton" Cc: linux-mm@kvack.org In-Reply-To: <20261203115429.2383861-1-stefan.wiehler@nokia.com> References: <20261203115429.2383861-1-stefan.wiehler@nokia.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 11:56:41 +0000 X-Stat-Signature: u5h6bx8c4fwgojmsyrau8pojsnz7ferq X-Rspam-User: X-Rspamd-Queue-Id: 9B8CD40004 X-Rspamd-Server: rspam09 X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-HE-Tag: 1796385403-971918 X-HE-Meta: U2FsdGVkX18KChwbcELTGnoosP7RoM0J5JbfwlmFvbMvf9lARojkyxnV7rOSCj3vr7dThNXCChMSy4LTX91tgOlFe5yeTaZLawpK2vho5LIPWnu6R15staSC+P2AAaaWAij3lLgwnuZFJrA52rQVyoJDavmCiJEIM0EJ3mirWrbwd7jQnh3qOmHdDyi9cUWmktzY93Z4AyV8DK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6x3nedf0QvdikvGznGNyKUyJqlzh8tCCGdcAkJArT9UUeBSGVpx+tlxb3lzB1N+I0u5+6tzrtycudp4o2u3tP+HqprqTMSFsdFO9ucGC/JSkCt/CXsJwNqN7mRjpQxzWEzHVoKoe5eDqp3GhbKjz4OJdTziiqSxOoROwAjjEeGEMmDDCzMBXYgNWFBlMjlVd3umi+9kBRA3nLtcAJT7ApaYwZXqjujLQ5cR43CZ8WBkAoxuCEovVr7zzxbY+mpnhk18AXRSIJavVlv3jtDD2SbjZdQ7Pqdk43c6vYI6ZNJ1k2VxYyOcpK7hQPPJVG9Leer2pCFli/6or1CPq3Up+3l9XDwitCPo5ILmTBC+v9g2UKPkawRHYstfm46/428uRBfdFXptrNZRez4iT28w7aDGxpntRdk1Riq+gbSu6j6kqYTG9EZYFVvcDNMFXs5wTenvxtSQzNG3oaVwHO6mQdLTIskG+Eymlfv/Bbj9jDRSdwrdkRX/RWOb24SDfVndbRdftsZ99GgSCYLHZLAwib9hngIrLvkMYLrl6tG5Z88NcT+0QiWxyzPPAQ8lErTlb2aJ00pULms= Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] mm: kmemleak: dump_str_object_info() truncates >4GB physical addresses - [Low] mm: kmemleak: missing Fixes trailer for commit 0c24e061196c - [Low] mm: kmemleak u64 pointer adds struct padding and 32-bit lookup overhead -- commit 42bc9a7add9577059db2423f9b06da1b825a2889 Author: Stefan Wiehler > mm: kmemleak: Keep full physical address for OBJECT_PHYS objects > > On 32-bit kernels with CONFIG_ARM_LPAE, kmemleak_alloc_phys() and the > other *_phys() helpers pass a phys_addr_t, but kmemleak stored the > address in an unsigned long. Memory above 4GB therefore lost its upper > bits. At scan time the lowmem check then compared the truncated page > frame against min_low_pfn/max_low_pfn, painted the object black, and > skipped scanning it. > > On our KeyStone II setup, the unflattened device tree lives in a > memblock above 4GB. Every pointer that only exists in that tree, such as > kobject names, property names and fwnode links created during > of_core_init(), was therefore reported as an unreferenced object. > > Store the object pointer as u64 and carry it through the object tree, > lookup, create, delete, paint and scan paths. Virtual addresses are > still untagged and cast to unsigned long where they are dereferenced > or printed. > > Signed-off-by: Stefan Wiehler [Severity: Low] This fixes a bug introduced when physical addresses began being stored directly in struct kmemleak_object.pointer. Should this include: Fixes: 0c24e061196c ("mm: kmemleak: add rbtree and store physical address= for objects allocated with PA") > diff --git a/mm/kmemleak.c b/mm/kmemleak.c > index d84c1e2c30478..428e2679dbcef 100644 > --- a/mm/kmemleak.c > +++ b/mm/kmemleak.c > @@ -144,7 +144,8 @@ struct kmemleak_object { > /* object usage count; object freed when use_count =3D=3D 0 */ > atomic_t use_count; > unsigned int del_state; /* deletion state */ > - unsigned long pointer; > + /* virtual or physical address of the block */ > + u64 pointer; > size_t size; > /* pass surplus references to this pointer */ > unsigned long excess_ref; [Severity: Low] Could this use phys_addr_t instead of u64, and place size before pointer? On 32-bit SMP architectures with 8-byte u64 alignment (such as ARM EABI), putting u64 pointer before size adds 8 bytes of padding, growing struct kmemleak_object from 116 to 128 bytes (+192 KB for the default mem_pool) and pushing size into a second cacheline away from rb_node and pointer. Using phys_addr_t avoids both the growth and 64-bit arithmetic in __lookup_object() and __link_object() on 32-bit !CONFIG_PHYS_ADDR_T_64BIT builds, while moving size before pointer eliminates the padding and cacheline split on 32-bit CONFIG_PHYS_ADDR_T_64BIT builds too. [ ... ] > @@ -593,7 +608,7 @@ static void put_object(struct kmemleak_object *object) > /* > * Look up an object in the object search tree and increase its use_coun= t. > */ > -static struct kmemleak_object *__find_and_get_object(unsigned long ptr, = int alias, > +static struct kmemleak_object *__find_and_get_object(u64 ptr, int alias, > unsigned int objflags) > { > unsigned long flags; [Severity: Medium] Should dump_str_object_info() and __dump_str_object_info() also be updated for 64-bit physical addresses? dump_str_object_info() still parses the debugfs dump=3D input into an unsigned long with kstrtoul() (and prints unknown addresses with 0x%08lx), so on 32-bit LPAE kernels looking up an OBJECT_PHYS object above 4GB returns -EINVAL. When widening dump_str_object_info() to kstrtou64() and __dump_str_object_info() to u64, the virtual and OBJECT_PERCPU lookups should be skipped when addr > ULONG_MAX; otherwise object_tree_addr() truncates the upper bits and can match an unrelated 32-bit object. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203115429.2383= 861-1-stefan.wiehler@nokia.com?part=3D1