kasan: change address layout [3/3]

PD#SWPL-8572

Problem:
In change http://scgit.amlogic.com:8080/#/c/73995/ we have changed
memory layout of vmalloc. Which caused kasan can't be used

Solution:
change kasan address layout

Verify:
x301

Change-Id: I28aee4b1d9b622dd884e6c2d6b621aa870cd8586
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
This commit is contained in:
Tao Zeng
2019-05-16 17:28:29 +08:00
committed by Luan Yuan
parent 8549cdc1dd
commit eac757fc55
4 changed files with 16 additions and 14 deletions

View File

@@ -1433,7 +1433,6 @@ choice
bool "3G/1G user/kernel split"
config VMSPLIT_3G_OPT
bool "3G/1G user/kernel split (for full 1G low memory)"
depends on !AMLOGIC_KASAN32
config VMSPLIT_2G
bool "2G/2G user/kernel split"
config VMSPLIT_1G

View File

@@ -53,7 +53,7 @@ LD += -EL
endif
ifeq ($(CONFIG_KASAN),y)
KASAN_SHADOW_OFFSET := 0x99000000
KASAN_SHADOW_OFFSET := 0xA0000000
endif
#

View File

@@ -20,16 +20,18 @@
* 0x00000000 +--------+
* | |
* | |
* | | User space memory, 2816MB
* | | User space memory, 2944MB
* | |
* | |
* 0xb0000000 +--------+
* | | Kasan shaddow memory, 144MB
* 0xb9000000 +--------+
* | | Vmalloc address, 356MB
* 0xb8000000 +--------+
* | | Kasan shaddow memory, 128MB
* 0xc0000000 +--------+
* | |
* | | Vmalloc address, 240MB
* | |
* 0xCF400000 +--------+
* 0xCF600000 +--------+ PKmap, for kmap 2MB
* 0xD0000000 +--------+ Modul 10MB
* 0xD0000000 +--------+ Module and pkmap, 10MB
* | |
* | | Kernel linear mapped space, 762MB
* | |
@@ -39,7 +41,8 @@
* 0xFFFF0000 +--------+ High vector, 4KB
*
*/
#define KASAN_SHADOW_SIZE (0x09000000)
#define KADDR_SIZE (SZ_1G)
#define KASAN_SHADOW_SIZE (KADDR_SIZE >> 3)
#define KASAN_SHADOW_START (TASK_SIZE)
#define KASAN_SHADOW_END (KASAN_SHADOW_START + KASAN_SHADOW_SIZE)
@@ -49,7 +52,7 @@
* shadow_addr = (address >> 3) + KASAN_SHADOW_OFFSET;
*
*/
#define KASAN_SHADOW_OFFSET 0x99000000UL
#define KASAN_SHADOW_OFFSET (KASAN_SHADOW_START - (VMALLOC_START >> 3))
struct map_desc;
void kasan_init(void);
void kasan_copy_shadow(pgd_t *pgdir);

View File

@@ -41,11 +41,11 @@
#ifdef CONFIG_AMLOGIC_KASAN32
/*
* if open AMLOGIC_KASAN32, PAGE_OFFSET is set to 0xD0000000
* we config 0xB0000000 as shadow memory start. so vmalloc
* can be 0xb9000000 and total 368mb space for vmalloc
* we config 0xB8000000 as shadow memory start. so vmalloc
* can be 0xC0000000 and total 256mb space for vmalloc
*/
#define VMALLOC_START (UL(0xB9000000))
#define TASK_SIZE (UL(0xB0000000))
#define VMALLOC_START (UL(CONFIG_PAGE_OFFSET) - UL(SZ_256M))
#define TASK_SIZE (VMALLOC_START - UL(SZ_128M))
#define KMEM_END (0xffa00000UL)
#else /* CONFIG_AMLOGIC_KASAN32 */
#define TASK_SIZE (UL(CONFIG_PAGE_OFFSET) - UL(SZ_64M))