From patchwork Wed Aug 17 11:46:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9285695 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 A593660459 for ; Wed, 17 Aug 2016 11:56:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95058290B7 for ; Wed, 17 Aug 2016 11:56:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87F58290BC; Wed, 17 Aug 2016 11:56:23 +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 C81FF290B7 for ; Wed, 17 Aug 2016 11:56:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZzQm-0006o2-HP; Wed, 17 Aug 2016 11:54:48 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZzM0-0001bZ-Aw for linux-arm-kernel@bombadil.infradead.org; Wed, 17 Aug 2016 11:49:52 +0000 Received: from mail-sn1nam02on0050.outbound.protection.outlook.com ([104.47.36.50] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZzLy-00032U-VO for linux-arm-kernel@lists.infradead.org; Wed, 17 Aug 2016 11:49:51 +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=XRX9E0lNBmVkM+EFD9D/VgaBpOoYNx+aoWGMZNA7Nh8=; b=CUO0vSheKhleW3FQ3Bv+7QN847CPzFzX3dWmA3+haQRL1+UgguKgrHPDwH5tIlWE8N/hRpclULUBJEZU9IDVvt9dnLoXRmnb9lg8JiNVG5K0aHT/J/bncnu9b7Npih+NqY2/xqvxAVr/hTjipVbMvVhMlUaqhRC3BKMl0zvtMBU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by BN4PR07MB2242.namprd07.prod.outlook.com (10.164.63.148) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Wed, 17 Aug 2016 11:49:27 +0000 From: Yury Norov To: , , , , , , Subject: [PATCH 16/18] arm64: ptrace: handle ptrace_request differently for aarch32 and ilp32 Date: Wed, 17 Aug 2016 14:46:41 +0300 Message-ID: <1471434403-25291-17-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471434403-25291-1-git-send-email-ynorov@caviumnetworks.com> References: <1471434403-25291-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM3PR03CA042.eurprd03.prod.outlook.com (10.141.191.170) To BN4PR07MB2242.namprd07.prod.outlook.com (10.164.63.148) X-MS-Office365-Filtering-Correlation-Id: 53656675-9e40-49d6-302e-08d3c6948ab0 X-Microsoft-Exchange-Diagnostics: 1; BN4PR07M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ft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:BN4PR07MB2242; BCL:0; PCL:0; RULEID:; SRVR:BN4PR07MB2242; X-Microsoft-Exchange-Diagnostics: 1; BN4PR07MB2242; 4:062do3HcHr9n5+0fROW4n0wkgujMLq2opcfkTX3rvSTtshBs9zjjdj2gfxjOPBVU9aO9ijS4B5vbnZrzxm4C4bvbi/pZDySfPvvHSSPdyhAMQT8t6nIYmzCzW+r79+v2AKj2N4/L+9qAsUgYgPeykbLTfLM/A7EwxcwdAeXXey8euRUGO+dEAVFDmpe/+YMB668f+hT7k/srE9WyomX8DvAazfYAnwv2DYXDTPYVKgJVUDSHAjAg9qA3dXuJbf3bYVqV73hYWkXUf7xM6D3WCgm3XOniOxdbDGtSQ3/qoXuKA/TTp7fTvA+iiY4y2F4xWio5WG17Za2d9actc4xv0vVjXZYq62KQmHMoIjvqWq9Xq0HeylblBHnVjT3ioS/KzUFtJCIUrj3nZQD6tQjPAQ== X-Forefront-PRVS: 0037FD6480 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(199003)(189002)(33646002)(81156014)(7416002)(5890100001)(8676002)(2906002)(3846002)(5001770100001)(189998001)(68736007)(586003)(81166006)(66066001)(97736004)(19580395003)(6116002)(77096005)(7736002)(50226002)(7846002)(305945005)(2950100001)(5003940100001)(76176999)(106356001)(105586002)(47776003)(50986999)(4326007)(101416001)(76506005)(36756003)(92566002)(42186005)(50466002)(575784001)(229853001)(19580405001)(48376002)(2201001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN4PR07MB2242; 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-asc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8N/v9qjhG2hY3Yw81afpOd9y6hhFPN8+ZzPA1HTvtW/YpNrfwjod8obJpM4GPvJshbztEW4mKRhlS6vA73BTNSqgJUN4+Jda46SRDzFrvemSAwAqd2THOWy03dY1MZhbRtx0tpbEkJtl1znaRsu5O5EzWg3lSsAEx+jpm06n56//LbXkS5VQzKiXYR5jbMlhYQg8WXN5uXEgEiloqG7c SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2016 11:49:27.0901 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN4PR07MB2242 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160817_074951_144304_49598E02 X-CRM114-Status: GOOD ( 17.88 ) 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: szabolcs.nagy@arm.com, heiko.carstens@de.ibm.com, cmetcalf@ezchip.com, ynorov@caviumnetworks.com, philipp.tomsich@theobroma-systems.com, joseph@codesourcery.com, zhouchengming1@huawei.com, Prasun.Kapoor@caviumnetworks.com, agraf@suse.de, geert@linux-m68k.org, kilobyte@angband.pl, manuel.montezelo@gmail.com, pinskia@gmail.com, linyongting@huawei.com, klimov.linux@gmail.com, broonie@kernel.org, bamvor.zhangjian@huawei.com, maxim.kuvyrkov@linaro.org, Nathan_Lynch@mentor.com, schwidefsky@de.ibm.com, davem@davemloft.net, 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 Here new aarch32 ptrace syscall handler is introsuced to avoid run-time detection of the task type. Signed-off-by: Yury Norov --- arch/arm64/include/asm/unistd32.h | 2 +- arch/arm64/kernel/ptrace.c | 91 ++++++++++++++++++++++++++++++++++++++- arch/arm64/kernel/sys32.c | 1 + include/linux/ptrace.h | 6 +++ kernel/ptrace.c | 10 ++--- 5 files changed, 103 insertions(+), 7 deletions(-) diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index b7e8ef1..6da7cbd 100644 --- a/arch/arm64/include/asm/unistd32.h +++ b/arch/arm64/include/asm/unistd32.h @@ -74,7 +74,7 @@ __SYSCALL(__NR_getuid, sys_getuid16) /* 25 was sys_stime */ __SYSCALL(25, sys_ni_syscall) #define __NR_ptrace 26 -__SYSCALL(__NR_ptrace, compat_sys_ptrace) +__SYSCALL(__NR_ptrace, compat_sys_aarch32_ptrace) /* 27 was sys_alarm */ __SYSCALL(27, sys_ni_syscall) /* 28 was sys_fstat */ diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 1d075ed..4f0df07 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,7 @@ #include #include +#include #include #include #include @@ -1215,7 +1217,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, +static long compat_a32_ptrace(struct task_struct *child, compat_long_t request, compat_ulong_t caddr, compat_ulong_t cdata) { unsigned long addr = caddr; @@ -1292,8 +1294,95 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, return ret; } + +COMPAT_SYSCALL_DEFINE4(aarch32_ptrace, compat_long_t, request, compat_long_t, pid, + compat_long_t, addr, compat_long_t, data) +{ + struct task_struct *child; + long ret; + + if (request == PTRACE_TRACEME) { + ret = ptrace_traceme(); + goto out; + } + + child = ptrace_get_task_struct(pid); + if (IS_ERR(child)) { + ret = PTR_ERR(child); + goto out; + } + + if (request == PTRACE_ATTACH || request == PTRACE_SEIZE) { + ret = ptrace_attach(child, request, addr, data); + goto out_put_task_struct; + } + + ret = ptrace_check_attach(child, request == PTRACE_KILL || + request == PTRACE_INTERRUPT); + if (!ret) { + ret = compat_a32_ptrace(child, request, addr, data); + if (ret || request != PTRACE_DETACH) + ptrace_unfreeze_traced(child); + } + + out_put_task_struct: + put_task_struct(child); + out: + return ret; +} + #endif /* CONFIG_AARCH32_EL0 */ +#ifdef CONFIG_ARM64_ILP32 + +long compat_arch_ptrace(struct task_struct *child, compat_long_t request, + compat_ulong_t caddr, compat_ulong_t cdata) +{ + sigset_t new_set; + + switch (request) { + case PTRACE_GETSIGMASK: + if (caddr != sizeof(compat_sigset_t)) + return -EINVAL; + + return put_sigset_t((compat_sigset_t __user *) (u64) cdata, + &child->blocked); + + case PTRACE_SETSIGMASK: + if (caddr != sizeof(compat_sigset_t)) + return -EINVAL; + + if (get_sigset_t(&new_set, (compat_sigset_t __user *) (u64) cdata)) + return -EFAULT; + + sigdelsetmask(&new_set, sigmask(SIGKILL)|sigmask(SIGSTOP)); + + /* + * Every thread does recalc_sigpending() after resume, so + * retarget_shared_pending() and recalc_sigpending() are not + * called here. + */ + spin_lock_irq(&child->sighand->siglock); + child->blocked = new_set; + spin_unlock_irq(&child->sighand->siglock); + + return 0; + + default: + return compat_ptrace_request(child, request, caddr, cdata); + } +} + +#elif defined (CONFIG_COMPAT) + +long compat_arch_ptrace(struct task_struct *child, compat_long_t request, + compat_ulong_t caddr, compat_ulong_t cdata) +{ + return 0; +} + +#endif + const struct user_regset_view *task_user_regset_view(struct task_struct *task) { #ifdef CONFIG_AARCH32_EL0 diff --git a/arch/arm64/kernel/sys32.c b/arch/arm64/kernel/sys32.c index a40b134..3752443 100644 --- a/arch/arm64/kernel/sys32.c +++ b/arch/arm64/kernel/sys32.c @@ -38,6 +38,7 @@ asmlinkage long compat_sys_fadvise64_64_wrapper(void); asmlinkage long compat_sys_sync_file_range2_wrapper(void); asmlinkage long compat_sys_fallocate_wrapper(void); asmlinkage long compat_sys_mmap2_wrapper(void); +asmlinkage long compat_sys_aarch32_ptrace(void); #undef __SYSCALL #define __SYSCALL(nr, sym) [nr] = sym, diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 504c98a..75887a0 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h @@ -97,6 +97,12 @@ int generic_ptrace_peekdata(struct task_struct *tsk, unsigned long addr, unsigned long data); int generic_ptrace_pokedata(struct task_struct *tsk, unsigned long addr, unsigned long data); +int ptrace_traceme(void); +struct task_struct *ptrace_get_task_struct(pid_t pid); +int ptrace_attach(struct task_struct *task, long request, + unsigned long addr, unsigned long flags); +int ptrace_check_attach(struct task_struct *child, bool ignore_state); +void ptrace_unfreeze_traced(struct task_struct *task); /** * ptrace_parent - return the task that is tracing the given task diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 1d3b766..7cfbfca 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -136,7 +136,7 @@ static bool ptrace_freeze_traced(struct task_struct *task) return ret; } -static void ptrace_unfreeze_traced(struct task_struct *task) +void ptrace_unfreeze_traced(struct task_struct *task) { if (task->state != __TASK_TRACED) return; @@ -168,7 +168,7 @@ static void ptrace_unfreeze_traced(struct task_struct *task) * RETURNS: * 0 on success, -ESRCH if %child is not ready. */ -static int ptrace_check_attach(struct task_struct *child, bool ignore_state) +int ptrace_check_attach(struct task_struct *child, bool ignore_state) { int ret = -ESRCH; @@ -292,7 +292,7 @@ bool ptrace_may_access(struct task_struct *task, unsigned int mode) return !err; } -static int ptrace_attach(struct task_struct *task, long request, +int ptrace_attach(struct task_struct *task, long request, unsigned long addr, unsigned long flags) { @@ -406,7 +406,7 @@ out: * Performs checks and sets PT_PTRACED. * Should be used by all ptrace implementations for PTRACE_TRACEME. */ -static int ptrace_traceme(void) + int ptrace_traceme(void) { int ret = -EPERM; @@ -1056,7 +1056,7 @@ int ptrace_request(struct task_struct *child, long request, return ret; } -static struct task_struct *ptrace_get_task_struct(pid_t pid) +struct task_struct *ptrace_get_task_struct(pid_t pid) { struct task_struct *child;