DAMON development mailing list
 help / color / mirror / Atom feed
From: SJ Park <sj@kernel.org>
To: sashiko-bot@kernel.org
Cc: SJ Park <sj@kernel.org>, damon@lists.linux.dev
Subject: Re: [RFC PATCH 06/10] mm/damon/core: hide private damos fields
Date: Mon, 13 Jul 2026 22:54:35 -0700	[thread overview]
Message-ID: <20260714055436.120034-1-sj@kernel.org> (raw)
In-Reply-To: <20260714045241.08E611F000E9@smtp.kernel.org>

On Tue, 14 Jul 2026 04:52:40 +0000 sashiko-bot@kernel.org wrote:

> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> 
> Pre-existing issues:
> - [High] `struct damos->last_applied` is left uninitialized upon allocation in `damon_new_scheme()`, leading to a potential read of uninitialized memory during the first scheme application.
> --
> 
> --- Patch [6]: [RFC PATCH 06/10] mm/damon/core: hide private damos fields ---
> Note: The format of this report has been altered to provide a free-form
> summary instead of quoting the original patch code directly, due to system
> recitation restrictions.
> 
> commit 74f6565901cd9e992427e68af079cc1885de502e
> Author: SJ Park <sj@kernel.org>
> mm/damon/core: hide private damos fields
> 
> This commit updates struct damos to hide several fields intended only for
> the DAMON core layer by moving them under a private comment block.
> 
> [Severity: High]
> This isn't a bug introduced by this patch, but while reviewing the changes
> to the last_applied field, I noticed a potential uninitialized memory read.
> 
> In mm/damon/core.c:damon_new_scheme(), a new struct damos is allocated
> using a non-zeroing kmalloc variant. While several fields are explicitly
> initialized in this function, the last_applied pointer is skipped and
> left uninitialized.
> 
> When kdamond_apply_schemes() performs the very first region walk, it calls
> into operations layers like mm/damon/paddr.c:damon_pa_invalid_damos_folio()
> before last_applied is ever cleared to NULL.
> 
> This causes damon_pa_invalid_damos_folio() to read the uninitialized heap
> value and compare it against the valid folio pointer currently being
> walked.
> 
> If a local user configures DAMON and the uninitialized heap memory happens
> to match a valid folio pointer being walked, could this result in an
> erroneous folio_put() being executed prematurely? Does this open up an
> exploitable use-after-free vulnerability during the initial scheme
> application?

Good finding.  I will separately work on this.

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


Thanks,
SJ

  reply	other threads:[~2026-07-14  5:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14  4:34 [RFC PATCH 00/10] mm/damon/core: hide core-private struct fields SJ Park
2026-07-14  4:34 ` [RFC PATCH 01/10] mm/damon/core: hide private damon_region fields SJ Park
2026-07-14  4:34 ` [RFC PATCH 02/10] mm/damon/core: hide private damon_target fields SJ Park
2026-07-14  4:34 ` [RFC PATCH 03/10] mm/damon/core: hide private damos_quota_goal fields SJ Park
2026-07-14  4:34 ` [RFC PATCH 04/10] mm/damon/core: hide private damos_quota fields SJ Park
2026-07-14  4:34 ` [RFC PATCH 05/10] mm/damon/core: hide private damos_filter fields SJ Park
2026-07-14  4:34 ` [RFC PATCH 06/10] mm/damon/core: hide private damos fields SJ Park
2026-07-14  4:52   ` sashiko-bot
2026-07-14  5:54     ` SJ Park [this message]
2026-07-14  6:16       ` SJ Park
2026-07-14  4:34 ` [RFC PATCH 07/10] mm/damon/core: hide private damon_filter fields SJ Park
2026-07-14  4:34 ` [RFC PATCH 08/10] mm/damon/core: hide private damon_probe fields SJ Park
2026-07-14  4:34 ` [RFC PATCH 09/10] mm/damon/sysfs: do not directly access damon_ctx->ops SJ Park
2026-07-14  4:34 ` [RFC PATCH 10/10] mm/damon/core: hide core-private damon_ctx fields 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=20260714055436.120034-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=sashiko-bot@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