Skip to content

Commit 7430074

Browse files
YadongQijren1
authored andcommitted
trusty: initialize tsc_offset to zero
Per trusty design, trusty requires a monotonic increasing secure tick(TSC) at run time. This secure tick will used to mitigate password/pin force attack, control key expiration, etc. Currently, the TSC_OFFSET is enabled. And guest will got (host_tsc + tsc_offset) when execute rdtsc/rdtscp/rdmsr to aquire tsc value. The host_tsc is always keeping increasing during the runtime. So initialize tsc_offset of trusty to 0 will ensure the secure tick feature. Signed-off-by: Qi Yadong <yadong.qi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent bf36022 commit 7430074

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

hypervisor/arch/x86/trusty.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,12 @@ static bool init_secure_world_env(struct vcpu *vcpu,
387387
vcpu->arch_vcpu.contexts[SECURE_WORLD].rip = entry_gpa;
388388
vcpu->arch_vcpu.contexts[SECURE_WORLD].rsp =
389389
TRUSTY_EPT_REBASE_GPA + size;
390+
vcpu->arch_vcpu.contexts[SECURE_WORLD].tsc_offset = 0;
391+
390392
exec_vmwrite(VMX_GUEST_RSP,
391393
TRUSTY_EPT_REBASE_GPA + size);
394+
exec_vmwrite(VMX_TSC_OFFSET_FULL,
395+
vcpu->arch_vcpu.contexts[SECURE_WORLD].tsc_offset);
392396

393397
return setup_trusty_info(vcpu, size, base_hpa);
394398
}

0 commit comments

Comments
 (0)