Re: [PATCH] x86: kmsan: fix boot failure due to instrumentation

From: Changbin Du
Date: Fri Mar 08 2024 - 01:12:14 EST


On Fri, Mar 08, 2024 at 06:45:32AM +0100, Borislav Petkov wrote:
> On Fri, Mar 08, 2024 at 12:44:01PM +0800, Changbin Du wrote:
> > Instrumenting sev.c and mem_encrypt_identity.c with KMSAN will result in
> > kernel being unable to boot. Some of the code are invoked too early in
> > boot stage that before kmsan is ready.
>
> How do you trigger this?
>
I run the kernel in qemu. One of the calltrace is:
(gdb) bt
#0 find_cc_blob (bp=0x14700 <exception_stacks+30464>) at arch/x86/kernel/sev.c:2067
#1 0x0000000003daeaab in snp_init (bp=0x14700 <exception_stacks+30464>) at arch/x86/kernel/sev.c:2098
#2 0x0000000003db3d69 in sme_enable (bp=0x14700 <exception_stacks+30464>) at arch/x86/mm/mem_encrypt_identity.c:516
#3 0x000000000100003e in startup_64 () at arch/x86/kernel/head_64.S:99
#4 0x0000000000000000 in ?? ()

find_cc_blob() has instrumentation enabled and panic when accessing shadow
memory.

> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette

--
Cheers,
Changbin Du