[PATCH] Avoid overwriting the current pgd (V4, x86_64)

kexec: Avoid overwriting the current pgd (V4, x86_64)

This patch upgrades the x86_64-specific kexec code to avoid overwriting the
current pgd. Overwriting the current pgd is bad when CONFIG_CRASH_DUMP is used
to start a secondary kernel that dumps the memory of the previous kernel.

The code introduces a new set of page tables. These tables are used to provide
an executable identity mapping without overwriting the current pgd.

Signed-off-by: Magnus Damm <magnus@valinux.co.jp>
Signed-off-by: Andi Kleen <ak@suse.de>
This commit is contained in:
Magnus Damm
2006-09-26 10:52:38 +02:00
committed by Andi Kleen
parent f574164491
commit 4bfaaef01a
3 changed files with 217 additions and 52 deletions

View File

@@ -1,6 +1,27 @@
#ifndef _X86_64_KEXEC_H
#define _X86_64_KEXEC_H
#define PA_CONTROL_PAGE 0
#define VA_CONTROL_PAGE 1
#define PA_PGD 2
#define VA_PGD 3
#define PA_PUD_0 4
#define VA_PUD_0 5
#define PA_PMD_0 6
#define VA_PMD_0 7
#define PA_PTE_0 8
#define VA_PTE_0 9
#define PA_PUD_1 10
#define VA_PUD_1 11
#define PA_PMD_1 12
#define VA_PMD_1 13
#define PA_PTE_1 14
#define VA_PTE_1 15
#define PA_TABLE_PAGE 16
#define PAGES_NR 17
#ifndef __ASSEMBLY__
#include <linux/string.h>
#include <asm/page.h>
@@ -64,4 +85,12 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
newregs->rip = (unsigned long)current_text_addr();
}
}
NORET_TYPE void
relocate_kernel(unsigned long indirection_page,
unsigned long page_list,
unsigned long start_address) ATTRIB_NORET;
#endif /* __ASSEMBLY__ */
#endif /* _X86_64_KEXEC_H */