48d2f0407b
On BOOK3S_32, when we have modules and strict kernel RWX, modules
are not in vmalloc space but in a dedicated segment that is
below PAGE_OFFSET.
So KASAN_SHADOW_START must take it into account.
MODULES_VADDR can't be used because it is not defined yet
in kasan.h
Fixes: 6ca055322d
("powerpc/32s: Use dedicated segment for modules with STRICT_KERNEL_RWX")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/6eddca2d5611fd57312a88eae31278c87a8fc99d.1596641224.git.christophe.leroy@csgroup.eu
52 lines
1.4 KiB
C
52 lines
1.4 KiB
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>
|
|
#include <linux/sizes.h>
|
|
|
|
#define KASAN_SHADOW_SCALE_SHIFT 3
|
|
|
|
#if defined(CONFIG_PPC_BOOK3S_32) && defined(CONFIG_MODULES) && defined(CONFIG_STRICT_KERNEL_RWX)
|
|
#define KASAN_KERN_START ALIGN_DOWN(PAGE_OFFSET - SZ_256M, SZ_256M)
|
|
#else
|
|
#define KASAN_KERN_START PAGE_OFFSET
|
|
#endif
|
|
|
|
#define KASAN_SHADOW_START (KASAN_SHADOW_OFFSET + \
|
|
(KASAN_KERN_START >> KASAN_SHADOW_SCALE_SHIFT))
|
|
|
|
#define KASAN_SHADOW_OFFSET ASM_CONST(CONFIG_KASAN_SHADOW_OFFSET)
|
|
|
|
#define KASAN_SHADOW_END (-(-KASAN_SHADOW_START >> KASAN_SHADOW_SCALE_SHIFT))
|
|
|
|
#ifdef CONFIG_KASAN
|
|
void kasan_early_init(void);
|
|
void kasan_mmu_init(void);
|
|
void kasan_init(void);
|
|
void kasan_late_init(void);
|
|
#else
|
|
static inline void kasan_init(void) { }
|
|
static inline void kasan_mmu_init(void) { }
|
|
static inline void kasan_late_init(void) { }
|
|
#endif
|
|
|
|
void kasan_update_early_region(unsigned long k_start, unsigned long k_end, pte_t pte);
|
|
int kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_end);
|
|
int kasan_init_region(void *start, size_t size);
|
|
|
|
#endif /* __ASSEMBLY */
|
|
#endif
|