mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-12 18:36:39 +07:00
f9040773b7
This moves the module area to right before the vmalloc area, and moves the kernel image to the base of the vmalloc area. This is an intermediate step towards implementing KASLR, which allows the kernel image to be located anywhere in the vmalloc area. Since other subsystems such as hibernate may still need to refer to the kernel text or data segments via their linears addresses, both are mapped in the linear region as well. The linear alias of the text region is mapped read-only/non-executable to prevent inadvertent modification or execution. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
#ifndef __ASM_KASAN_H
|
|
#define __ASM_KASAN_H
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#ifdef CONFIG_KASAN
|
|
|
|
#include <linux/linkage.h>
|
|
#include <asm/memory.h>
|
|
#include <asm/pgtable-types.h>
|
|
|
|
/*
|
|
* KASAN_SHADOW_START: beginning of the kernel virtual addresses.
|
|
* KASAN_SHADOW_END: KASAN_SHADOW_START + 1/8 of kernel virtual addresses.
|
|
*/
|
|
#define KASAN_SHADOW_START (VA_START)
|
|
#define KASAN_SHADOW_END (KASAN_SHADOW_START + KASAN_SHADOW_SIZE)
|
|
|
|
/*
|
|
* This value is used to map an address to the corresponding shadow
|
|
* address by the following formula:
|
|
* shadow_addr = (address >> 3) + KASAN_SHADOW_OFFSET;
|
|
*
|
|
* (1 << 61) shadow addresses - [KASAN_SHADOW_OFFSET,KASAN_SHADOW_END]
|
|
* cover all 64-bits of virtual addresses. So KASAN_SHADOW_OFFSET
|
|
* should satisfy the following equation:
|
|
* KASAN_SHADOW_OFFSET = KASAN_SHADOW_END - (1ULL << 61)
|
|
*/
|
|
#define KASAN_SHADOW_OFFSET (KASAN_SHADOW_END - (1ULL << (64 - 3)))
|
|
|
|
void kasan_init(void);
|
|
void kasan_copy_shadow(pgd_t *pgdir);
|
|
asmlinkage void kasan_early_init(void);
|
|
|
|
#else
|
|
static inline void kasan_init(void) { }
|
|
static inline void kasan_copy_shadow(pgd_t *pgdir) { }
|
|
#endif
|
|
|
|
#endif
|
|
#endif
|