Re: [PATCH] x86/sev-es: Do not use copy_from_kernel_nofault in early #VC handler

From: Adam Dunlap
Date: Thu Sep 07 2023 - 18:30:42 EST


On Thu, Sep 7, 2023 at 12:12 PM Dave Hansen <dave.hansen@xxxxxxxxx> wrote:

> What happens before this? This isn't the first CPUID
> invocation. Does this one just happen to #VC and all the others before
> don't?

I hadn't noticed this before, but there is an even earlier interrupt
handler vc_no_ghcb
which only supports cpuid. Potentially this version could work until
boot_cpu_data is
set up, but wasn't able to get it working myself.

> In any case, the most straightforward way out of this mess is to just
> move boot_cpu_data out of .bss and explicitly initialize it along with
> some documentation explaining the situation.

That seems totally reasonable. I tried applying the two patches that
you sent plus
boot_cpu_data.x86_virt_bits = 0; in early_setup_idt(), and that fixes
the problems
that we can see. Do you want me to send out a new patch with these changes
together?