linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Enze Li <lienze@kylinos.cn>
To: SeongJae Park <sj@kernel.org>
Cc: akpm@linux-foundation.org,  damon@lists.linux.dev,
	 linux-mm@kvack.org, enze.li@gmx.com, lienze@kylinos.cn
Subject: Re: [PATCH] mm/damon/core: fix potential memory leak by cleaning ops_filter in damon_destroy_scheme
Date: Wed, 15 Oct 2025 10:46:47 +0800	[thread overview]
Message-ID: <87jz0wg9uw.fsf@> (raw)
In-Reply-To: <20251014182539.50115-1-sj@kernel.org> (SeongJae Park's message of "Tue, 14 Oct 2025 11:25:38 -0700")

Hi SJ,

On Tue, Oct 14 2025 at 11:25:38 AM -0700, SeongJae Park wrote:

> On Tue, 14 Oct 2025 16:42:25 +0800 Enze Li <lienze@kylinos.cn> wrote:
>
>> Currently, damon_destroy_scheme() only cleans up the filter list but
>> leaves ops_filter untouched, which could lead to memory leaks when
>> a scheme is destroyed.
>> 
>> This patch ensures both filter and ops_filter are properly freed in
>> damon_destroy_scheme(), preventing potential memory leaks.
>
> Thank you for fixing this!
>
> FYI the leak is not only potential but can easily be reproduced using the ops
> damos filters.  For example, I was able to reproduce it using DAMON user-space
> tool (damo), like below.
>
>     $ sudo ./damo start
>     $ sudo ./damo report access --snapshot_damos_filter allow anon
>
> After the above steps I confirmed it leaks the memory using kmemleak.

Thank you for the review.

Considering that similar memory leak issues might occur elsewhere in the
future, should we consider exploring the introduction of Rust for
certain modules as a proactive measure?

My search through the mailing list archives didn't reveal similar
discussions, though I might have missed them.  Would you be open to
sharing your insights on this matter?

Best Regards,
Enze

<...>


  reply	other threads:[~2025-10-15  2:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14  8:42 Enze Li
2025-10-14 18:25 ` SeongJae Park
2025-10-15  2:46   ` Enze Li [this message]
2025-10-15 15:07     ` SeongJae Park

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=87jz0wg9uw.fsf@ \
    --to=lienze@kylinos.cn \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=enze.li@gmx.com \
    --cc=linux-mm@kvack.org \
    --cc=sj@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