From patchwork Wed May 16 08:19:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 10403047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 12AE9602C2 for ; Wed, 16 May 2018 08:33:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 011402656B for ; Wed, 16 May 2018 08:33:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9B2928806; Wed, 16 May 2018 08:33:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8708D2656B for ; Wed, 16 May 2018 08:33:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BqQN9KhqgkzC4SoUp9gY9GjoTX85QQnzwrqIvj5BliY=; b=W+/0C2+KB5hdBz ZNcDMfgw8JUlc7iRyGgMIAOa66umMAeAKJqeRnGU1MVF4er3u+tXTwYgFMl7iZBJqpmYUueWVliQ9 0BpBZJ5jzpB0NknsJ8DTBB7FK2Tz6aE3DmS0tUb56Oyhd/rpTHVRIU6b+Tpo3fuqA7ruaE2gQm/Il j9uc54WEm8m7e0hKLs5v3fLMP3Z65QUNPKH1/KMrWnvD6fS9cx8Pib8N/sUbFd8fUkd5Sd7wkR3gD aIYHdN+ZwM9Kh40zIToTpv6E4clU2jA/OFgoAY7tLowwnUf14KyuqY/gmf4VQGfYENCOx8GcpF/dy XU34JapqutA7DvI2MzyA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIrs8-0004Fl-Ay; Wed, 16 May 2018 08:33:20 +0000 Received: from merlin.infradead.org ([205.233.59.134]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIrhh-0004un-Pv for linux-arm-kernel@bombadil.infradead.org; Wed, 16 May 2018 08:22:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xogTNeJJNm/XjrlfhK3NLi7x/BkgXaItJFu5a1Q2JRw=; b=Y2wR/dkd5y4uMDgcoYoskoRHW aHZXMrFOhAbYH6WAbMVwduqfAEUIZB9h1vC5TejmHeR7cmlSzUKuIWoZtYqUzqrbybtWW9M6QIUFt gfBgLhrXnomI2EBfC4TWdh7OvdHnQl+MWinsaTGVSi565FJvHOpwQZFBJ2+MaX72T2uRo+5m+L89D GSRgz2CEAA9yDYI0pAyf2czh2wFgu6niUlehF/Bkt7W6RskMiJ71NFyFwjXKJmYt+rtfmdKKreBqa evO8Bj8looSO2V0NjJtTuGn0hs8YkmqF6M23ukFUp4+goimS8CwKptZJM3yOOlasmpd1lfWF3XE2E cfCIt+6rQ==; Received: from mail-by2nam01on0083.outbound.protection.outlook.com ([104.47.34.83] helo=NAM01-BY2-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIrhe-000201-RU for linux-arm-kernel@lists.infradead.org; Wed, 16 May 2018 08:22:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xogTNeJJNm/XjrlfhK3NLi7x/BkgXaItJFu5a1Q2JRw=; b=XMempxwxxnhyp/V2ktopPvyorSGw+v42tlCSUJq8fQIRx69GKVRtQPvMJ+fDr/fT7l5LxfYSADUZuTOg926V/YBXroeIgrN+Ak+Z7QKAPYwxkpObckCXQIb470+SNEe6rkANLdBdyjsW94kdibijvJKEc612pGOr68D266Xf+xs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Received: from localhost (176.59.36.13) by SN6PR07MB4384.namprd07.prod.outlook.com (2603:10b6:805:58::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Wed, 16 May 2018 08:22:15 +0000 From: Yury Norov To: Catalin Marinas , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org Subject: [PATCH 15/24] arm64: ilp32: introduce binfmt_ilp32.c Date: Wed, 16 May 2018 11:19:00 +0300 Message-Id: <20180516081910.10067-16-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180516081910.10067-1-ynorov@caviumnetworks.com> References: <20180516081910.10067-1-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [176.59.36.13] X-ClientProxiedBy: VI1PR08CA0125.eurprd08.prod.outlook.com (2603:10a6:800:d4::27) To SN6PR07MB4384.namprd07.prod.outlook.com (2603:10b6:805:58::15) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:SN6PR07MB4384; X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4384; 3:tExdOi5LtHSDJhg73zRqFbO2X3NgBwhFMcD1UVfxyN4TJtPGe/ZJHOutN+S0Dk945zPyaur+Z0tOserRJi4Yej9kxl0L6IXWa84I/hkMKMjypKTfdIzlGcljWc5pskh7wXMHXQp/+hhJMKLCqzhupxNbB4K5pfst4Nma1fN6s8py7MT4Dr0nugg1Fyx7mZ1AIp2N6dbf7Ttm9uhb0IYhj7IVX1ECXLYLaDYeva49THaPUfqBBcSm3uayWGYvod5D; 25:/hT2/YV7q8IEnJE8fB/5YXJShTN95IoqeZSMibuHRAg36QJE8kAMhqhmxgzVPymhSmts1R+jo60HGRlg3v7VcPHGawUnaI0UJZu6yoBAZHympVo/h9SyJqsOq7ovcyWocZ4hbEBRwaIU8ZF8LQpdcv3JWfkrfBwxWcgAZQ5PhWyufq0AsqqjNBHvz4y9FCSiQLPIZl7dUsuneK5dOsQ8VzAlJHaaf5YR00bpppCuFfSHl3rxVThh8XSnn1rgphr9XZa3pdmC3XSjxBr24kuSkK29q/Lzb6loLaQlx/tRJ0GHYI+3NR0QuVVwfi/bNoi/LhsNOXzWckAABCDjNhoxug==; 31:LfFe//RUAmnYb81MKDge27hdBe+vOU1EzECZ9r27DwqtpnT4A7bgRazZaAtP7DU7Uufazkv5eI8+wWJfuD0lrNo8NaVELmgaRZ1NnZEgdpiastopPniN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Qh+LWFQdzMnyXhaHWERMvMqBXgCUQ5qmh8CDbkPJnqVaY6R8kzjbE X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85827821059158); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(3231254)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:SN6PR07MB4384; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4384; X-Forefront-PRVS: 0674DC6DD3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(376002)(346002)(39380400002)(366004)(396003)(39860400002)(199004)(189003)(478600001)(26005)(53936002)(47776003)(386003)(446003)(16586007)(42882007)(316002)(11346002)(54906003)(110136005)(956004)(39060400002)(2616005)(1076002)(97736004)(72206003)(16526019)(186003)(4326008)(5660300001)(8936002)(81166006)(81156014)(76506005)(6116002)(48376002)(8676002)(106356001)(50466002)(3846002)(50226002)(68736007)(476003)(305945005)(7736002)(105586002)(2906002)(6496006)(76176011)(7416002)(52116002)(51416003)(36756003)(7406005)(25786009)(6666003)(66066001)(6486002)(486006); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4384; H:localhost; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN6PR07MB4384; 23:cIqlY6ZdMisA0ea6xGkdWRFDrUUVatQGbYquQdfjD?= =?us-ascii?Q?DOXxHGukHUUiKu89EJWyPCLZ7eNm0RT7UsSxEvg0Kz3MxNH63wRKPOqU3iPl?= =?us-ascii?Q?JAMQFRTd2oKYZ7tHQC+H9zkkChb9eDaUAp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svNHgVnWijklE4fqmOJMaCGnzi5Npdw+RoryzgBKfTMKPOl1Vg==; 5:debVWsM1y28afe9JFoeHZz3BW6ONxDyHVhCXJXUoC2D5NwRU1Jl8ywe1sa57iKEpL+kX53dUGoX0r/zOwyzc+lKn3c3EBWY8qbKqMjwqUjS3FGREH888HB6GWN22r9HNtoelYosBcYkXBIhcfFCDh4cbvYFnCVGs1JVpdD3pOSk=; 24:sfMellO6ZeaHDarVtVihRF360fLOZ6U1pySXVREaw7BbHRy9yBCeUss22ZQhhXiU6yvu19+URtHsA6bNZmMD59U3frtcEk245dE7vJhiC18= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4384; 7:9AKULjwZD/IsBg/kJJ7m+jqOTnFfL1iTn9eDyp3jKXmxO7iCU5seX4u9dTPGmLUZVRMxdWFZodS70LESMf6oqEjgB7VtzMT7JLZa3rws2FMpIwKxO8ACyWapiN57zPJDRPqnw+8GU7RxrD5N2QF6mBZ9DGzdN4AuO+C6kjGp68I/nfkTzSMATW49N4sgEq7jAkPk3THJHgECTuvPy0AQ2XhVVpCg7kBsyxgQ6DKqn3Ow0R4wvfKpeVftAe2If/p2 X-MS-Office365-Filtering-Correlation-Id: 537bdfc0-4d83-417a-485b-08d5bb062217 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2018 08:22:15.1754 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 537bdfc0-4d83-417a-485b-08d5bb062217 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4384 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180516_042231_067136_272EEDBC X-CRM114-Status: GOOD ( 13.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Szabolcs Nagy , Heiko Carstens , Yury Norov , Philipp Tomsich , Joseph Myers , Steve Ellcey , Prasun Kapoor , Andreas Schwab , Alexander Graf , Bamvor Zhangjian , Geert Uytterhoeven , Dave Martin , Adam Borowski , Manuel Montezelo , James Hogan , Chris Metcalf , Andrew Pinski , Lin Yongting , Alexey Klimov , Mark Brown , Maxim Kuvyrkov , Florian Weimer , Nathan_Lynch , James Morse , Ramana Radhakrishnan , Martin Schwidefsky , "David S . Miller" , Christoph Muellner Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Like binfmt_elf32.c for AARCH32, 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 | 87 ++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 arch/arm64/kernel/binfmt_ilp32.c diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index c63e0164fc12..3114191750ae 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -28,6 +28,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..26b2477d190d --- /dev/null +++ b/arch/arm64/kernel/binfmt_ilp32.c @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/* + * 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"