mirror of
https://github.com/torvalds/linux.git
synced 2025-04-12 16:47:42 +00:00

The early boot code runs from a 1:1 mapping of memory, and may execute before the kernel virtual mapping is even up. This means absolute symbol references cannot be permitted in this code. UBSAN injects references to global data structures into the code, and without -fPIC, those references are emitted as absolute references to kernel virtual addresses. Accessing those will fault before the kernel virtual mapping is up, so UBSAN needs to be disabled in early boot code. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: "H. Peter Anvin" <hpa@zytor.com> Link: https://lore.kernel.org/r/20241205112804.3416920-13-ardb+git@google.com
23 lines
842 B
C
23 lines
842 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_X86_INIT_H
|
|
#define _ASM_X86_INIT_H
|
|
|
|
#define __head __section(".head.text") __no_sanitize_undefined
|
|
|
|
struct x86_mapping_info {
|
|
void *(*alloc_pgt_page)(void *); /* allocate buf for page table */
|
|
void (*free_pgt_page)(void *, void *); /* free buf for page table */
|
|
void *context; /* context for alloc_pgt_page */
|
|
unsigned long page_flag; /* page flag for PMD or PUD entry */
|
|
unsigned long offset; /* ident mapping offset */
|
|
bool direct_gbpages; /* PUD level 1GB page support */
|
|
unsigned long kernpg_flag; /* kernel pagetable flag override */
|
|
};
|
|
|
|
int kernel_ident_mapping_init(struct x86_mapping_info *info, pgd_t *pgd_page,
|
|
unsigned long pstart, unsigned long pend);
|
|
|
|
void kernel_ident_mapping_free(struct x86_mapping_info *info, pgd_t *pgd);
|
|
|
|
#endif /* _ASM_X86_INIT_H */
|