From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Huacai Chen <chenhuacai@loongson.cn>
Cc: Sasha Levin <sashal@kernel.org>,
Huacai Chen <chenhuacai@kernel.org>,
Xuerui Wang <kernel@xen0n.name>,
stable@vger.kernel.org, linux-kernel@vger.kernel.org,
loongarch@lists.linux.dev, Tiezhu Yang <yangtiezhu@loongson.cn>
Subject: Re: [PATCH for 6.6 & 6.12] LoongArch: Rework KASAN initialization for PTW-enabled systems
Date: Mon, 16 Feb 2026 10:52:08 +0100 [thread overview]
Message-ID: <2026021631-sabbath-wrangle-3496@gregkh> (raw)
In-Reply-To: <20260215140953.1224579-1-chenhuacai@loongson.cn>
On Sun, Feb 15, 2026 at 10:09:53PM +0800, Huacai Chen wrote:
> From: Tiezhu Yang <yangtiezhu@loongson.cn>
>
> commit 5ec5ac4ca27e4daa234540ac32f9fc5219377d53 upstream.
>
> "kasan_early_stage = false" indicates that kasan is fully initialized,
> so it should be put at end of kasan_init().
>
> Otherwise bringing up the primary CPU failed when CONFIG_KASAN is set
> on PTW-enabled systems, here are the call chains:
>
> kernel_entry()
> start_kernel()
> setup_arch()
> kasan_init()
> kasan_early_stage = false
>
> The reason is PTW-enabled systems have speculative accesses which means
> memory accesses to the shadow memory after kasan_init() may be executed
> by hardware before. However, accessing shadow memory is safe only after
> kasan fully initialized because kasan_init() uses a temporary PGD table
> until we have populated all levels of shadow page tables and writen the
> PGD register. Moving "kasan_early_stage = false" later can defer the
> occasion of kasan_arch_is_ready(), so as to avoid speculative accesses
> on shadow pages.
>
> After moving "kasan_early_stage = false" to the end, kasan_init() can no
> longer call kasan_mem_to_shadow() for shadow address conversion because
> it will always return kasan_early_shadow_page. On the other hand, we
> should keep the current logic of kasan_mem_to_shadow() for both the early
> and final stage because there may be instrumentation before kasan_init().
>
> To solve this, we factor out a new mem_to_shadow() function from current
> kasan_mem_to_shadow() for the shadow address conversion in kasan_init().
The subject line AND the commit text here do not match the upstream
commit AND the diff is different and you did not explain what changed or
why :(
So as-is, I can't take this, sorry.
thanks,
greg k-h
next prev parent reply other threads:[~2026-02-16 9:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-15 14:09 [PATCH for 6.6 & 6.12] LoongArch: Rework KASAN initialization for PTW-enabled systems Huacai Chen
2026-02-16 9:52 ` Greg Kroah-Hartman [this message]
2026-02-16 10:09 ` Huacai Chen
2026-02-16 10:20 ` Greg Kroah-Hartman
2026-02-16 10:34 ` Huacai 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=2026021631-sabbath-wrangle-3496@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=chenhuacai@kernel.org \
--cc=chenhuacai@loongson.cn \
--cc=kernel@xen0n.name \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=yangtiezhu@loongson.cn \
/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