OSDN Git Service

x86/apic: Include the LDR when clearing out APIC registers
authorBandan Das <bsd@redhat.com>
Mon, 26 Aug 2019 10:15:13 +0000 (06:15 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Sep 2019 08:18:16 +0000 (10:18 +0200)
commit5bd0d83e2d5a5cc6e40e2d24020bfedb63b81995
tree7da07173adea137afb7c6aef54595f18de0d0e7d
parent26285030611e4b410c1e30afc2c9d1601fa7a128
x86/apic: Include the LDR when clearing out APIC registers

commit 558682b5291937a70748d36fd9ba757fb25b99ae upstream.

Although APIC initialization will typically clear out the LDR before
setting it, the APIC cleanup code should reset the LDR.

This was discovered with a 32-bit KVM guest jumping into a kdump
kernel. The stale bits in the LDR triggered a bug in the KVM APIC
implementation which caused the destination mapping for VCPUs to be
corrupted.

Note that this isn't intended to paper over the KVM APIC bug. The kernel
has to clear the LDR when resetting the APIC registers except when X2APIC
is enabled.

This lacks a Fixes tag because missing to clear LDR goes way back into pre
git history.

[ tglx: Made x2apic_enabled a function call as required ]

Signed-off-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20190826101513.5080-3-bsd@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/apic/apic.c