Skip to content
Commit b33ac88b authored by Kevin Pedretti's avatar Kevin Pedretti Committed by Avi Kivity
Browse files

KVM: Fix local apic timer divide by zero



kvm_lapic_reset() was initializing apic->timer.divide_count to 0,
which could potentially lead to a divide by zero error in
apic_get_tmcct().  Any guest that reads the APIC's CCR (current count)
register before setting DCR (divide configuration) would trigger a divide
by zero exception in the host kernel, leading to a host-OS crash.

This patch results in apic->timer.divide_count being initialized to
2 at reset, eliminating the bug (DCR=0 at reset, meaning divide by 2).

Signed-off-by: default avatarKevin Pedretti <kevin.pedretti@gmail.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent 0552f73b
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment