lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161221185640.GA16562@yury-N73SV>
Date:   Thu, 22 Dec 2016 00:26:40 +0530
From:   Yury Norov <ynorov@...iumnetworks.com>
To:     Catalin Marinas <catalin.marinas@....com>
CC:     <arnd@...db.de>, <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <linux-doc@...r.kernel.org>,
        <linux-arch@...r.kernel.org>, <szabolcs.nagy@....com>,
        <heiko.carstens@...ibm.com>, <cmetcalf@...hip.com>,
        <philipp.tomsich@...obroma-systems.com>, <joseph@...esourcery.com>,
        <zhouchengming1@...wei.com>, <Prasun.Kapoor@...iumnetworks.com>,
        <agraf@...e.de>, <geert@...ux-m68k.org>, <kilobyte@...band.pl>,
        <manuel.montezelo@...il.com>, <pinskia@...il.com>,
        <linyongting@...wei.com>, <klimov.linux@...il.com>,
        <broonie@...nel.org>, <bamvor.zhangjian@...wei.com>,
        Bamvor Zhang Jian <bamvor.zhangjian@...aro.org>,
        <maxim.kuvyrkov@...aro.org>, <Nathan_Lynch@...tor.com>,
        <schwidefsky@...ibm.com>, <davem@...emloft.net>,
        <christoph.muellner@...obroma-systems.com>
Subject: Re: [PATCH 10/18] arm64: ilp32: introduce binfmt_ilp32.c

On Mon, Dec 05, 2016 at 03:38:01PM +0000, Catalin Marinas wrote:
> On Fri, Oct 21, 2016 at 11:33:09PM +0300, Yury Norov wrote:
> > binfmt_ilp32.c is needed to handle ILP32 binaries
> > 
> > Signed-off-by: Yury Norov <ynorov@...iumnetworks.com>
> > Signed-off-by: Bamvor Zhang Jian <bamvor.zhangjian@...aro.org>
> > ---
> >  arch/arm64/include/asm/elf.h     |  6 +++
> >  arch/arm64/kernel/Makefile       |  1 +
> >  arch/arm64/kernel/binfmt_ilp32.c | 97 ++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 104 insertions(+)
> >  create mode 100644 arch/arm64/kernel/binfmt_ilp32.c
> > 
> > diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h
> > index f259fe8..be29dde 100644
> > --- a/arch/arm64/include/asm/elf.h
> > +++ b/arch/arm64/include/asm/elf.h
> > @@ -175,10 +175,16 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
> >  
> >  #define COMPAT_ELF_ET_DYN_BASE		(2 * TASK_SIZE_32 / 3)
> >  
> > +#ifndef USE_AARCH64_GREG
> >  /* AArch32 registers. */
> >  #define COMPAT_ELF_NGREG		18
> >  typedef unsigned int			compat_elf_greg_t;
> >  typedef compat_elf_greg_t		compat_elf_gregset_t[COMPAT_ELF_NGREG];
> > +#else /* AArch64 registers for AARCH64/ILP32 */
> > +#define COMPAT_ELF_NGREG	ELF_NGREG
> > +#define compat_elf_greg_t	elf_greg_t
> > +#define compat_elf_gregset_t	elf_gregset_t
> > +#endif
> 
> I think you only need compat_elf_gregset_t definition here and leave the
> other two undefined.

I checked everything here again, and found that almost all compat defines
may be moved to corresponding binfmt files. If everything is OK, I'll
incorporate next patch to the series

Yury

--
diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h
index abb75f5..76f0a5c 100644
--- a/arch/arm64/include/asm/elf.h
+++ b/arch/arm64/include/asm/elf.h
@@ -176,30 +176,10 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
 
 #define COMPAT_ELF_ET_DYN_BASE		(2 * TASK_SIZE_32 / 3)
 
-#ifndef USE_AARCH64_GREG
 /* AArch32 registers. */
 #define COMPAT_ELF_NGREG		18
 typedef unsigned int			compat_elf_greg_t;
 typedef compat_elf_greg_t		compat_elf_gregset_t[COMPAT_ELF_NGREG];
-#else /* AArch64 registers for AARCH64/ILP32 */
-#define COMPAT_ELF_NGREG	ELF_NGREG
-#define compat_elf_greg_t	elf_greg_t
-#define compat_elf_gregset_t	elf_gregset_t
-#endif
-
-/* AArch32 EABI. */
-#define EF_ARM_EABI_MASK		0xff000000
-#define compat_elf_check_arch(x)	(system_supports_32bit_el0() && \
-					 ((x)->e_machine == EM_ARM) && \
-					 ((x)->e_flags & EF_ARM_EABI_MASK))
-
-#define compat_start_thread		compat_start_thread
-#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
-
 #endif /* CONFIG_COMPAT */
 
 #endif /* !__ASSEMBLY__ */
diff --git a/arch/arm64/kernel/binfmt_elf32.c b/arch/arm64/kernel/binfmt_elf32.c
index 99a4cf2..7c38a22 100644
--- a/arch/arm64/kernel/binfmt_elf32.c
+++ b/arch/arm64/kernel/binfmt_elf32.c
@@ -17,16 +17,16 @@
 #define COMPAT_ELF_HWCAP		(compat_elf_hwcap)
 #define COMPAT_ELF_HWCAP2		(compat_elf_hwcap2)
 
-#ifdef __AARCH64EB__
-#define COMPAT_ELF_PLATFORM		("v8b")
-#else
-#define COMPAT_ELF_PLATFORM		("v8l")
-#endif
-
 #define compat_arch_setup_additional_pages \
 					aarch32_setup_vectors_page
 struct linux_binprm;
 extern int aarch32_setup_vectors_page(struct linux_binprm *bprm,
 				      int uses_interp);
 
+/* AArch32 EABI. */
+#define compat_elf_check_arch(x)	(system_supports_32bit_el0() && \
+					 ((x)->e_machine == EM_ARM) && \
+					 ((x)->e_flags & EF_ARM_EABI_MASK))
+
+
 #include "../../../fs/compat_binfmt_elf.c"
diff --git a/arch/arm64/kernel/binfmt_ilp32.c b/arch/arm64/kernel/binfmt_ilp32.c
index dd62467..ec4a412 100644
--- a/arch/arm64/kernel/binfmt_ilp32.c
+++ b/arch/arm64/kernel/binfmt_ilp32.c
@@ -1,7 +1,9 @@
 /*
  * Support for ILP32 Linux/aarch64 ELF binaries.
  */
-#define USE_AARCH64_GREG
+
+#undef compat_elf_gregset_t
+#define compat_elf_gregset_t	elf_gregset_t
 
 #include <linux/elfcore-compat.h>
 #include <linux/time.h>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ