lkml.org 
[lkml]   [2023]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] x86/sev-es: Do not use copy_from_kernel_nofault in early #VC handler
> Usually, we'll add some gunk in arch/x86/boot/compressed/misc.h to
> override the troublesome implementation. In this case, it would make a
> lot of sense to somehow avoid touching boot_cpu_data.x86_virt_bits in
> the first place.

Thanks for the comment. I realize this patch is doing something a bit misleading
here. In this case, "early" does not refer to the compressed kernel, but
actually the regular kernel but in the stage with this early #VC handler
vc_boot_ghcb (instead of the usual vc_raw_handle_exception). This #VC handler
triggers for the first time on a cpuid instruction in secondary_startup_64, but
boot_cpu_data.x86_virt_bits is not initialized until setup_arch inside of
start_kernel, which is at the end of secondary_startup_64.

The compressed kernel already has its own implementation of vc_decode_insn which
simply calls memcpy instead of copy_from_kernel_nofault, so the point of this
patch is to do the same thing for the early stages of the post-decompression
kernel.

So unless I'm misunderstanding, adding a version of copy_from_kernel_nofault to
the compressed directory wouldn't solve the problem since the problem does not
occur during the compressed stage.

\
 
 \ /
  Last update: 2023-09-07 01:26    [W:0.044 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site