From patchwork Tue Apr 5 22:08: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: 8756261 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 42F02C0553 for ; Tue, 5 Apr 2016 22:24:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B5DE1202EC for ; Tue, 5 Apr 2016 22:24:54 +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 3F1E9202BE for ; Tue, 5 Apr 2016 22:24:53 +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 1anZNl-0003jL-Nq; Tue, 05 Apr 2016 22:23:33 +0000 Received: from mail-bl2on0091.outbound.protection.outlook.com ([65.55.169.91] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1anZCz-0007Yy-08 for linux-arm-kernel@lists.infradead.org; Tue, 05 Apr 2016 22:12:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-caviumnetworks-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=BwgJxl37pkaWXpb19a8iXoRcCbuET2A8gyE7SeUNvkE=; b=XuPRKhxS6Rs5TbEL5TotHqsl3KVQHu0LsJTrE+fQSjFhMIo2xRVKS8x1q1cZI//WGHnMjdA1G0aLhfTckn0UJWrlCWw2S/jPF6hWpoKz90QOo49qOtK50k9h6ZxfWRNg2eewCc28YkHHE9S11CUitdFSe2NS31p0m4hSWdKofeI= Authentication-Results: arndb.de; dkim=none (message not signed) header.d=none;arndb.de; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost (95.143.213.121) by BLUPR07MB612.namprd07.prod.outlook.com (10.141.207.27) with Microsoft SMTP Server (TLS) id 15.1.443.12; Tue, 5 Apr 2016 22:12:05 +0000 From: Yury Norov To: , , , Subject: [PATCH 15/25] arm64: introduce is_a32_task and is_a32_thread (for AArch32 compat) Date: Wed, 6 Apr 2016 01:08:37 +0300 Message-ID: <1459894127-17698-16-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> References: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM2PR03CA0024.eurprd03.prod.outlook.com (25.160.207.34) To BLUPR07MB612.namprd07.prod.outlook.com (10.141.207.27) X-MS-Office365-Filtering-Correlation-Id: 299eb469-2125-4eee-fb2a-08d35d9f52dc X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB612; 2:9cw6FLWPGRbjH5mjtdx5M0ruic5OP2ZJMyfzrjiGRTTKN1xVUEy3NQGA3FsEMQgGnppQnhxFUuVjtsn0Ac4BDv0bqQRIaiJ9eGr/fX/8ieD+Ee92BnGgQh1x3TAXvZshQSz3ytp+EPDZvZp5TU65cD7v8bpwUR5kVvJWHLGKsEfdeURNovZ6+B1l+l74FmEY; 3:tBmhRAc2mEnC+XnAWa8+PpSCO9WZdgVsrKQghXw1W2n/OSaIPoyGgGrh9IZALxfsYxFbUA7Fr3xGVn3FeOwC+WnzhmX5slOsNKxJnQtvSnPZ7gzPsj3NvV/QQJexXgV9; 25:Ay5vxyyJ7rLkUVF1ISc58JvFVNgtYWi9pmAuoNk9fdgTlgivI177s4LEoSAq4IPPg3wF/ArXCz4/qgPFhSHl+4yN+nXvUPO1U2QWGdleUutkAgAojWvTH4tp+ILz+Sqgta96MIIIr0M5LwI0X6fEWuS+H+1IUzgYRP/Fm9jr2e67GMQgxDBkQGks4Kh0/8EWGfnGtAknFStAdyr8GB63C6x1KPs7ASgBW3NJ9omHvHMb5k5mbfI59qIXrGx6NYeNd6QPk1p7I0eD2kVGc+kFVP10/3stTH4ILcPfU+N4IwYCCG8W7BKnQboT28kx9t3Co9uPwbegR6NBUuaiGPqYD0vPXSx/mtTUhmbrUpn5rv4= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR07MB612; X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB612; 20:37PJVyIz2jbui7JggakVHZA1Qg4J9Wm3GrMfOWhh79Xhy0G9Fu5xFiBE3CO6pWK2LNXN1ozGrBF3jEiQBBJr2QJEJPTU0sadKXrTMCNGJS4QcQJ1GBmujR8GIW2ZB/dgXPHw7MnAhjqErWSmJDZ+R+Q0t1Y6MrRcQgFhqA5Vs1PIeJXHeyHdxF4KV/35888fQSqjHdpPnmAm0NJW07ELBAOyKrMEzJObvvCtqPytJBUimOGftZsWwttVs+4SxXobNZXFi/l/r7ElwxaJMG3v6CPbeLjXVIHbn9OSecvVAARq7eygjW7ulWwU3iJtJEtOiQccKRUTxzGgx+GAWOGD9GpHwevnEFZbhM2WU2iJg8h+OH6LNrdQOnufvqNfeKGyVq3RQwZ1TBe+YIW+hkH7Jmg5PTnyn4QGWUm7K9ekaFuDQGoWzLJ7pQJLuySv9BzNEl0y8MGtkcOD8D0kZZ4YYcU7LbLZxkmqrkjqma7z480l9cFocVQIbBaGrzMkTJ76ShBlb+Cflm8+GQoV6QVzn71kztocoQwA7ikTlkgHcEnfAvZ57qqMxibHLcx+HaKfhr1Tikp6GSdT61HOI1vFYXyfm4hmZgnhDR9U4RW+YEw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:BLUPR07MB612; BCL:0; PCL:0; RULEID:; SRVR:BLUPR07MB612; X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB612; 4:VdI28XzOlmLHgGJZfgVuraOF7IcCrCubNQWjdgxtp9ZpNL3NsQiEV2oWllYuuIfE9lbB5zae699oey0w+464VpkPGWFMT/SmEknr4D9FF2ZDLJbWzk/oKsmplRCt3ROrlqftuTNzmIn6t0kHmjOEr3CJ83xYwc0JcIgCjP9yk9uLAbVczJB5zGNpQpaR+cfVxJlAZX8p/6zz+HfSaMV0+4iNOWYGGFEXhOPsekUUT5hYMZ7B3pQ/w5QaTQnMgGHHcANDodaX7w+F4b/TgU/5OtaZ5C3/DHO8GiJbabQTgY1xBVcjTJBRgv8dDgvDT/N1G5V0WCZQMwcOguCVW2BBv7DuGkISfAn374ue0p0zVnz1FRG5PDg0t/BVXE/i8v3f X-Forefront-PRVS: 0903DD1D85 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(4001430100002)(33646002)(5008740100001)(3846002)(229853001)(92566002)(19580395003)(77096005)(5004730100002)(1096002)(36756003)(2201001)(50466002)(48376002)(50226001)(575784001)(47776003)(15975445007)(42186005)(66066001)(4326007)(76506005)(76176999)(107886002)(6116002)(50986999)(5003940100001)(586003)(81166005)(19580405001)(2950100001)(5001770100001)(189998001)(2906002)(2004002)(2101003)(473944003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR07MB612; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR07MB612; 23:UWPlX01X/SgK+7ImdkJtz3HjA1OxY4Uv5CkKU75Vfp?= =?us-ascii?Q?5S5HcRJKgAVa03tKN9BeWTj85CQVZlHOAtxLKmMy3l1Mms1keLxhvfaNv9zx?= =?us-ascii?Q?UTXO87CBbtgmj74YtLbOBiNcHJVEvwsM/wMDBjRk3cDHRW6lFa1/aAXKG85P?= =?us-ascii?Q?FvwmYEveHrpp3MP0/5PG60220OZxIRMOt1TqXucQBJR46fcjDePLi/Y6LNfs?= =?us-ascii?Q?FSxdyGvwfzfsl1UCrIMD2SmMYmT6muTaJYOs6Du5LcaPj1QU1UEvxd7FmdN+?= =?us-ascii?Q?MMVkaAbDX5tsiWlFKemPv6Bfn5yKk9FEJYkS0Fh2CU12KKZhDvBLazoT+jsa?= =?us-ascii?Q?8dC+B064bEpVB6w0pHE+KDN0OQ8wmdrk8iOo7+K2psQFmw6DCPm/9jChXXM6?= =?us-ascii?Q?pnIiHjB3uYIOiHPA7FO8YJxcknq9lpQgwvhNNLNEbPw77e6vm625Z+HO0BRU?= =?us-ascii?Q?X1TwUg4dvnuzbZmyQm+/aIun3NDZ1xkqUxrtIQcWD0Iryp2SM3m9YRnrjLJz?= =?us-ascii?Q?OM9xES6Lo2DVcneEET008CrW7N7j+4igoLql9qVpm9AvWzqZnz2lAgJ6mKr8?= =?us-ascii?Q?+aGhasQcQHJ5pUc8iqR0HylZ1aFehGAkexQlV4VC9mr3jBFRZkD7X/294Inr?= =?us-ascii?Q?BGsn41m3C3ZebH1ARp5f5wPxN++9GMY0xd9eH8r67CP/SISPbRLIua7pClru?= =?us-ascii?Q?7IIPr3vupNaL3YNa/2HOjiJ2D7usviOM9qNeJuuRleNMkUL17DFo8qbjZhyb?= =?us-ascii?Q?qoZzBb6aY6wreSQRBaAXak6ovCVurjL9VH5pbzX+/ZQcFDkjKcEAmuYHECOl?= =?us-ascii?Q?8YFZcbEty7n0uRCrp4olYZxNQm0cRq2HhB2XsJhmC5a2IQW8vbI69ggmSqag?= =?us-ascii?Q?IB6VglOjRwdQPMVlXzumvzk8nmfF3++D9zGZ/4mKR6a9mKAG+Kfp6ag9EfKv?= =?us-ascii?Q?9gyT4f9DddIqHCHCdJBB3RrJ1gnwJO2K2lP2iqCS3XyxNl2fgnWBOmCqLYlg?= =?us-ascii?Q?mLt+GZvS/6eKYSWHpyceoX/z2h7WXpLM2xS7g6+rmoyRq7TPC7PNJ9y+/H4b?= =?us-ascii?Q?ApTBO4vAO2RlqnBkkFpPdgTEIE?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB612; 5:/WQKjrt/n/FyGL4pyD6/bq0FPTjiniN5Vr8zWGD+GzUCF1fFruzixDQvBlyq+X5njJ4QTYWinjsAMZyMtXZvTOzyX377mWbWz7Llby4t25/w5a3zFn0vc1wi7qdE/B4Ami58RC3qhfoyYC36MwMDoA==; 24:eqULmWmbVkSBFoG/8N9S5rRgaskZkuQPMKUg8waUDPFT8qRryjuoNVz/JmEJGz60EIMRcOUMDWQYEPaWAX2hHnvP1wezrN5wyQb3nw21hWA= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2016 22:12:05.7956 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR07MB612 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160405_151225_650689_8BAA13D7 X-CRM114-Status: GOOD ( 18.21 ) 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: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, pinskia@gmail.com, Prasun.Kapoor@caviumnetworks.com, schwab@suse.de, broonie@kernel.org, linux-doc@vger.kernel.org, heiko.carstens@de.ibm.com, agraf@suse.de, klimov.linux@gmail.com, Andrew Pinski , ynorov@caviumnetworks.com, bamvor.zhangjian@huawei.com, schwidefsky@de.ibm.com, Nathan_Lynch@mentor.com, Philipp Tomsich , 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=-5.1 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID, 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 Based on patch of Andrew Pinski. This patch introduces is_a32_compat_task and is_a32_thread so it is easier to say this is a a32 specific thread or a generic compat thread/task. Corresponding functions are located in to avoid mess in headers. Some files include both and , and this is wrong because has already included. It was fixed too. Signed-off-by: Yury Norov Signed-off-by: Philipp Tomsich Signed-off-by: Christoph Muellner Signed-off-by: Andrew Pinski Reviewed-by: David Daney --- arch/arm64/include/asm/compat.h | 19 ++---------- arch/arm64/include/asm/elf.h | 10 +++---- arch/arm64/include/asm/ftrace.h | 2 +- arch/arm64/include/asm/is_compat.h | 58 ++++++++++++++++++++++++++++++++++++ arch/arm64/include/asm/memory.h | 3 +- arch/arm64/include/asm/processor.h | 5 ++-- arch/arm64/include/asm/syscall.h | 2 +- arch/arm64/include/asm/thread_info.h | 2 +- arch/arm64/kernel/hw_breakpoint.c | 10 +++---- arch/arm64/kernel/perf_regs.c | 2 +- arch/arm64/kernel/process.c | 7 ++--- arch/arm64/kernel/ptrace.c | 11 ++++--- arch/arm64/kernel/signal.c | 4 +-- arch/arm64/kernel/traps.c | 3 +- 14 files changed, 91 insertions(+), 47 deletions(-) create mode 100644 arch/arm64/include/asm/is_compat.h diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index eb8432b..df2f72d 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h @@ -24,6 +24,8 @@ #include #include +#include + #define COMPAT_USER_HZ 100 #ifdef __AARCH64EB__ #define COMPAT_UTS_MACHINE "armv8b\0\0" @@ -298,23 +300,6 @@ struct compat_shmid64_ds { compat_ulong_t __unused5; }; -static inline int is_compat_task(void) -{ - return test_thread_flag(TIF_32BIT); -} - -static inline int is_compat_thread(struct thread_info *thread) -{ - return test_ti_thread_flag(thread, TIF_32BIT); -} - -#else /* !CONFIG_COMPAT */ - -static inline int is_compat_thread(struct thread_info *thread) -{ - return 0; -} - #endif /* CONFIG_COMPAT */ #endif /* __KERNEL__ */ #endif /* __ASM_COMPAT_H */ diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index 24ed037..b5437c5 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -16,6 +16,10 @@ #ifndef __ASM_ELF_H #define __ASM_ELF_H +#ifndef __ASSEMBLY__ +#include +#endif + #include /* @@ -152,13 +156,9 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp); /* 1GB of VA */ -#ifdef CONFIG_COMPAT -#define STACK_RND_MASK (test_thread_flag(TIF_32BIT) ? \ +#define STACK_RND_MASK (is_compat_task() ? \ 0x7ff >> (PAGE_SHIFT - 12) : \ 0x3ffff >> (PAGE_SHIFT - 12)) -#else -#define STACK_RND_MASK (0x3ffff >> (PAGE_SHIFT - 12)) -#endif #ifdef CONFIG_COMPAT diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h index caa955f..0feb28a 100644 --- a/arch/arm64/include/asm/ftrace.h +++ b/arch/arm64/include/asm/ftrace.h @@ -54,7 +54,7 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr) #define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) { - return is_compat_task(); + return is_a32_compat_task(); } #endif /* ifndef __ASSEMBLY__ */ diff --git a/arch/arm64/include/asm/is_compat.h b/arch/arm64/include/asm/is_compat.h new file mode 100644 index 0000000..6139b5a --- /dev/null +++ b/arch/arm64/include/asm/is_compat.h @@ -0,0 +1,58 @@ +/* + * 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 . + */ + +#ifndef __ASM_IS_COMPAT_H +#define __ASM_IS_COMPAT_H +#ifndef __ASSEMBLY__ + +#include + +#ifdef CONFIG_AARCH32_EL0 + +static inline int is_a32_compat_task(void) +{ + return test_thread_flag(TIF_32BIT); +} + +static inline int is_a32_compat_thread(struct thread_info *thread) +{ + return test_ti_thread_flag(thread, TIF_32BIT); +} + +#else + +static inline int is_a32_compat_task(void) + +{ + return 0; +} + +static inline int is_a32_compat_thread(struct thread_info *thread) +{ + return 0; +} + +#endif /* CONFIG_AARCH32_EL0 */ + +#ifdef CONFIG_COMPAT + +static inline int is_compat_task(void) +{ + return is_a32_compat_task(); +} + +#endif /* CONFIG_COMPAT */ + +#endif /* !__ASSEMBLY__ */ +#endif /* __ASM_IS_COMPAT_H */ diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 12f8a00..a66a0f7 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -26,6 +26,7 @@ #include #include #include +#include /* * Allow for constants defined here to be used from assembly code @@ -61,7 +62,7 @@ #ifdef CONFIG_COMPAT #define TASK_SIZE_32 UL(0x100000000) -#define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \ +#define TASK_SIZE (is_compat_task() ? \ TASK_SIZE_32 : TASK_SIZE_64) #define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk, TIF_32BIT) ? \ TASK_SIZE_32 : TASK_SIZE_64) diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 5bbdbb4..1eccf47 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -41,7 +42,7 @@ #define STACK_TOP_MAX TASK_SIZE_64 #ifdef CONFIG_COMPAT #define AARCH32_VECTORS_BASE 0xffff0000 -#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \ +#define STACK_TOP (is_compat_task() ? \ AARCH32_VECTORS_BASE : STACK_TOP_MAX) #else #define STACK_TOP STACK_TOP_MAX @@ -94,7 +95,7 @@ struct thread_struct { #define task_user_tls(t) \ ({ \ unsigned long *__tls; \ - if (is_compat_thread(task_thread_info(t))) \ + if (is_a32_compat_thread(task_thread_info(t))) \ __tls = &(t)->thread.tp2_value; \ else \ __tls = &(t)->thread.tp_value; \ diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h index 709a574..ce09641 100644 --- a/arch/arm64/include/asm/syscall.h +++ b/arch/arm64/include/asm/syscall.h @@ -113,7 +113,7 @@ static inline void syscall_set_arguments(struct task_struct *task, */ static inline int syscall_get_arch(void) { - if (is_compat_task()) + if (is_a32_compat_task()) return AUDIT_ARCH_ARM; return AUDIT_ARCH_AARCH64; diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h index abd64bd..4daa559 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -118,7 +118,7 @@ static inline struct thread_info *current_thread_info(void) #define TIF_FREEZE 19 #define TIF_RESTORE_SIGMASK 20 #define TIF_SINGLESTEP 21 -#define TIF_32BIT 22 /* 32bit process */ +#define TIF_32BIT 22 /* AARCH32 process */ #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c index b45c95d..baa1eba 100644 --- a/arch/arm64/kernel/hw_breakpoint.c +++ b/arch/arm64/kernel/hw_breakpoint.c @@ -164,7 +164,7 @@ enum hw_breakpoint_ops { HW_BREAKPOINT_RESTORE }; -static int is_compat_bp(struct perf_event *bp) +static int is_a32_compat_bp(struct perf_event *bp) { struct task_struct *tsk = bp->hw.target; @@ -175,7 +175,7 @@ static int is_compat_bp(struct perf_event *bp) * deprecated behaviour if we use unaligned watchpoints in * AArch64 state. */ - return tsk && is_compat_thread(task_thread_info(tsk)); + return tsk && is_a32_compat_thread(task_thread_info(tsk)); } /** @@ -435,7 +435,7 @@ static int arch_build_bp_info(struct perf_event *bp) * Watchpoints can be of length 1, 2, 4 or 8 bytes. */ if (info->ctrl.type == ARM_BREAKPOINT_EXECUTE) { - if (is_compat_bp(bp)) { + if (is_a32_compat_bp(bp)) { if (info->ctrl.len != ARM_BREAKPOINT_LEN_2 && info->ctrl.len != ARM_BREAKPOINT_LEN_4) return -EINVAL; @@ -492,7 +492,7 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp) * AArch32 tasks expect some simple alignment fixups, so emulate * that here. */ - if (is_compat_bp(bp)) { + if (is_a32_compat_bp(bp)) { if (info->ctrl.len == ARM_BREAKPOINT_LEN_8) alignment_mask = 0x7; else @@ -679,7 +679,7 @@ static int watchpoint_handler(unsigned long addr, unsigned int esr, info = counter_arch_bp(wp); /* AArch32 watchpoints are either 4 or 8 bytes aligned. */ - if (is_compat_task()) { + if (is_a32_compat_task()) { if (info->ctrl.len == ARM_BREAKPOINT_LEN_8) alignment_mask = 0x7; else diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c index 3f62b35..a79058f 100644 --- a/arch/arm64/kernel/perf_regs.c +++ b/arch/arm64/kernel/perf_regs.c @@ -45,7 +45,7 @@ int perf_reg_validate(u64 mask) u64 perf_reg_abi(struct task_struct *task) { - if (is_compat_thread(task_thread_info(task))) + if (is_a32_compat_thread(task_thread_info(task))) return PERF_SAMPLE_REGS_ABI_32; else return PERF_SAMPLE_REGS_ABI_64; diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 8062482..746f2d3 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -47,7 +47,6 @@ #include #include -#include #include #include #include @@ -211,7 +210,7 @@ static void tls_thread_flush(void) { asm ("msr tpidr_el0, xzr"); - if (is_compat_task()) { + if (is_a32_compat_task()) { current->thread.tp_value = 0; /* @@ -263,7 +262,7 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, asm("mrs %0, tpidr_el0" : "=r" (*task_user_tls(p))); if (stack_start) { - if (is_compat_thread(task_thread_info(p))) + if (is_a32_compat_thread(task_thread_info(p))) childregs->compat_sp = stack_start; /* 16-byte aligned stack mandatory on AArch64 */ else if (stack_start & 15) @@ -303,7 +302,7 @@ static void tls_thread_switch(struct task_struct *next) *task_user_tls(current) = tpidr; tpidr = *task_user_tls(next); - tpidrro = is_compat_thread(task_thread_info(next)) ? + tpidrro = is_a32_compat_thread(task_thread_info(next)) ? next->thread.tp_value : 0; asm( diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index aa79e81..38a09338 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -38,7 +38,6 @@ #include #include -#include #include #include #include @@ -85,7 +84,7 @@ static void ptrace_hbptriggered(struct perf_event *bp, #ifdef CONFIG_AARCH32_EL0 int i; - if (!is_compat_task()) + if (!is_a32_compat_task()) goto send_sig; for (i = 0; i < ARM_MAX_BRP; ++i) { @@ -1203,9 +1202,9 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task) * 32-bit children use an extended user_aarch32_ptrace_view to allow * access to the TLS register. */ - if (is_compat_task()) + if (is_a32_compat_task()) return &user_aarch32_view; - else if (is_compat_thread(task_thread_info(task))) + else if (is_a32_compat_thread(task_thread_info(task))) return &user_aarch32_ptrace_view; #endif return &user_aarch64_view; @@ -1232,7 +1231,7 @@ static void tracehook_report_syscall(struct pt_regs *regs, * A scratch register (ip(r12) on AArch32, x7 on AArch64) is * used to denote syscall entry/exit: */ - regno = (is_compat_task() ? 12 : 7); + regno = (is_a32_compat_task() ? 12 : 7); saved_reg = regs->regs[regno]; regs->regs[regno] = dir; @@ -1343,7 +1342,7 @@ int valid_user_regs(struct user_pt_regs *regs, struct task_struct *task) if (!test_tsk_thread_flag(task, TIF_SINGLESTEP)) regs->pstate &= ~DBG_SPSR_SS; - if (is_compat_thread(task_thread_info(task))) + if (is_a32_compat_thread(task_thread_info(task))) return valid_compat_regs(regs); else return valid_native_regs(regs); diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index a8eafdb..be02f65 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -276,7 +276,7 @@ static int setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set, static void setup_restart_syscall(struct pt_regs *regs) { - if (is_compat_task()) + if (is_a32_compat_task()) compat_setup_restart_syscall(regs); else regs->regs[8] = __NR_restart_syscall; @@ -295,7 +295,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) /* * Set up the stack frame */ - if (is_compat_task()) { + if (is_a32_compat_task()) { if (ksig->ka.sa.sa_flags & SA_SIGINFO) ret = compat_setup_rt_frame(usig, ksig, oldset, regs); else diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index cdab14e..cacd30a 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -405,7 +406,7 @@ asmlinkage long do_ni_syscall(struct pt_regs *regs) { #ifdef CONFIG_AARCH32_EL0 long ret; - if (is_compat_task()) { + if (is_a32_compat_task()) { ret = compat_arm_syscall(regs); if (ret != -ENOSYS) return ret;