Skip to content

Commit

Permalink
Check CPUID instruction in Stage0 #VC handler (project-oak#4921)
Browse files Browse the repository at this point in the history
We want to make sure that the instruction pointer in a #VC exception really pointed to a CPUID instruction since it is the only #VC exception type we support.

Ref b/330197837
  • Loading branch information
conradgrobler authored Mar 21, 2024
1 parent 2120a04 commit ef2c4ec
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion stage0_bin/src/asm/boot.s
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ gp_handler:
vc_handler:
pop %ebx # get the error code
cmp $0x72, %ebx # is this about CPUID?
jne 2f # if not, skip ahead
jne 2f # if not, skip ahead and crash
mov (%esp), %ebx # get the instruction pointer
cmpw $0xa20f, (%ebx) # was this really a CPUID instruction?
jne 2f # if not it might be injected by the hypervisor, skip ahead and crash
cmp $0x0, %ecx # are we asked for a CPUID subleaf?
jne 2f # if yes, skip ahead, as we don't support subleaves
# Use the GHCB MSR protocol to request one page of CPUID information. The protocol itself is
Expand Down

0 comments on commit ef2c4ec

Please sign in to comment.