Skip to content

Commit f3e48e5

Browse files
joergroedelKAGA-KOKO
authored andcommitted
x86/ldt: Reserve address-space range on 32 bit for the LDT
Reserve 2MB/4MB of address-space for mapping the LDT to user-space on 32 bit PTI kernels. Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Pavel Machek <pavel@ucw.cz> Cc: "H . Peter Anvin" <hpa@zytor.com> Cc: linux-mm@kvack.org Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Juergen Gross <jgross@suse.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Jiri Kosina <jkosina@suse.cz> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: Brian Gerst <brgerst@gmail.com> Cc: David Laight <David.Laight@aculab.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Eduardo Valentin <eduval@amazon.com> Cc: Greg KH <gregkh@linuxfoundation.org> Cc: Will Deacon <will.deacon@arm.com> Cc: aliguori@amazon.com Cc: daniel.gruss@iaik.tugraz.at Cc: hughd@google.com Cc: keescook@google.com Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Waiman Long <llong@redhat.com> Cc: "David H . Gutteridge" <dhgutteridge@sympatico.ca> Cc: joro@8bytes.org Link: https://lkml.kernel.org/r/1531906876-13451-34-git-send-email-joro@8bytes.org
1 parent f59dbe9 commit f3e48e5

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

arch/x86/include/asm/pgtable_32_types.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,16 @@ extern bool __vmalloc_start_set; /* set once high_memory is set */
5050
((FIXADDR_TOT_START - PAGE_SIZE * (CPU_ENTRY_AREA_PAGES + 1)) \
5151
& PMD_MASK)
5252

53-
#define PKMAP_BASE \
53+
#define LDT_BASE_ADDR \
5454
((CPU_ENTRY_AREA_BASE - PAGE_SIZE) & PMD_MASK)
5555

56+
#define PKMAP_BASE \
57+
((LDT_BASE_ADDR - PAGE_SIZE) & PMD_MASK)
58+
5659
#ifdef CONFIG_HIGHMEM
5760
# define VMALLOC_END (PKMAP_BASE - 2 * PAGE_SIZE)
5861
#else
59-
# define VMALLOC_END (CPU_ENTRY_AREA_BASE - 2 * PAGE_SIZE)
62+
# define VMALLOC_END (LDT_BASE_ADDR - 2 * PAGE_SIZE)
6063
#endif
6164

6265
#define MODULES_VADDR VMALLOC_START

arch/x86/mm/dump_pagetables.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ enum address_markers_idx {
122122
VMALLOC_END_NR,
123123
#ifdef CONFIG_HIGHMEM
124124
PKMAP_BASE_NR,
125+
#endif
126+
#ifdef CONFIG_MODIFY_LDT_SYSCALL
127+
LDT_NR,
125128
#endif
126129
CPU_ENTRY_AREA_NR,
127130
FIXADDR_START_NR,
@@ -135,6 +138,9 @@ static struct addr_marker address_markers[] = {
135138
[VMALLOC_END_NR] = { 0UL, "vmalloc() End" },
136139
#ifdef CONFIG_HIGHMEM
137140
[PKMAP_BASE_NR] = { 0UL, "Persistent kmap() Area" },
141+
#endif
142+
#ifdef CONFIG_MODIFY_LDT_SYSCALL
143+
[LDT_NR] = { 0UL, "LDT remap" },
138144
#endif
139145
[CPU_ENTRY_AREA_NR] = { 0UL, "CPU entry area" },
140146
[FIXADDR_START_NR] = { 0UL, "Fixmap area" },
@@ -609,6 +615,9 @@ static int __init pt_dump_init(void)
609615
# endif
610616
address_markers[FIXADDR_START_NR].start_address = FIXADDR_START;
611617
address_markers[CPU_ENTRY_AREA_NR].start_address = CPU_ENTRY_AREA_BASE;
618+
# ifdef CONFIG_MODIFY_LDT_SYSCALL
619+
address_markers[LDT_NR].start_address = LDT_BASE_ADDR;
620+
# endif
612621
#endif
613622
return 0;
614623
}

0 commit comments

Comments
 (0)