mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-16 22:46:42 +07:00
e4630fdd47
The low-level resume-from-hibernation code on x86-64 uses kernel_ident_mapping_init() to create the temoprary identity mapping, but that function assumes that the offset between kernel virtual addresses and physical addresses is aligned on the PGD level. However, with a randomized identity mapping base, it may be aligned on the PUD level and if that happens, the temporary identity mapping created by set_up_temporary_mappings() will not reflect the actual kernel identity mapping and the image restoration will fail as a result (leading to a kernel panic most of the time). To fix this problem, rework kernel_ident_mapping_init() to support unaligned offsets between KVA and PA up to the PMD level and make set_up_temporary_mappings() use it as approprtiate. Reported-and-tested-by: Thomas Garnier <thgarnie@google.com> Reported-by: Borislav Petkov <bp@suse.de> Suggested-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Yinghai Lu <yinghai@kernel.org>
15 lines
463 B
C
15 lines
463 B
C
#ifndef _ASM_X86_INIT_H
|
|
#define _ASM_X86_INIT_H
|
|
|
|
struct x86_mapping_info {
|
|
void *(*alloc_pgt_page)(void *); /* allocate buf for page table */
|
|
void *context; /* context for alloc_pgt_page */
|
|
unsigned long pmd_flag; /* page flag for PMD entry */
|
|
unsigned long offset; /* ident mapping offset */
|
|
};
|
|
|
|
int kernel_ident_mapping_init(struct x86_mapping_info *info, pgd_t *pgd_page,
|
|
unsigned long pstart, unsigned long pend);
|
|
|
|
#endif /* _ASM_X86_INIT_H */
|