提交 25ac7c26 编写于 作者: L Liu Hua 提交者: Zheng Zengkai

ARM: kdump: Add LPAE support

hulk inclusion
category: bugfix
Bugzilla: 47259
CVE: N/A

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

With CONFIG_ARM_LPAE=y, memory in 32-bit ARM systems can exceed
4G. So if we use kdump in such systems. The capture kernel
should parse 64-bit elf header(parse_crash_elf64_headers).

And this process can not pass because ARM linux does not
supply related check function.

This patch adds check functions related of elf64 header.
Signed-off-by: NLiu Hua <sdu.liu@huawei.com>
Signed-off-by: NYufen Wang <wangyufen@huawei.com>
Reviewed-by: NLi Bin <huawei.libin@huawei.com>
Signed-off-by: Nzhangyi (F) <yi.zhang@huawei.com>

Conflicts:
	arch/arm/include/asm/elf.h
Signed-off-by: NLi Huafei <lihuafei1@huawei.com>
Reviewed-by: NWang Yufen <wangyufen@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 d72cad45
......@@ -99,11 +99,13 @@ typedef struct user_fp elf_fpregset_t;
extern char elf_platform[];
struct elf32_hdr;
struct elf64_hdr;
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
extern int elf_check_arch(const struct elf32_hdr *);
extern int elf_check_arch_64(const struct elf64_hdr *);
#define elf_check_arch elf_check_arch
#define ELFOSABI_ARM_FDPIC 65 /* ARM FDPIC platform */
......@@ -111,7 +113,7 @@ extern int elf_check_arch(const struct elf32_hdr *);
#define elf_check_const_displacement(x) ((x)->e_flags & EF_ARM_PIC)
#define ELF_FDPIC_CORE_EFLAGS 0
#define vmcore_elf64_check_arch(x) (0)
#define vmcore_elf64_check_arch(x) (elf_check_arch_64(x) || vmcore_elf_check_arch_cross(x))
extern int arm_elf_read_implies_exec(int);
#define elf_read_implies_exec(ex,stk) arm_elf_read_implies_exec(stk)
......
......@@ -40,6 +40,39 @@ int elf_check_arch(const struct elf32_hdr *x)
}
EXPORT_SYMBOL(elf_check_arch);
int elf_check_arch_64(const struct elf64_hdr *x)
{
unsigned int eflags;
/* Make sure it's an ARM executable */
if (x->e_machine != EM_ARM)
return 0;
/* Make sure the entry address is reasonable */
if (x->e_entry & 1) {
if (!(elf_hwcap & HWCAP_THUMB))
return 0;
} else if (x->e_entry & 3)
return 0;
eflags = x->e_flags;
if ((eflags & EF_ARM_EABI_MASK) == EF_ARM_EABI_UNKNOWN) {
unsigned int flt_fmt;
/* APCS26 is only allowed if the CPU supports it */
if ((eflags & EF_ARM_APCS_26) && !(elf_hwcap & HWCAP_26BIT))
return 0;
flt_fmt = eflags & (EF_ARM_VFP_FLOAT | EF_ARM_SOFT_FLOAT);
/* VFP requires the supporting code */
if (flt_fmt == EF_ARM_VFP_FLOAT && !(elf_hwcap & HWCAP_VFP))
return 0;
}
return 1;
}
EXPORT_SYMBOL(elf_check_arch_64);
void elf_set_personality(const struct elf32_hdr *x)
{
unsigned int eflags = x->e_flags;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册