From: sashiko-bot@kernel.org
To: "Mattathias Pinchover" <mattathias.pinchover@uber.com>,
"SJ Park" <sj@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Randy Dunlap" <rdunlap@infradead.org>
Cc: damon@lists.linux.dev, linux-mm@kvack.org
Subject: Re: [PATCH 3/6] mm/damon/tests/core-kunit: test sz_ops_filter_passed_last
Date: Mon, 16 Nov 2026 19:30:08 +0000 [thread overview]
Message-ID: <sashiko-outbox-217563@kernel.org> (raw)
In-Reply-To: <20261116-damon-sz-ops-b4-v1-3-1cffe7227e6d@uber.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mm/damon: uninitialized core_filters_default_reject read in
kunit test
--
commit 64315024865456d25a50aac3fbbdfa4d480bec80
Author: Mattathias Pinchover <mattathias.pinchover@uber.com>
mm/damon/tests/core-kunit: test sz_ops_filter_passed_last
This commit adds a KUnit test verifying that s->stat.sz_ops_filter_passed_last
records the ops filter-passed size for the last apply interval and remains
unchanged between apply intervals.
> diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
> index a5ca4bfe2f0db..ec83598fff0e6 100644
> --- a/mm/damon/tests/core-kunit.h
> +++ b/mm/damon/tests/core-kunit.h
> @@ -2541,6 +2541,97 @@ static void damon_test_last_region_quota_reset(struct kunit *test)
[ ... ]
> +static void damos_test_sz_ops_filter_passed_last(struct kunit *test)
> +{
[ ... ]
> + c = damon_new_ctx();
> + if (!c)
> + kunit_skip(test, "ctx alloc fail");
> + c->ops.apply_scheme = damos_test_apply_scheme_passed_stub;
> +
> + s = damon_new_scheme(&pattern, DAMOS_STAT, 0, "a, &wmarks,
> + NUMA_NO_NODE);
> + if (!s) {
> + damon_destroy_ctx(c);
> + kunit_skip(test, "scheme alloc fail");
> + }
> + damon_add_scheme(c, s);
[Severity: Medium]
Does this leave s->core_filters_default_reject uninitialized before
kdamond_apply_schemes() runs?
damon_new_scheme() allocates struct damos with kmalloc_obj() without
initializing core_filters_default_reject, and damon_add_scheme() does not
set it either. When damos_test_apply_interval() runs
kdamond_apply_schemes() -> damos_apply_scheme() -> damos_core_filter_out()
with an empty s->core_filters list, damos_core_filter_out() returns
s->core_filters_default_reject directly.
If that slab byte is non-zero (for example when reusing a struct damos
freed by an earlier test in damon_test_cases[] that set
core_filters_default_reject to true), damos_apply_scheme() filters out the
region before calling c->ops.apply_scheme(), causing KMSAN/UBSAN warnings
and false test failures with s->stat.sz_ops_filter_passed_last remaining 0.
Calling damos_set_filters_default_reject(s) after damon_add_scheme(c, s),
as in damos_test_apply_scheme_quota_sz(), initializes the field.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116-damon-sz-ops-b4-v1-0-1cffe7227e6d@uber.com?part=3
next prev parent reply other threads:[~2026-11-16 19:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 19:10 [PATCH 0/6] mm/damon: add sz_ops_filter_passed_last DAMOS stat Mattathias Pinchover via B4 Relay
2026-11-16 19:10 ` [PATCH 1/6] mm/damon/core: introduce sz_ops_filter_passed_last stat Mattathias Pinchover via B4 Relay
2026-11-16 19:10 ` [PATCH 2/6] mm/damon/sysfs-schemes: add sz_ops_filter_passed_last file Mattathias Pinchover via B4 Relay
2026-11-16 19:10 ` [PATCH 3/6] mm/damon/tests/core-kunit: test sz_ops_filter_passed_last Mattathias Pinchover via B4 Relay
2026-11-16 19:30 ` sashiko-bot [this message]
2026-11-16 19:10 ` [PATCH 4/6] Docs/mm/damon/design: update for sz_ops_filter_passed_last Mattathias Pinchover via B4 Relay
2026-11-16 19:10 ` [PATCH 5/6] Docs/admin-guide/mm/damon/usage: " Mattathias Pinchover via B4 Relay
2026-11-16 19:10 ` [PATCH 6/6] Docs/ABI/damon: " Mattathias Pinchover via B4 Relay
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-217563@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=damon@lists.linux.dev \
--cc=linux-mm@kvack.org \
--cc=mattathias.pinchover@uber.com \
--cc=rdunlap@infradead.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sj@kernel.org \
--cc=skhan@linuxfoundation.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