Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754551AbbKBXfj (ORCPT ); Mon, 2 Nov 2015 18:35:39 -0500 Received: from mail-bl2on0059.outbound.protection.outlook.com ([65.55.169.59]:10064 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752087AbbKBXdk (ORCPT ); Mon, 2 Nov 2015 18:33:40 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; From: Yury Norov To: , , , CC: , , , , , , , , , , , , Andrew Pinski , Yury Norov , Andrew Pinski Subject: [PATCH v6 11/17] ptrace: Allow compat to use the native siginfo Date: Tue, 3 Nov 2015 02:30:40 +0300 Message-ID: <1446507046-24604-12-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1446507046-24604-1-git-send-email-ynorov@caviumnetworks.com> References: <1446507046-24604-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [109.252.143.100] X-ClientProxiedBy: VI1PR05CA0004.eurprd05.prod.outlook.com (25.162.33.142) To CO2PR07MB620.namprd07.prod.outlook.com (10.141.228.156) X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB620;2:4ct96bdrb+AOB1OiXh05QNVHM53JZLS79iI4iYWu/TaJcq1/zwPAg8lxVBCDRZTjyM5BBVHAEWVy60si3zTxaR9OWRrMcwVe0vtuvd7FinHaOcAlOimaPQRqN6dmHReLuPZAm28Qhd4BVvHlowjKuE0gp5nialj2E2lDf5UzGik=;3:BCfF3STVNLEHwqhmuFN90IotnIL8FoWz28hWOZCK1c+bphS5dETMF2N7drHeupRTLUK5ewGfrrh6gvMX2HBHExMgPJy3ElvHyP4FaO7q4DMRCyKBHrhXbFFa1MWC7BjW1MgGei4BH1L2QnLfEEnmvg==;25:JW2c4alMefEJQJhA0y+6wfsEZ8W8zJYcxlDr7T3gJZT6wCmgYthc+SVbGuNhCaraBJ1DuCeqWymQp3PqYGV4mlj/dQDQnYj9c3SaBgKLdNHNF+qi0vi0hsYFEbImm+TlvtDLInZT72CRbHytGM9WSaY6nbDedxoYjPvdDOIDqmRGdzkYxJ+3Y/4q+Sg4p0xSDrWCMNuRnqGp3pqTFrSCOnI73oPmhkLrPtJxnRUwVtCDVQ5S4mIquB+E17l65YDoBwDbTfmWB+jImVFFFGuI3Q== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO2PR07MB620; X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB620;20:VfYF12ltJsPn7I1iSN97Hgmd2QMjx+UY0m02bMa3vFb1fkPUfj9u5ApFOwsK5mGak5pvjB0xpkw8XtuNyNc9AYOqSIhTjksr3r/5tAi3wFPherxe/MzH3VcE7xqxKAspLkeEw5cx2A9yjUtnVUCn6So42C9TEdaaw8h/JDo4HKAOI/vtp9ZcIRlivXbI1HbRip1tnqgNnb1tprFvbYJt/XplWs7j3Jn2tqCFYIgOjhJRywrhObhkGiiKfYKDty6rA4dAGFKCjFQe3YdHcqK6g91xVOYRHf4zImOFVm2gKugfJ5+txf00uY5qyrNkU6vjNwyoTNt3trA8BRTwG0ZW9WUzX+C3sxzcg9yd/O7MbSkH9ExXj5/6BCNdDd9CXpRHVxHUTZTgYvLzdZ57BVD0EzKxLig0/u9/8p5NuOB4WmqyRE2/RMnBmyEItkLdr32xCWZVrrO5quKcBAQid8S4PaRQ8UeTxCd1YYAuhqSdsvaAgPjF6Y77nMTMyuiUUnL9uI9CNA0K2vR/aKK5zAx6o/C20eUUFanALgHCZPsY++/xGtM/c5wxXTtPR8Lo2U67uGELqPbiivAUZsNn6R+fyDL7yZW34jYzCZYLXXP+4kA= 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)(5005006)(8121501046)(3002001)(10201501046);SRVR:CO2PR07MB620;BCL:0;PCL:0;RULEID:;SRVR:CO2PR07MB620; X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB620;4:ri12cMTgE5GOn4K0zvPqB2HF7eP2n3PhDKqTzoRNgOziFBZ/kgTVP+eCHf33lYMk/mBkPstQ0JgIOim2fB02R+Wlljqt35siNlE+JRQvYIz6WUTOMPyiJPbrq1o8yW4synFTkxbreOhIv0cvRCRrUoHZHj1KpTNiSoT5BBc7uCjldmth3KMwfpkWmK416P0O9HalYXFHdE1uQVAh2Mvz8z1DKdFu0RKTvckMn9+TQyqUQWcSAE4BuLwCPHQV/QnBjizYQqIdyHXmesdEadBWJreJZGz0i5NJcbttQ+apZ0rUk5sjrHUj8KfkxeS8wus2mDkNbyBOGJNWFmsGX74dy4rHIyCgmDwevGfxCjyFlosVT3f0KGgRwNLJkrd/5y8f X-Forefront-PRVS: 0748FF9A04 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(6009001)(189002)(199003)(66066001)(48376002)(50986999)(47776003)(5007970100001)(5004730100002)(5003940100001)(4001430100002)(40100003)(42186005)(101416001)(50466002)(76506005)(19580395003)(19580405001)(33646002)(76176999)(50226001)(105586002)(107886002)(106356001)(189998001)(5008740100001)(229853001)(122386002)(5001960100002)(2201001)(2950100001)(36756003)(87976001)(5001770100001)(81156007)(77096005)(92566002)(97736004)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:CO2PR07MB620;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CO2PR07MB620;23:9YV5xmZcpOqi5+VvNnNjItF85eqsLloSWAPq+N2R9j?= =?us-ascii?Q?Sj3Rvy08UPfM8eqAAPMzQ2Tc2RDXg+v3/OOWkWz9+AWs1vHej2RvpCKV4iyv?= =?us-ascii?Q?fDh6NN4wiaFyKb96qjtBQtSFfSTQNr9yfevRn3tHYMij4fIzBtTdd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JJrnLqkdk1c9o10y3JmtJyBOJcyUGK2NpPfL878pRhSOvpOxN3bn4eov?= =?us-ascii?Q?u4L4MKh6NzKrRmu4g5zzypObk3Q1hABPLPA8a6OefyognROQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB620;5:Qyk/sGnn95HnBH96ExVQ7JtuwDhIFPA6SvJklOFFPGIbo6b7foY3+/dGFQ9s8ib7wG63GL4o3yfynnvIXYUhwjKOQhT/1G9YBiI2BrkxUbut4xNDEJM9AV6DVpz6eQcI6c6gbVPSDqMocXn2sXtmZA==;24:WQf8z+CMrqGfwU/gMj+4o9j8U8ExBS6tZ5eAeWSRtkue2SwH8a9O+bVLvsvcgrzChX3cAI9O8MFoR10mt87BkDr3UrB59qxzSuGpN6GWk4o=;20:4Ulyfs/0y8V74lzb7dWy7hrRcV1OiykB8BXQ25j/swYkfHxVzpSK3AgmYSKoscSCch4TtRJ1Wrw0gYHPWdd8Ow== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2015 23:33:37.7135 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB620 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2884 Lines: 89 From: Andrew Pinski Set COMPAT_USE_NATIVE_SIGINFO to be true for non AARCH32 tasks. With ARM64 ILP32 ABI, we want to use the non-compat siginfo as we want to simplify signal handling for this new ABI. This patch just adds a new define COMPAT_USE_NATIVE_SIGINFO and if it is true then read/write in the compat case as it was the non-compat case. Signed-off-by: Christoph Muellner Signed-off-by: Philipp Tomsich Signed-off-by: Yury Norov Signed-off-by: Andrew Pinski Reviewed-by: David Daney --- include/linux/compat.h | 4 ++++ kernel/ptrace.c | 24 +++++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/include/linux/compat.h b/include/linux/compat.h index a76c917..0a25d90 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -24,6 +24,10 @@ #define COMPAT_USE_64BIT_TIME 0 #endif +#ifndef COMPAT_USE_NATIVE_SIGINFO +#define COMPAT_USE_NATIVE_SIGINFO 0 +#endif + #ifndef __SC_DELOUSE #define __SC_DELOUSE(t,v) ((t)(unsigned long)(v)) #endif diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 787320d..04799aa 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -652,7 +652,7 @@ static int ptrace_peek_siginfo(struct task_struct *child, break; #ifdef CONFIG_COMPAT - if (unlikely(is_compat_task())) { + if (unlikely(is_compat_task() && !COMPAT_USE_NATIVE_SIGINFO)) { compat_siginfo_t __user *uinfo = compat_ptr(data); if (copy_siginfo_to_user32(uinfo, &info) || @@ -1140,16 +1140,26 @@ int compat_ptrace_request(struct task_struct *child, compat_long_t request, case PTRACE_GETSIGINFO: ret = ptrace_getsiginfo(child, &siginfo); - if (!ret) - ret = copy_siginfo_to_user32( - (struct compat_siginfo __user *) datap, - &siginfo); + if (!ret) { + if (COMPAT_USE_NATIVE_SIGINFO) + ret = copy_siginfo_to_user( + (struct siginfo __user *) datap, + &siginfo); + else + ret = copy_siginfo_to_user32( + (struct compat_siginfo __user *) datap, + &siginfo); + } break; case PTRACE_SETSIGINFO: memset(&siginfo, 0, sizeof siginfo); - if (copy_siginfo_from_user32( - &siginfo, (struct compat_siginfo __user *) datap)) + if (COMPAT_USE_NATIVE_SIGINFO) + ret = copy_from_user(&siginfo, datap, sizeof(siginfo)); + else + ret = copy_siginfo_from_user32( + &siginfo, (struct compat_siginfo __user *) datap); + if (ret) ret = -EFAULT; else ret = ptrace_setsiginfo(child, &siginfo); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/