mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 09:14:19 +08:00
2edb16efc8
This patch adds KASAN support for PPC32. The following patch will add an early activation of hash table for book3s. Until then, a warning will be raised if trying to use KASAN on an hash 6xx. To support KASAN, this patch initialises that MMU mapings for accessing to the KASAN shadow area defined in a previous patch. An early mapping is set as soon as the kernel code has been relocated at its definitive place. Then the definitive mapping is set once paging is initialised. For modules, the shadow area is allocated at module_alloc(). Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
41 lines
954 B
C
41 lines
954 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __ASM_KASAN_H
|
|
#define __ASM_KASAN_H
|
|
|
|
#ifdef CONFIG_KASAN
|
|
#define _GLOBAL_KASAN(fn) _GLOBAL(__##fn)
|
|
#define _GLOBAL_TOC_KASAN(fn) _GLOBAL_TOC(__##fn)
|
|
#define EXPORT_SYMBOL_KASAN(fn) EXPORT_SYMBOL(__##fn)
|
|
#else
|
|
#define _GLOBAL_KASAN(fn) _GLOBAL(fn)
|
|
#define _GLOBAL_TOC_KASAN(fn) _GLOBAL_TOC(fn)
|
|
#define EXPORT_SYMBOL_KASAN(fn)
|
|
#endif
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <asm/page.h>
|
|
|
|
#define KASAN_SHADOW_SCALE_SHIFT 3
|
|
|
|
#define KASAN_SHADOW_START (KASAN_SHADOW_OFFSET + \
|
|
(PAGE_OFFSET >> KASAN_SHADOW_SCALE_SHIFT))
|
|
|
|
#define KASAN_SHADOW_OFFSET ASM_CONST(CONFIG_KASAN_SHADOW_OFFSET)
|
|
|
|
#define KASAN_SHADOW_END 0UL
|
|
|
|
#define KASAN_SHADOW_SIZE (KASAN_SHADOW_END - KASAN_SHADOW_START)
|
|
|
|
#ifdef CONFIG_KASAN
|
|
void kasan_early_init(void);
|
|
void kasan_mmu_init(void);
|
|
void kasan_init(void);
|
|
#else
|
|
static inline void kasan_init(void) { }
|
|
static inline void kasan_mmu_init(void) { }
|
|
#endif
|
|
|
|
#endif /* __ASSEMBLY */
|
|
#endif
|