Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753074AbdFSPxG (ORCPT ); Mon, 19 Jun 2017 11:53:06 -0400 Received: from mail-sn1nam01on0044.outbound.protection.outlook.com ([104.47.32.44]:43309 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752462AbdFSPxA (ORCPT ); Mon, 19 Jun 2017 11:53:00 -0400 Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=caviumnetworks.com; From: Yury Norov To: Catalin Marinas , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: Yury Norov , Adam Borowski , Andreas Schwab , Andrew Pinski , Bamvor Zhangjian , Chris Metcalf , Chris Metcalf , Florian Weimer , Heiko Carstens , James Hogan , James Morse , Joseph Myers , Maxim Kuvyrkov , Nathan_Lynch@mentor.com, Prasun.Kapoor@caviumnetworks.com, Ramana Radhakrishnan , Steve Ellcey , Alexander Graf , Mark Brown , christoph.muellner@theobroma-systems.com, davem@davemloft.net, Geert Uytterhoeven , Alexey Klimov , linyongting@huawei.com, manuel.montezelo@gmail.com, philipp.tomsich@theobroma-systems.com, schwidefsky@de.ibm.com, szabolcs.nagy@arm.com, zhouchengming1@huawei.com, Bamvor Jian Zhang Subject: [PATCH 12/20] arm64: ilp32: introduce binfmt_ilp32.c Date: Mon, 19 Jun 2017 18:49:55 +0300 Message-Id: <20170619155003.13218-13-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170619155003.13218-1-ynorov@caviumnetworks.com> References: <20170619155003.13218-1-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [85.253.137.34] X-ClientProxiedBy: VI1P190CA0022.EURP190.PROD.OUTLOOK.COM (10.165.188.163) To BY1PR0701MB1864.namprd07.prod.outlook.com (10.162.143.146) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9962ca2e-a063-40e2-bfae-08d4b72b3aca X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:BY1PR0701MB1864; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0701MB1864;3:ILovznBKgCx/hmi+lK1mOnzbF8nGBVpAAjNLrUwrZf8BtbohYnlEmDtIiaNhruTdggzbTSi8emhcisuKMsj6wlneeEyzFVSQr6eoRufHeu8MELpQueMUSqKLqxq9mrALfLb4Ur3ouqin1BuYPax67YKFdV0aQjzJ/z9K+dnrhidiqV0W98IYo7ueD3F027OfkGdy/B/zgF0aJl2hhoV5H38DIc4Fhq2Y89DCMDNiNjcxGwymnCZOoBf4KdlEBrPLttO//1IdRWUQfkSqIgGDi6SoqsbAZEOJu7dizkXTs5Qpga5FY5GlD5OVJme7sfWyVUbypG8gUVAqgKQ57iRDfQ==;25:A5/JprNsNzsyKzFFb1Q4Lm5yvSkIALbwOM4cr+4DmDqQ60qkn4LefkwVikSzNq3M2lg8UqEXIrrQNtaMy4/PIDUjHd0eojOc1+9oDOPUyV7P2agFKfKtx1AQx8OqQZrXBXhTIK7lxbmEpgawartFXs47494qIL+KMLYCQLu2tVkK7VmAJa/4StZdJAz7k26ZJ+rDJXkahSKgho4znieP6eXSXB7g7jGwBvzyAOKdjb/RTylhqwDP9ukMnfpawwhUwMnB6c7CFzrICnL6C1eeHRLQEOoGaT2ZNdxV8zMHqZ+rS5vzdCv8KRGIVbqYde313Y7qnkieXiSvbcrqzIwVzRPIc4Epd3f8K5w8V9gzBifIZK1d72lq81ED+fHNu7A2Fds++cCwGprqPjf5EbmkEWkdWTKhaW4dWTgAkKlirs4mX4nGwlZa46R+FyQ+dISYts1nz4kNdMXBVAERN5AsrPB6t+3jCAwrHiTbbv+EMOk= X-MS-TrafficTypeDiagnostic: BY1PR0701MB1864: X-Microsoft-Exchange-Diagnostics: 1;BY1PR0701MB1864;31:jIo2fu1HWKcquCmkGCB/vyTd9hJt5SdQiYxFi+0liub535RJKmJCPCeFOkcx3Q9oiuYopXW2GX+GL6zfTsNYuoGvliNJR4CGT8i9kp6byzq9mSmlqe9J9fgm9NjTno4v4QyoypXnbrqqTuIYNUz2lU1lPhnAiMSTjS2eE59a7K8XGoGXP4PjHUV53TOJcv6Cab4iWxob0g2wstdE2gS7HYiW1PlPE8usUhXPFScYDRY=;20:qVpqqaXRtwMrzTqgfx8GVmXb7vntuIRhL1b8+OQWOKP/5jpCXUjYoSni84NJExEpiMV/PwP47P+D6QM7278Ortx45e1/InJw1oQHlr4b6oAcwBXpvqZhPN+IocWLoJxChliEFFTIXGvkm7kHruh9VwLz3oyMVwU6kRvEKcXeKsdBpCW0cXX3J7gXWbJSEw72lAJFEtPLr01xgAjfCNzlX86Rrji0WGa935ZCb/kOMinunwRc21ugnNpULYl3iOxXOHcDWDzPTpjO+b7lS8/dq68iJx9brNjelJtIi3LH/zXsZTepau7E+4D+6ToBxu7SHKWxhkYu2RAJmj2ZJx2obbI+PZ5aVunvEhCD+OZSlMcoxzTKytZ5YQ8/zwVaCeoBgTIGRm9lum7+uL5kPnGW289in60pCz0ZSKlAdGxAnclMK9OQbtLsvjQVtlemrwVgQ2jMMSkIKLid7ju41rEXhGhQ7YQzfI3PNUX0gZsPxXlzjcm2rNPk0RJaxRgrZljhu9wkEuGuI2SYZtuICAZbqCZAVZ+AopXX/sdOwrWxsm7/SPiOXCpiPFxaEMi33HGORZPQX1KLYA+3ZMcziIppa7tJoznxM/NadQmOwo/tKdo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(10201501046)(93006095)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(20161123558100)(20161123560025)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BY1PR0701MB1864;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BY1PR0701MB1864; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY1PR0701MB1864;4:kV2rO56/LVerPOyRwy9lL41iNRY5sCkWid803AzG?= =?us-ascii?Q?TagZmYvUAaoTYcTmTWfWGqMbUEMmSemZNXym5JVjXumrGtzTBon1Oq2tcJ5n?= =?us-ascii?Q?muMm7HEK2aaEqtPPv8+N+5byZHXsn3LuM83ANC8QQjTUgkPJyzKZM9Z+E/eM?= =?us-ascii?Q?T6VwibRc8Gm/9aCQtERTnm9vmnoubAVvJwuptF2rQtes2Cz3TcOLne6t/VWJ?= =?us-ascii?Q?FlTHXLYfPPAnnbVD1N9y+4XNFhEuIWoq0UZ1xbDTwqvjxJ+kfJyiFeFGLBEI?= =?us-ascii?Q?CqLA32w7penOKAadtV+8Lq1daHrYnDxvIrkbAhzFWqeJ2uEWGLL6cEYNOna2?= =?us-ascii?Q?WetFIJOPfiOT0ox/4oc0pHvFOGg3M0Err16zmU30+KdyYsd/21SfEhQDeCfd?= =?us-ascii?Q?xhlEANr2If/P9S75tUNtBQS0w95mXfR9wrqSxv1zAKFdEjfr71naiSG++JDG?= =?us-ascii?Q?6QvW7yZiaQ0E4WCyTRwUECdKNaPfPN4xUjymsDzBePIM3Q7jSxSyeLW2+/+i?= =?us-ascii?Q?vHqDeZzXjkQDNiVKUS8sQDuf1RvJm61V5aYMFKv5va2PmniNKZxdLxtwHhth?= =?us-ascii?Q?4bcmugVG06/B3PUOliNMpTMdJyedZgRiTeN6d4kqP0Ig8f76irmT/u964K7G?= =?us-ascii?Q?7GYylGS3FMjSECES/czEHE5b9k4aOeUxfc6REX8v8+jPhFqkvpGfrecUSkvo?= =?us-ascii?Q?26m8wBJMo5Ql2h3ypEw4lYMc7/5kYlVJ7gkneJx9gl61HQzmZzS+vtbszls9?= =?us-ascii?Q?M9O+Dcqow0CuM+us0P4CGvNn4srrPcmVVJFJkX77ZI/d97/jLCJPnkGb1wyW?= =?us-ascii?Q?Rn6jzFKKKphjlIyvJ7pT+t90yAF+3EVcjwC5WRrQxPo4AFn8M4PykppBv3o0?= =?us-ascii?Q?TbdDbgHdw3tLpwY1oO573Fseek4C4dGZCobvKHzTkrvCh5RfkbVTAdxVZEde?= =?us-ascii?Q?ec3NNqsSWr36zEqKgO7P/F1fbmb8wOdVJ8tLUOzFJwOxeX/Oye1KASnX9Bvv?= =?us-ascii?Q?XJ2z+FvFPFA8Xkpea+391rIbdZ22V/fKJZDSOBJdV1qVuOqsx0eZLxt/wB1C?= =?us-ascii?Q?49MxD/PtDEVFWX8yFOnMOlZdJh/chQQYeu3OgrYp4r58X1txHSDcin5Pwufh?= =?us-ascii?Q?k76/OUrP1os=3D?= X-Forefront-PRVS: 0343AC1D30 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(6069001)(39840400002)(39450400003)(39850400002)(39410400002)(39400400002)(50226002)(33646002)(7416002)(7406005)(6666003)(5003940100001)(76176999)(305945005)(42882006)(2950100002)(6486002)(8676002)(50986999)(42186005)(7736002)(76506005)(50466002)(5660300001)(81166006)(48376002)(25786009)(54906002)(478600001)(189998001)(66066001)(1076002)(47776003)(72206003)(3846002)(6116002)(36756003)(38730400002)(53936002)(2906002)(6496005);DIR:OUT;SFP:1101;SCL:1;SRVR:BY1PR0701MB1864;H:localhost;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY1PR0701MB1864;23:5A5+Mo5jo32yu3Fl7HFZH8Y2k8CgB4NKIg8SMEW?= =?us-ascii?Q?PHz+AWO7Aa1XZ+fKOpvwDdZ/l2YdH/rKqnlKnu0HgflGyiaektgE1VGUbxFV?=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5yeUjwjkJKAVXpd3oVpEJJHCv?= =?us-ascii?Q?cqbIiHirjK7HNntaSrQfG75TN7nKP/NgJtLzSDptP58MrRpFXKf6wd/JpdGt?= =?us-ascii?Q?YzfFha8trSvwmhatxXYAKyZi27bTgs4MJZmKzgyei0nnQ1W2ckA=3D=3D?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY1PR0701MB1864;6:1v2eFOtvMldd3+XQsyS3W0Ptecjr0bJW2EBfvWKy?= =?us-ascii?Q?H/r7VoEf8koS3ZF68dexK5WvOEbEUmaq3Ocw9MslUFwvU3PEwIQAiUkg9JiN?= =?us-ascii?Q?FhzMcjyVyleO+MrSB5jwjWsPc/GE49Z8pCys+fYzgClg+3lLeW1UGThy7eob?= =?us-ascii?Q?RL7num4Q2oqG1FJ0qMrMVVHwumMfdXKRuXDb3R3zZR2wqUtm3yAU+oHQJZsk?= =?us-ascii?Q?gm7+L6VrFlWT0UzgluYFafGpzdlp7lz+MN8kN710yYt3VMlkGKP3iJT8RG9X?= =?us-ascii?Q?v800gY9qEQfpJWYggh7v7srpq2XNIKIfBaCO4KY3cItBdlsxUqgCmjF5RewU?= =?us-ascii?Q?2vbw3Gh0ThL8YVNMDWEtnZ5+SVeiODU51ld5auFjKD4V3XzivS6j872NZDCg?= =?us-ascii?Q?blTI9QX1fF1UXW2zEtww0Z5tCpoC2BlL27EiwtBiwntbFlnt57RIt4SOZf1c?= =?us-ascii?Q?jgNJIZXSEG5RODM3dFZkr/4QbouKoGFNuRgfdrH2CxTQpEVx7A8uZBIwIRBU?= =?us-ascii?Q?q+DgQS5TZVy83MVF0P8mWlpPdNIW71kvZWpGmKpqK+Wvw2cqoLzEzSL4Xl+q?= =?us-ascii?Q?cAbk4VUtPQn+WurOrqtJ5A8LigPRDe0YAIMf/qcQfErRymmO8Wyiu4P44og/?= =?us-ascii?Q?7YcWMda4jeTDJ7dBzMsVYJVQS0JJlD8osVEwngqL0UZABEFZSabRoVHOcPj1?= =?us-ascii?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nosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BY1PR0701MB1864;7:uWVGYH0lOns5kFmA/d0dPFLb4U4h1D7FkUGTxH/odOV0gYIJUYefp1z6FSUThGInMXLJjMJm6sbGZETlzHiKToFyfJ4RMKUIedRRdI5UT0UwnyUbbQszXYANsrf3KnjE67KrrYRSGUdTO8hwFb18NVyO9apoOdQdP4Q9Kvp5O2KsdwhMESlPAeP4o+mu7NJYUMH06+x/Jx1WDr75o1n02pXASfRoemkwnuN+wLZuRVg/5I3K9ghWPBa/Y+1NhHr1g3hvPT/cirQpU6DqL/qVGPPj35Aqg/3Kpo3kEPKI75qpBGpCQsnKr1erV6vEJChMiNa5hWTvb+wVOyoGwGQA3ILGzJX8qHIBRjx3fNVReWKtO1tEYYGnAZIOYHtGusojwML6e6UgJipBQFa277ketYfnWGuTQ+Yi86No/QDybrfsfk0euk0Jx6fuRB2bQRNKNOYA0MmplTxNEzuE1dijRAHyaFcwjAoQSKVeQG99Fc9CxLtGp/S53aYOvrI/z0rGwNPCOJ8zg+Sm+Db2bU123OFokYtdvyCwFRQiyub0RUiif3MoByfSfB+pe2qLSADQRqY7llInTQ0do5QVkUjQqz9IPsRMubCCm7o9xbAScyGka/Z75DMtSCglsya+GnUubVqdaEMJN7/RylqUEldYnp7UxJoEN+AVjHnNQPokiGQSNeIFSyAAPZnV6sASRkgeLee+tN0C1JH4Dl0Mwlh0W5Ipcz8KGwGVB/J1JfKDMHdxlr/qV7NUfHgVpINkGCUV8hx2BVIQFVoWQsrzUTrbDfWuRNztnx/Jh8CtNwqbEd0= X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2017 15:52:45.7987 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1864 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3449 Lines: 115 Like binfmt_elf32.c, binfmt_ilp32.c is needed to handle ILP32 binaries. Signed-off-by: Yury Norov Signed-off-by: Bamvor Jian Zhang --- arch/arm64/kernel/Makefile | 1 + arch/arm64/kernel/binfmt_ilp32.c | 85 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 arch/arm64/kernel/binfmt_ilp32.c diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index de6c84702d83..41d9a3ab07a7 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -29,6 +29,7 @@ $(obj)/%.stub.o: $(obj)/%.o FORCE arm64-obj-$(CONFIG_AARCH32_EL0) += sys32.o kuser32.o signal32.o \ sys_compat.o entry32.o binfmt_elf32.o +arm64-obj-$(CONFIG_ARM64_ILP32) += binfmt_ilp32.o arm64-obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o arm64-obj-$(CONFIG_ARM64_MODULE_PLTS) += module-plts.o diff --git a/arch/arm64/kernel/binfmt_ilp32.c b/arch/arm64/kernel/binfmt_ilp32.c new file mode 100644 index 000000000000..bb31325e6f80 --- /dev/null +++ b/arch/arm64/kernel/binfmt_ilp32.c @@ -0,0 +1,85 @@ +/* + * Support for ILP32 Linux/aarch64 ELF binaries. + */ +#undef CONFIG_AARCH32_EL0 +#define compat_elf_gregset_t elf_gregset_t + +#include +#include + +#undef ELF_CLASS +#define ELF_CLASS ELFCLASS32 + +#undef elfhdr +#undef elf_phdr +#undef elf_shdr +#undef elf_note +#undef elf_addr_t +#define elfhdr elf32_hdr +#define elf_phdr elf32_phdr +#define elf_shdr elf32_shdr +#define elf_note elf32_note +#define elf_addr_t Elf32_Addr + +/* + * Some data types as stored in coredump. + */ +#define user_long_t compat_long_t +#define user_siginfo_t compat_siginfo_t +#define copy_siginfo_to_user copy_siginfo_to_user32 + +/* + * The machine-dependent core note format types are defined in elfcore-compat.h, + * which requires asm/elf.h to define compat_elf_gregset_t et al. + */ +#define elf_prstatus compat_elf_prstatus +#define elf_prpsinfo compat_elf_prpsinfo + +/* AARCH64 ILP32 EABI. */ +#undef elf_check_arch +#define elf_check_arch(x) (((x)->e_machine == EM_AARCH64) \ + && (x)->e_ident[EI_CLASS] == ELFCLASS32) + +#undef SET_PERSONALITY +#define SET_PERSONALITY(ex) \ +do { \ + set_bit(TIF_32BIT, ¤t->mm->context.flags); \ + set_thread_flag(TIF_32BIT_AARCH64); \ + clear_thread_flag(TIF_32BIT); \ +} while (0) + +#undef ARCH_DLINFO +#define ARCH_DLINFO \ +do { \ + NEW_AUX_ENT(AT_SYSINFO_EHDR, \ + (elf_addr_t)(long)current->mm->context.vdso); \ +} while (0) + +#undef ELF_PLATFORM +#ifdef __AARCH64EB__ +#define ELF_PLATFORM ("aarch64_be:ilp32") +#else +#define ELF_PLATFORM ("aarch64:ilp32") +#endif + +#undef ELF_ET_DYN_BASE +#define ELF_ET_DYN_BASE COMPAT_ELF_ET_DYN_BASE + +#undef ELF_HWCAP +#undef ELF_HWCAP2 +#define ELF_HWCAP ((u32) elf_hwcap) +#define ELF_HWCAP2 ((u32) (elf_hwcap >> 32)) + +/* + * Rename a few of the symbols that binfmt_elf.c will define. + * These are all local so the names don't really matter, but it + * might make some debugging less confusing not to duplicate them. + */ +#define elf_format compat_elf_format +#define init_elf_binfmt init_compat_elf_binfmt +#define exit_elf_binfmt exit_compat_elf_binfmt + +#undef ns_to_timeval +#define ns_to_timeval ns_to_compat_timeval + +#include "../../../fs/binfmt_elf.c" -- 2.11.0