From: Kyuwon Cho <kyuwon.cho@skku.edu>
To: SJ Park <sj@kernel.org>, Andrew Morton <akpm@linux-foundation.org>
Cc: Quanmin Yan <yanquanmin1@huawei.com>,
Aveline Noir <jm5905938@gmail.com>,
sashiko-bot@kernel.org, sashiko-reviews@lists.linux.dev,
damon@lists.linux.dev, linux-mm@kvack.org
Subject: [PATCH v3 0/4] mm/damon/paddr: prevent address wrap in action walks
Date: Sat, 5 Dec 2026 10:52:00 +0900 [thread overview]
Message-ID: <cover.1796405525.git.kyuwon.cho@skku.edu> (raw)
The four physical-address DAMOS action walks advance a page-aligned cursor
by PAGE_SIZE or folio_size(). If the physical end of a region is near
PHYS_ADDR_MAX, either addition can wrap the cursor to zero.
Depending on where the wrap makes the loop restart, and on the folio
states and sizes in the address range, the walk can repeat multiple times.
In the worst case, it can be infinite.
As a result, kdamond can affect unexpectedly much memory and consume
system resources. Users cannot stop it because the busy kdamond does not
respond to DAMON sysfs input. Regions ending near PHYS_ADDR_MAX are rare
in practice, but the consequence is severe.
Calculate each converted end once before its loop and saturate every
PAGE_SIZE or folio-size advance at that end. Keep the fixes split by the
commits that introduced the walks so they can be backported independently.
---
Changes in v3:
- Restore the impact description, including the indefinite repeat, using
wording suggested by SJ Park.
- Hoist each end calculation before its loop and fold the separately
posted endpoint optimization into the fixes, as suggested by SJ Park.
- Correct the Fixes tags after SJ Park noted that the pageout tag was too
new. Aveline Noir identified the commit that introduced the pageout
walk.
The separate endpoint optimization can be dropped:
https://lore.kernel.org/all/179636379461.1106205.7227742056101745798@skku.edu/
The v3 plan discussion:
https://lore.kernel.org/all/179640027323.1616253.15840107925779563493@skku.edu/
v2:
https://lore.kernel.org/all/179636379461.1106205.17118044826561378975@skku.edu/
v1:
https://lore.kernel.org/all/179614474316.1073623.13833808548597202010@skku.edu/
The issue was found by an LLM-guided test generator that we are
developing as a research prototype.
The sysfs test case was posted in the v2 discussion:
https://lore.kernel.org/all/179640027309.1616249.12163670586345074790@skku.edu/
Kyuwon Cho (4):
mm/damon/paddr: prevent address wrap in pageout walks
mm/damon/paddr: prevent address wrap in LRU action walks
mm/damon/paddr: prevent address wrap in migration walks
mm/damon/paddr: prevent address wrap in stat walks
mm/damon/paddr.c | 52 +++++++++++++++++++++++++++++++++---------------
1 file changed, 36 insertions(+), 16 deletions(-)
--
2.43.0
next reply other threads:[~2026-12-05 1:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 1:52 Kyuwon Cho [this message]
2026-12-05 1:52 ` [PATCH v3 1/4] mm/damon/paddr: prevent address wrap in pageout walks Kyuwon Cho
2026-12-05 1:52 ` [PATCH v3 2/4] mm/damon/paddr: prevent address wrap in LRU action walks Kyuwon Cho
2026-12-05 1:52 ` [PATCH v3 3/4] mm/damon/paddr: prevent address wrap in migration walks Kyuwon Cho
2026-12-05 1:52 ` [PATCH v3 4/4] mm/damon/paddr: prevent address wrap in stat walks Kyuwon Cho
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=cover.1796405525.git.kyuwon.cho@skku.edu \
--to=kyuwon.cho@skku.edu \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=jm5905938@gmail.com \
--cc=linux-mm@kvack.org \
--cc=sashiko-bot@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sj@kernel.org \
--cc=yanquanmin1@huawei.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