This is a repost of the latest entry-stack plus Kaiser bits from Andy Lutomirski (v3 series from today) and Dave Hansen (kaiser-414-tipwip-20171123 version), on top of latest tip:x86/urgent (12a78d43de76).
This version is pretty well tested, at least on the usual x86 tree test systems. It has a couple of merge mistakes fixed, the biggest difference is in patch #22: x86/mm/kaiser: Prepare assembly for entry/exit CR3 switching The other patches are identical or very close to what I posted earlier today. Any remaining bugs caused by mis-merges, mis-backmerges or mis-fixes are mine. Thanks, Ingo Andy Lutomirski (19): x86/asm/64: Allocate and enable the SYSENTER stack x86/dumpstack: Add get_stack_info() support for the SYSENTER stack x86/gdt: Put per-cpu GDT remaps in ascending order x86/fixmap: Generalize the GDT fixmap mechanism x86/kasan/64: Teach KASAN about the cpu_entry_area x86/asm: Fix assumptions that the HW TSS is at the beginning of cpu_tss x86/dumpstack: Handle stack overflow on all stacks x86/asm: Move SYSENTER_stack to the beginning of struct tss_struct x86/asm: Remap the TSS into the cpu entry area x86/asm/64: Separate cpu_current_top_of_stack from TSS.sp0 x86/espfix/64: Stop assuming that pt_regs is on the entry stack x86/asm/64: Use a percpu trampoline stack for IDT entries x86/asm/64: Return to userspace from the trampoline stack x86/entry/64: Create a percpu SYSCALL entry trampoline x86/irq: Remove an old outdated comment about context tracking races x86/irq/64: In the stack overflow warning, print the offending IP x86/entry/64: Move the IST stacks into cpu_entry_area x86/entry/64: Remove the SYSENTER stack canary x86/entry: Clean up SYSENTER_stack code Dave Hansen (22): x86/mm/kaiser: Disable global pages by default with KAISER x86/mm/kaiser: Prepare assembly for entry/exit CR3 switching x86/mm/kaiser: Introduce user-mapped per-cpu areas x86/mm/kaiser: Mark per-cpu data structures required for entry/exit x86/mm/kaiser: Unmap kernel from userspace page tables (core patch) x86/mm/kaiser: Allow NX poison to be set in p4d/pgd x86/mm/kaiser: Make sure static PGDs are 8k in size x86/mm/kaiser: Map cpu entry area x86/mm/kaiser: Map dynamically-allocated LDTs x86/mm/kaiser: Map espfix structures x86/mm/kaiser: Map entry stack variable x86/mm: Move CR3 construction functions x86/mm: Remove hard-coded ASID limit checks x86/mm: Put mmu-to-h/w ASID translation in one place x86/mm/kaiser: Allow flushing for future ASID switches x86/mm/kaiser: Use PCID feature to make user and kernel switches faster x86/mm/kaiser: Disable native VSYSCALL x86/mm/kaiser: Add debugfs file to turn KAISER on/off at runtime x86/mm/kaiser: Add a function to check for KAISER being enabled x86/mm/kaiser: Un-poison PGDs at runtime x86/mm/kaiser: Allow KAISER to be enabled/disabled at runtime x86/mm/kaiser: Add Kconfig Hugh Dickins (1): x86/mm/kaiser: Map virtually-addressed performance monitoring buffers Masami Hiramatsu (1): x86/decoder: Add new TEST instruction pattern Documentation/x86/kaiser.txt | 162 ++++++++ arch/x86/Kconfig | 8 + arch/x86/boot/compressed/pagetable.c | 6 + arch/x86/entry/calling.h | 89 ++++ arch/x86/entry/entry_32.S | 6 +- arch/x86/entry/entry_64.S | 207 ++++++++-- arch/x86/entry/entry_64_compat.S | 31 +- arch/x86/events/intel/ds.c | 49 ++- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/include/asm/desc.h | 13 +- arch/x86/include/asm/fixmap.h | 58 ++- arch/x86/include/asm/kaiser.h | 68 +++ arch/x86/include/asm/mmu_context.h | 29 +- arch/x86/include/asm/pgtable.h | 19 +- arch/x86/include/asm/pgtable_64.h | 146 +++++++ arch/x86/include/asm/pgtable_types.h | 25 +- arch/x86/include/asm/processor.h | 49 ++- arch/x86/include/asm/stacktrace.h | 3 + arch/x86/include/asm/switch_to.h | 2 +- arch/x86/include/asm/thread_info.h | 2 +- arch/x86/include/asm/tlbflush.h | 208 ++++++++-- arch/x86/include/asm/traps.h | 1 - arch/x86/include/uapi/asm/processor-flags.h | 3 +- arch/x86/kernel/asm-offsets.c | 7 + arch/x86/kernel/asm-offsets_32.c | 5 - arch/x86/kernel/asm-offsets_64.c | 1 + arch/x86/kernel/cpu/common.c | 139 +++++-- arch/x86/kernel/doublefault.c | 36 +- arch/x86/kernel/dumpstack.c | 42 +- arch/x86/kernel/dumpstack_32.c | 6 + arch/x86/kernel/dumpstack_64.c | 6 + arch/x86/kernel/espfix_64.c | 27 +- arch/x86/kernel/head_64.S | 30 +- arch/x86/kernel/irq.c | 12 - arch/x86/kernel/irq_64.c | 4 +- arch/x86/kernel/ldt.c | 25 +- arch/x86/kernel/process.c | 15 +- arch/x86/kernel/process_64.c | 3 +- arch/x86/kernel/traps.c | 27 +- arch/x86/kernel/vmlinux.lds.S | 10 + arch/x86/kvm/x86.c | 3 +- arch/x86/lib/x86-opcode-map.txt | 2 +- arch/x86/mm/Makefile | 1 + arch/x86/mm/init.c | 75 ++-- arch/x86/mm/kaiser.c | 620 ++++++++++++++++++++++++++++ arch/x86/mm/kasan_init_64.c | 13 +- arch/x86/mm/pageattr.c | 18 +- arch/x86/mm/pgtable.c | 16 +- arch/x86/mm/tlb.c | 105 ++++- arch/x86/power/cpu.c | 16 +- arch/x86/xen/mmu_pv.c | 2 +- include/asm-generic/vmlinux.lds.h | 7 + include/linux/kaiser.h | 38 ++ include/linux/percpu-defs.h | 30 ++ init/main.c | 3 + kernel/fork.c | 1 + security/Kconfig | 10 + 57 files changed, 2243 insertions(+), 297 deletions(-) create mode 100644 Documentation/x86/kaiser.txt create mode 100644 arch/x86/include/asm/kaiser.h create mode 100644 arch/x86/mm/kaiser.c create mode 100644 include/linux/kaiser.h -- 2.14.1