From: Greg KH <gregkh@linuxfoundation.org>
To: fei.yang@intel.com
Cc: Peter Zijlstra <peterz@infradead.org>,
lucas.demarchi@intel.com, stable@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
intel-xe@lists.freedesktop.org,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [Intel-xe] [PATCH 1/1] x86/alternatives: Disable KASAN in apply_alternatives()
Date: Mon, 16 Oct 2023 19:03:05 +0200 [thread overview]
Message-ID: <2023101650-monogamy-bobbing-33f9@gregkh> (raw)
In-Reply-To: <20231016154025.3358622-2-fei.yang@intel.com>
On Mon, Oct 16, 2023 at 08:40:24AM -0700, fei.yang@intel.com wrote:
> From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
>
> Fei has reported that KASAN triggers during apply_alternatives() on
> a 5-level paging machine:
>
> BUG: KASAN: out-of-bounds in rcu_is_watching()
> Read of size 4 at addr ff110003ee6419a0 by task swapper/0/0
> ...
> __asan_load4()
> rcu_is_watching()
> trace_hardirqs_on()
> text_poke_early()
> apply_alternatives()
> ...
>
> On machines with 5-level paging, cpu_feature_enabled(X86_FEATURE_LA57)
> gets patched. It includes KASAN code, where KASAN_SHADOW_START depends on
> __VIRTUAL_MASK_SHIFT, which is defined with cpu_feature_enabled().
>
> KASAN gets confused when apply_alternatives() patches the
> KASAN_SHADOW_START users. A test patch that makes KASAN_SHADOW_START
> static, by replacing __VIRTUAL_MASK_SHIFT with 56, works around the issue.
>
> Fix it for real by disabling KASAN while the kernel is patching alternatives.
>
> [ mingo: updated the changelog ]
>
> Fixes: 6657fca06e3f ("x86/mm: Allow to boot without LA57 if CONFIG_X86_5LEVEL=y")
> Reported-by: Fei Yang <fei.yang@intel.com>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Signed-off-by: Ingo Molnar <mingo@kernel.org>
> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: stable@vger.kernel.org
> Link: https://lore.kernel.org/r/20231012100424.1456-1-kirill.shutemov@linux.intel.com
> (cherry picked from commit d35652a5fc9944784f6f50a5c979518ff8dacf61)
> ---
> arch/x86/kernel/alternative.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
What stable tree(s) is this for?
thanks,
greg k-h
next prev parent reply other threads:[~2023-10-16 17:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-16 15:40 [Intel-xe] [PATCH 0/1] x86/alternatives: Disable KASAN in apply_alternatives() fei.yang
2023-10-16 15:40 ` [Intel-xe] [PATCH 1/1] " fei.yang
2023-10-16 16:13 ` Lucas De Marchi
2023-10-16 17:03 ` Greg KH [this message]
2023-10-16 18:30 ` Yang, Fei
2023-10-16 15:41 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-10-16 15:42 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-10-16 15:43 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-10-16 15:50 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-10-16 15:50 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-10-16 15:52 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-10-16 16:25 ` [Intel-xe] ✓ CI.BAT: " Patchwork
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=2023101650-monogamy-bobbing-33f9@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=fei.yang@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=lucas.demarchi@intel.com \
--cc=peterz@infradead.org \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.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