From patchwork Tue Dec 15 21:42:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 7857421 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 85F6DBEEE1 for ; Tue, 15 Dec 2015 21:47:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 06939203A9 for ; Tue, 15 Dec 2015 21:47:08 +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 B6DD32037F for ; Tue, 15 Dec 2015 21:47:06 +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 1a8xPW-0003hs-BV; Tue, 15 Dec 2015 21:45:30 +0000 Received: from mail-bn1bon0626.outbound.protection.outlook.com ([2a01:111:f400:fc10::1:626] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a8xOp-0001k3-Pp for linux-arm-kernel@lists.infradead.org; Tue, 15 Dec 2015 21:45:03 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by BY2PR07MB615.namprd07.prod.outlook.com (10.141.222.150) with Microsoft SMTP Server (TLS) id 15.1.337.19; Tue, 15 Dec 2015 21:44:23 +0000 From: Yury Norov To: , , , Subject: [PATCH v6 04/20] arm64: change some CONFIG_COMPAT over to use CONFIG_AARCH32_EL0 instead Date: Wed, 16 Dec 2015 00:42:30 +0300 Message-ID: <1450215766-14765-5-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1450215766-14765-1-git-send-email-ynorov@caviumnetworks.com> References: <1450215766-14765-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: HE1PR01CA0001.eurprd01.prod.exchangelabs.com (25.163.2.139) To BY2PR07MB615.namprd07.prod.outlook.com (10.141.222.150) X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB615; 2:PMx/nKoIsj7PizZvQUkMjH+m+XRj8I4G606Ezcx8M5snM2PfuNvaTaZa6T7iVvjayMdJUAFSVd3Hec3fc2211/t+mUztzNXWOaKzhmUl5RgkAjQIsIvOPI/Tz2CUTnQwMRTXAbSu79nuEzSDlsjIyA==; 3:95geOARH8Mhl2dB01r3gh3Z0DfUQDo1oBGGpAsYwN8kjPx1lfYYRQFmH9+vJ1Gr5A7P6GQm+/qkdSpBICFyP08K25QPNL2cuUXirksCNUjctJr0kAFeFoIjG+9OypV+K; 25:LlGAeRMFw+2sFwOrAMdJKBuf/OOR4V8pK4daxVxpmiZtc6JS0gPiJcYZ3uVjy96faw/O9uIaCTvrEmmPhxf2LfzJ3tyT+c2xZ8fWLypbXDXphNdy1wbBx8wVDQnGX6jHc5B67ukN5Pfa81L4rnc9j7l5dBvprrqAo61u+uW8t3bgjF9VXYPozyKY6zWRZ8Ux4yff6SovSPeSzXo8Arp3s+b93OidVDA14PrnqULhT6B058L/xBPt43tLpssg3F37XmQrN1iQcBunl+s9kHolgg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR07MB615; X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB615; 20:hy+9Q06P5JUU9aNCDed+37VTTkTSNnC+yAKzBrfzWyx18utqkbWYB2SBklsn+o51HBoGD200FwBUVc9PNvtvk9DqPiM9u2pK2RRnh9QWoYgzOzqXkCPIvBat9ElGvDcyU8pe6i/a6LvEzWVFyEsETKURfZ+a+eUnNWRAsRjObwTO6r6CwEB/+yI0l5cZho0PAobfs2SQ+IW2xKR37z+7qhjij5zJNqAzQWKZFa/CYcKDE0tQ1iPVTeVD2wAsm3Wx+tA/s9TZVVXvButgCrRrquafRFjJ2GV1QVyqD/BJd0oFdyBHrJtYl9yIT1pBLvhff58Ri9jnANdImnJvE3Mv4g83B4eoUhjhd/IhW7xwl2WFRc4+BKE8+E26UWH6fJ3cumQt72rWJUqmRsZ08e+MEdQCh0T7ItF7/H/y1LAWAOBnprQvQ0BJW/ebw+8qojeZ9u8FhPUuVfrp1kw8mCaBaH1zmY+RGkA3DA1UwjARQHjPtLP1fc1SehCgtgLP1pEEw+e7DH+rdAl2ruUOPzeSDvLjTRQWy1YGx1IwjWF21NEFdDMkehvmXDvDLJe0JMcEqR+iaaQ7G7FCN1yX6q1A8BcO0tHvxUO6cyvBTSmK5K8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(3002001)(10201501046); SRVR:BY2PR07MB615; BCL:0; PCL:0; RULEID:; SRVR:BY2PR07MB615; X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB615; 4:so18346QMZC7a3ahxufwjhpvRqAPkUXQHn+tLV4CnwkTdI+0yORMlSANfVNZDltUWgWyHOQz+WIK5QHKik3KhvbGFNHFr00QoIDdlFD3CZ+XfK4poZFa7eSZpDjHrBevsOjOuROJAvVlaxn2/FkK/DfB01u0IFsIoHKQnIVpV/0o7txUo0zKQjxCZwG/qF/4cDevg4PS1IfQ6ztAcc/DvZltc2pUaDOhdWv35w748pZrehqecoXGD1ZpRwvf38ayhoOUYGkFRW1fvQ5VUg3ymwJXx1LQ0lV0/do+BpLwKkPPgx1E6XQHroTw+hlCI9p5mpyZZDymCJu/9mU0fnYiQNtTyDuLep4+BOWGBavzyG/htl2j5ja0jETGlHwM8WZW0ZnFQK8EwgCF6n+8WftoZLFFmroCXfhvMn2PefIbv1xUWOU6iFPQAMRrzermCst9 X-Forefront-PRVS: 07915F544A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(199003)(189002)(4001430100002)(81156007)(2201001)(5004730100002)(101416001)(47776003)(50226001)(66066001)(97736004)(42186005)(87976001)(19580405001)(107886002)(19580395003)(575784001)(5001960100002)(189998001)(92566002)(106356001)(76506005)(5001770100001)(50986999)(76176999)(105586002)(50466002)(229853001)(5008740100001)(6116002)(5003940100001)(36756003)(3846002)(48376002)(1096002)(15975445007)(586003)(77096005)(33646002)(2950100001)(122386002)(40100003)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR07MB615; 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; BY2PR07MB615; 23:O+89jAUeLvxJjY6TiwNHlXVF0kUuZBiVTPihO73ksV?= =?us-ascii?Q?k/R2vjAOJcv3knMTTMijjVmQz0RMrVWRyl+5SDMNcj+gPuautKUj9JqYZ3mo?= =?us-ascii?Q?19jjIU3dyk4uV6BlKj/57w9rZmwH15Xn47M2+ch/c/O8poquaxstQM7591fT?= =?us-ascii?Q?qA4FRgypTt6hLNwfO4GlqpgnXHSEliwFToYca3KDjvQmyPM5vetaDWTZL2oW?= =?us-ascii?Q?P8vvhF2NVo5YA4pwJx5YmT9+tKlwag0/fevGLKAI4HxByQx5fvCpw2YPsEgo?= =?us-ascii?Q?UueG28DpXuYnoi+jrTbxTKFq21h8YBT4MhzxnhG+2/prKCi+/bZk4aGFuyAh?= =?us-ascii?Q?a2wAw8BzL68lAr2itBj8uxk9WqsPSq4BzGFfncjkvEctmYNVNOqXdTF8k3CL?= =?us-ascii?Q?QUx21WB9uNmolLh4oRHW2eEYdtEUVGatCJtCdGoIWgrULHEEJFSmQ7pmws71?= =?us-ascii?Q?/n/zzFCdkeKwFSPOp5fkqQriX0cyWHvLSWWzTT3j8Or4tAm+IIx3QuMFbuXq?= =?us-ascii?Q?0lf/6xQHqdaJZZxcmiSHWJzso4BVFyZVMwsF/MszPtf1H0MujXyFiacuwFMW?= =?us-ascii?Q?sKKJ30RbvJExiU7RyYGDvwg+gm8A+dbyhZ2REdRmFRL+Xh/TcfV2zayilLv2?= =?us-ascii?Q?KLYIzfDdmJbXzegLiaQDpH3evqvbiT912uRJ24XTF2RUajUURRXX/tSOq6GE?= =?us-ascii?Q?qjzOAKDuOokxtrCwmwo9RK4xUXsskKgflocJvAkrtTF2VY0dfSt0emyTW1S5?= =?us-ascii?Q?gvV5fbbK9cmnE2dzIqQtiEE5wJdKyzzd5u6owF4Q/5fT3MY7sLRmcp7GMC+8?= =?us-ascii?Q?T6eKltfXZVqZXNvTkZNyAEf9e8oG+/1gEH3ow262PI86qwPG7tTOjkc29FyL?= =?us-ascii?Q?LHrMx/liWMIwEpNyHHEq/6d4WJ5LtLvsiPZ8r1KTb0YOXn/d/5Fvsx2omGq3?= =?us-ascii?Q?kz/5TyEtMbYlJlm6QtykXaaHcgz4Dfvoz09YUCEwXYiPCO4ru8FHzk39TnAX?= =?us-ascii?Q?Irzc7twlqOR2GrdzaEphNA+CcbnQHhobr+adhU77QW7LrlGmZC2kWZdRk2VV?= =?us-ascii?Q?0TovcdUq2jIU5eTVRcunNfTKYWE0Euhgwhq/C2mdfI7R96K1qsjTLiQAIMAR?= =?us-ascii?Q?FdldKnmHrBiHujbk/Pc7MyV7FORYhQNCiSu3Q0s6oEDLDws9cKDvJhdWAQsJ?= =?us-ascii?Q?zG5gopCUqnWvU=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB615; 5:AJZJafoEmLcchDljcjKCVtiyrH9WFPfmrgweUjoTKZk7KOr5t40S0rQr463EOJLoXtpFOcubZYoKIw7YZ3ck2WIiV6XEqdM3nwgO9ZBR6OvXebcW0Gt0Ltgc3pojj/X4TtOB4VqeKMR+d6aJj2fqgw==; 24:JnlZFvfiTW7xMEEGR9uRRa2oqHFQMB/p4MIiGZBgpa039RALEpCInL9uEp7SPzJWcGcwXp6k3wCjRexsSdeeMGwn8pyaYX9af6UZkvtx4Fg= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2015 21:44:23.1501 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR07MB615 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151215_134449_127471_F02C5C42 X-CRM114-Status: GOOD ( 11.01 ) 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, Andrew Pinski , ynorov@caviumnetworks.com, jan.dakinevich@gmail.com, Andrew Pinski , 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, 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 Reviewed-by: David Daney Signed-off-by: Philipp Tomsich Signed-off-by: Christoph Muellner Signed-off-by: Yury Norov Signed-off-by: Andrew Pinski --- arch/arm64/include/asm/elf.h | 11 ++++++++--- 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 | 6 ++++-- arch/arm64/include/asm/unistd.h | 7 +++++-- 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/traps.c | 2 +- arch/arm64/kernel/vdso.c | 4 ++-- 13 files changed, 50 insertions(+), 27 deletions(-) diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index faad6df..d255764 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 @@ -183,6 +185,9 @@ extern int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp); #define compat_arch_setup_additional_pages \ aarch32_setup_vectors_page +#endif + +#define compat_elf_check_arch(x) compat_a32_elf_check_arch(x) #endif /* CONFIG_COMPAT */ 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..e68fcce 100644 --- a/arch/arm64/include/asm/signal32.h +++ b/arch/arm64/include/asm/signal32.h @@ -17,7 +17,9 @@ #define __ASM_SIGNAL32_H #ifdef __KERNEL__ -#ifdef CONFIG_COMPAT + +#ifdef CONFIG_AARCH32_EL0 + #include #define AARCH32_KERN_SIGRET_CODE_OFFSET 0x500 @@ -47,6 +49,6 @@ 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_COMPAT */ +#endif /* CONFIG_AARCH32_EL0 */ #endif /* __KERNEL__ */ #endif /* __ASM_SIGNAL32_H */ diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index 41e58fe..e6216ef 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@ -13,9 +13,8 @@ * 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 #define __ARCH_WANT_SYS_PAUSE #define __ARCH_WANT_SYS_GETPGRP @@ -26,7 +25,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. */ @@ -44,6 +45,8 @@ #define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE+2) #define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE+5) +#define __ARCH_WANT_COMPAT_STAT64 + #define __NR_compat_syscalls 390 #endif 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/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];