[PATCH 0/3] x86/kasan: Populate shadow for read-only IDT mapping

From: Sean Christopherson
Date: Fri Nov 04 2022 - 14:32:57 EST


Fix a regression introduced by mapping shadows for the per-cpu portions of
the CPU entry area on-demand. The read-only IDT mapping is also shoved
into the CPU entry area, but since it's shared, no CPU creates a shadow
for it. KVM on Intel does an IDT lookup in software when handling host
IRQs that arrived in the guest, which results in KASAN dereferencing an
unmapped shadow.

The first two patches are cleanups to make the fix (and code in general)
less ugly.

Side topic, KASAN should really decide whether it wants to use "void *"
or "unsigned long", e.g. kasan_populate_shadow() takes "unsigned long" but
kasan_populate_early_shadow() takes "void *". And the amount of casting
throughout the code is bonkers.

Sean Christopherson (3):
x86/kasan: Rename local CPU_ENTRY_AREA variables to shorten names
x86/kasan: Add helpers to align shadow addresses up and down
x86/kasan: Populate shadow for shared chunk of the CPU entry area

arch/x86/mm/kasan_init_64.c | 50 ++++++++++++++++++++++++-------------
1 file changed, 32 insertions(+), 18 deletions(-)


base-commit: 3301badde43dee7c2a013fbd6479c258366519da
--
2.38.1.431.g37b22c650d-goog