From patchwork Tue Sep 29 22:14:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 54271 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id BE02B2300D for ; Tue, 29 Sep 2015 22:18:53 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf12886414wic.3 for ; Tue, 29 Sep 2015 15:18:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type :spamdiagnosticoutput:spamdiagnosticmetadata:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=yuMAlT9XTXm7lz3zXEdCB1WTtxMG9d3i7Xpq12bENKI=; b=YttHJPcIXHOpPXI25cnmIuCGIMG8s7zs/5hFYkpwt2UXVdTxx0N/CMVosmWZkmKcy7 Rh3Du/9g/aSXpFZzDqw3EUxlQGDYbuDMknWJUHfxdzpE8u2EHyO2S+L2BVCP8EDxISOQ OecGZuzGpoC6omJL1fqj808fFGjTVtwuKneTm9kX445Jw4Ws36tNIMqPxVhW4T46OVUz yoik0Rp7bapvAbwyJtJj5g/ncieStW/Ulwm2LSLi24XsuuIDeDx9hVCnFlnt/b7YK3Wt qH2FMO4QRE7Yn78xR7I9lY6q6k43lmj7VTR89zxnJBQ80SN4OcvkTeJlDo4hi7KcVGnA TtPA== X-Gm-Message-State: ALoCoQlE/J2GmUEegKUFvoLtq6963j496mGzNLko+XqSS/Sne5N/WJU8+XoW2+Tie/H+1p5ItDqT X-Received: by 10.180.35.132 with SMTP id h4mr4260849wij.5.1443565133077; Tue, 29 Sep 2015 15:18:53 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.231 with SMTP id e7ls6261laa.3.gmail; Tue, 29 Sep 2015 15:18:52 -0700 (PDT) X-Received: by 10.112.131.8 with SMTP id oi8mr72927lbb.99.1443565132889; Tue, 29 Sep 2015 15:18:52 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id d11si6349200lfe.173.2015.09.29.15.18.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Sep 2015 15:18:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by lahh2 with SMTP id h2so25530194lah.0 for ; Tue, 29 Sep 2015 15:18:52 -0700 (PDT) X-Received: by 10.25.19.73 with SMTP id j70mr64244lfi.29.1443565132729; Tue, 29 Sep 2015 15:18:52 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2398005lbq; Tue, 29 Sep 2015 15:18:51 -0700 (PDT) X-Received: by 10.66.147.104 with SMTP id tj8mr410049pab.125.1443565131206; Tue, 29 Sep 2015 15:18:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qq4si40531618pbc.157.2015.09.29.15.18.50; Tue, 29 Sep 2015 15:18:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754329AbbI2WSp (ORCPT + 30 others); Tue, 29 Sep 2015 18:18:45 -0400 Received: from mail-by2on0063.outbound.protection.outlook.com ([207.46.100.63]:36550 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755763AbbI2WSU (ORCPT ); Tue, 29 Sep 2015 18:18:20 -0400 Received: from localhost (91.78.158.8) by CO2PR07MB617.namprd07.prod.outlook.com (10.141.228.143) with Microsoft SMTP Server (TLS) id 15.1.274.16; Tue, 29 Sep 2015 22:18:16 +0000 From: Yury Norov To: , , , , , CC: , , , , , Yury Norov Subject: [PATCH v5 18/23] ptrace: Allow compat to use the native siginfo Date: Wed, 30 Sep 2015 01:14:15 +0300 Message-ID: <1443564860-31208-19-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1443564860-31208-1-git-send-email-ynorov@caviumnetworks.com> References: <1443564860-31208-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [91.78.158.8] X-ClientProxiedBy: DB5PR02CA0032.eurprd02.prod.outlook.com (25.161.237.42) To CO2PR07MB617.namprd07.prod.outlook.com (10.141.228.143) X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB617; 2:30pETCUGSQkoAzhtEFps42lniEqPiVfU74lSsFIdMJdGKHZMRhioTWm0hCL3IVPsIMwd9xkUxHd38nfY94u891j2rVlHZNIT57Lh20tT0dtAkM1mwotEzqUPaGa7nxG7VVGvvf+OHf7US8zf3l/hoY88RIOxIk8UTeHNnjCwIBI=; 3:CeK3dSB/tB59p3KXi1yE3Qo5Nzw3eI7mam5m6Zw+f0xcF+AYZ2169Mg7tU6EyMWEoOM7mvZTlfPTK9sqCNZlvETQQR/Cy9wYawcTnCFwggMh87fWnnlFQ0BxJLg5Rp1ynEFf3vmz8ioL0B37yBfR3Q==; 25:j5mLn1V3qWJBit71k/Q4gP1tWeOBx3r2d1YP3cY3y+TJFElKx1+Bl1+UanLvE5unxy68e6KA9fvR9CeEn4elJi42aWthJ6KbcS7oPG6CwskW0tQhSW96dHlCFs3Q6y1xXZ+xOOqV81fqAPmhz4SPBtJ6JU8OWM8tU2Yk9V4teF9TCM8xBYo2WDIalZze2XaAIazKjOeP5yE0OPV33RlsU7GQdJBwqM3+LjV2W6dUkjbJv7xGH8AqJ0/JXUgD6n8uRggiUitGRRHGTy6z7KzHcw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO2PR07MB617; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB617; 20:uHGOvVKp7/49FtB2ckf3MuS4ssK+kvEa2deKxwIxXCEoNIY0Of9w5Qd5t+00UN/Cz6ClO6DeovSijmtwebXyD2HfG4xgrrDCgJTUyattw9YfbWrhqpK+CAIUYxXpHRWBI39pPn7r50yHVuqyJcyKRO2XBB+Vx7VJ5x1mguF8eSHWGCcniQEzvKg7FRSQzsAeCsxUUVlrVIYrxuiXjoAcXthyHfwDM3SRT1nIbAKLhZM3S+7RWAYExyMD5cfQvP1cSaXmrKcjZCSLDiLOcuZWQJU/Be8Utgd/iBDxY9Y4SdApZjAJs/X1df14I3orqdEovcJMMzPHGTjU16KH4ltMJdFYk3EIdm8IkRTEG4E4RxI5izjeGxLz3hCmcdQUk8HpsF+tBKOltkDWGXRTWu8a+dn1wQs594i3hZ1mj+ZLdTFtuUndAdaqYD0crHm1Zbr8by1OHDho3lziVQ4yw2cbvDocbY5E3zwXuXdbFJQ1QDtFJ7o6z1yzds4AiF3uVIfWIbDU4ubQnBnF1WE9zWXS9Rb7S+RMKyL9Dh+7WjeaJc7Aeh6n+SBPdqKSN1snUNTXg8d8MwHdu27x0vCpzlWTKF0+diKKY0GH4T5Fg4u7eXc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(3002001); SRVR:CO2PR07MB617; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB617; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB617; 4:rssRpPRDXL8NuW46LG0ulTb8aYrc4H1mNHxfnxkHn0p6gzMqB/ImwG2I0foogZlHOAcPcgIbWQEu1q/rP2mtsojh4D7E4xJj1f4ElVVsJu/L/kFu1t8fTkfFHi82SO2nBractvsbmyeqkfz4MUi2kemoqOdBtMjq9TwXXz8uypGNvk700aO4sUHH2fIWjHI+k9WMSpgGVMVoNjMzCBrH38FX4pBVqF8cTLlbM8p25+y+8WyoTQqSsu6mpQ1mJHWADyXw8AyRbI8bMcMM2y9ckxwMx6FRkao9UZFCHdbmQGtpGh49cxG0oigKLft1QkOU3BjzuBzhbBEQ5yn/5uvX7ETFnH11ueHfwybDQTeEops= X-Forefront-PRVS: 0714841678 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(199003)(189002)(50226001)(47776003)(64706001)(5003940100001)(19580405001)(105586002)(87976001)(62966003)(101416001)(50466002)(2950100001)(106356001)(189998001)(5008740100001)(33646002)(48376002)(66066001)(46102003)(5004730100002)(77156002)(92566002)(50986999)(36756003)(76176999)(5001960100002)(40100003)(122386002)(229853001)(97736004)(4001540100001)(42186005)(5007970100001)(77096005)(2201001)(76506005)(81156007)(107886002)(19580395003)(5001770100001)(68736005)(5001830100001)(5001860100001)(4001430100001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR07MB617; 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-ascii?Q?1; CO2PR07MB617; 23:m/tiq1ttrIO9Z/u/XHufRuorD5d8PUznrBRgdv1rRC?= =?us-ascii?Q?8uOAou11vcvyJZMGpa7oo5EUtQ5TZS3V0jOrIExvwkDrqNmKwzMazl4T16Pr?= =?us-ascii?Q?q/7XdPP9u5rKZLjYylQsEkFGIBfOcLCPsllHVnM7W6x88pgzOPxLL7bDb6a2?= =?us-ascii?Q?nx1Xgy7g5E6KxvB+2KMeeQ2uYr5C4BFiJuLWTMd4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ascii?Q?lQU3Azp12Tr0k3VnxYM6id59IMXqcpgEZaNROex3mmAEkbsy0U/NOfsrv3Z/?= =?us-ascii?Q?s27PsD2CsYmHut3kDZnBVC03NZB/1+0AvSQH58EzOrStUl1+9s4lQnq21vtq?= =?us-ascii?Q?XZ8j2cMrpj2i+HQ/+N3ZGVKqDwAHI5FKSfT6btib7qHIZzscUsL/Oomuolyd?= =?us-ascii?Q?/jJ5sotdTR11cL2hCYNpl/a0+d75hktglK3lqiF4Hd8N+XuvlTMPHxLPhD0Q?= =?us-ascii?Q?BP/fqVV0S9OZjxqrO34DE=3D?= X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB617; 5:UP/3DIxZ3Yu8wzvQ/q+OU3eTuiSa24FP6Hb/1VmSIbhTGAW5Ea/QJY4YiNEMqqu+BSEavQWWCSaZSjuFv5iXiUn3Imti2EAyfHg1QTKv4Lv+L0Uh2oQWx/XnkOr7PQ4f9m7L6pQRfAQObkdk1AslTQ==; 24:okJw8SQHWcMaWOmE5qjqgXoxVjqP0qGgbTEIbIw+8GYDvJqh3QTgG3VG91k2iAcFEsh3Xb+DUwTfS5rom1llSYPX2UgHCRbGh8CM/Vm6dAk=; 20:IAyZNrDBxShOJkTYW1OMlQVfiB1UGIZQ49vMW1KxvDdFeAt/2MbwMesm7pewIcS8DpZ/SfJj/Ms6ZHNfZnezCw== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2015 22:18:16.5609 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB617 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linux-kernel-owner@vger.kernel.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 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);