DAMON development mailing list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "SJ Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [PATCH 1/3] mm/damon/sysfs-schemes: hold damon_sysfs_lock in target_metric_store()
Date: Sun, 25 Oct 2026 16:52:55 +0000	[thread overview]
Message-ID: <sashiko-outbox-184283@kernel.org> (raw)
In-Reply-To: <20261025164808.152048-2-sj@kernel.org>

> damon_sysfs_add_quota_score() reads damos_sysfs_quota_goal->metric
> twice, once to set damos_quota_goal->metric to the value, and once again
> to set the metric-dependent damos_quota_goal unions based on the value.
> 
> target_metrics_score() can update damos_sysfs_quota_goal->metric between
> the two reads.  This time-of-check to time-of-use (toctou) race can make
> the union fields incorrectly set.  The incorrect damos_quota_goal will
> be passed to the core layer and make DAMOS incorrectly behave.
> 
> Users could reproduce the race by writing a new value to the
> target_metric sysfs file while DAMON is starting, or online parameters
> update is ongoing.  The issue will only rarely happen in the real use
> cases.  It requires sysfs write permission.  The race window is short.
> Sane users wouldn't do such writes while DAMON enablement and/or online
> parameters update is ongoing.
> [ ... ]
> [2] https://lore.kernel.org/20261021005234.94107-1-sj@kernel.org
> 
> Fixes: 85fcf0ffc460 ("mm/damon/sysfs-schemes: connect damos_quota_goal nid with core layer")
> Cc: <stable@vger.kernel.org> # 6.16.x
> Signed-off-by: SJ Park <sj@kernel.org>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261025164808.152048-1-sj@kernel.org?part=1


  reply	other threads:[~2026-10-25 16:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-25 16:48 [PATCH 0/3] mm/damon: fix three race bugs in sysfs and core SJ Park
2026-10-25 16:48 ` [PATCH 1/3] mm/damon/sysfs-schemes: hold damon_sysfs_lock in target_metric_store() SJ Park
2026-10-25 16:52   ` sashiko-bot [this message]
2026-10-25 16:48 ` [PATCH 2/3] mm/damon/core: move static variable last_nr_regions to damon_ctx SJ Park
2026-10-25 16:53   ` sashiko-bot
2026-10-25 16:48 ` [PATCH 3/3] mm/damon/core: move static variable rotation " SJ Park
2026-10-25 16:51   ` sashiko-bot

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=sashiko-outbox-184283@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