From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796323258; b=IzkUGljIkzGcZxgspJCk9U3EathaHXdtujNI5ryEKkOKXal4hYCb+jbooDLDNKED5zE+ jxih7vRFxg10OlQZiaHFtC8elDTDnpfGyBTqO1hT2XeZ9wtxTkcwncH54U4BQnGk6Ddxk EuK8Yhsx5svZ7OzYPplZqrV5XA4G4mt9yHMnEis6Swo9uZnQQ0zXfCqIOkvyr8pATf6M0 pA+eoNKD5OvdFj6vHwUYjvlXvM0NtJyMnUKBPcCLNqRxIm9yGKxSpT3+2AGoBxEmqTBZU MUCDnOWG/UWwrZy/lGUTjrF3nhwSPYT+7gRVq0VVpA+W4ELfROUT0bwbI+uSKWIilog== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796323258; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=h+wQWfUIOTUQMvYxsPL/ftqt3eUWfL68AEv+XEjTmYw=; b=dZkAfkGNxGZTL2UShoLehicLIzKDqKS4y0DSGgrHNp1ico2ndvF0e5Fw7H7KNq9XoyMm FqMlkLUQJy4H+PrkW+0CIkNYm6CpJ9xKBVnuB3JcA9F92zbuRwj69WMijivl+4/xRFKrA VrndK5a6JoiaiSy9tlEEtICvhJgAtAWA+4ck7ODvHWCirmZek7fsa/I4K8nu/LkPdXfek 1mV9gkcstX6nR1/jJtaCTOE+HxEM+8klJssex1bCKXc9R00mYKx1aFjb5nkYDKPDkO6GC NGo2ebc0suECWCZqZWU0NrxDux5Ki/klt7j+WYMUmbxA0FqqCUWY9/qpFHZzXUMx6Iw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=HPcW0TA2; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65651606A32D; Thu, 3 Dec 2026 18:40:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=HPcW0TA2 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD9D51F00893; Thu, 3 Dec 2026 18:40:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796323257; bh=h+wQWfUIOTUQMvYxsPL/ftqt3eUWfL68AEv+XEjTmYw=; h=Date:To:From:In-Reply-To:References:Subject; b=HPcW0TA23DtsgvgvyJZNq19xvNRoa6vA4dBI3nqbyxre7hKhZOwbXKUmSkEmZx5qS KUWHMyt2F8r2NO302d58F/n7uFxzV8qe4hniFlqQHki1M+4OHMSdNcc9Vv8BSn7hvh 8wFr/Zv9jvylmp8Gd+jLlInEZv8J87Rrk1y5fuOY= Date: Thu, 03 Dec 2026 10:40:57 -0800 To: mm-commits@vger.kernel.org,tongweilin@linux.alibaba.com, stable@vger.kernel.org,leitao@debian.org,david@kernel.org, catalin.marinas@arm.com,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261203152515.2270778-3-catalin.marinas@arm.com> References: <20261203152515.2270778-3-catalin.marinas@arm.com> Subject: + mm-kmemleak-do-not-hex-dump-objects-once-free-tracking-has-stopped.patch added to mm-new branch Message-Id: <20261203184057.CD9D51F00893@smtp.kernel.org> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: mm: kmemleak: do not hex dump objects once free tracking has stopped has been added to the -mm mm-new branch. Its filename is mm-kmemleak-do-not-hex-dump-objects-once-free-tracking-has-stopped.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-kmemleak-do-not-hex-dump-objects-once-free-tracking-has-stopped.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Catalin Marinas Subject: mm: kmemleak: do not hex dump objects once free tracking has stopped Date: Thu, 03 Dec 2026 15:25:13 +0000 If kmemleak is disabled after reporting leaks, the metadata is kept so that the report can still be read, but kmemleak_free_enabled is cleared. kmemleak_free() then no longer clears OBJECT_ALLOCATED, which the report checks under object->lock before hex dumping an object. Reading the report can therefore hex dump memory that has been freed, or unmapped in the case of vmalloc and percpu areas. Skip the hex dump once kmemleak_free_enabled is cleared. The callers hold scan_mutex, under which kmemleak_do_cleanup() clears the flag. Link: https://patch.msgid.link/20261203152515.2270778-3-catalin.marinas@arm.com Fixes: 74341703edca ("kmemleak: Report previously found leaks even after an error") Signed-off-by: Catalin Marinas Signed-off-by: Andrew Morton Cc: Weilin Tong Cc: Breno Leitao Cc: David Hildenbrand Cc: mm/kmemleak.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/mm/kmemleak.c~mm-kmemleak-do-not-hex-dump-objects-once-free-tracking-has-stopped +++ a/mm/kmemleak.c @@ -312,6 +312,13 @@ static void hex_dump_object(struct seq_f if (WARN_ON_ONCE(object->flags & OBJECT_PHYS)) return; + /* + * Frees are no longer tracked, so the object may have been freed or + * unmapped. The callers hold scan_mutex, under which the flag is cleared. + */ + if (!kmemleak_free_enabled) + return; + if (object->flags & OBJECT_PERCPU) ptr = (const u8 *)this_cpu_ptr((void __percpu *)object->pointer); _ Patches currently in -mm which might be from catalin.marinas@arm.com are mm-kmemleak-take-kmemleak_lock-in-the-disable-time-object-cleanup.patch mm-kmemleak-do-not-hex-dump-objects-once-free-tracking-has-stopped.patch mm-kmemleak-annotate-the-lockless-accesses-to-the-enable-flags.patch