From patchwork Wed Aug 17 11:46:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9285703 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 C8F4460459 for ; Wed, 17 Aug 2016 11:58:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE171290BF for ; Wed, 17 Aug 2016 11:58:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1342290C3; Wed, 17 Aug 2016 11:58:58 +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=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 31414290BF for ; Wed, 17 Aug 2016 11:58:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZzT8-0001R3-40; Wed, 17 Aug 2016 11:57:14 +0000 Received: from mail-by2nam01on0062.outbound.protection.outlook.com ([104.47.34.62] helo=NAM01-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZzLN-0000t4-9Q for linux-arm-kernel@lists.infradead.org; Wed, 17 Aug 2016 11:49:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-caviumnetworks-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=2IUQ//g54d6zszzCBPum7ldpjKTEYTPkPkIat1pFYuQ=; b=ZMoaK8PgDea3M++ROvZLj7DcmvWMMxCKlQqfwCEtz+zN9DSr7vXGvbH0EiJHqumh4hefZ5EypqJ1WmSTG3RcpubSitoe7Wrg7sT7uffcsOSAtz6RnHikiEfcDx2bz0WCLqr0zObhkaoWSMpro/go+lerkfNIAfAIJOCtMeEUCUs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by SN1PR07MB2254.namprd07.prod.outlook.com (10.164.47.148) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.549.15; Wed, 17 Aug 2016 11:48:46 +0000 From: Yury Norov To: , , , , , , Subject: [PATCH 12/18] arm64: ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Date: Wed, 17 Aug 2016 14:46:37 +0300 Message-ID: <1471434403-25291-13-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471434403-25291-1-git-send-email-ynorov@caviumnetworks.com> References: <1471434403-25291-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM3PR03CA048.eurprd03.prod.outlook.com (10.141.191.176) To SN1PR07MB2254.namprd07.prod.outlook.com (10.164.47.148) X-MS-Office365-Filtering-Correlation-Id: ce7771f1-4a7c-4121-1d61-08d3c69472c6 X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2254; 2:bFctfDmN3lF3cBg2MGahES/vuRnyU1dg0m7Rv7nytfxFLAJNJz78n5aM+Am9ZEjGznTJ2yhs10PVfX+OhZ8yWdum4UyQnlRTI/r5CIqyZ4XZsTfeSngl5Lfu5gHp/BClT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DrBAbHKBcwRKaFB775QdbFC7io157cqYf1CwdZF8yjJO5oJSzsIdz1nubOFRj43tQai+mFiLLhupiAdgWXGeWweUMh2VLiEp5YI7jBlakmY71vTfh9IbcXIoORWsp0Xw+/FzHTL57au8lck0uJekKaLznjYyYjFIqftD/uoqYIpGfiKFZwTjG4fl1u98Rov9qq943aO3HzUdtrRpLaDQAT/5P5mYQY6bvglhlTo1vcenfNC8066punPhkbt8AOTWETOzlkuV1kdONkaV11gRHMW4ICYq5EJM91E5gkh6mAMAh5cg5iRCpRgUkFwP3bhmWYXOI2j6PnaOwURt8H2EyvMO5o8Bm5kUcqIlWHQR4vUc8gIUnOG+/gpy8CQfBxeWxlpnegESkvD1W0fYDr8wsucCAECCk479J0I5zIfHaXrkT3SWcLfGp46YBO6XlvV/oeLCyO+XWyuD95lLIXd49qwQ3bsnmTJEZ2FOicDjs= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(22074186197030); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:SN1PR07MB2254; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2254; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2254; 4:+roMAtZmxQPskPvB0KH5i/SUYlneNdTIcSmQ6IhPeXgb+cXaAh711gwqni+ZXvzP70WBWQwFled6KwQcCHwzClz1W+2I5p0dkftoGgrzNi2EKBcKU24qMjPTdm9Yck85kbI0MgLaOxNslkymJ1hNMNHDgrdieIlAp3ttWgqB5bp3hlivVIV2AMAQdfEzCb3EX98+UWPOW5pvYMGoBShQhNrtmfK+XmXrOySDNIX4PT4HSKwnKzJnijLczNdhXd/JW/8DxF0az7keygKqMr5pstyEpYjYh7OBeHVE4kL3cxrA4OsAXQCcK0PZ3YrUMDbJ+00p4UY3nC2uM08/bEKF8m7l1MjNk993SKjAOf/q4ibRaMgJxDjmJcb7vDqq178+/Bvt1gbAua0k9OR+reSTaLOlDChiECD1spuoskZCM+k473DuNOIjUXqL5wZ0iNa9tTL7mJye7wMUzp/YnbeWJw== X-Forefront-PRVS: 0037FD6480 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(2950100001)(76176999)(101416001)(8676002)(7846002)(229853001)(50986999)(36756003)(33646002)(305945005)(50466002)(4326007)(81166006)(42186005)(189998001)(586003)(4001430100002)(7736002)(50226002)(19580405001)(7416002)(81156014)(92566002)(47776003)(19580395003)(575784001)(2906002)(106356001)(97736004)(105586002)(5001770100001)(68736007)(15975445007)(77096005)(3846002)(6116002)(76506005)(48376002)(2201001)(107886002)(66066001)(5003940100001)(2004002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2254; 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; SN1PR07MB2254; 23:kNUiru+an2owcGtsjgz4+cUMxd+7i1PaO2fxJwznu?= =?us-ascii?Q?HWynFvPWYX49olOkdaYlEnt7yfkPsUrCBMzclRcWCTJQL2O1T6+990LVSREP?= =?us-ascii?Q?mDnQQGzn7tVekCXyrsmdbIadcDxXMB9Mx2QkiV7uOF3h2SfYENX7POVuL1/w?= =?us-ascii?Q?MVP3AkOSwJfKfeRj3twrhFZXS8mfR8F3L2eu9djY1FlnvQZlcjnSQM1xoDLT?= =?us-ascii?Q?ePcbki/ZGqp8urM29jA9Dv2/cznRPAmDqCLF+v0jkOBJvY/2Z/zn2SjyYmiT?= =?us-ascii?Q?w6RyI4Xwyq0nfkTwfmgDzxgCUZqU+c3MPno3EERZdzLWMGYlbzQi7seEoF1d?= =?us-ascii?Q?glZG1p4LLvxVGjDMqWTbzVhf0eEZS9KwmoLocI6PkKBfOcBdW0ERuB09juyI?= =?us-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Diagnostics: 1; SN1PR07MB2254; 6:HcZULVJk9Zg3sR5di7CdvltB+xD+JdZNZ8dJ0ldmqzSmCMh/nbLW5SJojSI+E/ZWr4xezJ6aPJdbFp+nz5oLtHnqDvvJF7J9Gb2ODP89WmIT7LTUWSpZ4OnQ4cxWEneuxpZbVOUMspyaHn72ovjDabzJYx/KPxk4IhUsbq1GYVz0QP5DCgIlNrD9TTysEU8yTvFjtIPI93H9cX/iwV26W+QsbNuBNbF7Y6OT0qR/FlCHCzDshiULV50HMDbRoT7tLDUhr8ff8EL1MjSnUw8UOE0pSDjGeIZUY0yS0k/1M7E=; 5:wd2ljao92KTllSa/D4I1J6r6SpQvQwiYv9YJKTy0k6ZDS6RmxV4lBPCKCwJs/k7Uks7dJBqo4Yo2/AOdf+bJesD3t5DhRKURC++xXSQ5MkRkhhDWxH+tx3eDQ7Nza+Peyfiuvg4ZarfAYTOj29uXIQ==; 24:NbRbWu4NzmbkBD9e1/T5VNSITbEZfgQOU8+x6XHFh0pwmSl/93kd5WnvVEUp+N0lu9MwPyDhXPL/5Ab2WGHIF80G9DoBLBoKiWsIsCCSHOg=; 7:tFQcR1FsWSLVtrQV+whfz4HQ6s5s1vQRboPwa3G1cZVac/d5idxiOCxDwJVE687hXnivHfU7xxq7Vz6uA3FNGbugUqy7M1WC0/+vdh8a1B6yRuPhEadRHUns0mFhAXbqe5iKP9vqyYZOb82/AGyrqIJ2zIQ8JNaM4QSQC0m8Kh8k8WS0BF6ZfhGq3d5tlBRNpTs2D7HwWnqymA1prnJzfP6YMRXK0d4UOPSg5midtzLDEDAn6TQRIulj1B96KZB7 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2016 11:48:46.8624 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2254 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160817_044914_517266_10A75AC8 X-CRM114-Status: GOOD ( 12.62 ) 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: szabolcs.nagy@arm.com, heiko.carstens@de.ibm.com, cmetcalf@ezchip.com, ynorov@caviumnetworks.com, philipp.tomsich@theobroma-systems.com, joseph@codesourcery.com, zhouchengming1@huawei.com, Prasun.Kapoor@caviumnetworks.com, agraf@suse.de, Andrew Pinski , geert@linux-m68k.org, kilobyte@angband.pl, manuel.montezelo@gmail.com, pinskia@gmail.com, linyongting@huawei.com, klimov.linux@gmail.com, broonie@kernel.org, bamvor.zhangjian@huawei.com, maxim.kuvyrkov@linaro.org, Nathan_Lynch@mentor.com, Andrew Pinski , schwidefsky@de.ibm.com, davem@davemloft.net, 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-Virus-Scanned: ClamAV using ClamSMTP From: Andrew Pinski Add a separate syscall-table for ILP32, which dispatches either to native LP64 system call implementation or to compat-syscalls, as appropriate. Signed-off-by: Andrew Pinski Signed-off-by: Yury Norov --- arch/arm64/include/asm/unistd.h | 6 ++- arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/entry.S | 28 +++++++++++++- arch/arm64/kernel/sys_ilp32.c | 86 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 arch/arm64/kernel/sys_ilp32.c diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index fe9d6c1..250654c 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@ -13,13 +13,17 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + +#ifdef CONFIG_COMPAT +#define __ARCH_WANT_SYS_LLSEEK +#endif + #ifdef CONFIG_AARCH32_EL0 #define __ARCH_WANT_COMPAT_SYS_GETDENTS64 #define __ARCH_WANT_COMPAT_STAT64 #define __ARCH_WANT_SYS_GETHOSTNAME #define __ARCH_WANT_SYS_PAUSE #define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK #define __ARCH_WANT_SYS_NICE #define __ARCH_WANT_SYS_SIGPENDING #define __ARCH_WANT_SYS_SIGPROCMASK diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 4a81d93..36257b7 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -27,7 +27,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_ARM64_ILP32) += binfmt_ilp32.o sys_ilp32.o arm64-obj-$(CONFIG_COMPAT) += entry32_common.o arm64-obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 9e18747..4c44312 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -255,6 +255,23 @@ tsk .req x28 // current thread_info .text +#ifdef CONFIG_ARM64_ILP32 +/* + * AARCH64/ILP32. Zero top halves of x0-x7 + * registers as userspace may put garbage there. + */ + .macro delouse_input_regs + mov w0, w0 + mov w1, w1 + mov w2, w2 + mov w3, w3 + mov w4, w4 + mov w5, w5 + mov w6, w6 + mov w7, w7 + .endm +#endif + /* * Exception vectors. */ @@ -523,6 +540,7 @@ el0_svc_compat: * AArch32 syscall handling */ adrp stbl, compat_sys_call_table // load compat syscall table pointer + ldr x16, [tsk, #TI_FLAGS] uxtw scno, w7 // syscall number in w7 (r7) mov sc_nr, #__NR_compat_syscalls b el0_svc_naked @@ -749,15 +767,21 @@ ENDPROC(ret_from_fork) .align 6 el0_svc: adrp stbl, sys_call_table // load syscall table pointer + ldr x16, [tsk, #TI_FLAGS] uxtw scno, w8 // syscall number in w8 mov sc_nr, #__NR_syscalls +#ifdef CONFIG_ARM64_ILP32 + tst x16, #_TIF_32BIT_AARCH64 + b.eq el0_svc_naked // We are using LP64 syscall table + adrp stbl, sys_call_ilp32_table // load ilp32 syscall table pointer + delouse_input_regs +#endif el0_svc_naked: // compat entry point stp x0, scno, [sp, #S_ORIG_X0] // save the original x0 and syscall number enable_dbg_and_irq ct_user_exit 1 - ldr x16, [tsk, #TI_FLAGS] // check for syscall hooks - tst x16, #_TIF_SYSCALL_WORK + tst x16, #_TIF_SYSCALL_WORK // check for syscall hooks b.ne __sys_trace cmp scno, sc_nr // check upper syscall limit b.hs ni_sys diff --git a/arch/arm64/kernel/sys_ilp32.c b/arch/arm64/kernel/sys_ilp32.c new file mode 100644 index 0000000..10fc0ca --- /dev/null +++ b/arch/arm64/kernel/sys_ilp32.c @@ -0,0 +1,86 @@ +/* + * AArch64- ILP32 specific system calls implementation + * + * Copyright (C) 2016 Cavium Inc. + * Author: Andrew Pinski + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#define __SYSCALL_COMPAT + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Using aarch32 syscall handlerss where off_t is passed. + */ +#define compat_sys_fadvise64_64 compat_sys_fadvise64_64_wrapper +#define compat_sys_fallocate compat_sys_fallocate_wrapper +#define compat_sys_fcntl64 sys_fcntl +#define compat_sys_ftruncate64 compat_sys_ftruncate64_wrapper +#define compat_sys_pread64 compat_sys_pread64_wrapper +#define compat_sys_pwrite64 compat_sys_pwrite64_wrapper +#define compat_sys_readahead compat_sys_readahead_wrapper +#define compat_sys_shmat sys_shmat +#define compat_sys_sync_file_range compat_sys_sync_file_range2_wrapper +#define compat_sys_truncate64 compat_sys_truncate64_wrapper +#define sys_mmap2 compat_sys_mmap2_wrapper +#define sys_ptrace compat_sys_ptrace + +/* + * Use non-compat syscall handlers where rlimit, stat and statfs + * structure pointers are passed, as their layout is identical to LP64. + */ +#define compat_sys_fstatfs64 sys_fstatfs +#define compat_sys_statfs64 sys_statfs +#define sys_fstat64 sys_newfstat +#define sys_fstatat64 sys_newfstatat +#define compat_sys_getrlimit sys_getrlimit +#define compat_sys_setrlimit sys_setrlimit + +asmlinkage long compat_sys_fadvise64_64_wrapper(void); +asmlinkage long compat_sys_fallocate_wrapper(void); +asmlinkage long compat_sys_ftruncate64_wrapper(void); +asmlinkage long compat_sys_mmap2_wrapper(void); +asmlinkage long compat_sys_pread64_wrapper(void); +asmlinkage long compat_sys_pwrite64_wrapper(void); +asmlinkage long compat_sys_readahead_wrapper(void); +asmlinkage long compat_sys_sync_file_range2_wrapper(void); +asmlinkage long compat_sys_truncate64_wrapper(void); + +asmlinkage long ilp32_sys_rt_sigreturn_wrapper(void); +#define compat_sys_rt_sigreturn ilp32_sys_rt_sigreturn_wrapper + +#include + +#undef __SYSCALL +#define __SYSCALL(nr, sym) [nr] = sym, + +/* + * The sys_call_ilp32_table array must be 4K aligned to be accessible from + * kernel/entry.S. + */ +void *sys_call_ilp32_table[__NR_syscalls] __aligned(4096) = { + [0 ... __NR_syscalls - 1] = sys_ni_syscall, +#include +};