Re: [PATCH] mm: kmemleak: confirm suspected leaks with a second scan

From: Breno Leitao

Date: Mon Jul 13 2026 - 05:04:48 EST


On Mon, Jul 13, 2026 at 10:00:39AM +0100, Catalin Marinas wrote:
> On Fri, Jul 10, 2026 at 01:51:40AM -0700, Breno Leitao wrote:
> > On Thu, Jul 09, 2026 at 06:24:47PM +0100, Catalin Marinas wrote:
> > > The kmemleak marking phase is not atomic. While the object graph is
> > > traversed, the kernel can modify pointers, free objects or allocate new
> > > ones. If a reference to an object is moved from one location to another,
> > > kmemleak scanning may miss it. We have explicit annotations like
> > > kmemleak_transient_leak() but identifying and maintaining them is not
> > > trivial.
> > >
> > > Given that such transient leaks are short-lived, rather than just
> > > reporting such objects as leaks, do another scan to confirm the
> > > suspected objects. If no new leaks are found during the first scan, skip
> > > the confirmation one.
> > >
> > > Signed-off-by: Catalin Marinas <catalin.marinas@xxxxxxx>
> > > Assisted-by: Claude:claude-opus-4-8
> > > Cc: Breno Leitao <leitao@xxxxxxxxxx>
> > > Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> >
> > Tested-by: Breno Leitao <leitao@xxxxxxxxxx>
> > Reviewed-by: Breno Leitao <leitao@xxxxxxxxxx>
>
> Thanks!
>
> > PS: This is now conflicting with commit 946935b07cc94 ("mm/kmemleak:
> > skip the remaining scan phases when interrupted"), which has just showed
> > up in linux-next. So, a respin might be required.
> >
> > > BTW, I'll be away from Saturday for three weeks. I may reply
> > > occasionally but won't be able to test anything.
> >
> > Let me know if you want me to respin it based on linux-next.
>
> Yes, please, you have time. Thank you!

Ack, I will respin soon.