From patchwork Tue May 24 00:04:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9132579 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 0F4A7607D3 for ; Tue, 24 May 2016 00:20:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0354828237 for ; Tue, 24 May 2016 00:20:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBEF828252; Tue, 24 May 2016 00:20:18 +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 0AA1D28237 for ; Tue, 24 May 2016 00:20:18 +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 1b503x-00021Q-Uw; Tue, 24 May 2016 00:19:09 +0000 Received: from mail-by2on0088.outbound.protection.outlook.com ([207.46.100.88] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b4zrU-0005b1-3l for linux-arm-kernel@lists.infradead.org; Tue, 24 May 2016 00:06:44 +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=kfr/O2E+H7HwCDR8BN4V36UbJtyYsy1lauynIf0rqek=; b=Aixp7irkoUNQBXPBSTHm1pXDhouD2ghTp/sTXeD7SHpMbFUME5KEBhK6Z5+UkbkFfYwRk2uqIUBkm6iqM1aGJyLbkP7x5vc4jwl0yzITsglXdEWZGceoVkOTvqDusup7LN82PmDfzK/e5Hlo2NCuWPVZisreS8GlDagvimrJmIc= 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 (50.233.148.158) by BN4PR07MB2227.namprd07.prod.outlook.com (10.164.63.145) with Microsoft SMTP Server (TLS) id 15.1.497.12; Tue, 24 May 2016 00:05:54 +0000 From: Yury Norov To: , , , , , , , Subject: [PATCH 13/23] arm64: introduce is_a32_task and is_a32_thread (for AArch32 compat) Date: Tue, 24 May 2016 03:04:42 +0300 Message-ID: <1464048292-30136-14-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1464048292-30136-1-git-send-email-ynorov@caviumnetworks.com> References: <1464048292-30136-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [50.233.148.158] X-ClientProxiedBy: DM2PR0501CA0025.namprd05.prod.outlook.com (10.162.29.163) To BN4PR07MB2227.namprd07.prod.outlook.com (10.164.63.145) X-MS-Office365-Filtering-Correlation-Id: 6f1192a9-7a64-4d0b-b810-08d383672ca5 X-Microsoft-Exchange-Diagnostics: 1; BN4PR07MB2227; 2:x4YijBBGmHUZsuQuUHCQKQ2jkS4tIXt/AeOGceFbHROvD6ziRxj9SLc0eICUfnm5wbNdFAoSxbQde4R9VJGIC10bREySofLq66NOWZJq38NQ/w9LN2WGNGii0LhF62IQ+Q8VGOUuQDGOupjKbzNZsMtz3YRy9c0KxDx6qL2Nrnzy/OR6gsWowTShR+WVd2Je; 3:O3AkcXjVSC2p/6/938PheaKvSpZ+DaDIs7g4O8Qf6m7L1a848OwLfgY9gqj+x7eLrB78COdniRHKE1IdBXYNjOPTlnRoYwzZNVFU0CbXTUdtvyqjt/jGqgsmrUPhN3AK; 25:svdczaREM1L3KJ/2zFCedxAVaISs1d2BGuabc39Qv3uYrwqCG84euVW5NY0hQ0X9GvRfEdImTOdWAavRRuhN5L0Jdv0odv62vAdH+KyG+A/mFx+YktNvjWT7cbGu/LTk7zUlZl/FUZBItvr8/jIvOCnOS3O2h4/sGQObBQqf6tDvOFRc5B+hxKVopGiSWzLxU8qzF2V14lZwZMZkmJMNEfd18osxnu1aXOoo4+VjVAN4lagke6+6JblA+1phkwRNOAK0d1C8LqND5BMCFEuvGDzoJ7wfIa976TOdAES7ZSZjErA+n0H4herk78Edk8XcGpMEWRAYiFyIzNDJ01eGCmtJYRwxkR1CJFXKt0j/Iy0ybDXquEGVp9xdJElUyifBy5Xx5dN+0clVmZoCR6lDSneEbA0HYSTgsp/+L4Uff1U= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN4PR07MB2227; X-Microsoft-Exchange-Diagnostics: 1; BN4PR07MB2227; 20:K8jfqRptUjCOEeG8q9tvfn0YJ3joapTsf4tmrKLYqzDQjuRbQTwQYC94Fb0bdpeL2dd/TWlIdZTz0odyu2EKV3mH1NWKrQ6+2ut+Znm2vtTtWXHQIij8E987qfX3nv3bfVrv3phhbQwqF39oreRxCiKeuMKV14Za0EA3zd8xg5jN3/EEnb1njROUydicPjQ5EzO7iJDfCwICWgJ1fFRoqI1BUlDEEbOAnTdXLTZzT7+bEyjx0voq8Qd48yPlgwUFlJbr5kOR6B0IksU45PrNVkt9kN8AWgsumBm2zBOJhn0Aj05ayLEn1R4sa9T4GIKrN2FQlj24H60desfhUH034f3FswVokvpjWR0foQZUykeDdJoxqndCWMJlsN5KolvOT23DfaDBjnkV2TdiYFHJw1GpnOU/jsym2Nh/C2mcDfgOEqX/cJMCkMPh+KCOooHMLRRAs40Zgj4/jX0Qv/FGC9OyryOH6j/OqrgDeTqIt/1nCPrLegGxqsFwYQUnCnrHTpxiLwlStS/5rAu2/3+GrPwpyrIg/BfYUT0G/xRk0GeX8/Jmc2aD38xzUQ4SY1h92c+olxyS3BVHR48KEb1vrwOTdx9eOxzsGjXvpq7PRt0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001); SRVR:BN4PR07MB2227; BCL:0; PCL:0; RULEID:; SRVR:BN4PR07MB2227; X-Microsoft-Exchange-Diagnostics: 1; BN4PR07MB2227; 4:rGcwxDj5WA0GiUi/KYaUo3qB5+QgEzRCLD1o6FAb+jVa6WewFVai2EaLJe1yccmhOupmhGRUOV0UuKgivddGvKO53TG9t+t3YHYWuH7I5tEZBIo0mf0w6uWQz30mfXe7FhBnWHHHhP5Iwj+OP0rUcoJo8byHJegX0k/bwD2LrvJPrrRuH5R6tCFmaqWUiY8xLUY4iV1RLgnZLPP50neQ1/xlrd558+fA70nPeAeYZ2ZN81+kGdNqo0bjSDDIpIO4TVFuYD6FlKkW9c92Zntr3z+5MbjpaFdrq1UHPhyfOjlGlNYI6Oshvt88c/ETmmGEo341wIKHDY0wToNhtnun7fJ5WPz9TcgRVPfQZk5kD5oTnb5tFZWY581+WAME32HE X-Forefront-PRVS: 09525C61DB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(2906002)(4001430100002)(575784001)(5001770100001)(189998001)(107886002)(4326007)(5008740100001)(36756003)(2201001)(33646002)(50466002)(229853001)(48376002)(66066001)(47776003)(15975445007)(42186005)(50986999)(5003940100001)(586003)(77096005)(19580405001)(19580395003)(6116002)(50226002)(5004730100002)(81166006)(92566002)(2950100001)(8676002)(76176999)(76506005)(2004002)(2101003)(473944003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN4PR07MB2227; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN4PR07MB2227; 23:rypJwbadOqh+7w2ACyzXwSpW81VmFUr0J2gQNtoY4?= =?us-ascii?Q?bM4SMbz6wvLiP9ErBDYimsHKKBvjOC+uMpvJ3JVOayCJt/g67sr36VTTjv/m?= =?us-ascii?Q?rygXh3BHLKcQDN8GhCwYJiEIWwJk4LL+NydSDrRaFDxostojVizZtGPzrwGK?= =?us-ascii?Q?B3IMZuxGN/+hyt22dyRyXSCHkGFuZ5yxAYajLay0sMA7PsNkHbt+OMidaUZo?= =?us-ascii?Q?PyLkYKxyLjqmbUtKvTnJtf6WZtAgJblH+84uLQgkWJTqrI6GdpR0QLj0YZ3d?= =?us-ascii?Q?uwWQo1i5wNoQ71Sev1HN880RmovYzSvPPdL96f6K856i+buRQ0XXCm26JEG4?= =?us-ascii?Q?iEE4U1k7vowG9bdVsF6ANAPP7J3jR0qsKrlcoq+50CT7MLM3tLmDmDsEB0vO?= =?us-ascii?Q?IPgFFz4a7AtECNohC5X5bc05upVi1BiWr2s5s8/LoMVXK5ibE20+9JofX5VC?= =?us-ascii?Q?SEGwCaWXkBbEy/ly+hSxfvj1FBVWDI3geHJCqgLLV/Opk0+dXIKMVSuxRXHA?= =?us-ascii?Q?v0EekfoxP5xguTXF5BJLKig1qpSVfEr9irqU/LrwPkACdfhK4dSxo9v54lBI?= =?us-ascii?Q?R2XDsLZ+eb1aGsDS8LPBO0Zqsi1BamVa8s18HmnqDwG9Ebf8UamBBEQ4M8Oe?= =?us-ascii?Q?auR7e/jfBa9NUHUxkFmZwC4QR75qV3mgV2wV/mV6TJyRGRQm5JxPU7wYeFJ5?= =?us-ascii?Q?nYJ/46ZdZ5mulf5rHTCv7qWYsrIrtPebOr4J7jNW1R1RhnLvdkZkoSa9jf+u?= =?us-ascii?Q?7D8aZ0oljgWH48+FhNTEqzeEky289ygmYeT03UVtD/2b1EBiEcf8U478RJN2?= =?us-ascii?Q?QRK8gZgBvAARlWhQ53NPUC/IZVESBUcO7SOkmyrhJPTqKvUnnqWqqOSo10Rj?= =?us-ascii?Q?IE+dMJ2e2CyVuMdPgJWBAeAQGy8cSbawuVmhChuj3zqUlcQM7xZwPIJC/bVO?= =?us-ascii?Q?fjOPXrl6L67B5WgQVgHx6Y494rAVKGWKPNja5wx2ey1V/ITzUTQ6p56P9GYl?= =?us-ascii?Q?tNZUyuS77HKBLHDP40OjNNILA0DPLTfQVrVvcHeJyRsxtrO1AL0WdAkW/Ybn?= =?us-ascii?Q?jCgP4Y=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN4PR07MB2227; 5:11jx0FN+9YyRV/1nZENKOQvcwBV9lvpK+c6dwJ/yqXyrYEmGOWJx0P0gftN8rU7bg72D7cCDwHQpnLrU5DKd0M8iirfsGGcHLQI+Z2hzn91CbqFT4FybQvB0NniIQdmQ/rZPkHwfwPHq6YC15YjooA==; 24:C8x6BUJF+F67+9waY69NLBJzpPHaKAlNF36TOfANGE2kN0RAJd5XsIsruQyKpT0v4DI6Gs6hnUT85SY+EJ5dnMb3cL2dCo3K7E0Yll5QSro=; 7:BmyLbqBmsayhyvP44BIjj1ToTmi4htsdoLTpfWEi5rmmwFd1/53rM0THktQydfTEo00InxCaS9mlOxM/9zYRPQrGclNqHCIuEPOJ5SlYij6Hat6j7SwXrjDIEKgqzJheRKeEHnsG8jt4ALmom5ySDMxYKLi9LJvXnQd2/oH9GkvQL8zwYi0QwTLNL1Ve+jk/ SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2016 00:05:54.0956 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN4PR07MB2227 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160523_170616_663144_66CA3848 X-CRM114-Status: GOOD ( 17.35 ) 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: kilobyte@angband.pl, pinskia@gmail.com, szabolcs.nagy@arm.com, Nathan_Lynch@mentor.com, heiko.carstens@de.ibm.com, agraf@suse.de, geert@linux-m68k.org, Prasun.Kapoor@caviumnetworks.com, klimov.linux@gmail.com, Andrew Pinski , broonie@kernel.org, ynorov@caviumnetworks.com, schwidefsky@de.ibm.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-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 85461e8..515444a 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -411,7 +412,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;