Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1235595
| From | Yury Norov <ynorov@caviumnetworks.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v5 16/23] arm64: add support for starting ILP32 (ELFCLASS32) binaries |
| Date | 2015-09-30 00:20 +0200 |
| Message-ID | <qebpE-2HP-33@gated-at.bofh.it> (permalink) |
| References | <qebpD-2HP-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Andrew Pinski <apinski@cavium.com>
Handle ILP32 (AArch64, but ELFCLASS32) binaries on ARM64.
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h
index d4d53c91a..9a854f9 100644
--- a/arch/arm64/include/asm/elf.h
+++ b/arch/arm64/include/asm/elf.h
@@ -134,7 +134,11 @@ typedef struct user_fpsimd_state elf_fpregset_t;
*/
#define ELF_PLAT_INIT(_r, load_addr) (_r)->regs[0] = 0
-#define SET_PERSONALITY(ex) clear_thread_flag(TIF_32BIT);
+#define SET_PERSONALITY(ex) \
+do { \
+ clear_thread_flag(TIF_32BIT_AARCH64); \
+ clear_thread_flag(TIF_32BIT); \
+} while (0)
#define ARCH_DLINFO \
do { \
@@ -167,6 +171,9 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
#define COMPAT_ELF_ET_DYN_BASE (2 * TASK_SIZE_32 / 3)
+extern int aarch32_setup_vectors_page(struct linux_binprm *bprm,
+ int uses_interp);
+
#ifdef CONFIG_AARCH32_EL0
/* AArch32 registers. */
@@ -176,27 +183,23 @@ typedef compat_a32_elf_greg_t compat_a32_elf_gregset_t[COMPAT_A32_ELF_NGREG];
/* AArch32 EABI. */
#define EF_ARM_EABI_MASK 0xff000000
-#define compat_elf_check_arch(x) (((x)->e_machine == EM_ARM) && \
+#define compat_a32_elf_check_arch(x) (((x)->e_machine == EM_ARM) && \
((x)->e_flags & EF_ARM_EABI_MASK))
#define compat_start_thread compat_start_thread
-#define COMPAT_SET_PERSONALITY(ex) set_thread_flag(TIF_32BIT);
-#define COMPAT_ARCH_DLINFO
-
-
-extern int aarch32_setup_vectors_page(struct linux_binprm *bprm,
- int uses_interp);
-#define compat_arch_setup_additional_pages \
- aarch32_setup_vectors_page
+#define COMPAT_A32_SET_PERSONALITY(ex) \
+do { \
+ clear_thread_flag(TIF_32BIT_AARCH64); \
+ set_thread_flag(TIF_32BIT); \
+} while (0)
+#define COMPAT_A32_ARCH_DLINFO do {} while (0)
#else
-
typedef elf_greg_t compat_elf_greg_t;
typedef elf_gregset_t compat_elf_gregset_t;
#define compat_a32_elf_check_arch(x) 0
-#define COMPAT_SET_PERSONALITY(ex)
-#define COMPAT_ARCH_DLINFO
-
+#define COMPAT_A32_SET_PERSONALITY(ex) do {} while (0)
+#define COMPAT_A32_ARCH_DLINFO do {} while (0)
#endif
/* If ILP32 is turned on, we want to define the compat_elf_greg_t to the non compat
@@ -217,7 +220,46 @@ typedef compat_a32_elf_greg_t compat_elf_greg_t;
typedef compat_a32_elf_gregset_t compat_elf_gregset_t;
#endif
-#define compat_elf_check_arch(x) compat_a32_elf_check_arch(x)
+#ifdef CONFIG_ARM64_ILP32
+#define compat_ilp32_elf_check_arch(x) ((x)->e_machine == EM_AARCH64)
+#define COMPAT_ILP32_SET_PERSONALITY(ex) \
+do { \
+ set_thread_flag(TIF_32BIT_AARCH64); \
+ clear_thread_flag(TIF_32BIT); \
+} while (0)
+#define COMPAT_ILP32_ARCH_DLINFO \
+do { \
+ NEW_AUX_ENT(AT_SYSINFO_EHDR, \
+ (elf_addr_t)(long)current->mm->context.vdso); \
+} while (0)
+#else
+#define compat_ilp32_elf_check_arch(x) 0
+#define COMPAT_ILP32_SET_PERSONALITY(ex) do {} while (0)
+#define COMPAT_ILP32_ARCH_DLINFO do {} while (0)
+#endif
+
+#define compat_elf_check_arch(x) (compat_a32_elf_check_arch(x) || compat_ilp32_elf_check_arch(x))
+#define COMPAT_SET_PERSONALITY(ex) \
+do { \
+ if (compat_a32_elf_check_arch(&ex)) \
+ COMPAT_A32_SET_PERSONALITY(ex); \
+ else \
+ COMPAT_ILP32_SET_PERSONALITY(ex); \
+} while (0)
+
+/* ILP32 uses the "LP64-like" vdso pages */
+#define compat_arch_setup_additional_pages \
+ (is_a32_compat_task() \
+ ? &aarch32_setup_vectors_page \
+ : &(arch_setup_additional_pages))
+
+#define COMPAT_ARCH_DLINFO \
+do { \
+ if (is_a32_compat_task()) \
+ COMPAT_A32_ARCH_DLINFO; \
+ else \
+ COMPAT_ILP32_ARCH_DLINFO; \
+} while (0)
#endif /* CONFIG_COMPAT */
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index 26352a6..b239b9b 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -107,6 +107,14 @@ int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp)
return PTR_ERR_OR_ZERO(ret);
}
+#else
+int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp)
+{
+ (void) bprm;
+ (void) uses_interp;
+
+ return -EINVAL;
+}
#endif /* CONFIG_AARCH32_EL0 */
static struct vm_special_mapping vdso_spec[2];
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v5 00/23] ILP32 for ARM64 Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:20 +0200
[PATCH v5 08/23] arm64:ilp32: use 64bit syscall-names for ILP32 when passing 64bit registers Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:20 +0200
[PATCH v5 17/23] arm64:ilp32: add vdso-ilp32 and use for signal return Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:20 +0200
Re: [PATCH v5 17/23] arm64:ilp32: add vdso-ilp32 and use for signal return Nathan Lynch <Nathan_Lynch@mentor.com> - 2015-09-30 06:10 +0200
Re: [PATCH v5 17/23] arm64:ilp32: add vdso-ilp32 and use for signal return Yury Norov <ynorov@caviumnetworks.com> - 2015-10-01 21:50 +0200
Re: [PATCH v5 17/23] arm64:ilp32: add vdso-ilp32 and use for signal return "Dr. Philipp Tomsich" <philipp.tomsich@theobroma-systems.com> - 2015-10-01 22:40 +0200
[PATCH v5 09/23] arm64:ilp32: use non-compat syscall names for ILP32 as for LP64 Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:20 +0200
[PATCH v5 23/23] arm64:ilp32: add ARM64_ILP32 to Kconfig Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:20 +0200
[PATCH v5 13/23] arm64:ilp32: share HWCAP between LP64 and ILP32 Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:20 +0200
[PATCH v5 04/23] arm64: change some CONFIG_COMPAT over to use CONFIG_AARCH32_EL0 instead Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:20 +0200
Re: [PATCH v5 04/23] arm64: change some CONFIG_COMPAT over to use CONFIG_AARCH32_EL0 instead kbuild test robot <lkp@intel.com> - 2015-09-30 05:40 +0200
[PATCH v5 02/23] arm64: ensure the kernel is compiled for LP64 Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:20 +0200
[PATCH v5 16/23] arm64: add support for starting ILP32 (ELFCLASS32) binaries Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:20 +0200
[PATCH v5 15/23] arm64:ilp32: support core dump generation for ILP32 Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:20 +0200
[PATCH v5 05/23] arm64:ilp32: expose 'kernel_long' as 'long long' for ILP32 Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:20 +0200
[PATCH v5 10/23] arm64: introduce is_a32_task and is_a32_thread (for AArch32 compat) Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:20 +0200
Re: [PATCH v5 10/23] arm64: introduce is_a32_task and is_a32_thread (for AArch32 compat) kbuild test robot <lkp@intel.com> - 2015-09-30 05:50 +0200
[PATCH v5 22/23] aarch64: ilp32: msgrcv, msgsnd handlers Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:30 +0200
[PATCH v5 20/23] arm64:ilp32: use the native siginfo instead of the compat siginfo Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:30 +0200
[PATCH v5 07/23] arm64:ilp32: share signal structures between ILP32 and LP64 ABIs Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:30 +0200
[PATCH v5 19/23] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:30 +0200
[PATCH v5 21/23] arm64:ilp32: change COMPAT_ELF_PLATFORM to report a a subplatform for ILP32 Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:30 +0200
[PATCH v5 18/23] ptrace: Allow compat to use the native siginfo Yury Norov <ynorov@caviumnetworks.com> - 2015-09-30 00:30 +0200
Re: [PATCH v5 00/23] ILP32 for ARM64 Catalin Marinas <catalin.marinas@arm.com> - 2015-09-30 12:20 +0200
Re: [PATCH v5 00/23] ILP32 for ARM64 Mark Brown <broonie@kernel.org> - 2015-09-30 18:50 +0200
Re: [PATCH v5 00/23] ILP32 for ARM64 Catalin Marinas <catalin.marinas@arm.com> - 2015-10-01 13:20 +0200
Re: [PATCH v5 00/23] ILP32 for ARM64 Mark Brown <broonie@kernel.org> - 2015-10-01 13:40 +0200
Re: [PATCH v5 00/23] ILP32 for ARM64 Andrey Konovalov <andrey.konovalov@linaro.org> - 2015-10-01 18:50 +0200
Re: [PATCH v5 00/23] ILP32 for ARM64 Yury Norov <ynorov@caviumnetworks.com> - 2015-10-01 21:40 +0200
Re: [PATCH v5 00/23] ILP32 for ARM64 Yury Norov <ynorov@caviumnetworks.com> - 2015-10-01 21:20 +0200
Re: [PATCH v5 00/23] ILP32 for ARM64 Arnd Bergmann <arnd@arndb.de> - 2015-10-01 23:30 +0200
Re: [PATCH v5 00/23] ILP32 for ARM64 "Pinski, Andrew" <Andrew.Pinski@caviumnetworks.com> - 2015-10-01 23:50 +0200
Re: [PATCH v5 00/23] ILP32 for ARM64 Catalin Marinas <catalin.marinas@arm.com> - 2015-10-02 11:40 +0200
Re: [PATCH v5 00/23] ILP32 for ARM64 "Kapoor, Prasun" <Prasun.Kapoor@caviumnetworks.com> - 2015-10-03 05:00 +0200
Re: [PATCH v5 00/23] ILP32 for ARM64 Catalin Marinas <catalin.marinas@arm.com> - 2015-10-05 18:00 +0200
Re: [PATCH v5 00/23] ILP32 for ARM64 "Pinski, Andrew" <Andrew.Pinski@caviumnetworks.com> - 2015-10-05 23:10 +0200
Re: [PATCH v5 00/23] ILP32 for ARM64 Yury Norov <ynorov@caviumnetworks.com> - 2015-10-05 21:20 +0200
csiph-web