Skip to content

RFC mm/damon: move damos filter range arguments validation to core

SJ Park damon linux-kselftest linux-mm lkml stable 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest8 patches 4 repliesIn review
  2. v1 RFC8 patches 7 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8mm/damon/sysfs-schemes: read sysfs_filter->addr_range only oncemm/damon/sysfs-schemes.c+3 -30 replies
2/8mm/damon/sysfs-schemes: read sysfs_filter->sz_range only oncemm/damon/sysfs-schemes.c+3 -40 replies
3/8mm/damon/core: return an error from damos_commit_filter_arg()mm/damon/core.c+28 -133 replies
4/8mm/damon/core: disallow max < min damos filter range arguments commitmm/damon/core.c+6 -00 replies
5/8mm/damon/sysfs-schemes: drop centralized filter range arg validationsmm/damon/sysfs-schemes.c+0 -130 replies
6/8mm/damon/sysfs-schemes: use switch-case in add_scheme_filters()mm/damon/sysfs-schemes.c+13 -50 replies
7/8mm/damon/core-kunit: extend damos_commit_filter_for() for wrong inputmm/damon/tests/core-kunit.h+15 -90 replies
8/8mm/damon/core-kunit: test invalid damos filter commitsmm/damon/tests/core-kunit.h+14 -01 reply

Reviews trailers per patch

1 of 8 patches has a Reviewed-by or Acked-by.

PatchKunwu Chan
1/8
2/8
3/8R-b
4/8
5/8
6/8
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [RFC PATCH v2 0/8] mm/damon: move damos filter range arguments validation to core

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
- RFC: https://lore.kernel.org/[email protected]
- 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: 9b2df9f07a4a7a5d9f625d26f9482486859d64aa

Signature · 1 line
2.47.3