From c3df6935134ae5ccd87f39f2567488c26491ede4 Mon Sep 17 00:00:00 2001 From: "Martin K. Petersen" Date: Thu, 4 Jan 2018 16:45:34 -0500 Subject: [PATCH] KAISER KABI tweaks. Makes KPTI KABI compatible. Orabug: 27333760 CVE: CVE-2017-5754 Signed-off-by: Martin K. Petersen Signed-off-by: Pavel Tatashin Signed-off-by: Kirtikar Kashyap --- arch/x86/include/asm/processor.h | 4 ++++ arch/x86/kernel/process.c | 4 ++++ include/linux/mmzone.h | 4 +++- mm/vmstat.c | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 77038e5aefaa..3154597bfb17 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -300,7 +300,11 @@ struct tss_struct { } ____cacheline_aligned; +#ifndef __GENKSYMS__ DECLARE_PER_CPU_SHARED_ALIGNED_USER_MAPPED(struct tss_struct, cpu_tss); +#else +DECLARE_PER_CPU_SHARED_ALIGNED(struct tss_struct, cpu_tss); +#endif #ifdef CONFIG_X86_32 DECLARE_PER_CPU(unsigned long, cpu_current_top_of_stack); diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 87c2996f1688..f6c1cea968d9 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -38,7 +38,11 @@ * section. Since TSS's are completely CPU-local, we want them * on exact cacheline boundaries, to eliminate cacheline ping-pong. */ +#ifndef __GENKSYMS__ __visible DEFINE_PER_CPU_SHARED_ALIGNED_USER_MAPPED(struct tss_struct, cpu_tss) = { +#else +__visible DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, cpu_tss) = { +#endif .x86_tss = { .sp0 = TOP_OF_INIT_STACK, #ifdef CONFIG_X86_32 diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 1b0172473768..887119882296 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -131,9 +131,11 @@ enum zone_stat_item { NR_SLAB_RECLAIMABLE, NR_SLAB_UNRECLAIMABLE, NR_PAGETABLE, /* used for pagetables */ - /* Second 128 byte cacheline */ NR_KERNEL_STACK, + /* Second 128 byte cacheline */ +#ifndef __GENKSYMS__ NR_KAISERTABLE, +#endif NR_UNSTABLE_NFS, /* NFS unstable pages */ NR_BOUNCE, NR_VMSCAN_WRITE, diff --git a/mm/vmstat.c b/mm/vmstat.c index 8e0cbcd0fccc..9152387d34f5 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -714,7 +714,9 @@ const char * const vmstat_text[] = { "nr_slab_unreclaimable", "nr_page_table_pages", "nr_kernel_stack", +#ifndef __GENKSYMS__ "nr_overhead", +#endif "nr_unstable", "nr_bounce", "nr_vmscan_write", -- 2.50.1