From patchwork Wed May 16 08:19:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 10403053 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 35656601F9 for ; Wed, 16 May 2018 08:36:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2137D287F3 for ; Wed, 16 May 2018 08:36:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 151A128813; Wed, 16 May 2018 08:36:29 +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 57602287F3 for ; Wed, 16 May 2018 08:36:28 +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=6EoQ6OaMPYf78vrbF8mgJyZTndjScCAGURegE8b1SO8=; b=keOAmlNy8XlRV6 tIrA9oWCG0R4p5g7Fnas3f+EMQCJNCY5UD5tD+bArvwX7I8nqgNMHJbwo5VHhSl3dzb18WNKSvn9D //v90VILQVZh2VyXiNZAuuB+/FVCD7njAjKttG0vqlKP8wlYRGo6yPcNwShO3ijpNZUssiBF9ZGKj +1usWsWU9GibHZTxQWaUVUx/JH+tTd0sXTGkuC6dGaL83shfZPUGygfMOBxzf7FnspAXl8afYCtPX l+N25nTB4RwxCYtvktaeeCSWLtw835TuC40+HaZYZyV2UijIvOUsa7yWH0vleLC3GNUNGANh9csz+ TEcAgsrAI3hg7gIDGwtA==; 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 1fIrv0-0006u5-9z; Wed, 16 May 2018 08:36:18 +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 1fIrhy-00052B-3N for linux-arm-kernel@bombadil.infradead.org; Wed, 16 May 2018 08:22:50 +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=z/teLk9lbhF4GDwGjLc+ZbUyg26nzBPGDnAY7nA2oCI=; b=M8mnVU7MnWuR9+5aoSOhpdUnI v62piDLrMUDFyZE1AE8fD6Wmk139cF+n2dbGPHidzRjZl82x3lSTea38L6MsOgNAhGOP8KR/rp+f7 lkj5x9jIf11ZA8AAlLKdtsL5vNmCPPrJ4mSQLSqyG2YU0OD4Udud9SU/GzQIKOoQhXOFyA/0vVotf T3C12uwJWzK9TGGAZ1WtecQUcvVCN/Ipdqjsv1ItnDEI8rk7KckkNdoHBESPClG3lJNHNdNPhiRHC /LZ1NlZXfPiaMg4an52TiGt+ioU61P6ZKmpKTAo9wOi7SZEGiyyNspDkWjEcVNdyxXt6O3tkkVn/w xCpPDcx0Q==; Received: from mail-by2nam01on0611.outbound.protection.outlook.com ([2a01:111:f400:fe42::611] helo=NAM01-BY2-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIrhv-00020k-HA for linux-arm-kernel@lists.infradead.org; Wed, 16 May 2018 08:22:49 +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=z/teLk9lbhF4GDwGjLc+ZbUyg26nzBPGDnAY7nA2oCI=; b=CfeNH4BUKCvdlNFKgzJXED3zJzPDxOV2NHSzefcVMF1NQ3GXH5/bYYYezFukDPyoJR8/UQvq8aC1yhoO6YT5G0A8Yq2QNnKfeugYDxv6B6eD/HP1m4T8pLi9xXtIeL0hFxy+dMB181r94ivbbbhRZcHR7Blbggc5McWNiCehie4= 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:30 +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 17/24] arm64: ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Date: Wed, 16 May 2018 11:19:02 +0300 Message-Id: <20180516081910.10067-18-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: VI1PR08CA0114.eurprd08.prod.outlook.com (2603:10a6:800:d4::16) 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:X5lnRTJteecAEFRmMz4c5iCmTu4WflLBtgoYg/hc2Ca/oc2RtPVrNRhHbQ20b2QEPKqasL6AdD4G1ghCdYpUSw6aIhRxhGHADL/rFhhbXzMkwDnrdCoRmOl6NDna84/klO+JZrtgUiWrq3IgOXPOHZpuV9wBKY1/VnsXnSti6ObCPSNRcwkRBwg4COOMi7Zp6LyNE44yzXmLcQ4fSw5XAhZYIQ5a3t3s5PFJ0i08AqOkq3v/AaqOXuDsG1l703NS; 25:D4wrvlIO0Rwh4qj6aCidnmR0IGgKGJPt1sRQEkZL0UyGWYvnIYqPkZwVO1LhVCtLwP11JSAvSXTNlFYiz3AKXosVeiY2uDe9du/wi7ZYDHqEz4NTAMPq7Hg0nubnwT5bNj0iN6WJAILFXYAboajLpK0zpBegkJKsuz0Vw/3M9trqSpBX7S556u/LiVxLkt3tc3INaBBTEb6RXirrNwDByWwlj8+vYX/SBvgNYMuIQpdaBbtANvzFaFRe6SoBuU55FvXgP56qlJxJnYzoKAumhkbPzp9MTOqh+ap4BWf2UyQ2lXC96p5YoOdWwQ98EndS8/3mgt98cZ1P994qWnS3Rw==; 31:2sOYSHQiOhClV4tbcII6nfVx0jJnxKT4TZrbh1vcxpvbmYzAvhQYt34OlmWfhB/HlpFgCJD0TOmMfsDadtanLdI0uzpp1XAEnilPU5iNsXpZZwVY/mqPIVBK1NX8dQmLeofBdOa/OceiN6oLxBti3TsyNK7uPLQKczhlhcu7TQK69MKTVvAfMdC6GpQHZGFD/wMXq6h8YaEVwByPinIluzycKt5pGYOoF1F8npjsA5I= X-MS-TrafficTypeDiagnostic: SN6PR07MB4384: X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4384; 20:lSRSuLmTKoxxmhReNTEOb9CX4P0eHPSBfy7LE2p0hZCIEIajuwyKPeOHQuvPLiYVZJ0ncn68ZTns1SMMbbuNXz6hAI0vb0t8dJFC9+yKs6oTYRp7d6SRQG7JeMWowybN61FVjcA/4L57jQqBJ/L5aTdqS+skWLZBOgwywTjOKnZXkUOzohaEFZkmdB0lk5kA/gY7306xRQASRlzddZGYlpAQMyVyjBrfTpolRg7ETtCq2xZfnbGubX9nk6K7Ps+BK1niXN6tzG7XuSRdfnnombZMcqc/eaSO7GsgLRkvtoCYnViFrlntL3YumZHtfguq2/vEBMgBXeS5duTnWI+eiL8jZ08IFj4HTAZvX3nqvtlxdL5+NA2l1ennd1uNNB281ae2R6IM5QiSE/NfrL7MBrBlnGKRjzUvNEW7/GxKdrGktgFADCZQXMV+LH0TZ1B+LJXbm5vW1fZWU5VDORm1YNDXKugPbnOyf1ueJ5VoA5LeemvITdciRBSVmA1uwIpCEQGLX8n2AIi1Pu7Ck4wvwAWxiHFuNxxs8s9SRe2RyRIHyiEdb72RjgDlqBl0F3TQgJog8yqeH7T6QzgQSyM4A8Dk9PEE0mZ1iloMEJWmDpE= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(22074186197030)(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-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4384; 4:YaoXOFSnDsVuPLRW8XfRZyXONQofVWlJe7JaEIHbOD45C3stDQ/8ylnr3b2GV8+NR8eJfp675mhZJhOrsvyw+9LnuCfNs7sYLHlV7aeEG9T+DBVZygirZ0Xw4LJ5PCGn8W8udhS9V7mBPvr+5yAyfX8G17SLh9FVncEYJs4n9UpsE/TE0lLfPSbt0WGJdrQ3+hceivDEp+8sJ9xVPxs8EdXA7WzFiIi4i35AmbZesjONLeH+7flRroByPrOHx0w9gH57/cPMXd9n/hRr4rWitZf2gE/UcEBRaMb0/fohniTSeeW2/B6xu11/5/GFb+GX+H2sYCa6TSoUsuTn0nOvSaw/6zYG5rYayakJseRMk2bmRjtuD42+uCD1AE0KBFnV X-Forefront-PRVS: 0674DC6DD3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(396003)(366004)(39380400002)(39860400002)(376002)(346002)(189003)(199004)(6306002)(36756003)(25786009)(7406005)(6496006)(7736002)(305945005)(2906002)(105586002)(76176011)(52116002)(51416003)(7416002)(66066001)(486006)(6486002)(6666003)(42882007)(11346002)(316002)(446003)(16586007)(956004)(39060400002)(2616005)(54906003)(110136005)(478600001)(26005)(107886003)(386003)(59450400001)(53936002)(47776003)(50466002)(3846002)(106356001)(81166006)(81156014)(48376002)(8676002)(6116002)(76506005)(50226002)(68736007)(476003)(72206003)(16526019)(97736004)(5660300001)(186003)(4326008)(1076002)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4384; H:localhost; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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:cPUKIGHvZINqDK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zHAHsaejhm4Qr29vhwlU+9j8jz0M2HNg3igqx1swAqLt6q2gd/411cyEANNpOK/WGL4Xvud7yyezatjB/kCAmIcJU1Gg4afnFBpNVQzCvdIiG7rBosMTuM2MMxbaAjcNxerFbd/eEzCBbpbpWwuYKRa1V2axPy0H4VlSSFm0E9PxeV5YyocWDjNCOXaHDym6ytc6y1w7dxz+U9WSGDup+no7utFWRKQKsLrKl4VCSJd7nwgzEoFwoXYCjKbXWuoeL3esoNqv8HvSf7oXeK5TyvDDOA==; 5:4eSJhPGtgpw1ydgqj0xsB9vm/cFpACOlpRAHj8PoYI47nn0qMapyDcP2/zq/whFSjddr/dAV1eJNXStzeGMsO9alpjurjTgkYfGp1QpF8ard8NMxH+Tfo84q9X+dytIwump54LIhim6CiR2k5J4cvlkRWgSo5pwnhBQ0IgQyt4I=; 24:JmG3C/oJSgRereh5C/GSeB4Ia9RTPdGMUk9bzxoIs24326MxkYdHTYHl++RlpDRZFtl+pbKOzCM5cnSr51O1FufYhvWKN6yMZT9If/HLcVk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4384; 7:ZBp9JRlmuRbV1+Xsx+sd7vyNowC3424FMc8KEZA9M8UXe7TpBkRtfBye19kcnh0/nWlO+BjxY+eO/5EX6YtfiWyJL7MbCXoqXEMJ9fGLaKgKXGWepogGWTeExstoxptTblJmHwBEuu7JM5A66GGIaUvzhs0szWggYLmPelMSOs9bC8R+Jcr61abbVcWiQIzsAWmtWwSx+Q+GbfTD9mWF8gEv3EtoPQE8mxDhq3Gd+dEr7jxamXMNv9Fk3dVbBeYi X-MS-Office365-Filtering-Correlation-Id: 0c800a41-dd5b-47d8-216b-08d5bb062b08 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2018 08:22:30.2225 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c800a41-dd5b-47d8-216b-08d5bb062b08 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_042248_081686_34FCC9BC X-CRM114-Status: GOOD ( 14.02 ) 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 , Andrew Pinski , 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 , Andrew Pinski , 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 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 Signed-off-by: Bamvor Jian Zhang --- arch/arm64/include/asm/unistd.h | 8 ++- arch/arm64/include/uapi/asm/unistd.h | 12 ++++ arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/entry.S | 31 +++++++++- arch/arm64/kernel/sys_ilp32.c | 90 ++++++++++++++++++++++++++++ 5 files changed, 137 insertions(+), 6 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 99d29290c98b..1bf5572cd078 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@ -13,12 +13,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifdef CONFIG_AARCH32_EL0 + +#ifdef CONFIG_COMPAT #define __ARCH_WANT_COMPAT_STAT64 +#define __ARCH_WANT_SYS_LLSEEK +#endif + +#ifdef CONFIG_AARCH32_EL0 #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/include/uapi/asm/unistd.h b/arch/arm64/include/uapi/asm/unistd.h index 439b1c55c827..80f1cb4ae2e1 100644 --- a/arch/arm64/include/uapi/asm/unistd.h +++ b/arch/arm64/include/uapi/asm/unistd.h @@ -15,7 +15,19 @@ * along with this program. If not, see . */ +/* + * Use AARCH32 interface for sys_sync_file_range() as it passes 64-bit arguments. + */ +#if defined(__ILP32__) || defined(__SYSCALL_COMPAT) +#define __ARCH_WANT_SYNC_FILE_RANGE2 +#endif + +/* + * AARCH64/ILP32 is introduced after next syscalls were deprecated. + */ +#if !(defined(__ILP32__) || defined(__SYSCALL_COMPAT)) #define __ARCH_WANT_RENAMEAT #define __ARCH_WANT_SET_GET_RLIMIT +#endif #include diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 2dde9ae508ec..a6db407d4089 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -28,7 +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_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 698907724eed..d03542418f9b 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -401,6 +401,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. */ @@ -695,6 +712,7 @@ el0_svc_compat: */ ldr x16, [tsk, #TSK_TI_FLAGS] // load thread flags adrp stbl, compat_sys_call_table // load compat syscall table pointer + ldr x19, [tsk, #TSK_TI_FLAGS] mov wscno, w7 // syscall number in w7 (r7) mov wsc_nr, #__NR_compat_syscalls b el0_svc_naked @@ -916,14 +934,15 @@ ENDPROC(ret_to_user) el0_svc: ldr x16, [tsk, #TSK_TI_FLAGS] // load thread flags adrp stbl, sys_call_table // load syscall table pointer + ldr x19, [tsk, #TSK_TI_FLAGS] mov wscno, w8 // syscall number in w8 mov wsc_nr, #__NR_syscalls #ifdef CONFIG_ARM64_SVE alternative_if_not ARM64_SVE - b el0_svc_naked + b el0_svc_select_table alternative_else_nop_endif - tbz x16, #TIF_SVE, el0_svc_naked // Skip unless TIF_SVE set: + tbz x16, #TIF_SVE, el0_svc_select_table // Skip unless TIF_SVE set: bic x16, x16, #_TIF_SVE // discard SVE state str x16, [tsk, #TSK_TI_FLAGS] @@ -939,12 +958,18 @@ alternative_else_nop_endif msr cpacr_el1, x9 // synchronised by eret to el0 #endif +el0_svc_select_table: +#ifdef CONFIG_ARM64_ILP32 + tbz x19, #TIF_32BIT_AARCH64, 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, xscno, [sp, #S_ORIG_X0] // save the original x0 and syscall number enable_daif ct_user_exit 1 - tst x16, #_TIF_SYSCALL_WORK // check for syscall hooks + tst x19, #_TIF_SYSCALL_WORK // check for syscall hooks b.ne __sys_trace cmp wscno, wsc_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 000000000000..9803d7806328 --- /dev/null +++ b/arch/arm64/kernel/sys_ilp32.c @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/* + * AArch64- ILP32 specific system calls implementation + * + * Copyright (C) 2018 Cavium Inc. + * Author: Andrew Pinski + */ + +#define __SYSCALL_COMPAT + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * AARCH32 requires 4-page alignment for shared memory, + * but AARCH64 - only 1 page. This is the only difference + * between compat and native sys_shmat(). So ILP32 just pick + * AARCH64 version. + */ +#define compat_sys_shmat sys_shmat + +/* + * ILP32 needs special handling for some ptrace requests. + */ +#define sys_ptrace compat_sys_ptrace + +/* + * Using AARCH32 interface for syscalls that take 64-bit + * parameters in registers. + */ +#define compat_sys_fadvise64_64 compat_sys_fadvise64_64_wrapper +#define compat_sys_fallocate compat_sys_fallocate_wrapper +#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_sync_file_range2 compat_sys_sync_file_range2_wrapper +#define compat_sys_truncate64 compat_sys_truncate64_wrapper +#define sys_mmap2 compat_sys_mmap2_wrapper + +/* + * Using AARCH32 interface for syscalls that take the size of + * struct statfs as an argument, as it's calculated differently + * in kernel and user spaces. + */ +#define compat_sys_fstatfs64 compat_sys_fstatfs64_wrapper +#define compat_sys_statfs64 compat_sys_statfs64_wrapper + +/* + * Using custom wrapper for rt_sigreturn() to handle custom + * struct rt_sigframe. + */ +#define compat_sys_rt_sigreturn ilp32_sys_rt_sigreturn_wrapper + +asmlinkage long compat_sys_fstatfs64_wrapper(void); +asmlinkage long compat_sys_statfs64_wrapper(void); +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); + +#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 +};