x86/boot/compressed/64: Add CPUID sanity check to 32-bit boot-path
authorJoerg Roedel <jroedel@suse.de>
Fri, 12 Mar 2021 12:38:22 +0000 (13:38 +0100)
committerBorislav Petkov <bp@suse.de>
Thu, 18 Mar 2021 22:04:12 +0000 (23:04 +0100)
commite927e62d8e370ebfc0d702fec22bc752249ebcef
tree5dd8d6270eafbbf21afc1aab64189a67c43083a9
parent1ccdbf748d862bc2ea106fa9f2300983c77860fe
x86/boot/compressed/64: Add CPUID sanity check to 32-bit boot-path

The 32-bit #VC handler has no GHCB and can only handle CPUID exit codes.
It is needed by the early boot code to handle #VC exceptions raised in
verify_cpu() and to get the position of the C-bit.

But the CPUID information comes from the hypervisor which is untrusted
and might return results which trick the guest into the no-SEV boot path
with no C-bit set in the page-tables. All data written to memory would
then be unencrypted and could leak sensitive data to the hypervisor.

Add sanity checks to the 32-bit boot #VC handler to make sure the
hypervisor does not pretend that SEV is not enabled.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210312123824.306-7-joro@8bytes.org
arch/x86/boot/compressed/mem_encrypt.S