Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753840AbdFSPwt (ORCPT ); Mon, 19 Jun 2017 11:52:49 -0400 Received: from mail-dm3nam03on0057.outbound.protection.outlook.com ([104.47.41.57]:46891 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752637AbdFSPwp (ORCPT ); Mon, 19 Jun 2017 11:52:45 -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 Subject: [PATCH 11/20] arm64: introduce binfmt_elf32.c Date: Mon, 19 Jun 2017 18:49:54 +0300 Message-Id: <20170619155003.13218-12-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: VI1P190CA0006.EURP190.PROD.OUTLOOK.COM (10.165.188.147) To SN1PR0701MB1870.namprd07.prod.outlook.com (10.162.100.20) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PR0701MB1870: X-MS-Office365-Filtering-Correlation-Id: 992fbadc-61f2-4499-def4-08d4b72b3431 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:SN1PR0701MB1870; X-Microsoft-Exchange-Diagnostics: 1;SN1PR0701MB1870;3:QhcVuQBnlv7RLFq8/bAOndI4fVqzjghmBEcgZ8aqAWgoJqFJTFg3YTXt/lsuD9v0/ZDMlY5CKHNdGjqHVTzbkVbquznt48toZxvckXqQ7yixlZrp786EV2shXTpDAU4fCgjvJTfA6KlKi4AuS30Q5RTuSD3axwE5fiWhyz1eqINruDxcr6P6QsJSndTjwAta+c58nqQOEkg1j0gGZupFuQKz7g8leNWF+1MnH9FhPM3Nz69T6OyU4iPxiQvo64dWDmOn9+U9SuT5LeL/8156A/wSWMxU6s0UDXJXuHf20T4Z3fFzGy6EwKiSczeiXjhyuPqzePpwRyy76XsshQfMWQ==;25:2a40/akSlDpVgbLalhwcMoMQlEuMmHQlF/pKUy1z5SiiY+cMaYTVPmTv3eelVeGDcPw8uNBdODWir9/OneFg17hKuZT1ygtSQwuUI2vlUApkTJdlgMgW9c4hFB9GET09N08mWbc6bIVrQW4njSZrjXaawVdUxIn1iBtYL2BgLUmE2eqwILvR8xA9BDil8nFXeKFX/6PySqa0/UuU8Bml7hbmJn1WPB+B5C3qxNaYYmHjNceBCrEZ6jxd83CddNhL3iK7j2BeEoocR2kNKAlC/JDU36Vaz2JrSg5kEebqA2CIIL/cmEQZcpvmQd7wM6kjJc5qMWUmNTkH8XkmxfXysxebN8cZ5e/iOLvTYP2VZX4bDvkOlMSesL+8P58sLJKaf2UR+UTI+pDaudyYPf5UZ1lwvGygQ+zVuUjR1vXmLMqRERIcq0tbkds75FtFUQ4HkmHJnGq+hSDwvuJfnjh1WkihAPHD0gsFjibyTiNI1J8= X-Microsoft-Exchange-Diagnostics: 1;SN1PR0701MB1870;31:a2vQTMZ5FtkJ5TAO6F2FzWL7cEy4sG2Rz6ppqGavxKh/62f95pMKPSzpjWSl3ZWBmSSAvqttbDBfi/gNX7wulS95ZwSfP5jG6ittpsBDVDlyA+0LdEUu1zLyKi3blYw0GlWFgqa6n+nq5sV6LxOdyfFWiruov+aBgbpnRuq7IRAqINJ8fxsdQiQ5fXEbVIFB73qm56oIR+jxz6UG0P7qwPnJhAM7I8+1uEWOG6WApCA=;20:ONcpCi/O5nNlStGTHm2T7U7xsf+wNeghebMJPKxG3epJIq8/gDH6BaH8IftN5kh4qzU2OFz/yxSN8RNuqTBh8NZYjNUz9yiHVQC14BWRIMwIJTT5WhbPUYhBQ8p3DCCfIkba63KcpbJrM53kur9p3Qct6moLCvwB2rmgm4L340dzBpYPYx7l2VeUmMvtUG+aHanZ8DV+YsuQAyQsZjnNRLD4G1ZQfxda6XSprg336YnecEFdSEoozxhhEbG/AbRM2TcqUAoV+CQN6ehw9l/Jlldn+BYgxBnEMyJTx1Lr7yGlo2uxhUkyu3Xx5wfVsFofkjFt5GzVDMomAFPaPVNlkFclLBiy84/TOU11NA5ibvbR6iUXGVZJVjdZ4EKrjn+66CR9baoXlU1ClXYwHtTLW+Yhmh5dxHEYIgCo7rjE83J77HDYU9wCwjpbqzbGZhEuWU+T8fR2D5K0TGjYiVogiWqIGfQKzygUvsykmXaGohSFfmkSFw/5HgYbFRSO2ZyK5HWWloENYiRcov0sXtiZMiQ8E3HvBHBl+/NxtETOaxyTAh4Hf9CyA/u04wuld2+egtOPW5Dn0Ae/TxNumyTQ0kn/a5SP01ZqtsY4N+UHXj0= 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)(93006095)(3002001)(100000703101)(100105400095)(10201501046)(6041248)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:SN1PR0701MB1870;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:SN1PR0701MB1870; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR0701MB1870;4:F6GycshF0Pefr++1VwfDTPgOCyUMJmZRKiegYAad?= =?us-ascii?Q?jAN/yne8n3sFn8yvHqFwE35RvEk8NjzHxAOvUaZJ1U9CT0ul/5jW4cSA31oR?= =?us-ascii?Q?81lVqW2V1jfdzdmDT2FapVwsLZveSO4Rs4WeJroX18z43apCLhOMbBwDq2vP?= =?us-ascii?Q?lnArZRhOnfvLRDvN0pZ2zaLTnJi1N5VV5/YTrBxz5kCEUGCFoxU1fiw1aoWf?= =?us-ascii?Q?yG4Jj4OfAbdvg6T7er+SB0VGJFk93VpjbLaiXqQJdPq76lMbsoQQPY7YkBMZ?= =?us-ascii?Q?TyZ0a+AtdHRT5iz5leT9nuLILOyWpu+QXjukOrTVtBxvV58lcrmuC7U76CK4?= =?us-ascii?Q?lwTdd1SFbxkA63ufgj/C+f7S+df8m7EbPsqG7FqjXgXcj6sAXJObzWKnPGf3?= =?us-ascii?Q?uIITnCAv2I3iATVmuSOBcvxLycU7LtcoIdkE3uNiNXn5D8/eKt3x2jxyQnvc?= =?us-ascii?Q?ZSk543wgkoj924OTLMQcxZv18p3Hbsg4Or8D/1h52l1NtPaUNMRA4SzG6m1P?= =?us-ascii?Q?pfT91IzwClSQv20Nn3rB1PAXeEvyyaR2qqyM5Y5gpVTZ9CgK7cGtcNhXW/jj?= =?us-ascii?Q?t17vSmUi8KEP1NR5Nat8zPk86HRpWE5QVYZpSn1vwSGw0pAi7J93fEem1Z90?= =?us-ascii?Q?LcBg2OPIeWZO436jWBHqNMzE0jB5Shq1GjiHYezq9HguJtaRq3to7zyFT40Y?= =?us-ascii?Q?pXXjc30Xx0zzpGk6TnV4JOrnJqMOF+XkEZJ5cAr5EAVuXGozvgkbqtmO5RfP?= =?us-ascii?Q?Q1v7M9WSvXDcU6pjE21im4JqBZ/afVRig5mTlRQEnMIJSbov8OLrY1jhaAK6?= =?us-ascii?Q?v9/RRqiVaXXRFNaLj+402hAx0V31365G69ocBLiameIOSnPiJY3kK/mPOvj0?= =?us-ascii?Q?rgA7JNa607C5D4rU3J6NR1rKMmkb9UEFugl1CYFEqB5XOrO/lBJf6RXdY143?= =?us-ascii?Q?sso9FSLWMfpsEPU0dm4OouCkByb5iMKLfUHXeJZF7k8nQlCh5ldDsOP/QBLT?= =?us-ascii?Q?6501gvuQ8oJVnmnSR4BWViMS3HIYMOWUu5MuQLpIwQ+Ri0jfthQg7D/afa8X?= =?us-ascii?Q?m93FQVJ9KmM6788Uc6H3pAVsgdsq3wScUyc2oSf3W1ibaGiDzwKIFmpfId4h?= =?us-ascii?Q?oTW1WO5YRQw=3D?= X-Forefront-PRVS: 0343AC1D30 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6069001)(6009001)(39840400002)(39850400002)(39400400002)(39410400002)(39450400003)(50466002)(5003940100001)(1076002)(8676002)(50986999)(33646002)(48376002)(76506005)(5660300001)(25786009)(6116002)(2906002)(47776003)(76176999)(189998001)(66066001)(3846002)(50226002)(81166006)(38730400002)(54906002)(478600001)(72206003)(53936002)(6486002)(2950100002)(42882006)(6666003)(6496005)(42186005)(7416002)(7736002)(7406005)(36756003)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR0701MB1870;H:localhost;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR0701MB1870;23:grUtECPT8p6IC4T3gBKkDZ0/W+cY0xYUd5YeYrP?= =?us-ascii?Q?wI05ijKgZ29ZmTNPq/wopixIVNEDw6/uNh+Hr4fxxsE84ZE2WTLEqrj3V6mC?= =?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Metadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN1PR0701MB1870;7:kXCJWdRLI0xWf8ktY1qA0CesTv0d6N8HkuY9idZtg9xgWIGRBIn6vKWBPXbT7WwNYDEkW+I32IpMoSRfiP/R09DoxReWyG94GUOVXCiANyX6U8sSqORD6thXxJH4BdJw/HqdzfEMYNzd8NPQOZ04npoH2OgIL9BfLnQFre+/wHheiJuTlvl7d4onU98vXTdgAdN3McZw3Nw3Qt80D+dfbyso5w/OW1VsENIYVfuc/jcmG8Zq1qWm1uqTuM9h8VPo7XE2lP3MZeZ3vUR05cdBFEY0o2mgvjRJIjDhcHLA0cSkLrQfHajSHMdzcSjCOp3Gejgv3hAdaiPpmOoMb3Tv2zwoYNwpkozqiIGAQ95OGcFF6JCftFIjAsUA4ETUFYS294/6LerloRpqyagaTMp93BIhHlC0OBwiR4ANsGQbWdmdIkiggw8+Rnd27fNAKpdXsvm/tR6ffYiHAQ8yhCjdaRGdrUKqeM/pzMVFlUO7geFakDjFWPeeZ0eR67RATByYLqxbhywwGu+IP8Kl9Q5bSN+W+O/EDSl8yPYNaf6E/w9l/+x8jEm5gJJ1F4cVJnsz99rt+qn8XCdDtIkdoepP32yqJbAxOmph8kMaSRMaKVQ6SDH7PXtRcAD0fNMNWcy5mQqkmatAwhA5jsSVu2/ZhFzp4NB9P06yFGcGusEzKvhdYlMWaNIslA5jg4hhU9UeYZ8Sfnyjs6hsQNDouH71bpY1RiFwC35nySjV3MyWEYjNk+1nZ2hsVmlPz4PTzBKVfSKMcNF8PJSuMfBlC52eE0CS8Fr0O4hVrzDVN5rD3rE= X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2017 15:52:34.9180 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0701MB1870 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4848 Lines: 144 As we support more than one compat formats, it looks more reasonable to not use fs/compat_binfmt.c. Custom binfmt_elf32.c allows to move aarch32 specific definitions there and make code more maintainable and readable. Signed-off-by: Yury Norov --- arch/arm64/Kconfig | 1 - arch/arm64/include/asm/elf.h | 30 +++--------------------------- arch/arm64/include/asm/hwcap.h | 2 -- arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/binfmt_elf32.c | 37 +++++++++++++++++++++++++++++++++++++ 5 files changed, 41 insertions(+), 31 deletions(-) create mode 100644 arch/arm64/kernel/binfmt_elf32.c diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 8713a2807582..168ab2cc426b 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1085,7 +1085,6 @@ config AARCH32_EL0 bool "Kernel support for 32-bit EL0" def_bool y depends on ARM64_4K_PAGES || EXPERT - select COMPAT_BINFMT_ELF if BINFMT_ELF select HAVE_UID16 select OLD_SIGSUSPEND3 select COMPAT_OLD_SIGACTION diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index 8f7bafa60d01..2a727658f51c 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -174,39 +174,15 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm, #endif #ifdef CONFIG_COMPAT - #define COMPAT_ELF_ET_DYN_BASE (2 * TASK_SIZE_32 / 3) +#endif /* CONFIG_COMPAT */ +#ifdef CONFIG_AARCH32_EL0 /* 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]; - -/* 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 -/* - * Unlike the native SET_PERSONALITY macro, the compat version inherits - * READ_IMPLIES_EXEC across a fork() since this is the behaviour on - * arch/arm/. - */ -#define COMPAT_SET_PERSONALITY(ex) \ -({ \ - set_bit(TIF_32BIT, ¤t->mm->context.flags); \ - clear_thread_flag(TIF_32BIT_AARCH64); \ - 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 - -#endif /* CONFIG_COMPAT */ +#endif /* CONFIG_AARCH32_EL0 */ #endif /* !__ASSEMBLY__ */ diff --git a/arch/arm64/include/asm/hwcap.h b/arch/arm64/include/asm/hwcap.h index 2c7fc5d89813..99dfd9277559 100644 --- a/arch/arm64/include/asm/hwcap.h +++ b/arch/arm64/include/asm/hwcap.h @@ -47,8 +47,6 @@ #define ELF_HWCAP (elf_hwcap) #ifdef CONFIG_AARCH32_EL0 -#define COMPAT_ELF_HWCAP (compat_elf_hwcap) -#define COMPAT_ELF_HWCAP2 (compat_elf_hwcap2) extern unsigned int compat_elf_hwcap, compat_elf_hwcap2; #endif diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 49fefa42d136..de6c84702d83 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -28,7 +28,7 @@ $(obj)/%.stub.o: $(obj)/%.o FORCE $(call if_changed,objcopy) arm64-obj-$(CONFIG_AARCH32_EL0) += sys32.o kuser32.o signal32.o \ - sys_compat.o entry32.o + sys_compat.o entry32.o binfmt_elf32.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_elf32.c b/arch/arm64/kernel/binfmt_elf32.c new file mode 100644 index 000000000000..ff1f192a738a --- /dev/null +++ b/arch/arm64/kernel/binfmt_elf32.c @@ -0,0 +1,37 @@ +/* + * Support for AArch32 Linux ELF binaries. + */ + +/* AArch32 EABI. */ +#define EF_ARM_EABI_MASK 0xff000000 + +#define compat_start_thread compat_start_thread +/* + * Unlike the native SET_PERSONALITY macro, the compat version inherits + * READ_IMPLIES_EXEC across a fork() since this is the behaviour on + * arch/arm/. + */ +#define COMPAT_SET_PERSONALITY(ex) \ +({ \ + set_bit(TIF_32BIT, ¤t->mm->context.flags); \ + clear_thread_flag(TIF_32BIT_AARCH64); \ + set_thread_flag(TIF_32BIT); \ + }) + +#define COMPAT_ARCH_DLINFO +#define COMPAT_ELF_HWCAP (compat_elf_hwcap) +#define COMPAT_ELF_HWCAP2 (compat_elf_hwcap2) + +#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" -- 2.11.0