From: Andrew Morton <akpm@linux-foundation.org>
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
Subject: + mm-kmemleak-do-not-hex-dump-objects-once-free-tracking-has-stopped.patch added to mm-new branch
Date: Thu, 03 Dec 2026 10:40:57 -0800 [thread overview]
Message-ID: <20261203184057.CD9D51F00893@smtp.kernel.org> (raw)
In-Reply-To: <20261203152515.2270778-3-catalin.marinas@arm.com>
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 <catalin.marinas@arm.com>
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 <catalin.marinas@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Weilin Tong <tongweilin@linux.alibaba.com>
Cc: Breno Leitao <leitao@debian.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: <stable@vger.kernel.org>
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
parent reply other threads:[~2026-12-03 18:40 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20261203152515.2270778-3-catalin.marinas@arm.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261203184057.CD9D51F00893@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=david@kernel.org \
--cc=leitao@debian.org \
--cc=mm-commits@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tongweilin@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox