Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756051AbcLUS5A (ORCPT ); Wed, 21 Dec 2016 13:57:00 -0500 Received: from mail-by2nam01on0088.outbound.protection.outlook.com ([104.47.34.88]:27002 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750795AbcLUS46 (ORCPT ); Wed, 21 Dec 2016 13:56:58 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Date: Thu, 22 Dec 2016 00:26:40 +0530 From: Yury Norov To: Catalin Marinas CC: , , , , , , , , , , , , , , , , , , , , , Bamvor Zhang Jian , , , , , Subject: Re: [PATCH 10/18] arm64: ilp32: introduce binfmt_ilp32.c Message-ID: <20161221185640.GA16562@yury-N73SV> References: <1477081997-4770-1-git-send-email-ynorov@caviumnetworks.com> <1477081997-4770-11-git-send-email-ynorov@caviumnetworks.com> <20161205153801.GE14429@e104818-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20161205153801.GE14429@e104818-lin.cambridge.arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [223.196.245.147] X-ClientProxiedBy: VI1PR0901CA0048.eurprd09.prod.outlook.com (10.167.203.144) To CY1PR07MB2247.namprd07.prod.outlook.com (10.164.112.149) X-MS-Office365-Filtering-Correlation-Id: 32e0cb5b-3044-4b57-4951-08d429d32207 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2247; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2247;3:WZWL8iMdSuk1PQFiLmFSIGhzkrK4V11cktIdMGCY9teYhi2tp6YcDevAx0w+sOh96NoMBBf6WCpVyygAqHvmMCp0xeFeHotgL/Lh+sjaZzgJvYbcmCyQFpk+n2RtBPS6BbnThs6mlagTutWYkzQGaDXvFyKV1l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ABVvA/zGHioq0xHpRftamivIWEbfVI//+X7siTuk0kqV/lM0jRiJ2sgAY2t/alQlH0tJX0VvKyE3MeuNENHEuxPXGGM0Oc8gZwvxu9yhDRPEpCCV/quSsX89tOJ7HUXkGJINgIWQoRM+fKZruHv9ndnUR4fhBLFaxv6Nk06nClpNTN3yuoX/7dbgGqjt02Q1+Ky0w6qLeTNBUfjHjtOZsKMyvoVyoJ1TkF9yo9ZhCmaay9Ye/whgJICyQY9NOHzewNEgyYZCm4DUn3jb7KB+ce4lQWOpDzrkhc+xcnKiSAK40UERlVFLP1b55vkB7N+vK7ctq/NiGjc2hnJyQqsm2+YDOsB4sTL7xJH5jqe4Uj3gXR2EaYEoYPUbcPJjjox8O/IY+u/nKjALDaq8Y4silIiIS4eo0fplJU1Nla6wBokCy7CZKKRutM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123555025)(20161123562025)(20161123564025)(20161123560025)(6072148);SRVR:CY1PR07MB2247;BCL:0;PCL:0;RULEID:;SRVR:CY1PR07MB2247; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2247;4:rXCr/aY20qf6Jkl6qhuJGu+iuQaY1SZXzDasamh4NJ3ttQQtnHZ4g9Yk89FjAXCL/cliVG9+vu2vIA5iiGqxGyi6hh3peHEjJLpkpI2ZCThbqAZYq4JXbASrPDTcEhO4jmazb9i/9dNyHt8DiKTP5T/OCz7IXru4msiJDPD9LzbUZkt55FsSpp+V0hesnAB1FQK5CYu1NKXJHdVMIdu6yUqbzaKzRHLzRrQd8w1f+tkwJyPZOcomDjoMCKo9CmRa51XWcNfMxirzyahX6HmibXQYUnGfrygv0Kqn4iN6CvpHI88jHZJCkkRtlmFzfLtmr3w+yNgA9iNBIpcxCpi8mD7gKclcqpyhpZLMkkTuzMXAHioOIxJiNpIUm01L2nzctS21BlUqWDup164pBZp3bSqN6xtitLJn/07H91hvz8ceLJVH6mMTQRJTkcbobNzhKRfiQW6EVvyQoirN6pVUG15IfbVdG/X4K4Se8FN1eWv4XBfdtayCiqjAsUD5hWgRDI7tYlqfmLVDIrZG4rabS5RGDJjZRg3bXHkyT04AuS3ClyMNrY1eMlpJAU6ZHTVIlu1CC9YSHHhfBAy8L0pQJQ== X-Forefront-PRVS: 01630974C0 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39450400003)(24454002)(189002)(199003)(106356001)(46406003)(66066001)(5660300001)(575784001)(110136003)(9686002)(42186005)(105586002)(229853002)(101416001)(68736007)(47776003)(4001350100001)(97756001)(97736004)(189998001)(33656002)(76506005)(92566002)(6486002)(50466002)(23726003)(81166006)(81156014)(2906002)(4326007)(1076002)(38730400001)(7416002)(6116002)(6916009)(8676002)(7736002)(33716001)(3846002)(305945005)(54356999)(76176999)(50986999)(6496003)(6666003)(39060400001)(2950100002)(25786008)(83506001)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2247;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR07MB2247;23:NQ9HZJQVgVshv0A72+oqZziDgHOSjHkhxppKtjCL9?= =?us-ascii?Q?gReeS4iyNLikiXUAaAUMEs1pxj+rTDrdriGnQKUTvR7w2H04CPgqGAnsh1Nv?= =?us-ascii?Q?isknVb6tm9ijMhp1FRXwVX3+wgn+DDslUJUJcVw99Y5UH0h3/0nJLUVr69ff?= =?us-ascii?Q?1NzTsn+LEaqqenzhVthUi8AGnmqBMn3J63mvcJsbrZznaus7x9dnT+6iV7l/?= =?us-ascii?Q?CcAEC3iow+oXGB1KhAEeZZwCf0/fMXoGQeTPw6qHR+35Jli69dpSWmSB2UvR?= =?us-ascii?Q?hZf2AUmC3ifP06bQkok4d6CBO7Z/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LHCCtBLDNqGflTp0UdDtDmfZCWdEdOZYmVlZtgCUC9QMWK6r1Pa91zUSFHrdeSiYAo8vaZgFYPm7eTonl3REdiRHo3abk+3j0jJQeu9g6L02HnPoZt8O7emhsVEiOPy7zECi7RlUDR702KF15iFsZ3LHXDAW2JuI7fxOAWWQwYZ7cscfzGL04+UIXldKprf9FCQYvQX9eqU69bG7o05Kg3f7Q+iA/zPRc+yIKhUYWFTgd3Yx/Q6S3YvkFeHb3mdoN+iumQoFgbQDxUJeli+mKupibbDipEJRc5YNa3nmGDBMfaYxO7n3ke1jiLrHHgL9Y9SxMufC/GlXbW8feF7mKyBw4LbMvA4tuH3DU97EHhB71IkOyBRS1zXkBfSkAlcRWVW2iQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2016 18:56:54.3707 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2247 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4127 Lines: 119 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 > > Signed-off-by: Bamvor Zhang Jian > > --- > > 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 #include