From: SJ Park <sj@kernel.org>
To: sashiko-bot@kernel.org
Cc: SJ Park <sj@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
damon@lists.linux.dev, linux-mm@kvack.org
Subject: Re: [RFC PATCH v3 2/7] mm/damon/vaddr: use damos->last_applied for migrate action
Date: Fri, 27 Nov 2026 14:39:54 -0800 [thread overview]
Message-ID: <20261127223955.106119-1-sj@kernel.org> (raw)
In-Reply-To: <sashiko-outbox-238332@kernel.org>
On Fri, 27 Nov 2026 22:33:33 +0000 sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [High] mm/damon/vaddr: NULL folio dereference in
> damos_va_migrate_pmd_entry()
> --
>
> commit 28e5ee87b052dd198d574f424c2cf49c18aacf24
> Author: SJ Park <sj@kernel.org>
>
> mm/damon/vaddr: use damos->last_applied for migrate action
>
> This commit updates damos_va_migrate_pmd_entry() to track and skip the last
> applied folio via damos->last_applied using damos_va_invalid_folio().
>
> > diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
> > index ca7ce9bd96e7d..c8f93a19c840e 100644
> > --- a/mm/damon/vaddr.c
> > +++ b/mm/damon/vaddr.c
>
> [ ... ]
>
> > @@ -881,10 +888,11 @@ static int damos_va_migrate_pmd_entry(pmd_t *pmd, unsigned long addr,
> > if (pte_none(ptent) || !pte_present(ptent))
> > continue;
> > folio = vm_normal_folio(walk->vma, addr, ptent);
> > - if (!folio)
> > - continue;
> > page_idx = folio_page_idx(folio, pte_page(ptent));
> > nr = folio_nr_pages(folio) - page_idx;
> > + if (damos_va_invalid_folio(folio, s))
> > + continue;
>
> [Severity: High]
> Can this dereference a NULL folio when vm_normal_folio() returns NULL, such
> as for the shared zero page or a special PFN mapping? Removing the !folio
> check before folio_page_idx() and folio_nr_pages() passes NULL into
> folio_nr_pages() -> folio_test_large() before damos_va_invalid_folio() is
> reached.
Good catch. I will restore the !folio check.
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261127222719.105510-1-sj@kernel.org?part=2
>
Thanks,
SJ
next prev parent reply other threads:[~2026-11-27 22:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 22:27 [RFC PATCH v3 0/7] mm/damon: various improvements/cleanups for code, tests and comments SJ Park
2026-11-27 22:27 ` [RFC PATCH v3 1/7] mm/damon/vaddr: advance migration attempt in folio level for filter out SJ Park
2026-11-27 22:27 ` [RFC PATCH v3 2/7] mm/damon/vaddr: use damos->last_applied for migrate action SJ Park
2026-11-27 22:33 ` sashiko-bot
2026-11-27 22:39 ` SJ Park [this message]
2026-11-27 22:27 ` [RFC PATCH v3 3/7] mm/damon/vaddr: implement sz_filter_passed for migrate_{hot,cold} action SJ Park
2026-11-27 22:35 ` sashiko-bot
2026-11-27 22:41 ` SJ Park
2026-11-27 22:27 ` [RFC PATCH v3 4/7] mm/damon/sysfs-schemes: drop redundant and racy zero target_value check SJ Park
2026-11-27 22:27 ` [RFC PATCH v3 5/7] selftests/damon/damos_apply_interval: remove unused variables SJ Park
2026-11-27 22:27 ` [RFC PATCH v3 6/7] selftests/damon: remove unused imports of sys and time modules SJ Park
2026-11-27 22:27 ` [RFC PATCH v3 7/7] mm/damon: update file intro comments to call DAMON just DAMON SJ Park
2026-11-27 22:35 ` [RFC PATCH v3 0/7] mm/damon: various improvements/cleanups for code, tests and comments sashiko-bot
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=20261127223955.106119-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-mm@kvack.org \
--cc=sashiko-bot@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.