Skip to content

Commit

Permalink
Fix incorrect write in tdx.s of stage0_bin_tdx.
Browse files Browse the repository at this point in the history
AP_IN_64BIT_COUNT is a u32 variable. When increasing using `incq`, it has a 4 bytes oob write and result in UB.

Change-Id: I9e140452f9fffd1891b880d9fd46d7a0d8058118
  • Loading branch information
Changochen committed Jan 23, 2025
1 parent 8371cbc commit fb3351a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion stage0_bin_tdx/src/asm/tdx.s
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ _tdx_64bit_start:

_park_ap_64bit:
leaq (AP_IN_64BIT_COUNT), %rcx # Load address of AP_IN_64BIT_COUNT onto rcx
lock incq (%rcx) # Atomically increment AP_IN_64BIT_COUNT
lock incl (%rcx) # Atomically increment AP_IN_64BIT_COUNT

movl %esi, %ebp # esi has the VCPU_INDEX, save it in ebp

Expand Down

0 comments on commit fb3351a

Please sign in to comment.