Skip to content

Commit bcbfbd8

Browse files
Liran Alonbonzini
authored andcommitted
KVM: x86: Fix kernel info-leak in KVM_HC_CLOCK_PAIRING hypercall
kvm_pv_clock_pairing() allocates local var "struct kvm_clock_pairing clock_pairing" on stack and initializes all it's fields besides padding (clock_pairing.pad[]). Because clock_pairing var is written completely (including padding) to guest memory, failure to init struct padding results in kernel info-leak. Fix the issue by making sure to also init the padding with zeroes. Fixes: 55dd00a ("KVM: x86: add KVM_HC_CLOCK_PAIRING hypercall") Reported-by: [email protected] Reviewed-by: Mark Kanda <[email protected]> Signed-off-by: Liran Alon <[email protected]> Cc: [email protected] Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 7f9ad1d commit bcbfbd8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/x86/kvm/x86.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6918,6 +6918,7 @@ static int kvm_pv_clock_pairing(struct kvm_vcpu *vcpu, gpa_t paddr,
69186918
clock_pairing.nsec = ts.tv_nsec;
69196919
clock_pairing.tsc = kvm_read_l1_tsc(vcpu, cycle);
69206920
clock_pairing.flags = 0;
6921+
memset(&clock_pairing.pad, 0, sizeof(clock_pairing.pad));
69216922

69226923
ret = 0;
69236924
if (kvm_write_guest(vcpu->kvm, paddr, &clock_pairing,

0 commit comments

Comments
 (0)