diff options
author | Salvatore Bonaccorso <carnil@debian.org> | 2015-12-31 15:48:05 +0100 |
---|---|---|
committer | Salvatore Bonaccorso <carnil@debian.org> | 2015-12-31 15:49:59 +0100 |
commit | abab5c27457a6526802d8b2aa8ea1a4e9189c8a0 (patch) | |
tree | 758b57a7fe4826d8699b449fcaf537f50a73970f | |
parent | e57c91d8867ce42a7d8f2e86a93c2fe8931f74c4 (diff) | |
download | kernel_replicant_linux-abab5c27457a6526802d8b2aa8ea1a4e9189c8a0.tar.gz kernel_replicant_linux-abab5c27457a6526802d8b2aa8ea1a4e9189c8a0.tar.bz2 kernel_replicant_linux-abab5c27457a6526802d8b2aa8ea1a4e9189c8a0.zip |
[x86] kvm: Reload pit counters for all channels when restoring state (CVE-2015-7513)
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | debian/patches/bugfix/x86/KVM-x86-Reload-pit-counters-for-all-channels-when-re.patch | 53 | ||||
-rw-r--r-- | debian/patches/series | 1 |
3 files changed, 56 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index bcb12a961a3c..031bdfee2b04 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,8 @@ linux (4.3.3-3) UNRELEASED; urgency=medium [ Salvatore Bonaccorso ] * ovl: fix permission checking for setattr (CVE-2015-8660) + * [x86] kvm: Reload pit counters for all channels when restoring state + (CVE-2015-7513) -- Ben Hutchings <ben@decadent.org.uk> Fri, 18 Dec 2015 20:19:24 +0000 diff --git a/debian/patches/bugfix/x86/KVM-x86-Reload-pit-counters-for-all-channels-when-re.patch b/debian/patches/bugfix/x86/KVM-x86-Reload-pit-counters-for-all-channels-when-re.patch new file mode 100644 index 000000000000..9359d34e0e3b --- /dev/null +++ b/debian/patches/bugfix/x86/KVM-x86-Reload-pit-counters-for-all-channels-when-re.patch @@ -0,0 +1,53 @@ +From: Andrew Honig <ahonig@google.com> +Date: Wed, 18 Nov 2015 14:50:23 -0800 +Subject: KVM: x86: Reload pit counters for all channels when restoring state +Origin: https://git.kernel.org/linus/0185604c2d82c560dab2f2933a18f797e74ab5a8 + +Currently if userspace restores the pit counters with a count of 0 +on channels 1 or 2 and the guest attempts to read the count on those +channels, then KVM will perform a mod of 0 and crash. This will ensure +that 0 values are converted to 65536 as per the spec. + +This is CVE-2015-7513. + +Signed-off-by: Andy Honig <ahonig@google.com> +Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> +[carnil: Backport to 4.3.3: context] +--- + arch/x86/kvm/x86.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/arch/x86/kvm/x86.c ++++ b/arch/x86/kvm/x86.c +@@ -3437,10 +3437,11 @@ static int kvm_vm_ioctl_get_pit(struct k + static int kvm_vm_ioctl_set_pit(struct kvm *kvm, struct kvm_pit_state *ps) + { + int r = 0; +- ++ int i; + mutex_lock(&kvm->arch.vpit->pit_state.lock); + memcpy(&kvm->arch.vpit->pit_state, ps, sizeof(struct kvm_pit_state)); +- kvm_pit_load_count(kvm, 0, ps->channels[0].count, 0); ++ for (i = 0; i < 3; i++) ++ kvm_pit_load_count(kvm, i, ps->channels[i].count, 0); + mutex_unlock(&kvm->arch.vpit->pit_state.lock); + return r; + } +@@ -3461,6 +3462,7 @@ static int kvm_vm_ioctl_get_pit2(struct + static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps) + { + int r = 0, start = 0; ++ int i; + u32 prev_legacy, cur_legacy; + mutex_lock(&kvm->arch.vpit->pit_state.lock); + prev_legacy = kvm->arch.vpit->pit_state.flags & KVM_PIT_FLAGS_HPET_LEGACY; +@@ -3470,7 +3472,8 @@ static int kvm_vm_ioctl_set_pit2(struct + memcpy(&kvm->arch.vpit->pit_state.channels, &ps->channels, + sizeof(kvm->arch.vpit->pit_state.channels)); + kvm->arch.vpit->pit_state.flags = ps->flags; +- kvm_pit_load_count(kvm, 0, kvm->arch.vpit->pit_state.channels[0].count, start); ++ for (i = 0; i < 3; i++) ++ kvm_pit_load_count(kvm, i, kvm->arch.vpit->pit_state.channels[i].count, start); + mutex_unlock(&kvm->arch.vpit->pit_state.lock); + return r; + } diff --git a/debian/patches/series b/debian/patches/series index 9cafb259e8da..94167d7a9a87 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -127,3 +127,4 @@ bugfix/all/xen-pciback-for-xen_pci_op_disable_msi-x-only-disabl.patch bugfix/all/xen-pciback-don-t-allow-msi-x-ops-if-pci_command_mem.patch bugfix/all/ptrace-being-capable-wrt-a-process-requires-mapped-uids-gids.patch bugfix/all/keys-fix-race-between-read-and-revoke.patch +bugfix/x86/KVM-x86-Reload-pit-counters-for-all-channels-when-re.patch |