From: sashiko-bot@kernel.org
To: "Krishna Iyer" <kiyer@crusoe.ai>
Cc: damon@lists.linux.dev
Subject: Re: [PATCH 5/6] mm/damon/sysfs: support aging_flush
Date: Sun, 30 Aug 2026 05:22:49 +0000 [thread overview]
Message-ID: <20260830052249.CFD6D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260830051407.50008-6-kiyer@crusoe.ai>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The newly added `aging_flush` field in `struct damon_sysfs_context` is not initialized during allocation, leading to undefined default behavior and a minor information leak.
--
commit d37fc04bb82ae96572d3c46e4e494980a145a1c1
Author: Krishna Iyer <kiyer@crusoe.ai>
mm/damon/sysfs: support aging_flush
This commit exposes the aging_flush monitoring context option via a new DAMON
sysfs context file. It accepts boolean strings to configure the value, which
the commit message states defaults to N.
> diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
> index e3858ffab4b22..c8bc9cfbe4cf5 100644
> --- a/mm/damon/sysfs.c
> +++ b/mm/damon/sysfs.c
> @@ -1403,6 +1403,7 @@ struct damon_sysfs_context {
> struct kobject kobj;
> enum damon_ops_id ops_id;
> unsigned long addr_unit;
> + bool aging_flush;
[Severity: Medium]
Since this structure is allocated using kmalloc_obj() in
damon_sysfs_context_alloc(), does this leave the new aging_flush field
uninitialized?
The commit message mentions it "defaults to N", but without an explicit
initialization in damon_sysfs_context_alloc(), it appears it could inherit a
random value from the heap:
mm/damon/sysfs.c:damon_sysfs_context_alloc() {
...
struct damon_sysfs_context *context = kmalloc_obj(*context);
...
context->pause = false;
return context;
}
> struct damon_sysfs_attrs *attrs;
> struct damon_sysfs_targets *targets;
> struct damon_sysfs_schemes *schemes;
[ ... ]
> @@ -1618,6 +1619,29 @@ static ssize_t pause_store(struct kobject *kobj, struct kobj_attribute *attr,
> return count;
> }
>
> +static ssize_t aging_flush_show(struct kobject *kobj,
> + struct kobj_attribute *attr, char *buf)
> +{
> + struct damon_sysfs_context *context = container_of(kobj,
> + struct damon_sysfs_context, kobj);
> +
> + return sysfs_emit(buf, "%c\n", context->aging_flush ? 'Y' : 'N');
[Severity: Medium]
If aging_flush is left uninitialized during allocation, could reading it here
expose uninitialized kernel memory to user-space?
> +}
> +
> +static ssize_t aging_flush_store(struct kobject *kobj,
[ ... ]
> @@ -2102,6 +2130,7 @@ static int damon_sysfs_apply_inputs(struct damon_ctx *ctx,
> if (err)
> return err;
> ctx->addr_unit = READ_ONCE(sys_ctx->addr_unit);
> + ctx->aging_flush = READ_ONCE(sys_ctx->aging_flush);
[Severity: Medium]
Could reading an uninitialized sys_ctx->aging_flush here cause unpredictable
behavior by randomly applying the uninitialized value to the core DAMON
context?
> /* addr_unit is respected by only DAMON_OPS_PADDR */
> if (ops_id == DAMON_OPS_PADDR)
> ctx->min_region_sz = max(
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260830051407.50008-1-kiyer@crusoe.ai?part=5
next prev parent reply other threads:[~2026-08-30 5:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-30 5:14 [PATCH 0/6] mm/damon: support access monitoring of hugetlb-backed memory Krishna Iyer
2026-08-30 5:14 ` [PATCH 1/6] mm/damon: move damon_hugetlb_mkold() from vaddr to ops-common Krishna Iyer
2026-08-30 5:26 ` sashiko-bot
2026-08-30 16:33 ` SJ Park
2026-08-30 5:14 ` [PATCH 2/6] mm/damon/ops-common: handle hugetlb folios in folio mkold/young rmap walkers Krishna Iyer
2026-08-30 5:28 ` sashiko-bot
2026-08-30 16:13 ` SJ Park
2026-08-30 18:10 ` SJ Park
2026-08-30 16:48 ` SJ Park
2026-08-30 5:14 ` [PATCH 3/6] mm/damon/paddr: support hugetlb folios in access monitoring Krishna Iyer
2026-08-30 5:29 ` sashiko-bot
2026-08-30 16:15 ` SJ Park
2026-08-30 17:12 ` SJ Park
2026-08-30 5:14 ` [PATCH 4/6] mm/damon: support flush-assisted access bit clearing for monitoring Krishna Iyer
2026-08-30 5:23 ` sashiko-bot
2026-08-30 5:14 ` [PATCH 5/6] mm/damon/sysfs: support aging_flush Krishna Iyer
2026-08-30 5:22 ` sashiko-bot [this message]
2026-08-30 5:14 ` [PATCH 6/6] mm/damon/stat: " Krishna Iyer
2026-08-30 5:18 ` sashiko-bot
2026-08-30 18:04 ` [PATCH 0/6] mm/damon: support access monitoring of hugetlb-backed memory 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=20260830052249.CFD6D1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=damon@lists.linux.dev \
--cc=kiyer@crusoe.ai \
--cc=sashiko-reviews@lists.linux.dev \
/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