]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/x86/include/asm/kasan.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-bionic-kernel.git] / arch / x86 / include / asm / kasan.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
ef7f0d6a
AR
2#ifndef _ASM_X86_KASAN_H
3#define _ASM_X86_KASAN_H
4
920e277e
AR
5#include <linux/const.h>
6#define KASAN_SHADOW_OFFSET _AC(CONFIG_KASAN_SHADOW_OFFSET, UL)
7
ef7f0d6a
AR
8/*
9 * Compiler uses shadow offset assuming that addresses start
10 * from 0. Kernel addresses don't start from 0, so shadow
11 * for kernel really starts from compiler's shadow offset +
12 * 'kernel address space start' >> KASAN_SHADOW_SCALE_SHIFT
13 */
14#define KASAN_SHADOW_START (KASAN_SHADOW_OFFSET + \
4c7c4483
KS
15 ((-1UL << __VIRTUAL_MASK_SHIFT) >> 3))
16/*
17 * 47 bits for kernel address -> (47 - 3) bits for shadow
18 * 56 bits for kernel address -> (56 - 3) bits for shadow
19 */
20#define KASAN_SHADOW_END (KASAN_SHADOW_START + (1ULL << (__VIRTUAL_MASK_SHIFT - 3)))
ef7f0d6a
AR
21
22#ifndef __ASSEMBLY__
23
ef7f0d6a 24#ifdef CONFIG_KASAN
5d5aa3cf 25void __init kasan_early_init(void);
ef7f0d6a
AR
26void __init kasan_init(void);
27#else
5d5aa3cf 28static inline void kasan_early_init(void) { }
ef7f0d6a
AR
29static inline void kasan_init(void) { }
30#endif
31
32#endif
33
34#endif