From: Catalin Marinas <catalin.marinas@arm.com>
To: Breno Leitao <leitao@debian.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com, stable@vger.kernel.org
Subject: Re: [PATCH] mm/kmemleak: fix checksum computation for per-cpu objects
Date: Fri, 3 Jul 2026 17:28:26 +0100 [thread overview]
Message-ID: <akfjKpv838nqsl78@arm.com> (raw)
In-Reply-To: <20260703-kmemleak_checksum-v1-1-5e0ab7d6966f@debian.org>
On Fri, Jul 03, 2026 at 09:17:24AM -0700, Breno Leitao wrote:
> The per-cpu object checksum folds each CPU's CRC together with XOR and
> seeds every CRC with 0. Both choices make update_checksum() miss content
> changes:
>
> - XOR is self-cancelling, so equal contents on two CPUs cancel out and
> simultaneous identical changes leave the checksum unchanged.
> - crc32(0, ...) over all-zero content is 0, so a freshly allocated,
> zeroed per-cpu area checksums to 0, matching the initial value, and
> the object is never seen to change.
>
> See discussions at [0].
>
> When update_checksum() wrongly reports an actively modified object as
> unchanged, kmemleak stops greying it for an extra scan and can report a
> live per-cpu object as a leak.
>
> Fold the per-cpu CRC as a single rolling checksum across all CPUs and
> initialise the object checksum to ~0 so the first computed value always
> registers as a change, even for content that hashes to 0.
> reset_checksum() is seeded the same way.
>
> Link: https://lore.kernel.org/all/akfYImSNDh3OjIfR@gmail.com [0]
> Co-developed-by: Catalin Marinas <catalin.marinas@arm.com>
Since you added co-developed-by, I think it needs this as well:
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(otherwise I'm fine with suggested-by)
Thanks for the investigation and posting this.
--
Catalin
next prev parent reply other threads:[~2026-07-03 16:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 16:17 [PATCH] mm/kmemleak: fix checksum computation for per-cpu objects Breno Leitao
2026-07-03 16:28 ` Catalin Marinas [this message]
2026-07-03 17:09 ` Pavel Tikhomirov
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=akfjKpv838nqsl78@arm.com \
--to=catalin.marinas@arm.com \
--cc=akpm@linux-foundation.org \
--cc=kernel-team@meta.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ptikhomirov@virtuozzo.com \
--cc=stable@vger.kernel.org \
/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