Commit 2e5ddf1f authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by Zheng Zengkai
Browse files

ARM: use LOADADDR() to get load address of sections

stable inclusion
from stable-v5.10.105
commit 29d9b56df1e18a8ff2e669b79e511163972a8b65
category: bugfix
bugzilla: 186460 https://gitee.com/src-openeuler/kernel/issues/I53MHA
CVE: CVE-2022-23960

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=29d9b56df1e1



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

commit 8d9d651f upstream.

Use the linker's LOADADDR() macro to get the load address of the
sections, and provide a macro to set the start and end symbols.

Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarChen Jiahao <chenjiahao16@huawei.com>
Reviewed-by: default avatarLiao Chang <liaochang1@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent ad1936b5
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -26,6 +26,11 @@
#define ARM_MMU_DISCARD(x)	x
#endif

/* Set start/end symbol names to the LMA for the section */
#define ARM_LMA(sym, section)						\
	sym##_start = LOADADDR(section);				\
	sym##_end = LOADADDR(section) + SIZEOF(section)

#define PROC_INFO							\
		. = ALIGN(4);						\
		__proc_info_begin = .;					\
@@ -115,19 +120,19 @@
 * only thing that matters is their relative offsets
 */
#define ARM_VECTORS							\
	__vectors_start = .;						\
	__vectors_lma = .;						\
	.vectors 0xffff0000 : AT(__vectors_start) {			\
		*(.vectors)						\
	}								\
	. = __vectors_start + SIZEOF(.vectors);				\
	__vectors_end = .;						\
	ARM_LMA(__vectors, .vectors);					\
	. = __vectors_lma + SIZEOF(.vectors);				\
									\
	__stubs_start = .;						\
	.stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) {		\
	__stubs_lma = .;						\
	.stubs ADDR(.vectors) + 0x1000 : AT(__stubs_lma) {		\
		*(.stubs)						\
	}								\
	. = __stubs_start + SIZEOF(.stubs);				\
	__stubs_end = .;
	ARM_LMA(__stubs, .stubs);					\
	. = __stubs_lma + SIZEOF(.stubs);
									\
#define ARM_TCM								\
	__itcm_start = ALIGN(4);					\