]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ARM: add ELF_FDPIC support
authorNicolas Pitre <nicolas.pitre@linaro.org>
Sat, 22 Jul 2017 05:02:40 +0000 (01:02 -0400)
committerNicolas Pitre <nicolas.pitre@linaro.org>
Sun, 10 Sep 2017 23:31:46 +0000 (19:31 -0400)
This includes the necessary code to recognise the FDPIC format on ARM
and the ptrace command definitions used by the common ptrace code.

Based on patches originally from Mickael Guene <mickael.guene@st.com>.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Mickael GUENE <mickael.guene@st.com>
Tested-by: Vincent Abriou <vincent.abriou@st.com>
Tested-by: Andras Szemzo <szemzo.andras@gmail.com>
arch/arm/include/asm/elf.h
arch/arm/include/asm/mmu.h
arch/arm/include/uapi/asm/ptrace.h
fs/Kconfig.binfmt

index e2786acf8202e92b5c57233e3ff975473669e280..ad0ca4f2ba13091d1e61e75951ce180177b8c56e 100644 (file)
@@ -100,6 +100,11 @@ struct elf32_hdr;
 extern int elf_check_arch(const struct elf32_hdr *);
 #define elf_check_arch elf_check_arch
 
+#define ELFOSABI_ARM_FDPIC  65 /* ARM FDPIC platform */
+#define elf_check_fdpic(x)  ((x)->e_ident[EI_OSABI] == ELFOSABI_ARM_FDPIC)
+#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)
 
 extern int arm_elf_read_implies_exec(int);
@@ -120,6 +125,13 @@ int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs);
    have no such handler.  */
 #define ELF_PLAT_INIT(_r, load_addr)   (_r)->ARM_r0 = 0
 
+#define ELF_FDPIC_PLAT_INIT(_r, _exec_map_addr, _interp_map_addr, dynamic_addr) \
+       do { \
+               (_r)->ARM_r7 = _exec_map_addr; \
+               (_r)->ARM_r8 = _interp_map_addr; \
+               (_r)->ARM_r9 = dynamic_addr; \
+       } while(0)
+
 extern void elf_set_personality(const struct elf32_hdr *);
 #define SET_PERSONALITY(ex)    elf_set_personality(&(ex))
 
index a5b47421059dc34153f7450a1cc7d2baf21200b5..e0eb16680a5bd448cc1bc2e53bfcd7b24fae71fc 100644 (file)
@@ -33,6 +33,10 @@ typedef struct {
  */
 typedef struct {
        unsigned long   end_brk;
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+       unsigned long   exec_fdpic_loadmap;
+       unsigned long   interp_fdpic_loadmap;
+#endif
 } mm_context_t;
 
 #endif
index 5af0ed1b825a2aa95dc0626c9e1a685924979e24..3173eb9751fd27b0291ec5bcaa7567f9a2ca62c0 100644 (file)
 #define PTRACE_SETVFPREGS      28
 #define PTRACE_GETHBPREGS      29
 #define PTRACE_SETHBPREGS      30
+#define PTRACE_GETFDPIC                31
+
+#define PTRACE_GETFDPIC_EXEC   0
+#define PTRACE_GETFDPIC_INTERP 1
 
 /*
  * PSR bits
index b2f82cf6bf86826050038af029e8bd311f6555a7..6ef70ce8e976de99979ed96c70ea9e54d0fbd820 100644 (file)
@@ -35,7 +35,7 @@ config ARCH_BINFMT_ELF_STATE
 config BINFMT_ELF_FDPIC
        bool "Kernel support for FDPIC ELF binaries"
        default y
-       depends on (FRV || BLACKFIN || (SUPERH32 && !MMU) || C6X)
+       depends on ((ARM && !MMU) || FRV || BLACKFIN || (SUPERH32 && !MMU) || C6X)
        select ELFCORE
        help
          ELF FDPIC binaries are based on ELF, but allow the individual load