From: sashiko-bot@kernel.org
To: "SJ Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [PATCH 8/8] mm/damon/sysfs: remove region size validation
Date: Sun, 05 Jul 2026 16:05:59 +0000 [thread overview]
Message-ID: <20260705160559.900E61F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260705155600.96555-9-sj@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Removal of region size validation allows accepting negative size regions which are then silently transformed into valid positive size regions.
--
commit 9f8b624e84e757e30369d491c2b454f3896c87c7
Author: SJ Park <sj@kernel.org>
mm/damon/sysfs: remove region size validation
This commit removes the region size validation in DAMON sysfs, relying on the
assumption that damon_set_regions() performs complete validation.
> diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
> index e666dddf1feba..b65651498e0d1 100644
> --- a/mm/damon/sysfs.c
> +++ b/mm/damon/sysfs.c
> @@ -1987,9 +1987,6 @@ static int damon_sysfs_set_regions(struct damon_target *t,
> struct damon_sysfs_region *sys_region =
> sysfs_regions->regions_arr[i];
>
> - if (sys_region->ar.start > sys_region->ar.end)
> - goto out;
> -
[Severity: Medium]
Does removing this check allow invalid input to be silently accepted?
If a user configures a region via sysfs where start is greater than end,
damon_set_regions() might still accept it because the alignment happens
before the size validation:
mm/damon/core.c:damon_set_regions() {
...
start = ALIGN_DOWN(ranges[i].start, min_region_sz);
end = ALIGN(ranges[i].end, min_region_sz);
if (start >= end)
return -EINVAL;
...
}
If the user provides start = 100 and end = 50, and min_region_sz is 4096,
the alignment step evaluates start to 0 and end to 4096.
This causes the subsequent check to see 0 >= 4096 (which is false), silently
mutating the invalid negative-sized region into a valid positive size region
instead of rejecting it.
> ranges[i].start = sys_region->ar.start;
> ranges[i].end = sys_region->ar.end;
> if (i == 0)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260705155600.96555-1-sj@kernel.org?part=8
next prev parent reply other threads:[~2026-07-05 16:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-05 15:55 [PATCH 0/8] mm/damon: validate all parameters in the core SJ Park
2026-07-05 15:55 ` [PATCH 1/8] mm/damon/core: safely validate src on damon_commit_ctx() SJ Park
2026-07-05 15:55 ` [PATCH 2/8] mm/damon/core: do parameter testing commit on damon_start() SJ Park
2026-07-05 15:55 ` [PATCH 3/8] mm/damon/sysfs: remove duplicated commit input validity check SJ Park
2026-07-05 15:55 ` [PATCH 4/8] mm/damon/reclaim: remove duplicated min_region_sz power of 2 check SJ Park
2026-07-05 16:12 ` sashiko-bot
2026-07-05 16:36 ` SJ Park
2026-07-05 15:55 ` [PATCH 5/8] mm/damon/lru_sort: remove duplicated min_region_sz power_of_2() check SJ Park
2026-07-05 15:55 ` [PATCH 6/8] mm/damon: document region size validation in damon_set_regions() SJ Park
2026-07-05 15:55 ` [PATCH 7/8] mm/damon/core: remove start, end check in damon_set_region_system_rams() SJ Park
2026-07-05 16:06 ` sashiko-bot
2026-07-05 16:40 ` SJ Park
2026-07-05 15:55 ` [PATCH 8/8] mm/damon/sysfs: remove region size validation SJ Park
2026-07-05 16:05 ` sashiko-bot [this message]
2026-07-05 16:41 ` SJ Park
2026-07-05 16:46 ` [PATCH 0/8] mm/damon: validate all parameters in the core SJ Park
2026-07-05 19:16 ` Andrew Morton
2026-07-05 19:43 ` SJ Park
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=20260705160559.900E61F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=damon@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sj@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox