From patchwork Fri Jun 17 23:54:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9185239 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 3308F601C0 for ; Sat, 18 Jun 2016 00:01:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CD2127EE2 for ; Sat, 18 Jun 2016 00:01:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10CF42833B; Sat, 18 Jun 2016 00:01: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=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable 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 3897C27EE2 for ; Sat, 18 Jun 2016 00:01:28 +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 1bE3fl-0006hA-2S; Fri, 17 Jun 2016 23:59:37 +0000 Received: from mail-bn1on0071.outbound.protection.outlook.com ([157.56.110.71] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bE3bq-0001IP-8X for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2016 23:55:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-caviumnetworks-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=EOfLX6oRH793DiK2MixrSWRkjVOMLXK8Jk/Pay/ykis=; b=JXzx5M86tj51Vh5zETSGI07ILI7RXQNaU5FvSAMHVP6nSI8UPmOmMtUXxmAycaXDP0RqtSBcN78oQf1LuaoF+1nffyR+Ir9er2YnXmCEpKrVU0eyoc42kGfOPqX7xx4H0iwysBWjib3KbeYsYpW8579DC6h0J7ptmA3nAP2qvvQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (50.233.148.158) by CY1PR07MB2248.namprd07.prod.outlook.com (10.164.112.150) with Microsoft SMTP Server (TLS) id 15.1.517.8; Fri, 17 Jun 2016 23:55:10 +0000 From: Yury Norov To: , , , , , , Subject: [PATCH 08/19] arm64: introduce is_a32_task and is_a32_thread (for AArch32 compat) Date: Sat, 18 Jun 2016 02:54:17 +0300 Message-ID: <1466207668-10549-9-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1466207668-10549-1-git-send-email-ynorov@caviumnetworks.com> References: <1466207668-10549-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [50.233.148.158] X-ClientProxiedBy: SN1PR10CA0029.namprd10.prod.outlook.com (10.162.255.167) To CY1PR07MB2248.namprd07.prod.outlook.com (10.164.112.150) X-MS-Office365-Filtering-Correlation-Id: 20f9a674-98f2-47cb-b559-08d3970ad19b X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2248; 2:uMbDTmc1bnMQCfYTeH2PpbDpvfviu7ii/WQMpIsxwki6Qf7CLuxmpfAH0uULfkNw0/yav0lmIjdF55SRCerbgimzfmjEZbQ6GNfRdO6RrUiLeTW9Q6dDtf/YXaT1fuiGkVu+iWzsDgRp7HxPylY6im7UBu7nf48aaxE1PV+NoaG5UO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vH71xrLHHtKKzDH4UXP9tw3zoK0DbBL1RJJjnN2LbsY1zOkCHJei5OGdH3RUrQjXcETK3I98Fmcftu5QT1y3tKFF3eJ+DFWBxttgZUWCebjT3Oox/3z7L27yGvjsZ9ammvKyBkgG/RjfPvidfG3HxhF2StRAqpCXEvrQ3IcA+KJnlGnDICizqZvEdGcw8czikJV5yNV75tqzrxoWi0iwLLxOeSy1glj2Umtt7ca54= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(22074186197030); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:CY1PR07MB2248; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2248; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2248; 4:eafopb80fCxmm074n0N8IpPJEFtb+5oNn/dz+SKVnJHP6sUsFHEtGdUEsQa3Hfb7DgX2MRiOmLZkXLM1JTLyYytLylIPccPBkkkn3w1dWXl5mDow/+yYbsT8SYf8Z0O9/dKDMw9e4/4zjx+kfCg9/NRM3c+exQbKKRzGOchLusnQcJ5sjZeRz6mMks/Pr7DgW1tug8Qgo8FxC9PZKawPk3mfegPE1rL0quD5irUeXRq6Si5KliBIkbU766xrGrjrJ8L4QXmqZah/k56qBBUnrnzlXj2Yf5U3wxAXvpE73Ctidc24PNQjyQ5aDsGvkvXN8dOt/5ABLKpR+M/E/JaaK16LWk8VGwMzm/DYCTp6mGfsfqytcL35vi+YfMxFiS9ApQ5Ei/9UrtZBR7yzuZhd/onS1xHhUG9qzDQtoMpGIqlwA4eCgCo666PKJRMlEN5e X-Forefront-PRVS: 09760A0505 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(199003)(189002)(97736004)(105586002)(5001770100001)(106356001)(47776003)(36756003)(33646002)(19580405001)(4001430100002)(19580395003)(2906002)(7846002)(42186005)(189998001)(107886002)(15975445007)(81156014)(8676002)(81166006)(101416001)(77096005)(4326007)(2950100001)(6116002)(3846002)(586003)(68736007)(2201001)(76176999)(50986999)(66066001)(5004730100002)(229853001)(92566002)(48376002)(76506005)(5003940100001)(50226002)(50466002)(2004002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2248; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; CAT:NONE; LANG:en; CAT:NONE; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2248; 23:DIgy4RQfPF8UxU1oQfFIiEFxpLXfV/9qL5Vl/tiiX?= =?us-ascii?Q?aEY8UFSfTX7o0yRxp4ZnyNRlWavHcOQEb51hIqF1zL8sVUdhRB93djgaCHK1?= =?us-ascii?Q?xIQklamJNzyRaOcIqWgvM2ILf2Bucm7UjjYG01ICrWnH0dU4zK8tTDvtWcEG?= =?us-ascii?Q?Z3ls26NWbM9iufYdeV2bAx/Lk6iR8fvrg59tcxY4uExx2Rb0hM7kQ9TFCsUR?= =?us-ascii?Q?r/QV82pbd73ADpfqMEXPhcIUmQqOv9ivMx55guXJniDEF1k9RJu5YJJ06Sz4?= =?us-ascii?Q?P3Uvhjm0NuWlyThlMjcFSTtcSYQqXncsMqC6Wrtly8dxx7gbGx4rrf+OE2mr?= =?us-ascii?Q?DgmN77VgnRJImyqYRrkMs3PZOI0PP8R92nSogohV/K3rwNxsWmlbFRlozq4z?= =?us-ascii?Q?QbNtItINpJnGHmipsuCfpR2V0O8o5W1WxyvG6R/iWnRTXJ4Ef3+uxM2wlXyZ?= =?us-ascii?Q?xxySQYMliMDXW9wdOmV4uUR/t66MzQaDA1FYXC0uwxyhMmGwRoDzDAd6QK2/?= =?us-ascii?Q?EULVcuQtTBxZUiRbeJt8/duZ3Y0An0ncZD5IYRk3UdHYxzTiT99qA7l6iL7J?= =?us-ascii?Q?rrmKwB2vU3fN22lXuK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sj1xD295eX07oG9NA=; 5:70LJXzlQlu4dw/yYJMjtwU96ZEL4oOjI4AagCQyc0u7ItN8YhAKcs4XqOr5ZQCRciA/nUcVRQIMq/WTMqkSMQlZ/Bdk1UB8iBCiAAPRvJq5ZlTmrS0aWqP9ehuzHEv1j9U4zwU79/vPGRTG7RMv7Sg==; 24:Y7FZmMzjFNSms3qK6y1O/3v+M+HoDjZHl6S8RDF3WixyPz/JnJaKw85T7qU9vc+TNnL22wKt7TchRVp9wsBke+pjMah3tKQ/ueKilLNQ5qk=; 7:sfyNC/OVgEyZrIUfEoJrVXS4KseGnptpGm21Z0oxoJShHv0S7aGET6kfCvrMcAABeIhkvXUcqktb4DxNHmPOq52Dug0B0HcyuXUg77iTmL8++uS0DnpIrebsA8GXq7iasR0CtkuVykrzKtJFYdFRII6qOq/xOZvssNieWDuGmuElJTR5vKuZBvdLx1fYe4L8sdtA3leHqNH97VQaoMho7A== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2016 23:55:10.9490 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2248 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160617_165534_661042_FB8F2967 X-CRM114-Status: GOOD ( 16.16 ) 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, manuel.montezelo@gmail.com, 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, maxim.kuvyrkov@linaro.org, schwidefsky@de.ibm.com, bamvor.zhangjian@huawei.com, philipp.tomsich@theobroma-systems.com, linyongting@huawei.com, davem@davemloft.net, 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 | 64 ++++++++++++++++++++++++++++++++++++ arch/arm64/include/asm/memory.h | 5 +-- 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, 98 insertions(+), 48 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 579b6e6..bef2d90 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 __AARCH64EB__ #define COMPAT_ELF_PLATFORM ("v8b") 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..8dba5ca --- /dev/null +++ b/arch/arm64/include/asm/is_compat.h @@ -0,0 +1,64 @@ +/* + * 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 */ + +static inline int is_compat_thread(struct thread_info *thread) +{ + return is_a32_compat_thread(thread); +} + + +#endif /* !__ASSEMBLY__ */ +#endif /* __ASM_IS_COMPAT_H */ diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 31b7322..4d734a1 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 @@ -78,9 +79,9 @@ #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) ? \ +#define TASK_SIZE_OF(tsk) (is_compat_thread(tsk) ? \ TASK_SIZE_32 : TASK_SIZE_64) #else #define TASK_SIZE 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 ce21aa8..d67f518 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 6cd2612..c008ec8 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -47,7 +47,6 @@ #include #include -#include #include #include #include @@ -204,7 +203,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; /* @@ -256,7 +255,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; else childregs->sp = stack_start; @@ -293,7 +292,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 973faec..d77be17 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;