Re: [patch V181 00/54] x86/pti: Final XMAS release

From: Thomas Gleixner
Date: Wed Dec 20 2017 - 18:49:05 EST


On Wed, 20 Dec 2017, Thomas Gleixner wrote:

> Changes since V163:
>
> - Moved the cpu entry area out of the fixmap because that caused failures
> due to fixmap size and cleanup_highmap() zapping fixmap PTEs.
>
> - Moved all cpu entry area related code into separate files. The
> hodgepodge in cpu/common.c was really not appropriate.
>
> - Folded Juergens XEN PV fix for vsyscall
>
> - Folded Peters ACCESS bit simplification
>
> - Cleaned up and fixed dump_pagetables
>
> - Added Vlastimils PTI/NOPTI marker for dumpstack
>
> - Addressed various minor review comments
>
> Diffstat against V163 appended.
>
> Thanks to everyone who looked and cared!
>
> It's perfect now because I'm going to have quiet holidays no matter what.

Almost perfect. 0-day is amazing. It unearthed yet more include hell. I'm
not going to repost the whole thing. Find the delta fix below.

I've updated the git tree at:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.x86/pti

head commit is now: 9b12709513089f4e71190685930e7f9f0d75fee7

The new patch tarball is at:

https://tglx.de/~tglx/patches-pti-184.tar.bz2

sha1sum of decompressed tarball: 2dbdfb57cf65a0c1e558ed55747e17d3c8d8adee

Thanks,

tglx

8<--------------

diff --git a/arch/x86/include/asm/cpu_entry_area.h b/arch/x86/include/asm/cpu_entry_area.h
index e05a39029446..4a7884b8dca5 100644
--- a/arch/x86/include/asm/cpu_entry_area.h
+++ b/arch/x86/include/asm/cpu_entry_area.h
@@ -71,13 +71,7 @@ extern void cea_set_pte(void *cea_vaddr, phys_addr_t pa, pgprot_t flags);
#define CPU_ENTRY_AREA_MAP_SIZE \
(CPU_ENTRY_AREA_PER_CPU + CPU_ENTRY_AREA_TOT_SIZE - CPU_ENTRY_AREA_BASE)

-static inline struct cpu_entry_area *get_cpu_entry_area(int cpu)
-{
- unsigned long va = CPU_ENTRY_AREA_PER_CPU + cpu * CPU_ENTRY_AREA_SIZE;
- BUILD_BUG_ON(sizeof(struct cpu_entry_area) % PAGE_SIZE != 0);
-
- return (struct cpu_entry_area *) va;
-}
+extern struct cpu_entry_area *get_cpu_entry_area(int cpu);

static inline struct entry_stack *cpu_entry_stack(int cpu)
{
diff --git a/arch/x86/mm/cpu_entry_area.c b/arch/x86/mm/cpu_entry_area.c
index 66c0d1207243..b5dfb762c64c 100644
--- a/arch/x86/mm/cpu_entry_area.c
+++ b/arch/x86/mm/cpu_entry_area.c
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-2.0

+#include <linux/spinlock.h>
#include <linux/percpu.h>
+
#include <asm/cpu_entry_area.h>
#include <asm/pgtable.h>
#include <asm/fixmap.h>
@@ -13,6 +15,15 @@ static DEFINE_PER_CPU_PAGE_ALIGNED(char, exception_stacks
[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ]);
#endif

+struct cpu_entry_area *get_cpu_entry_area(int cpu)
+{
+ unsigned long va = CPU_ENTRY_AREA_PER_CPU + cpu * CPU_ENTRY_AREA_SIZE;
+ BUILD_BUG_ON(sizeof(struct cpu_entry_area) % PAGE_SIZE != 0);
+
+ return (struct cpu_entry_area *) va;
+}
+EXPORT_SYMBOL(get_cpu_entry_area);
+
void cea_set_pte(void *cea_vaddr, phys_addr_t pa, pgprot_t flags)
{
unsigned long va = (unsigned long) cea_vaddr;