Commit fdfd3c17 authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Zheng Zengkai
Browse files

ARM: kernel: refer to swapper_pg_dir via its symbol

maillist inclusion
commit fe64d7efe89877bc52454f9f2bc9ab0ce01ae8fc
category: feature
feature: ARM kaslr support
bugzilla: 47952
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git/commit/?h=arm-kaslr-latest&id=fe64d7efe89877bc52454f9f2bc9ab0ce01ae8fc



-------------------------------------------------

The location of swapper_pg_dir is relative to the kernel, not to
PAGE_OFFSET or PHYS_OFFSET. So define the symbol relative to the
start of the kernel image, and refer to it via its name.

Cc: Russell King <linux@armlinux.org.uk>
Acked-by: default avatarNicolas Pitre <nico@linaro.org>
Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: default avatarCui GaoSheng <cuigaosheng1@huawei.com>
Reviewed-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 05bfa534
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -45,14 +45,6 @@
#define PMD_ORDER	2
#endif

	.globl	swapper_pg_dir
	.equ	swapper_pg_dir, KERNEL_RAM_VADDR - PG_DIR_SIZE

	.macro	pgtbl, rd, phys
	add	\rd, \phys, #TEXT_OFFSET
	sub	\rd, \rd, #PG_DIR_SIZE
	.endm

/*
 * Kernel startup entry point.
 * ---------------------------
@@ -74,6 +66,9 @@
	.arm

	__HEAD
	.globl	swapper_pg_dir
	.equ	swapper_pg_dir, . - PG_DIR_SIZE

ENTRY(stext)
 ARM_BE8(setend	be )			@ ensure we are in BE8 mode

@@ -169,7 +164,7 @@ ENDPROC(stext)
 *  r4 = physical page table address
 */
__create_page_tables:
	pgtbl	r4, r8				@ page table address
	adr_l	r4, swapper_pg_dir		@ page table address

	/*
	 * Clear the swapper page table