/* * These are used to set parameters in the core dumps.
*/ #define ELF_CLASS ELFCLASS64 #ifdef __AARCH64EB__ #define ELF_DATA ELFDATA2MSB #else #define ELF_DATA ELFDATA2LSB #endif #define ELF_ARCH EM_AARCH64
/* * This yields a string that ld.so will use to load implementation * specific libraries for optimization. This is more specific in * intent than poking at uname or /proc/cpuinfo.
*/ #define ELF_PLATFORM_SIZE 16 #ifdef __AARCH64EB__ #define ELF_PLATFORM ("aarch64_be") #else #define ELF_PLATFORM ("aarch64") #endif
/* * This is used to ensure we don't load something for the wrong architecture.
*/ #define elf_check_arch(x) ((x)->e_machine == EM_AARCH64)
/* * An executable for which elf_read_implies_exec() returns TRUE will * have the READ_IMPLIES_EXEC personality flag set automatically. * * The decision process for determining the results are: * * CPU*: | arm32 | arm64 | * ELF: | | | * ---------------------|------------|------------| * missing PT_GNU_STACK | exec-all | exec-none | * PT_GNU_STACK == RWX | exec-stack | exec-stack | * PT_GNU_STACK == RW | exec-none | exec-none | * * exec-all : all PROT_READ user mappings are executable, except when * backed by files on a noexec-filesystem. * exec-none : only PROT_EXEC user mappings are executable. * exec-stack: only the stack and PROT_EXEC user mappings are executable. * * *all arm64 CPUs support NX, so there is no "lacks NX" column. *
*/ #define compat_elf_read_implies_exec(ex, stk) (stk == EXSTACK_DEFAULT)
/* * This is the base location for PIE (ET_DYN with INTERP) loads. On * 64-bit, this is above 4GB to leave the entire 32-bit address * space open for things that want to use the area for 32-bit pointers.
*/ #ifdef CONFIG_ARM64_FORCE_52BIT #define ELF_ET_DYN_BASE (2 * TASK_SIZE_64 / 3) #else #define ELF_ET_DYN_BASE (2 * DEFAULT_MAP_WINDOW_64 / 3) #endif/* CONFIG_ARM64_FORCE_52BIT */
#ifndef __ASSEMBLY__
#include <uapi/linux/elf.h> #include <linux/bug.h> #include <linux/errno.h> #include <linux/fs.h> #include <linux/types.h> #include <asm/processor.h> /* for signal_minsigstksz, used by ARCH_DLINFO */
/* * When the program starts, a1 contains a pointer to a function to be * registered with atexit, as per the SVR4 ABI. A value of 0 means we have no * such handler.
*/ #define ELF_PLAT_INIT(_r, load_addr) (_r)->regs[0] = 0
/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */ #define ARCH_DLINFO \ do { \
NEW_AUX_ENT(AT_SYSINFO_EHDR, \
(elf_addr_t)current->mm->context.vdso); \
\ /* \ * Should always be nonzero unless there's a kernel bug. \ * If we haven't determined a sensible value to give to \ * userspace, omit the entry: \
*/ if (likely(signal_minsigstksz)) \
NEW_AUX_ENT(AT_MINSIGSTKSZ, signal_minsigstksz); \ else \
NEW_AUX_ENT(AT_IGNORE, 0); \
} while (0)
#define ARCH_HAS_SETUP_ADDITIONAL_PAGES struct linux_binprm; externint arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp);
/* PIE load location for compat arm. Must match ARM ELF_ET_DYN_BASE. */ #define COMPAT_ELF_ET_DYN_BASE 0x000400000UL
/* AArch32 EABI. */ #define EF_ARM_EABI_MASK 0xff000000 int compat_elf_check_arch(conststruct elf32_hdr *); #define compat_elf_check_arch compat_elf_check_arch #define compat_start_thread compat_start_thread /* * Unlike the native SET_PERSONALITY macro, the compat version maintains * READ_IMPLIES_EXEC across an execve() since this is the behaviour on * arch/arm/.
*/ #define COMPAT_SET_PERSONALITY(ex) \
({ \
set_thread_flag(TIF_32BIT); \
}) #ifdef CONFIG_COMPAT_VDSO #define COMPAT_ARCH_DLINFO \ do { \ /* \ * Note that we use Elf64_Off instead of elf_addr_t because \ * elf_addr_t in compat is defined as Elf32_Addr and casting \ * current->mm->context.vdso to it triggers a cast warning of \ * cast from pointer to integer of different size. \
*/
NEW_AUX_ENT(AT_SYSINFO_EHDR, \
(Elf64_Off)current->mm->context.vdso); \
} while (0) #else #define COMPAT_ARCH_DLINFO #endif externint aarch32_setup_additional_pages(struct linux_binprm *bprm, int uses_interp); #define compat_arch_setup_additional_pages \
aarch32_setup_additional_pages
#endif/* CONFIG_COMPAT */
struct arch_elf_state { int flags;
};
#define ARM64_ELF_BTI (1 << 0)
#define INIT_ARCH_ELF_STATE { \
.flags = 0, \
}
staticinlineint arch_parse_elf_property(u32 type, constvoid *data,
size_t datasz, bool compat, struct arch_elf_state *arch)
{ /* No known properties for AArch32 yet */ if (IS_ENABLED(CONFIG_COMPAT) && compat) return 0;
if (type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) { const u32 *p = data;
if (datasz != sizeof(*p)) return -ENOEXEC;
if (system_supports_bti() &&
(*p & GNU_PROPERTY_AARCH64_FEATURE_1_BTI))
arch->flags |= ARM64_ELF_BTI;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.