[PATCH 0/8] mm/damon: move damos filter range arguments validation to core
From: SJ Park
Date: Mon Sep 14 2026 - 12:03:09 EST
DAMOS filter range arguments are being validated in the DAMON sysfs
interface. Some of those have minor time-of-check to time-of-use
(TOCTOU) bugs. In future, other callers might have duplicated
validations with similar bugs.
Fix the bugs and further refactor the code to move the validation to the
core layer. Also add kunit test cases for the validations.
Patches 1 and 2 fix the existing TOCTOU bugs. Patches 3 and 4 adds the
validation in the core layer. Patch 5 drops the replicated validation
in DAMON sysfs interface. Patch 6 further cleanup the code. Patches 7
and 8 extends kunit tests to test the validation.
Changes from RFC v2
- RFC v2: https://lore.kernel.org/20260913171706.103052-1-sj@xxxxxxxxxx
- Drop RFC tag.
- Rebase to latest mm-new.
Changes from RFC
- RFC: https://lore.kernel.org/20260912191807.138502-1-sj@xxxxxxxxxx
- Handle error from damos_commit_filter_arg() on all call sites.
SJ Park (8):
mm/damon/sysfs-schemes: read sysfs_filter->addr_range only once
mm/damon/sysfs-schemes: read sysfs_filter->sz_range only once
mm/damon/core: return an error from damos_commit_filter_arg()
mm/damon/core: disallow max < min damos filter range arguments commit
mm/damon/sysfs-schemes: drop centralized filter range arg validations
mm/damon/sysfs-schemes: use switch-case in add_scheme_filters()
mm/damon/core-kunit: extend damos_commit_filter_for() for wrong input
mm/damon/core-kunit: test invalid damos filter commits
mm/damon/core.c | 47 +++++++++++++++++++++++++++----------
mm/damon/sysfs-schemes.c | 32 ++++++++++---------------
mm/damon/tests/core-kunit.h | 38 +++++++++++++++++++++++-------
3 files changed, 76 insertions(+), 41 deletions(-)
base-commit: 5e38c61dbb4349ff7e900d97d96f369c64678eea
--
2.47.3