From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 10 Dec 2018 22:34:47 -0000 Received: from mga02.intel.com ([134.134.136.20]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gWPkY-00014A-SD for speck@linutronix.de; Mon, 10 Dec 2018 18:53:48 +0100 From: Andi Kleen Subject: [MODERATED] [PATCH v2 0/8] MDSv2 8 Date: Mon, 10 Dec 2018 09:53:32 -0800 Message-Id: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 To: speck@linutronix.de Cc: Andi Kleen List-ID: Here's support for flushing CPU buffers on kernel exit or going idle for group 4. This prevents leaking any data in the non SMT case. This either uses the VERW instruction using the recently released microcode updates, or using software sequences for some platforms. This mainly covers single thread, not SMT (except for the idle case). I lumped all the issues together under the Microarchitectural Data Sampling (MDS) name because they need the same mitigations,a and it doesn't seem worth duplicating the sysfs files and bug entries. Some notes: - Against 4.20-rc5 - There's a (bogus) build time warning from objtool about unreachable code. - No support for Xeon Phi so far. Changes against previous version: - Added software sequences - Various fixes and cleanups. Andi Kleen (8): x86/speculation/mds: Add basic bug infrastructure for MDS x86/speculation/mds: Clear CPU buffers on kernel exit for 64bit x86/speculation/mds: Clear CPU buffers on entering idle x86/speculation/mds: Add sysfs reporting x86/speculation/mds: Add software sequences for older CPUs. x86/speculation/mds: Force MDS_EXIT on paranoid exit for sw sequence x86/speculation/mds: Call software sequences on KVM entry x86/speculation/mds: Clear buffers on kernel exit for 32bit kernels .../ABI/testing/sysfs-devices-system-cpu | 1 + .../admin-guide/kernel-parameters.txt | 13 +++ arch/x86/entry/calling.h | 2 + arch/x86/entry/entry_32.S | 5 + arch/x86/entry/entry_64.S | 16 +++ arch/x86/entry/entry_64_compat.S | 1 + arch/x86/include/asm/cpufeatures.h | 4 + arch/x86/include/asm/irqflags.h | 3 + arch/x86/include/asm/msr-index.h | 1 + arch/x86/include/asm/mwait.h | 4 + arch/x86/include/asm/nospec-branch.h | 14 +++ arch/x86/kernel/cpu/bugs.c | 109 ++++++++++++++++++ arch/x86/kernel/cpu/common.c | 14 +++ arch/x86/kernel/kvm.c | 1 + arch/x86/kernel/process.c | 4 + arch/x86/kernel/smpboot.c | 1 + arch/x86/kvm/vmx.c | 8 ++ arch/x86/lib/Makefile | 1 + arch/x86/lib/clear_cpu.S | 107 +++++++++++++++++ drivers/base/cpu.c | 8 ++ 20 files changed, 317 insertions(+) create mode 100644 arch/x86/lib/clear_cpu.S -- 2.17.2