mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00

While __noinstr already contained __no_sanitize_coverage, it needs to be added to __init and __head section markings to support the Clang implementation of CONFIG_KSTACK_ERASE. This is to make sure the stack depth tracking callback is not executed in unsupported contexts. The other sanitizer coverage options (trace-pc and trace-cmp) aren't needed in __head nor __init either ("We are interested in code coverage as a function of a syscall inputs"[1]), so this is fine to disable for them as well. Link: https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/kcov.c?h=v6.14#n179 [1] Acked-by: Marco Elver <elver@google.com> Link: https://lore.kernel.org/r/20250724055029.3623499-3-kees@kernel.org Signed-off-by: Kees Cook <kees@kernel.org>
27 lines
1.0 KiB
C
27 lines
1.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_X86_INIT_H
|
|
#define _ASM_X86_INIT_H
|
|
|
|
#if defined(CONFIG_CC_IS_CLANG) && CONFIG_CLANG_VERSION < 170000
|
|
#define __head __section(".head.text") __no_sanitize_undefined __no_stack_protector
|
|
#else
|
|
#define __head __section(".head.text") __no_sanitize_undefined __no_sanitize_coverage
|
|
#endif
|
|
|
|
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 */
|