]>
Commit | Line | Data |
---|---|---|
76ec7e59 | 1 | From 9ec7ffb2871c23d5c0961f0241bd118ca2395edb Mon Sep 17 00:00:00 2001 |
e4cdf2a5 FG |
2 | From: Thomas Gleixner <tglx@linutronix.de> |
3 | Date: Thu, 4 Jan 2018 13:01:40 +0100 | |
4 | Subject: [PATCH 237/241] x86/mm: Map cpu_entry_area at the same place on 4/5 | |
5 | level | |
6 | MIME-Version: 1.0 | |
7 | Content-Type: text/plain; charset=UTF-8 | |
8 | Content-Transfer-Encoding: 8bit | |
9 | ||
10 | commit f2078904810373211fb15f91888fba14c01a4acc upstream. | |
11 | ||
12 | There is no reason for 4 and 5 level pagetables to have a different | |
13 | layout. It just makes determining vaddr_end for KASLR harder than | |
14 | necessary. | |
15 | ||
16 | Fixes: 92a0f81d8957 ("x86/cpu_entry_area: Move it out of the fixmap") | |
17 | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> | |
18 | Cc: Andy Lutomirski <luto@kernel.org> | |
19 | Cc: Benjamin Gilbert <benjamin.gilbert@coreos.com> | |
20 | Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
21 | Cc: Dave Hansen <dave.hansen@linux.intel.com> | |
22 | Cc: Peter Zijlstra <peterz@infradead.org> | |
23 | Cc: Thomas Garnier <thgarnie@google.com>, | |
24 | Cc: Alexander Kuleshov <kuleshovmail@gmail.com> | |
25 | Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1801041320360.1771@nanos | |
26 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
27 | Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> | |
28 | --- | |
29 | Documentation/x86/x86_64/mm.txt | 7 ++++--- | |
30 | arch/x86/include/asm/pgtable_64_types.h | 4 ++-- | |
31 | arch/x86/mm/dump_pagetables.c | 2 +- | |
32 | 3 files changed, 7 insertions(+), 6 deletions(-) | |
33 | ||
34 | diff --git a/Documentation/x86/x86_64/mm.txt b/Documentation/x86/x86_64/mm.txt | |
35 | index ddd5ffd31bd0..f7dabe1f01e9 100644 | |
36 | --- a/Documentation/x86/x86_64/mm.txt | |
37 | +++ b/Documentation/x86/x86_64/mm.txt | |
38 | @@ -12,8 +12,8 @@ ffffea0000000000 - ffffeaffffffffff (=40 bits) virtual memory map (1TB) | |
39 | ... unused hole ... | |
40 | ffffec0000000000 - fffffbffffffffff (=44 bits) kasan shadow memory (16TB) | |
41 | ... unused hole ... | |
42 | -fffffe0000000000 - fffffe7fffffffff (=39 bits) LDT remap for PTI | |
43 | -fffffe8000000000 - fffffeffffffffff (=39 bits) cpu_entry_area mapping | |
44 | +fffffe0000000000 - fffffe7fffffffff (=39 bits) cpu_entry_area mapping | |
45 | +fffffe8000000000 - fffffeffffffffff (=39 bits) LDT remap for PTI | |
46 | ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks | |
47 | ... unused hole ... | |
48 | ffffffef00000000 - fffffffeffffffff (=64 GB) EFI region mapping space | |
49 | @@ -37,7 +37,8 @@ ffd4000000000000 - ffd5ffffffffffff (=49 bits) virtual memory map (512TB) | |
50 | ... unused hole ... | |
51 | ffdf000000000000 - fffffc0000000000 (=53 bits) kasan shadow memory (8PB) | |
52 | ... unused hole ... | |
53 | -fffffe8000000000 - fffffeffffffffff (=39 bits) cpu_entry_area mapping | |
54 | +fffffe0000000000 - fffffe7fffffffff (=39 bits) cpu_entry_area mapping | |
55 | +... unused hole ... | |
56 | ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks | |
57 | ... unused hole ... | |
58 | ffffffef00000000 - fffffffeffffffff (=64 GB) EFI region mapping space | |
59 | diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h | |
60 | index c92bd73b1e46..0dd48d17a4a1 100644 | |
61 | --- a/arch/x86/include/asm/pgtable_64_types.h | |
62 | +++ b/arch/x86/include/asm/pgtable_64_types.h | |
63 | @@ -87,7 +87,7 @@ typedef struct { pteval_t pte; } pte_t; | |
64 | # define VMALLOC_SIZE_TB _AC(32, UL) | |
65 | # define __VMALLOC_BASE _AC(0xffffc90000000000, UL) | |
66 | # define __VMEMMAP_BASE _AC(0xffffea0000000000, UL) | |
67 | -# define LDT_PGD_ENTRY _AC(-4, UL) | |
68 | +# define LDT_PGD_ENTRY _AC(-3, UL) | |
69 | # define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT) | |
70 | #endif | |
71 | ||
72 | @@ -109,7 +109,7 @@ typedef struct { pteval_t pte; } pte_t; | |
73 | #define ESPFIX_PGD_ENTRY _AC(-2, UL) | |
74 | #define ESPFIX_BASE_ADDR (ESPFIX_PGD_ENTRY << P4D_SHIFT) | |
75 | ||
76 | -#define CPU_ENTRY_AREA_PGD _AC(-3, UL) | |
77 | +#define CPU_ENTRY_AREA_PGD _AC(-4, UL) | |
78 | #define CPU_ENTRY_AREA_BASE (CPU_ENTRY_AREA_PGD << P4D_SHIFT) | |
79 | ||
80 | #define EFI_VA_START ( -4 * (_AC(1, UL) << 30)) | |
81 | diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c | |
82 | index 12b93d350480..a764bf6f3473 100644 | |
83 | --- a/arch/x86/mm/dump_pagetables.c | |
84 | +++ b/arch/x86/mm/dump_pagetables.c | |
85 | @@ -61,10 +61,10 @@ enum address_markers_idx { | |
86 | KASAN_SHADOW_START_NR, | |
87 | KASAN_SHADOW_END_NR, | |
88 | #endif | |
89 | + CPU_ENTRY_AREA_NR, | |
90 | #if defined(CONFIG_MODIFY_LDT_SYSCALL) && !defined(CONFIG_X86_5LEVEL) | |
91 | LDT_NR, | |
92 | #endif | |
93 | - CPU_ENTRY_AREA_NR, | |
94 | #ifdef CONFIG_X86_ESPFIX64 | |
95 | ESPFIX_START_NR, | |
96 | #endif | |
97 | -- | |
98 | 2.14.2 | |
99 |