diff options
| author | Thomas Garnier <thgarnie@google.com> | 2017-03-14 13:05:06 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2017-03-16 04:06:24 -0400 |
| commit | f06bdd4001c257792c54dce9427399f2896470af (patch) | |
| tree | 4ee85acaed85053bcd9d59a65aed361b9a0a4bcf /arch | |
| parent | e13b73dd9c8003993b171173ba803363faf74238 (diff) | |
x86/mm: Adapt MODULES_END based on fixmap section size
This patch aligns MODULES_END to the beginning of the fixmap section.
It optimizes the space available for both sections. The address is
pre-computed based on the number of pages required by the fixmap
section.
It will allow GDT remapping in the fixmap section. The current
MODULES_END static address does not provide enough space for the kernel
to support a large number of processors.
Signed-off-by: Thomas Garnier <thgarnie@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Len Brown <len.brown@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Lorenzo Stoakes <lstoakes@gmail.com>
Cc: Luis R . Rodriguez <mcgrof@kernel.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Rafael J . Wysocki <rjw@rjwysocki.net>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: kasan-dev@googlegroups.com
Cc: kernel-hardening@lists.openwall.com
Cc: kvm@vger.kernel.org
Cc: lguest@lists.ozlabs.org
Cc: linux-doc@vger.kernel.org
Cc: linux-efi@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-pm@vger.kernel.org
Cc: xen-devel@lists.xenproject.org
Cc: zijun_hu <zijun_hu@htc.com>
Link: http://lkml.kernel.org/r/20170314170508.100882-1-thgarnie@google.com
[ Small build fix. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/x86/include/asm/pgtable_64_types.h | 3 | ||||
| -rw-r--r-- | arch/x86/kernel/module.c | 1 | ||||
| -rw-r--r-- | arch/x86/mm/dump_pagetables.c | 1 | ||||
| -rw-r--r-- | arch/x86/mm/kasan_init_64.c | 1 |
4 files changed, 5 insertions, 1 deletions
diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h index 0b2797e5083c..516593e66bd6 100644 --- a/arch/x86/include/asm/pgtable_64_types.h +++ b/arch/x86/include/asm/pgtable_64_types.h | |||
| @@ -68,7 +68,8 @@ typedef struct { pteval_t pte; } pte_t; | |||
| 68 | #endif /* CONFIG_RANDOMIZE_MEMORY */ | 68 | #endif /* CONFIG_RANDOMIZE_MEMORY */ |
| 69 | #define VMALLOC_END (VMALLOC_START + _AC((VMALLOC_SIZE_TB << 40) - 1, UL)) | 69 | #define VMALLOC_END (VMALLOC_START + _AC((VMALLOC_SIZE_TB << 40) - 1, UL)) |
| 70 | #define MODULES_VADDR (__START_KERNEL_map + KERNEL_IMAGE_SIZE) | 70 | #define MODULES_VADDR (__START_KERNEL_map + KERNEL_IMAGE_SIZE) |
| 71 | #define MODULES_END _AC(0xffffffffff000000, UL) | 71 | /* The module sections ends with the start of the fixmap */ |
| 72 | #define MODULES_END __fix_to_virt(__end_of_fixed_addresses + 1) | ||
| 72 | #define MODULES_LEN (MODULES_END - MODULES_VADDR) | 73 | #define MODULES_LEN (MODULES_END - MODULES_VADDR) |
| 73 | #define ESPFIX_PGD_ENTRY _AC(-2, UL) | 74 | #define ESPFIX_PGD_ENTRY _AC(-2, UL) |
| 74 | #define ESPFIX_BASE_ADDR (ESPFIX_PGD_ENTRY << PGDIR_SHIFT) | 75 | #define ESPFIX_BASE_ADDR (ESPFIX_PGD_ENTRY << PGDIR_SHIFT) |
diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c index 477ae806c2fa..fad61caac75e 100644 --- a/arch/x86/kernel/module.c +++ b/arch/x86/kernel/module.c | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include <asm/page.h> | 35 | #include <asm/page.h> |
| 36 | #include <asm/pgtable.h> | 36 | #include <asm/pgtable.h> |
| 37 | #include <asm/setup.h> | 37 | #include <asm/setup.h> |
| 38 | #include <asm/fixmap.h> | ||
| 38 | 39 | ||
| 39 | #if 0 | 40 | #if 0 |
| 40 | #define DEBUGP(fmt, ...) \ | 41 | #define DEBUGP(fmt, ...) \ |
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index 58b5bee7ea27..75efeecc85eb 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | #include <asm/kasan.h> | 21 | #include <asm/kasan.h> |
| 22 | #include <asm/pgtable.h> | 22 | #include <asm/pgtable.h> |
| 23 | #include <asm/fixmap.h> | ||
| 23 | 24 | ||
| 24 | /* | 25 | /* |
| 25 | * The dumper groups pagetable entries of the same type into one, and for | 26 | * The dumper groups pagetable entries of the same type into one, and for |
diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c index 8d63d7a104c3..1bde19ef86bd 100644 --- a/arch/x86/mm/kasan_init_64.c +++ b/arch/x86/mm/kasan_init_64.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | #include <asm/tlbflush.h> | 10 | #include <asm/tlbflush.h> |
| 11 | #include <asm/sections.h> | 11 | #include <asm/sections.h> |
| 12 | #include <asm/fixmap.h> | ||
| 12 | 13 | ||
| 13 | extern pgd_t early_level4_pgt[PTRS_PER_PGD]; | 14 | extern pgd_t early_level4_pgt[PTRS_PER_PGD]; |
| 14 | extern struct range pfn_mapped[E820_X_MAX]; | 15 | extern struct range pfn_mapped[E820_X_MAX]; |
