From patchwork Thu Jan 7 23:34:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 7980691 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 20BF5BEEE5 for ; Thu, 7 Jan 2016 23:43:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D14C2014A for ; Thu, 7 Jan 2016 23:43:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5EE9A2010E for ; Thu, 7 Jan 2016 23:43:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aHKBz-0005rD-ON; Thu, 07 Jan 2016 23:42:07 +0000 Received: from mail-bl2on0093.outbound.protection.outlook.com ([65.55.169.93] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aHK9i-00028L-FA for linux-arm-kernel@lists.infradead.org; Thu, 07 Jan 2016 23:40:03 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by BY2PR07MB613.namprd07.prod.outlook.com (10.141.222.144) with Microsoft SMTP Server (TLS) id 15.1.361.13; Thu, 7 Jan 2016 23:39:22 +0000 From: Yury Norov To: , , , Subject: [PATCH v6 11/21] arm64: ilp32: introduce binfmt_ilp32.c Date: Fri, 8 Jan 2016 02:34:29 +0300 Message-ID: <1452209679-19445-12-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1452209679-19445-1-git-send-email-ynorov@caviumnetworks.com> References: <1452209679-19445-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM3PR01CA044.eurprd01.prod.exchangelabs.com (10.141.191.34) To BY2PR07MB613.namprd07.prod.outlook.com (10.141.222.144) X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB613; 2:wojJbYYNQHGsymLfeeE0RpX+9kQhfJmJ5yzakl+npj5xpiGceA3Jpl1QYdLApk/wrVrKCc0IcDqY6EQqqeWQD2OeJ3P5yIVLAmfLMuaxsmiDZ0TM+E+eUgbiRe9vBJZjsiPuMiIt1epQky1+daN9Gw==; 3:xN7Rk0K/dQfOtVAWsasf3rFUtC6+9no+Tb0GRLbbMpDUHpF0N4kfNOdswi9soj4P0OxFU9O0cxaF284ugclt6zRfNTErMwleqCy5TSG4/t5SG4ujk7yIjOVVdTJJMlFV; 25:YeQmSUBPEtZ5kIkpGY4lRHEWVWQ8PPe8gwDtncBPd+lDxHAIL5PtFwtpKq2CFkCf1dKT6XEZIWfhkFvEjSHBzEJeTLaQnGbEfgR90vn0zZ3sUWFTILKYoRm1NsoFD/Z8qIPfat6d4Cm3PS/U59+urh/IVZt4/ek1bXVvpyP2iDzdsPnJFO/45S6PtqYjgMuysWmkP1jS2Vi9Hb1BIRudTcuEfht7cmFJLXBGRwcVxZIV18l09cp97X31pOLu0uLs X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR07MB613; X-MS-Office365-Filtering-Correlation-Id: 112d7aa5-297f-4995-87c4-08d317bbc54e X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB613; 20:w8tUln4TPu6ncRkJW+4HzXW2dyjL0DlKzwb+Y1MgpRcLkzh+lsMGxqmwBezoFWAjdcMAg6CzjxhiE6xzhsLPXYhOma47cEFbDMxXDIFpU81m+Y7snw80CBNxhuJLiMr3ljlMpVbxwLLkDPh6mA40Hniiu7mQ9S3zLyuoN8ILTQGvQoplHGN2eTbBBR0zT7jWdw+H23bd6jpRXXcTsGE8yXgm07xZpma3/Q6+4SVuRVKnJQNJpmggrizJCfqyh/6fjr8h1i9amV2Aye6NvVup+/wKgnUBWnO313jN/JhikNi9G4C2gRXLNxkY5/l2vfJE4UNvXMDyQk/6s0aZDs7+db1ChSdJynfdp/AFikauNjlvrbyERd5mha62aebwXKbop0nxWDMunqxt96NWcaQWdI75BAuQ06qnRqPoV+aCvbYxJiGO2jF38v84EI3rCeNKt3dopbCi+MklrfLEa7gJbWAtexBXAYzZZtTfqUmh298f3vhRk1msk1YWU2x+PN17RWJt3Afvrx5E4a9r3ydp19I9+y86mQSB/x1xoJ5FVrp9KSBYeaIvsNnqsCVhTffIFGMHwhs5ISYj6cyZYoX3D0FMvMzXSDJIQXdRS1gpG3A= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001); SRVR:BY2PR07MB613; BCL:0; PCL:0; RULEID:; SRVR:BY2PR07MB613; X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB613; 4:s66dWXgUfVt2gPJlhdKXbbM+vQdidBhLhSadMVnTZArS0m/Azhtj7AgsZloRMGo9jInxG23MFJeWQ190/BsPtAXEsktGID8pJQuaxXXVxaMVeS8F3Oqplu6pEwYvhQDGqo7tDCMRLQj+2hDfoP3qNM4Gx40neL1kjIk/d/X6B1chmns7ONzy7AQ7GLO1HGUw0tfjZtG3maDKgUIW6PCmwsbji+Quxsc+pEqhXGx7gK/N3A+09vKYKAMn0P4CcRswA7z/re4ONHZDTn1aH2ZoF6cW70geZP4sVgxyh1Hqxl5UpKNdLXDH/m9KLBmCf0sYGpHYsTZfKmCuPEdQYtHYxpl5riJPmQMDAK86R9UUSTpnIE931YPVGuw0xVdfaGLslc3CHwH1XZ74Xch0SQElzaT5nJd8xWwUJEz9X3pj5PM= X-Forefront-PRVS: 0814A2C7A3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(189002)(199003)(586003)(40100003)(122386002)(5001770100001)(87976001)(5004730100002)(36756003)(50986999)(81156007)(5003940100001)(42186005)(97736004)(48376002)(92566002)(1096002)(47776003)(66066001)(76176999)(3846002)(2201001)(5008740100001)(106356001)(101416001)(50226001)(6116002)(19580405001)(4326007)(2950100001)(77096005)(33646002)(105586002)(76506005)(189998001)(50466002)(19580395003)(229853001)(5001960100002)(2906002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR07MB613; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR07MB613; 23:TSEP7jSLj3IKJrQG4t/8T4yN9ImXjgQWr6k9S8vnpv?= =?us-ascii?Q?eez+r3zBWkkaocXcfedxG2DtBt2XnOfQs4ypHob8n6LrGwUsORR347hbet40?= =?us-ascii?Q?gAgs8XArg1ZytOttuwI+PTV7yhqipgWnior5cMP1/UpV2NhRnZ0cJ/5n0jRq?= =?us-ascii?Q?W1EXF24vmBOxr7IctKN02H3pLo8kEKGgxnvdHqWNjk+IpytYiDNl4oEvqb/L?= =?us-ascii?Q?NOgjEFragrAAUH8JMYpacd9X05UerMuJsOprmQWrNm+V48HicrXfo9U+UGOo?= =?us-ascii?Q?YALgHDgmLFe3Ma4QHAsPsgyka5jdomKnfMnbWY5h8xRszTZTts3kkVgF/R62?= =?us-ascii?Q?OQWpNKnSoY6TFdwocJyceTjzwyi5AtkgxE/pCnJsqWv49aEvRQI8a/LT7hIr?= =?us-ascii?Q?x/rk5vtw8zHYZlt/V80bYS2x3II2p5B+7Pe7LOPwZvIiEbWKBQM5S0oCgGMb?= =?us-ascii?Q?ApW4G7dIvri8vi7VTiG5Y8njLjwT18/PSxDGIHrXd9GME7yK58/JeKe1QQ2l?= =?us-ascii?Q?nmRCnQUe+ouPY6BAZD9mgyfo6DkxdW1YV9w2T2tIpKYbz/qpX0BhntL/zTdu?= =?us-ascii?Q?+RPNZ9DcK9JhAUUho5uchuARgGBVZm7vFkFL0nHWhSXDMzM5WP9IkS3gocNR?= =?us-ascii?Q?ams+jFqourVsqGsrwDTg4pYkERChO8N7mGyikjDu06pbXbYIFJTQtbabc/Ms?= =?us-ascii?Q?mJyUW+7o2hz+ZziDxo0klV/ATW4EWWLqwyP/Urgv7RQycRMDos0ajIxtXleG?= =?us-ascii?Q?9D/DusUGj5HAXy4hVJfat2Wj7jj3UtaEA31dhB1LnfIHDeBJ2r3WuHGsep5d?= =?us-ascii?Q?YalwCTpCTeL/MbB6i5PgN3Z3BSASxCf+KQziI++Sn/l9YvtZ2nnYBKrAcu/R?= =?us-ascii?Q?ihNr845ptiB2OV1rlwOfRcHpgvfhbEAgdRn52DHlTHt1nPrNRsw7oL7cXynb?= =?us-ascii?Q?4UxHIcfeYrRqahXg93rwEpRode899of3m9lG72ikeVC12l3y88KNoWP4NFyC?= =?us-ascii?Q?gdXdLu6cvQDsudQ3LtLNSZWBPDYhscCzyjCqq8WdCsJFb7lsKCEbWjPYLyXU?= =?us-ascii?Q?BapwPdQJa/L3VghlHg6C/2bl3jFFtefNZ7bMdWWkakLLiY7xXnWNEdibUzf7?= =?us-ascii?Q?4ABLzVzqc=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB613; 5:0QN5QRsSTnwDkHeSDdZgax9Shum1fiCnCn8M3o39S5NfYKGNzt7ZfTm0k8tlJ+CWv1wWniOvKUiGBo079tBkZQp5nTfdq5zIsFf71m91du+iCGuBUTfFjo4sz1vgED3djkCouWDAVGj15ZE350RJAw==; 24:X4MFSUSYU07uAun960cqWV4AZlrxZbb2ovUcDxn6YXqjd3QGzqeINHHXrJFBugz+3vk47bxU/d+2eTt0QKDcThiLnV6QFRHOYKfcU0oOy3A= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2016 23:39:22.1578 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR07MB613 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160107_153947_185764_04B3FA0B X-CRM114-Status: GOOD ( 10.41 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pinskia@gmail.com, Prasun.Kapoor@caviumnetworks.com, schwab@suse.de, broonie@kernel.org, Nathan_Lynch@mentor.com, agraf@suse.de, klimov.linux@gmail.com, ynorov@caviumnetworks.com, jan.dakinevich@gmail.com, ddaney.cavm@gmail.com, bamvor.zhangjian@huawei.com, philipp.tomsich@theobroma-systems.com, joseph@codesourcery.com, christoph.muellner@theobroma-systems.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP to handle ILP32 binaries Signed-off-by: Yury Norov --- arch/arm64/kernel/Makefile | 1 + arch/arm64/kernel/binfmt_ilp32.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 arch/arm64/kernel/binfmt_ilp32.c diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index f1b798a..ad7158c 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 \ ../../arm/kernel/opcodes.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_PERF_EVENTS) += perf_regs.o perf_callchain.o diff --git a/arch/arm64/kernel/binfmt_ilp32.c b/arch/arm64/kernel/binfmt_ilp32.c new file mode 100644 index 0000000..02a7a6c --- /dev/null +++ b/arch/arm64/kernel/binfmt_ilp32.c @@ -0,0 +1,21 @@ +/* + * Support for ILP32 Linux/aarch64 ELF binaries. + */ + +/* AARCH64 ILP32 EABI. */ +#define compat_elf_check_arch(x) (((x)->e_machine == EM_AARCH64) \ + && (x)->e_ident[EI_CLASS] == ELFCLASS32) + +#define COMPAT_SET_PERSONALITY(ex) \ +do { \ + set_thread_flag(TIF_32BIT_AARCH64); \ + clear_thread_flag(TIF_32BIT); \ +} while (0) + +#define COMPAT_ARCH_DLINFO \ +do { \ + NEW_AUX_ENT(AT_SYSINFO_EHDR, \ + (elf_addr_t)(long)current->mm->context.vdso); \ +} while (0) + +#include "../../../fs/compat_binfmt_elf.c"