Skip to content

Commit f207890

Browse files
committed
x86/mm: Map cpu_entry_area at the same place on 4/5 level
There is no reason for 4 and 5 level pagetables to have a different layout. It just makes determining vaddr_end for KASLR harder than necessary. Fixes: 92a0f81 ("x86/cpu_entry_area: Move it out of the fixmap") Signed-off-by: Thomas Gleixner <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Benjamin Gilbert <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: stable <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Garnier <[email protected]>, Cc: Alexander Kuleshov <[email protected]> Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1801041320360.1771@nanos
1 parent f5a4071 commit f207890

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Documentation/x86/x86_64/mm.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ ffffea0000000000 - ffffeaffffffffff (=40 bits) virtual memory map (1TB)
1212
... unused hole ...
1313
ffffec0000000000 - fffffbffffffffff (=44 bits) kasan shadow memory (16TB)
1414
... unused hole ...
15-
fffffe0000000000 - fffffe7fffffffff (=39 bits) LDT remap for PTI
16-
fffffe8000000000 - fffffeffffffffff (=39 bits) cpu_entry_area mapping
15+
fffffe0000000000 - fffffe7fffffffff (=39 bits) cpu_entry_area mapping
16+
fffffe8000000000 - fffffeffffffffff (=39 bits) LDT remap for PTI
1717
ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks
1818
... unused hole ...
1919
ffffffef00000000 - fffffffeffffffff (=64 GB) EFI region mapping space
@@ -37,7 +37,8 @@ ffd4000000000000 - ffd5ffffffffffff (=49 bits) virtual memory map (512TB)
3737
... unused hole ...
3838
ffdf000000000000 - fffffc0000000000 (=53 bits) kasan shadow memory (8PB)
3939
... unused hole ...
40-
fffffe8000000000 - fffffeffffffffff (=39 bits) cpu_entry_area mapping
40+
fffffe0000000000 - fffffe7fffffffff (=39 bits) cpu_entry_area mapping
41+
... unused hole ...
4142
ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks
4243
... unused hole ...
4344
ffffffef00000000 - fffffffeffffffff (=64 GB) EFI region mapping space

arch/x86/include/asm/pgtable_64_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ typedef struct { pteval_t pte; } pte_t;
8888
# define VMALLOC_SIZE_TB _AC(32, UL)
8989
# define __VMALLOC_BASE _AC(0xffffc90000000000, UL)
9090
# define __VMEMMAP_BASE _AC(0xffffea0000000000, UL)
91-
# define LDT_PGD_ENTRY _AC(-4, UL)
91+
# define LDT_PGD_ENTRY _AC(-3, UL)
9292
# define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT)
9393
#endif
9494

@@ -110,7 +110,7 @@ typedef struct { pteval_t pte; } pte_t;
110110
#define ESPFIX_PGD_ENTRY _AC(-2, UL)
111111
#define ESPFIX_BASE_ADDR (ESPFIX_PGD_ENTRY << P4D_SHIFT)
112112

113-
#define CPU_ENTRY_AREA_PGD _AC(-3, UL)
113+
#define CPU_ENTRY_AREA_PGD _AC(-4, UL)
114114
#define CPU_ENTRY_AREA_BASE (CPU_ENTRY_AREA_PGD << P4D_SHIFT)
115115

116116
#define EFI_VA_START ( -4 * (_AC(1, UL) << 30))

arch/x86/mm/dump_pagetables.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ enum address_markers_idx {
6161
KASAN_SHADOW_START_NR,
6262
KASAN_SHADOW_END_NR,
6363
#endif
64+
CPU_ENTRY_AREA_NR,
6465
#if defined(CONFIG_MODIFY_LDT_SYSCALL) && !defined(CONFIG_X86_5LEVEL)
6566
LDT_NR,
6667
#endif
67-
CPU_ENTRY_AREA_NR,
6868
#ifdef CONFIG_X86_ESPFIX64
6969
ESPFIX_START_NR,
7070
#endif

0 commit comments

Comments
 (0)