public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] mm/damon: validate min_region_size to be power of 2
@ 2026-04-03  5:23 Liew Rui Yan
  2026-04-03  5:23 ` [PATCH v3 1/2] mm/damon/lru_sort: " Liew Rui Yan
  2026-04-03  5:23 ` [PATCH v3 2/2] mm/damon/reclaim: " Liew Rui Yan
  0 siblings, 2 replies; 17+ messages in thread
From: Liew Rui Yan @ 2026-04-03  5:23 UTC (permalink / raw)
  To: sj; +Cc: yanquanmin1, damon, linux-mm, Liew Rui Yan

Problem
=======
When a user provides an invalid min_region_sz (not a power-of-2) via the
DAMON sysfs interface, damon_commit_ctx() fails the validation, which
causes the kdamond to terminate unexpectedly.

Reproduction steps:
1. Enable DAMON_LRU_SORT or DAMON_RECLAIM.
2. Set an invalid 'min_region_sz' by setting 'addr_unit' such that
   'DAMON_MIN_REGION_SZ / addr_unit' is not a power-of-2 (e.g.,
   addr_unit=3).
3. Commit the parameters via 'commit_inputs'.
4. kdamond terminates due to the validation failure.

Solution
========
Add power-of-2 validation in damon_lru_sort_apply_parameters() and
damon_reclaim_apply_parameters(), return -EINVAL immediately.

Patch 1 fixes the issue for DAMON_LRU_SORT.
Patch 2 fixes the issue for DAMON_RECLAIM.

Changes from v2
(https://lore.kernel.org/20260402053756.26606-1-aethernet65535@gmail.com)
- Split the patch into two per-module patches.
- Add Fixes: and Cc: stable tags.
- Elaborate user impact and reproduction steps.
Changes from v1
(https://lore.kernel.org/20260331073231.30060-1-aethernet65535@gmail.com)
- Fix memory leak issue.
Changes from first attempt
(https://lore.kernel.org/20260327062627.66426-1-aethernet65535@gmail.com)
- Renamed the subject.
- Validate min_region_sz rather than addr_unit.

Liew Rui Yan (2):
  mm/damon/lru_sort: validate min_region_size to be power of 2
  mm/damon/reclaim: validate min_region_size to be power of 2

 mm/damon/lru_sort.c | 5 +++++
 mm/damon/reclaim.c  | 5 +++++
 2 files changed, 10 insertions(+)

-- 
2.53.0



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2026-04-06 15:50 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03  5:23 [PATCH v3 0/2] mm/damon: validate min_region_size to be power of 2 Liew Rui Yan
2026-04-03  5:23 ` [PATCH v3 1/2] mm/damon/lru_sort: " Liew Rui Yan
2026-04-03  8:31   ` (sashiko review) " Liew Rui Yan
2026-04-03 15:55     ` SeongJae Park
2026-04-04  9:09       ` Liew Rui Yan
2026-04-04 20:18         ` SeongJae Park
2026-04-03  8:59   ` Quanmin Yan
2026-04-03  9:50     ` Liew Rui Yan
2026-04-03 16:19   ` SeongJae Park
2026-04-04  9:11     ` Liew Rui Yan
2026-04-04 20:30       ` SeongJae Park
2026-04-06  9:41         ` Liew Rui Yan
2026-04-06 15:50           ` SeongJae Park
2026-04-03  5:23 ` [PATCH v3 2/2] mm/damon/reclaim: " Liew Rui Yan
2026-04-03  8:33   ` (sashiko review) " Liew Rui Yan
2026-04-03 16:07     ` SeongJae Park
2026-04-03 16:20   ` SeongJae Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox