From: Johannes Weiner <hannes@cmpxchg.org>
To: Mashiro Chen <mashiro.chen@mailbox.org>
Cc: surenb@google.com, peterz@infradead.org, mingo@redhat.com,
juri.lelli@redhat.com, vincent.guittot@linaro.org,
dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
syzbot+4b1bd55fba6260160779@syzkaller.appspotmail.com
Subject: Re: [PATCH] sched/psi: initialize *flags in psi_memstall_enter when PSI is disabled
Date: Wed, 8 Apr 2026 11:10:15 -0400 [thread overview]
Message-ID: <adZv1-U_JdY1Iv0H@cmpxchg.org> (raw)
In-Reply-To: <20260405055044.554243-1-mashiro.chen@mailbox.org>
On Sun, Apr 05, 2026 at 01:50:44PM +0800, Mashiro Chen wrote:
> When PSI is disabled, psi_memstall_enter() returns early without
> writing to *flags, leaving the caller's local variable uninitialized.
> psi_memstall_leave() also returns early when PSI is disabled and does
> not read *flags, so the uninitialized value is never used functionally.
>
> However, KMSAN tracks the shadow and origin metadata per physical
> address. When a kernel stack page is subsequently reused, a new object
> at the same address inherits the stale KMSAN shadow from the old
> uninitialized pflags, causing spurious uninit-value reports in
> unrelated code paths such as __flush_smp_call_function_queue().
>
> Initialize *flags to 0 in the psi_disabled early-return path to
> prevent the stale shadow from escaping the callers' stack frames.
How is this not a kmsan bug?
I don't think putting an unexpected init into unrelated code with no
comment is an appropriate fix for what seems like a false positive in
this tool.
next prev parent reply other threads:[~2026-04-08 15:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-05 5:50 [PATCH] sched/psi: initialize *flags in psi_memstall_enter when PSI is disabled Mashiro Chen
2026-04-08 15:10 ` Johannes Weiner [this message]
2026-04-08 16:14 ` Mashiro Chen
2026-04-08 16:40 ` Johannes Weiner
2026-04-08 16:58 ` Mashiro Chen
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=adZv1-U_JdY1Iv0H@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mashiro.chen@mailbox.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=surenb@google.com \
--cc=syzbot+4b1bd55fba6260160779@syzkaller.appspotmail.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/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