mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-24 07:16:15 +07:00
8ad8b72721
This patch ports the feature Kernel Address SANitizer (KASAN). Note: The start address of shadow memory is at the beginning of kernel space, which is 2^64 - (2^39 / 2) in SV39. The size of the kernel space is 2^38 bytes so the size of shadow memory should be 2^38 / 8. Thus, the shadow memory would not overlap with the fixmap area. There are currently two limitations in this port, 1. RV64 only: KASAN need large address space for extra shadow memory region. 2. KASAN can't debug the modules since the modules are allocated in VMALLOC area. We mapped the shadow memory, which corresponding to VMALLOC area, to the kasan_early_shadow_page because we don't have enough physical space for all the shadow memory corresponding to VMALLOC area. Signed-off-by: Nick Hu <nickhu@andestech.com> Reported-by: Greentime Hu <green.hu@gmail.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
28 lines
770 B
C
28 lines
770 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2013 Regents of the University of California
|
|
*/
|
|
|
|
#ifndef _ASM_RISCV_STRING_H
|
|
#define _ASM_RISCV_STRING_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/linkage.h>
|
|
|
|
#define __HAVE_ARCH_MEMSET
|
|
extern asmlinkage void *memset(void *, int, size_t);
|
|
extern asmlinkage void *__memset(void *, int, size_t);
|
|
|
|
#define __HAVE_ARCH_MEMCPY
|
|
extern asmlinkage void *memcpy(void *, const void *, size_t);
|
|
extern asmlinkage void *__memcpy(void *, const void *, size_t);
|
|
|
|
/* For those files which don't want to check by kasan. */
|
|
#if defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__)
|
|
|
|
#define memcpy(dst, src, len) __memcpy(dst, src, len)
|
|
#define memset(s, c, n) __memset(s, c, n)
|
|
|
|
#endif
|
|
#endif /* _ASM_RISCV_STRING_H */
|