From patchwork Mon Nov 2 23:30:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 7538761 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 34B609F71A for ; Mon, 2 Nov 2015 23:34:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AB9A52061B for ; Mon, 2 Nov 2015 23:34:42 +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 333BB2041C for ; Mon, 2 Nov 2015 23:34:41 +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 1ZtOan-0005S2-Al; Mon, 02 Nov 2015 23:32:49 +0000 Received: from mail-bl2on0083.outbound.protection.outlook.com ([65.55.169.83] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZtOaP-0004zu-E3 for linux-arm-kernel@lists.infradead.org; Mon, 02 Nov 2015 23:32:33 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (109.252.143.100) by DM2PR07MB624.namprd07.prod.outlook.com (10.141.177.154) with Microsoft SMTP Server (TLS) id 15.1.306.13; Mon, 2 Nov 2015 23:32:01 +0000 From: Yury Norov To: , , , Subject: [PATCH v6 04/17] arm64: change some CONFIG_COMPAT over to use CONFIG_AARCH32_EL0 instead Date: Tue, 3 Nov 2015 02:30:33 +0300 Message-ID: <1446507046-24604-5-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1446507046-24604-1-git-send-email-ynorov@caviumnetworks.com> References: <1446507046-24604-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [109.252.143.100] X-ClientProxiedBy: VI1PR06CA0038.eurprd06.prod.outlook.com (25.162.116.176) To DM2PR07MB624.namprd07.prod.outlook.com (10.141.177.154) X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB624; 2:U9CNDSvOGPpepiKUaz5De5MpSZI7uDZdcy78BDetUW8o2LynuCN3eItqC418L48n0bAleC41axdSBBj40EJ62yk3dAS+Kf75z0sP9ll60VrF5MoBni7ZUaCL5JBodMM/dhyj2AfIkAhpEg0r1PRqRBJZHciefIy+Z0DxZCy9lYs=; 3:sx1vv29ukXMK46/j1TMXatLRwNNyfqITQDHUfd/+1xKuWMN/dq2XDBDt5h1sMZXGE2HPtm4P2hgpkaxFMwci1Vfbu4VpEjtXk1ntQz3E9hcbN+IyyjcpnVGDAYaUysuQH+6DW2Xw1tNDW1lkJXWsdQ==; 25:vj9zYrrghdJTUac4yGIoKRW0VVDqTbeHxOtf3RqjPRB7ujdTnzpmn8BQoEwlB8qW4M5fFERoBZROeMikRh5Hn60epJ2O2sLs71xeBMxJuJuQF1VafHjVzYmBQsDYvC2OwxZ/eXblqdR7SS7R4DYCz74XtUET7DEchsqcRY53Edb6ZO83RgTgacNcp3g3rY5YYMZd5g4N5i/uqp/Coyyxr8A1l8qEEB3f9rQWriJrkWorGynYS4lGJmmrToukremYhCuImUhqDtF+e67+cTsM7w== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR07MB624; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB624; 20:hngYoXlgB7a5hXHYr+3Ioab3SsaCUmEOwAbDdld4/DRA+QsigJSWzHpoaxYc0IWRMQqo8KygFGyjnWkW6tsMnCtwYvT+/z6KLf0FQVuuP2DkwQH9P/8TrWmJszvRumzoJAPv5wAEMeVNqzklUqzzTfUXgRCtMr7aPml8EU9L7TgNVb2FEG8ujh9mLs4kgniTGj/x6Kr6jhP70f6GyTkhV3/cLOZjOFIPV2otCBIccjSLbs9G+dLwFn8+kk0yxEccfPjYKnjp7ubrq0upnON/NmTTKesk1Bag9G3wvXu00d1brGWQhU7+VL63/XTKm6ng6ipbSgH9yVISAnmTu2dCMN2FVA2+UFNd5MCegaq8g58+xbnL270dDYJ9p0N+KBiiUN0MvS+7KQzRYIhuuffZtZuXWonwiAVTLHj7lXKSJ4hwVIYF/esBEPzIZY5N5dfObeFpBA+wa7NoQ3+0qSn32BZTh9ZUzsGKyW/9BuzggX8beJaC2IbgrjCQe4yjzzza5GX2hopz/CCHWyTA3uQGixASK8rywm8OK8h9wnCG/VD0F0GWrOhJ7vX92R7sMkj4IQYQwc12apMyuvzyTRlTa71YLqZyxVSu7mGbz6LlH3k= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001)(10201501046); SRVR:DM2PR07MB624; BCL:0; PCL:0; RULEID:; SRVR:DM2PR07MB624; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB624; 4:ODn9xpvahJunQMLw+XT3FL2aR3djQSw3PIt+wSxLKV/XsDtsHEk844U+AgpD3TgXHyxx//3OTdF6x/CzKjI38F6owdr/eOK7LxN4Gdr+FbxkbFCPYtXfL2VFi7ptIHa2imNyB/B6m/RQH3fhr74LAJ554jGQMpM34lIXTtDBld9W5QUPxe1c5L+/JOrAHAxFwbanBCsHLK6UVbgyWsp6vtsziiA/z+pnfGus2XbP4dV4gl1vV3auPU1CXI6Q0wyON0n4ZtDkDgXbMEtvr3GMkY3LdEPlm38RFwuoiHOg2AX/cDVbtk0b5QQujrPYIxtIe97nCpgCoI2pXhnbp3neRRaec1RT8Y64yat3fcIBRXmL6Soe3SyM6+qfCM+XdxDs X-Forefront-PRVS: 0748FF9A04 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(199003)(189002)(42186005)(5008740100001)(66066001)(48376002)(229853001)(106356001)(122386002)(575784001)(15975445007)(40100003)(33646002)(2950100001)(19580395003)(47776003)(77096005)(50226001)(50986999)(5001960100002)(105586002)(107886002)(19580405001)(76176999)(81156007)(189998001)(36756003)(87976001)(50466002)(92566002)(76506005)(5001920100001)(2201001)(5003940100001)(5004730100002)(4001430100002)(97736004)(101416001)(5001770100001)(5007970100001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR07MB624; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; DM2PR07MB624; 23:LxdopjE4cam6rVT7FYB1F0Xj6KEqfjihMsqBqCNGgg?= =?us-ascii?Q?aP/DccXgRmZySTlW5gHRBNn1fVG9FoyItm/krCZuzmQvxBwZgpLHnBcpDmRW?= =?us-ascii?Q?XsscXEYjbOZ73aKWdsdmI1vuBDFZlg9UZeLD7e67ygXCnBszVmxNS1QvJtqn?= =?us-ascii?Q?5H91BEAzPMv9w45MGsO2HIt3vPvLiJhYXMObKodCHdwmk2BdByigsGUg3vLu?= =?us-ascii?Q?QmVc1l2xuaornZCXpZ/Q75LbqBw7rMQ9APi+n5wnDBNvN2SpFPmlF4ieIYm8?= =?us-ascii?Q?cR1lggBx/hr4n0O1Tj2mRWFHzyiEYnSJe1M3gqKu5R8aOt9yU0qWIJ7X1ncT?= =?us-ascii?Q?UoZvxJUAJVnHDxJ+XrN+TzhSQKTM+GtVWjrUXW7Oel+YNzZ/zDQpcAespEgj?= =?us-ascii?Q?3JfEdQPww354lVwFYhTPI/huI4MBjRFeRbY8MtuHFE7tKYsE/eC9fNuKpbFR?= =?us-ascii?Q?HZuYQlQIa3SAFPqoyJLPJZwwcca3CPWwYNN1gzOjkWVKIJTHzRqcrk/dpcbX?= =?us-ascii?Q?6IRsdg1dnNZX4qWijHjo190KNysX/044ltmJT5XtRMF0JkGWBenuWD27Fa2w?= =?us-ascii?Q?R8fFxHznSHzGURElJyQPHQ3o8kjDlwJxEGU1H3Z9spnvHY8lkLPcwoJCP5nP?= =?us-ascii?Q?1DHziObAhEIKMmEmeeiFn1crw1G1LEe6JlurMQ8NXaL3CuraHkPfxjpg/VsE?= =?us-ascii?Q?YkP3GXaKluku5eQZyINDHpmsv5ginmCs1tw/xuqOpotxds+QmITuseIK9g7Y?= =?us-ascii?Q?Ka/QDhda3wCW/7ZPaXOhiB2AxOZw01MT3aOU0Wr3dphgqcIINk+/6u9vMlY2?= =?us-ascii?Q?sIl+7t7yrDhVNWOfIPojSxIZjgm5D82w6bSjTlYkLIIP/Wd6GudStKZtud82?= =?us-ascii?Q?dswgyVjm8UkYQ6I0mvCGyM47NfzUp6gYrKp2RnOxziTC2U7qpAcGX5RLxqa6?= =?us-ascii?Q?vX/wQnbi+BaXL584aiixn7H3WHjPBohze+AjnBQO8fI1frmGhAUMsZBPKLQf?= =?us-ascii?Q?puytNGUQZ8SwFcO3U0H+YTAf0GWWvpbqOj1DG+UQ/8OmNps7HJxpKy/UVQ0j?= =?us-ascii?Q?uIRDd66JVsiPO5TS70yoafQ353trav72XOSMQkL+9O2zeH92Mpfs44idlR68?= =?us-ascii?Q?wMdguh6Uh3jKhWAE9DMP8a+0u4EXAmP/YR9qMz83EE6iTgw0hJS2VsveXUoc?= =?us-ascii?Q?lh2j21JN7kr30=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB624; 5:4nvBvMjlA2zb2ox4priCTl7I7haNWDZb/9wv3aL50GS9SrU4QeGnt+aKv2Svn+RSiG/wu2FWQo71CCYqRH6mAwmFQLB8L43O1weTDcyvdeYGPvLfj3ZcPvwIH13o3En/cFnwFbkvv6FPfc+iUm5aPQ==; 24:fclEQ5wQsE6DpLAv2EnjaovR2rnPgtN6o6IOwh0eZKGYhDa4khTmczf3A3H5NRvJnf+XgqI84hLt1oQk8pMHUbCbh1UFcqWUCWkIrHoiwn0=; 20:q3XUcaVYfOldk0HeP1Vy0v5ijlLZIL+QunjtXOTc6tYZ+uJTep3MCKXmJlauwEz0rEc4Eg1Y8p/uB3QDxb0oLQ== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2015 23:32:01.9953 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR07MB624 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151102_153226_019447_945F2A25 X-CRM114-Status: GOOD ( 12.78 ) 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, Nathan_Lynch@mentor.com, agraf@suse.de, klimov.linux@gmail.com, Andrew Pinski , broonie@kernel.org, jan.dakinevich@gmail.com, Andrew Pinski , ddaney.cavm@gmail.com, bamvor.zhangjian@huawei.com, Yury Norov , philipp.tomsich@theobroma-systems.com, andrey.konovalov@linaro.org, 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, T_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 From: Andrew Pinski Signed-off-by: Philipp Tomsich Signed-off-by: Christoph Muellner Signed-off-by: Yury Norov Signed-off-by: Andrew Pinski Reviewed-by: David Daney --- arch/arm64/include/asm/elf.h | 20 +++++++++++++++++--- arch/arm64/include/asm/fpsimd.h | 2 +- arch/arm64/include/asm/processor.h | 4 ++-- arch/arm64/include/asm/ptrace.h | 2 +- arch/arm64/include/asm/signal32.h | 19 +++++++++++++++++++ arch/arm64/include/asm/stat.h | 2 ++ arch/arm64/include/asm/unistd.h | 4 +++- arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/asm-offsets.c | 2 +- arch/arm64/kernel/entry.S | 6 +++--- arch/arm64/kernel/head.S | 2 +- arch/arm64/kernel/ptrace.c | 27 ++++++++++++++++++++------- arch/arm64/kernel/signal.c | 16 ++++++++++++++++ arch/arm64/kernel/traps.c | 2 +- arch/arm64/kernel/vdso.c | 4 ++-- 15 files changed, 90 insertions(+), 24 deletions(-) diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index faad6df..663f25d 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -166,14 +166,16 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm, #define COMPAT_ELF_ET_DYN_BASE (2 * TASK_SIZE_32 / 3) +#ifdef CONFIG_AARCH32_EL0 + /* AArch32 registers. */ -#define COMPAT_ELF_NGREG 18 +#define COMPAT_A32_ELF_NGREG 18 typedef unsigned int compat_elf_greg_t; -typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; +typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_A32_ELF_NGREG]; /* AArch32 EABI. */ #define EF_ARM_EABI_MASK 0xff000000 -#define compat_elf_check_arch(x) (((x)->e_machine == EM_ARM) && \ +#define compat_a32_elf_check_arch(x) (((x)->e_machine == EM_ARM) && \ ((x)->e_flags & EF_ARM_EABI_MASK)) #define compat_start_thread compat_start_thread @@ -184,6 +186,18 @@ extern int aarch32_setup_vectors_page(struct linux_binprm *bprm, #define compat_arch_setup_additional_pages \ aarch32_setup_vectors_page +#else + +typedef elf_greg_t compat_elf_greg_t; +typedef elf_gregset_t compat_elf_gregset_t; +#define compat_a32_elf_check_arch(x) 0 +#define COMPAT_SET_PERSONALITY(ex) +#define COMPAT_ARCH_DLINFO + +#endif + +#define compat_elf_check_arch(x) compat_a32_elf_check_arch(x) + #endif /* CONFIG_COMPAT */ #endif diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm/fpsimd.h index 50f559f..63b19f1 100644 --- a/arch/arm64/include/asm/fpsimd.h +++ b/arch/arm64/include/asm/fpsimd.h @@ -52,7 +52,7 @@ struct fpsimd_partial_state { }; -#if defined(__KERNEL__) && defined(CONFIG_COMPAT) +#if defined(__KERNEL__) && defined(CONFIG_AARCH32_EL0) /* Masks for extracting the FPSR and FPCR from the FPSCR */ #define VFP_FPSCR_STAT_MASK 0xf800009f #define VFP_FPSCR_CTRL_MASK 0x07f79f00 diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 98f3235..ff4abec 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -79,7 +79,7 @@ struct cpu_context { struct thread_struct { struct cpu_context cpu_context; /* cpu context */ unsigned long tp_value; /* TLS register */ -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 unsigned long tp2_value; #endif struct fpsimd_state fpsimd_state; @@ -88,7 +88,7 @@ struct thread_struct { struct debug_info debug; /* debugging */ }; -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 #define task_user_tls(t) \ ({ \ unsigned long *__tls; \ diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h index 536274e..1059b3f 100644 --- a/arch/arm64/include/asm/ptrace.h +++ b/arch/arm64/include/asm/ptrace.h @@ -120,7 +120,7 @@ struct pt_regs { #define arch_has_single_step() (1) -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 #define compat_thumb_mode(regs) \ (((regs)->pstate & COMPAT_PSR_T_BIT)) #else diff --git a/arch/arm64/include/asm/signal32.h b/arch/arm64/include/asm/signal32.h index eeaa975..7097718 100644 --- a/arch/arm64/include/asm/signal32.h +++ b/arch/arm64/include/asm/signal32.h @@ -20,6 +20,7 @@ #ifdef CONFIG_COMPAT #include +#ifdef CONFIG_AARCH32_EL0 #define AARCH32_KERN_SIGRET_CODE_OFFSET 0x500 extern const compat_ulong_t aarch32_sigret_code[6]; @@ -47,6 +48,24 @@ static inline int compat_setup_rt_frame(int usig, struct ksignal *ksig, sigset_t static inline void compat_setup_restart_syscall(struct pt_regs *regs) { } +#endif /* CONFIG_AARCH32_EL0 */ +#else +static inline void compat_setup_restart_syscall(struct pt_regs *regs) +{ +} + +static inline int compat_setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set, + struct pt_regs *regs) +{ + return -ENOSYS; +} + +static inline int compat_setup_frame(int usid, struct ksignal *ksig, + sigset_t *set, struct pt_regs *regs) +{ + return -ENOSYS; +} + #endif /* CONFIG_COMPAT */ #endif /* __KERNEL__ */ #endif /* __ASM_SIGNAL32_H */ diff --git a/arch/arm64/include/asm/stat.h b/arch/arm64/include/asm/stat.h index 15e3559..af04276 100644 --- a/arch/arm64/include/asm/stat.h +++ b/arch/arm64/include/asm/stat.h @@ -22,6 +22,7 @@ #include +#ifdef CONFIG_AARCH32_EL0 /* * struct stat64 is needed for compat tasks only. Its definition is different * from the generic struct stat64. @@ -59,3 +60,4 @@ struct stat64 { #endif #endif +#endif diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index 41e58fe..4c2cbbc 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 #define __ARCH_WANT_COMPAT_SYS_GETDENTS64 #define __ARCH_WANT_COMPAT_STAT64 #define __ARCH_WANT_SYS_GETHOSTNAME @@ -26,7 +26,9 @@ #define __ARCH_WANT_COMPAT_SYS_SENDFILE #define __ARCH_WANT_SYS_FORK #define __ARCH_WANT_SYS_VFORK +#endif +#ifdef CONFIG_COMPAT /* * Compat syscall numbers used by the AArch64 kernel. */ diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 22dc9bc..1470332 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -20,7 +20,7 @@ arm64-obj-y := debug-monitors.o entry.o irq.o fpsimd.o \ cpufeature.o alternative.o cacheinfo.o \ smp.o smp_spin_table.o topology.o -arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \ +arm64-obj-$(CONFIG_AARCH32_EL0) += sys32.o kuser32.o signal32.o \ sys_compat.o entry32.o \ ../../arm/kernel/opcodes.o arm64-obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c index 8d89cf8..e3bcf77 100644 --- a/arch/arm64/kernel/asm-offsets.c +++ b/arch/arm64/kernel/asm-offsets.c @@ -51,7 +51,7 @@ int main(void) DEFINE(S_X7, offsetof(struct pt_regs, regs[7])); DEFINE(S_LR, offsetof(struct pt_regs, regs[30])); DEFINE(S_SP, offsetof(struct pt_regs, sp)); -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 DEFINE(S_COMPAT_SP, offsetof(struct pt_regs, compat_sp)); #endif DEFINE(S_PSTATE, offsetof(struct pt_regs, pstate)); diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 4306c93..52be5c8 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -212,7 +212,7 @@ ENTRY(vectors) ventry el0_fiq_invalid // FIQ 64-bit EL0 ventry el0_error_invalid // Error 64-bit EL0 -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 ventry el0_sync_compat // Synchronous 32-bit EL0 ventry el0_irq_compat // IRQ 32-bit EL0 ventry el0_fiq_invalid_compat // FIQ 32-bit EL0 @@ -252,7 +252,7 @@ el0_error_invalid: inv_entry 0, BAD_ERROR ENDPROC(el0_error_invalid) -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 el0_fiq_invalid_compat: inv_entry 0, BAD_FIQ, 32 ENDPROC(el0_fiq_invalid_compat) @@ -414,7 +414,7 @@ el0_sync: b.ge el0_dbg b el0_inv -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 .align 6 el0_sync_compat: kernel_entry 0, 32 diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 90d09ed..d11d0b2 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -519,7 +519,7 @@ CPU_LE( movk x0, #0x30d0, lsl #16 ) // Clear EE and E0E on LE systems mov x0, #0x33ff msr cptr_el2, x0 // Disable copro. traps to EL2 -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 msr hstr_el2, xzr // Disable CP15 traps to EL2 #endif diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 1971f49..2a39b5d 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -76,7 +76,7 @@ static void ptrace_hbptriggered(struct perf_event *bp, .si_addr = (void __user *)(bkpt->trigger), }; -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 int i; if (!is_compat_task()) @@ -651,7 +651,7 @@ static const struct user_regset_view user_aarch64_view = { .regsets = aarch64_regsets, .n = ARRAY_SIZE(aarch64_regsets) }; -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 #include enum compat_regset { @@ -853,7 +853,7 @@ static int compat_tls_set(struct task_struct *target, static const struct user_regset aarch32_regsets[] = { [REGSET_COMPAT_GPR] = { .core_note_type = NT_PRSTATUS, - .n = COMPAT_ELF_NGREG, + .n = COMPAT_A32_ELF_NGREG, .size = sizeof(compat_elf_greg_t), .align = sizeof(compat_elf_greg_t), .get = compat_gpr_get, @@ -877,7 +877,7 @@ static const struct user_regset_view user_aarch32_view = { static const struct user_regset aarch32_ptrace_regsets[] = { [REGSET_GPR] = { .core_note_type = NT_PRSTATUS, - .n = COMPAT_ELF_NGREG, + .n = COMPAT_A32_ELF_NGREG, .size = sizeof(compat_elf_greg_t), .align = sizeof(compat_elf_greg_t), .get = compat_gpr_get, @@ -1109,7 +1109,7 @@ static int compat_ptrace_sethbpregs(struct task_struct *tsk, compat_long_t num, } #endif /* CONFIG_HAVE_HW_BREAKPOINT */ -long compat_arch_ptrace(struct task_struct *child, compat_long_t request, +long compat_a32_arch_ptrace(struct task_struct *child, compat_long_t request, compat_ulong_t caddr, compat_ulong_t cdata) { unsigned long addr = caddr; @@ -1186,11 +1186,24 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, return ret; } -#endif /* CONFIG_COMPAT */ +#else /* !CONFIG_AARCH32_EL0 */ +#define compat_a32_arch_ptrace(child, request, caddr, cdata) (-1) +#endif /* !CONFIG_AARCH32_EL0 */ + +#ifdef CONFIG_COMPAT +long compat_arch_ptrace(struct task_struct *child, compat_long_t request, + compat_ulong_t caddr, compat_ulong_t cdata) +{ + if (is_compat_task()) + return compat_a32_arch_ptrace(child, request, caddr, cdata); + return compat_ptrace_request(child, request, caddr, cdata); +} +#endif + const struct user_regset_view *task_user_regset_view(struct task_struct *task) { -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 /* * Core dumping of 32-bit tasks or compat ptrace requests must use the * user_aarch32_view compatible with arm32. Native ptrace requests on diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index e18c48c..1e3593c 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -414,3 +414,19 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, fpsimd_restore_current_state(); } + +/* + * Some functions are needed for compat ptrace but we don't define + * them if we don't have AARCH32 support compiled in + */ +#if defined CONFIG_COMPAT && !defined CONFIG_AARCH32_EL0 +int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) +{ + return -EFAULT; +} + +int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) +{ + return -EFAULT; +} +#endif diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index f93aae5..9ce9894 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -363,7 +363,7 @@ long compat_arm_syscall(struct pt_regs *regs); asmlinkage long do_ni_syscall(struct pt_regs *regs) { -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 long ret; if (is_compat_task()) { ret = compat_arm_syscall(regs); diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index 97bc68f..26352a6 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -49,7 +49,7 @@ static union { } vdso_data_store __page_aligned_data; struct vdso_data *vdso_data = &vdso_data_store.data; -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 /* * Create and map the vectors page for AArch32 tasks. */ @@ -107,7 +107,7 @@ int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp) return PTR_ERR_OR_ZERO(ret); } -#endif /* CONFIG_COMPAT */ +#endif /* CONFIG_AARCH32_EL0 */ static struct vm_special_mapping vdso_spec[2];