twx-linux/arch/x86/include/asm
Boqun Feng a2b7861bb3 kvm/x86: Avoid async PF preempting the kernel incorrectly
Currently, in PREEMPT_COUNT=n kernel, kvm_async_pf_task_wait() could call
schedule() to reschedule in some cases.  This could result in
accidentally ending the current RCU read-side critical section early,
causing random memory corruption in the guest, or otherwise preempting
the currently running task inside between preempt_disable and
preempt_enable.

The difficulty to handle this well is because we don't know whether an
async PF delivered in a preemptible section or RCU read-side critical section
for PREEMPT_COUNT=n, since preempt_disable()/enable() and rcu_read_lock/unlock()
are both no-ops in that case.

To cure this, we treat any async PF interrupting a kernel context as one
that cannot be preempted, preventing kvm_async_pf_task_wait() from choosing
the schedule() path in that case.

To do so, a second parameter for kvm_async_pf_task_wait() is introduced,
so that we know whether it's called from a context interrupting the
kernel, and the parameter is set properly in all the callsites.

Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
2017-10-04 18:28:53 +02:00
..
crypto
e820
fpu x86/fpu: Introduce validate_xstate_header() 2017-09-26 09:43:45 +02:00
numachip
trace x86/fpu: Rename fpu::fpstate_active to fpu::initialized 2017-09-26 09:43:36 +02:00
uv
xen xen: fixes for 4.14-rc3 2017-09-29 12:24:28 -07:00
a.out-core.h
acenv.h
acpi.h acpi, x86/mm: Remove encryption mask from ACPI page protection type 2017-07-30 12:09:12 +02:00
agp.h
alternative-asm.h
alternative.h x86/asm: Fix inline asm call constraints for Clang 2017-09-23 15:06:20 +02:00
amd_nb.h
apb_timer.h
apic_flat_64.h
apic.h
apicdef.h
apm.h
arch_hweight.h
archrandom.h
asm-offsets.h
asm-prototypes.h
asm.h x86/asm: Use register variable to get stack pointer value 2017-09-29 19:39:44 +02:00
atomic64_32.h
atomic64_64.h
atomic.h
barrier.h
bios_ebda.h
bitops.h
boot.h
bootparam_utils.h
bug.h
bugs.h
cache.h
cacheflush.h libnvdimm, nd_blk: remove mmio_flush_range() 2017-08-31 15:05:10 -07:00
calgary.h
ce4100.h
checksum_32.h
checksum_64.h
checksum.h
clocksource.h
cmdline.h
cmpxchg_32.h
cmpxchg_64.h
cmpxchg.h
compat.h
cpu_device_id.h
cpu.h
cpufeature.h
cpufeatures.h First batch of KVM changes for 4.14 2017-09-08 15:18:36 -07:00
cpumask.h
crash.h
current.h
debugreg.h
delay.h
desc_defs.h x86/ldttss: Clean up 32-bit descriptors 2017-08-29 12:07:25 +02:00
desc.h x86/paravirt: Remove no longer used paravirt functions 2017-09-13 10:55:15 +02:00
device.h
disabled-features.h
div64.h
dma-mapping.h
dma.h
dmi.h
dwarf2.h
edac.h
efi.h
elf.h Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-09-04 12:21:28 -07:00
emergency-restart.h
entry_arch.h x86/ipi: Make platform IPI depend on APIC 2017-08-29 11:42:29 +02:00
espfix.h
exec.h
export.h
extable.h
fb.h
fixmap.h
floppy.h
frame.h
ftrace.h
futex.h futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
gart.h
genapic.h
geode.h
hardirq.h x86: irq: Define a global vector for nested posted interrupts 2017-07-26 18:57:45 +02:00
highmem.h
hpet.h
hugetlb.h
hw_breakpoint.h
hw_irq.h x86/idt: Remove the tracing IDT completely 2017-08-29 11:42:28 +02:00
hypertransport.h
hypervisor.h x86: provide an init_mem_mapping hypervisor hook 2017-08-11 15:50:21 +02:00
i8259.h
ia32_unistd.h
ia32.h
imr.h
inat_types.h
inat.h
init.h
insn.h
inst.h
intel_mid_vrtc.h
intel_pmc_ipc.h
intel_pt.h
intel_punit_ipc.h
intel_rdt_sched.h x86/intel_rdt: Modify the intel_pqr_state for better performance 2017-08-14 11:47:47 +02:00
intel_scu_ipc.h
intel_telemetry.h
intel-family.h
intel-mid.h
io_apic.h
io.h Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-09-04 12:21:28 -07:00
iomap.h
iommu_table.h
iommu.h
iosf_mbi.h
ipi.h
irq_regs.h
irq_remapping.h
irq_vectors.h x86: irq: Define a global vector for nested posted interrupts 2017-07-26 18:57:45 +02:00
irq_work.h x86/irq_work: Make it depend on APIC 2017-08-29 11:42:30 +02:00
irq.h x86/irq: Remove duplicated used_vectors definition 2017-08-29 11:42:21 +02:00
irqdomain.h
irqflags.h
ist.h
jump_label.h
kasan.h
kaslr.h
kbdleds.h
Kbuild
kdebug.h
kexec-bzimage64.h
kexec.h x86/mm, kexec: Fix memory corruption with SME on successive kexecs 2017-07-30 12:09:12 +02:00
kgdb.h
kmap_types.h
kmemcheck.h
kprobes.h
kvm_emulate.h KVM: x86: Add return value to kvm_cpuid(). 2017-08-24 18:09:15 +02:00
kvm_guest.h
kvm_host.h KVM: Add struct kvm_vcpu pointer parameter to get_enable_apicv() 2017-09-13 18:29:06 +02:00
kvm_page_track.h
kvm_para.h kvm/x86: Avoid async PF preempting the kernel incorrectly 2017-10-04 18:28:53 +02:00
kvmclock.h
linkage.h
livepatch.h
local64.h
local.h
mach_timer.h
mach_traps.h
math_emu.h
mc146818rtc.h
mce.h
mem_encrypt.h x86/mm: Make the SME mask a u64 2017-09-07 11:53:11 +02:00
microcode_amd.h
microcode_intel.h
microcode.h
misc.h
mmconfig.h
mmu_context.h x86/mm/64: Stop using CR3.PCID == 0 in ASID-aware code 2017-09-17 18:59:08 +02:00
mmu.h
mmx.h
mmzone_32.h
mmzone_64.h
mmzone.h
module.h x86/unwind: Add the ORC unwinder 2017-07-26 13:18:20 +02:00
mpspec_def.h
mpspec.h x86/cpu: Remove unused and undefined __generic_processor_info() declaration 2017-09-11 08:16:37 +02:00
mpx.h
mshyperv.h x86/asm: Fix inline asm call constraints for Clang 2017-09-23 15:06:20 +02:00
msi.h
msidef.h
msr-index.h
msr-trace.h
msr.h
mtrr.h
mwait.h
nmi.h
nops.h
numa_32.h
numa.h
olpc_ofw.h
olpc.h
orc_lookup.h x86/unwind: Add the ORC unwinder 2017-07-26 13:18:20 +02:00
orc_types.h x86/unwind: Add the ORC unwinder 2017-07-26 13:18:20 +02:00
page_32_types.h
page_32.h
page_64_types.h
page_64.h x86/mm, mm/hwpoison: Clear PRESENT bit for kernel 1:1 mappings of poison pages 2017-08-17 10:30:49 +02:00
page_types.h
page.h
paravirt_types.h x86/asm: Fix inline asm call constraints for Clang 2017-09-23 15:06:20 +02:00
paravirt.h x86/paravirt: Remove no longer used paravirt functions 2017-09-13 10:55:15 +02:00
parport.h
pat.h
pci_64.h
pci_x86.h
pci-direct.h
pci-functions.h
pci.h
percpu.h
perf_event_p4.h
perf_event.h
pgalloc.h
pgtable_32_types.h
pgtable_32.h
pgtable_64_types.h
pgtable_64.h mm: thp: enable thp migration in generic path 2017-09-08 18:26:45 -07:00
pgtable_types.h mm: x86: move _PAGE_SWP_SOFT_DIRTY from bit 7 to bit 1 2017-09-08 18:26:45 -07:00
pgtable-2level_types.h
pgtable-2level.h
pgtable-3level_types.h
pgtable-3level.h
pgtable.h x86/paravirt: Remove no longer used paravirt functions 2017-09-13 10:55:15 +02:00
pkeys.h
platform_sst_audio.h
pm-trace.h
pmc_core.h
posix_types.h
preempt.h x86/asm: Fix inline asm call constraints for Clang 2017-09-23 15:06:20 +02:00
probe_roms.h
processor-cyrix.h
processor-flags.h x86/CPU: Align CR3 defines 2017-08-21 11:35:50 +02:00
processor.h x86/asm: Fix inline asm call constraints for Clang 2017-09-23 15:06:20 +02:00
prom.h
proto.h x86/xen: Get rid of paravirt op adjust_exception_frame 2017-08-31 21:35:10 +02:00
ptrace.h x86/asm/32: Fix regs_get_register() on segment registers 2017-08-10 13:14:58 +02:00
purgatory.h
pvclock-abi.h
pvclock.h
qrwlock.h
qspinlock_paravirt.h
qspinlock.h
realmode.h
reboot_fixups.h
reboot.h
refcount.h locking/refcounts, x86/asm: Implement fast refcount overflow protection 2017-08-17 10:40:26 +02:00
required-features.h
rio.h
rmwcc.h x86/asm: Add suffix macro for GEN_*_RMWcc() 2017-07-25 11:18:09 +02:00
rwsem.h x86/asm: Fix inline asm call constraints for Clang 2017-09-23 15:06:20 +02:00
seccomp.h
sections.h
segment.h x86/idt: Move early IDT setup out of 32-bit asm 2017-08-29 12:07:26 +02:00
serial.h
set_memory.h
setup_arch.h
setup.h treewide: Consolidate Apple DMI checks 2017-08-03 23:26:22 +02:00
shmparam.h
sigcontext.h
sigframe.h
sighandling.h
signal.h
simd.h
smap.h
smp.h
sparsemem.h
special_insns.h x86/paravirt: Remove no longer used paravirt functions 2017-09-13 10:55:15 +02:00
spinlock_types.h
spinlock.h
sta2x11.h
stackprotector.h
stacktrace.h
string_32.h x86: implement memset16, memset32 & memset64 2017-09-08 18:26:48 -07:00
string_64.h x86: implement memset16, memset32 & memset64 2017-09-08 18:26:48 -07:00
string.h
suspend_32.h
suspend_64.h
suspend.h
svm.h KVM: SVM: Enable Virtual GIF feature 2017-08-23 18:37:37 +02:00
swiotlb.h
switch_to.h
sync_bitops.h
sys_ia32.h
syscall.h
syscalls.h
sysfb.h
tce.h
text-patching.h
thread_info.h x86/asm: Use register variable to get stack pointer value 2017-09-29 19:39:44 +02:00
time.h
timer.h
timex.h
tlb.h x86/mm: Enable RCU based page table freeing (CONFIG_HAVE_RCU_TABLE_FREE=y) 2017-08-31 11:07:07 +02:00
tlbbatch.h
tlbflush.h x86/mm: Reinitialize TLB state on hotplug and resume 2017-09-06 20:12:57 -07:00
topology.h x86/topology: Remove the unused parent_node() macro 2017-07-27 10:53:00 +02:00
trace_clock.h
traps.h x86/xen: Get rid of paravirt op adjust_exception_frame 2017-08-31 21:35:10 +02:00
tsc.h
uaccess_32.h
uaccess_64.h
uaccess.h x86: Don't cast away the __user in __get_user_asm_u64() 2017-09-25 09:36:16 +02:00
unaligned.h
unistd.h
unwind_hints.h x86/asm: Fix UNWIND_HINT_REGS macro for older binutils 2017-08-10 14:16:19 +02:00
unwind.h x86/kconfig: Consolidate unwinders into multiple choice selection 2017-07-26 14:05:36 +02:00
uprobes.h
user32.h
user_32.h
user_64.h
user.h
vdso.h
vga.h
vgtod.h
virtext.h
vm86.h
vmx.h KVM: MMU: Add 5 level EPT & Shadow page table support. 2017-08-24 18:09:17 +02:00
vsyscall.h
vvar.h
word-at-a-time.h
x2apic.h
x86_init.h
xor_32.h
xor_64.h
xor_avx.h
xor.h