Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753930AbdFSPxv (ORCPT ); Mon, 19 Jun 2017 11:53:51 -0400 Received: from mail-cys01nam02on0085.outbound.protection.outlook.com ([104.47.37.85]:61408 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753920AbdFSPxq (ORCPT ); Mon, 19 Jun 2017 11:53:46 -0400 Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=caviumnetworks.com; From: Yury Norov To: Catalin Marinas , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: Yury Norov , Adam Borowski , Andreas Schwab , Andrew Pinski , Bamvor Zhangjian , Chris Metcalf , Chris Metcalf , Florian Weimer , Heiko Carstens , James Hogan , James Morse , Joseph Myers , Maxim Kuvyrkov , Nathan_Lynch@mentor.com, Prasun.Kapoor@caviumnetworks.com, Ramana Radhakrishnan , Steve Ellcey , Alexander Graf , Mark Brown , christoph.muellner@theobroma-systems.com, davem@davemloft.net, Geert Uytterhoeven , Alexey Klimov , linyongting@huawei.com, manuel.montezelo@gmail.com, philipp.tomsich@theobroma-systems.com, schwidefsky@de.ibm.com, szabolcs.nagy@arm.com, zhouchengming1@huawei.com, Bamvor Jian Zhang Subject: [PATCH 18/20] arm64: ptrace: handle ptrace_request differently for aarch32 and ilp32 Date: Mon, 19 Jun 2017 18:50:01 +0300 Message-Id: <20170619155003.13218-19-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170619155003.13218-1-ynorov@caviumnetworks.com> References: <20170619155003.13218-1-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [85.253.137.34] X-ClientProxiedBy: VI1P190CA0030.EURP190.PROD.OUTLOOK.COM (10.165.188.171) To CY1PR0701MB1866.namprd07.prod.outlook.com (10.163.42.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 44c13d53-11c5-4cc1-9a6f-08d4b72b5c5e X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:CY1PR0701MB1866; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1866;3:GCKlrwpe5O4NNSNrWLW5b7DiP8hCAmmc0seY0fSbLAv3lT0rKyZGSibHZLNQzCLhkVzGPNEJj3RtzI+HxoDoihMZb+4LDY6sA1RBhUVDHnG/etMh47k8Q4feHC39qsBXHrTDRCKRr2pXsmhAnIsCcaHfAbh4JI+vz5fg9N3XWAqS7/klSMW/4irwe8Wvx3v1BDt8PX0WFTT8c22mvCUf+pdrbLJY6af7G4V20yn98WsuwLpXk/fcpUJHIp/hLYPHz3aayt2qAfsWUxmUkexqkvAcG8nsKGc/TXWzoHNjBi0WNaorZO6T8H7tCSeOJdFcwawY/t7ikeLMec+kM3p6dw==;25:jSgFnsOhJ5GwNvRk0Igkz10emW7oygnmRzrsUKM9UVt6Fpv4kXpNpR0kCKvQQYEpsBp2DKSpodZ4KwJfR9x3f3dprtiRe6KX9mzL3db/d0YkucPm3l/r2o2WMuC/Ks9xwTMVVGCYPGtc2bSpmNT2dqnQb+YtuUaoaYyEhUFHYJgAAy2/wPUcl2sf6FzQH0D5MJ/hJ2u52YwJoVwhpr+CTV4wXMwDVduAWviSZftLtxqlM38A/afhkiGYQPQHJKWcCK2jc/vixhXNEx+LAXqd/i3rctKieQcH1VYQhlUqkfny/1SOp/UqBgK+BF3I9Hjciiq4I/z9Ofd6VtCS8kDZo3zhmdyXhkwK0YWO6RUgdSFJM3yKEbl/nTQpC2CseDOxU8uWFe0OfR5dokHnRZQDyLxq4Xenfb/QHLbEnTaEuOZeciO6PJ7YgcuvcAXfZP2VmBAeGEnzw2NR3edv+5zqyG/yyM//wQqv648offxiZ7s= X-MS-TrafficTypeDiagnostic: CY1PR0701MB1866: X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1866;31:HS6N8v+oc7NyEzE51ajiPTRAfFcltT7CxiZFbJ6vr0ULu6eu7rZC2Qu7B60pLMt7ag9CnjIOeRggYnPY0utH+C/AqcqBilNsx0GDAO8hxXCCCIt715IMPknhEYm5gkkZ/bmtyx9bZwXcDitzcU2o39y8Oehjcheq2r02KoBIobFxFpNg3Rt5LX7INh2miusCWbr05/A8mGbmSqdRyhABmcb78qt3LNl2f+QWvt2JagQ=;20:8ZvP7G227CSHJ8a9DUo2PaPtTSHHlYO4Ks26jh4SPCcQyQLTdLlCRx3ObXWnkJbG/Sx9sNkgAv/agtJVFiJNySae9W1+rgCQ7wxXlmMEOKC5xpZgNXfJXoTaUir/mqmjelIRF9kiD4t/xX2cuTjzYbwt1MxHkiBQA4kB4h6WM2QtR9UR/FwLxBxqZdDcvefa1boR61OH1TS8uFBrdG4w5sGN9aM/tLCgagWhzJDNXH3idqovyvnDecXv9oiFaqs0/5QpfRa4gOO8f3VofvSMMUuwP5Di8DCPcSvdh/Vpf7IxV1SqbCOxH0J5X82CBTRYE8HZgSNPSpcEM2DOleSFzrnB1Ug1vdMDXqeYQIa7FSx4mMgJ3njYSkYhTFkvWMSYTKeYX/J6euHA/GUNgaQ/0W1r8toz1q3IUN/DBPrrwVtAEjcxIWQFardaUlP85l/NTYoLhIkiSKgUiQ9KNrn1VHIHsd75zcVmMd7GdiFotKNM7gWiI1gBMin/cT4DB3EsUxesV277aqvHYRAz43mULyN8mDyjW1WC1zRXqG0opVn8+GSBwXQ8TioVbQ12/k1PxnkiXbHj/sO+6l34VS9SLIyOEuRgUxzTDx7F+xK++2w= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(50582790962513); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(10201501046)(3002001)(93006095)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(20161123564025)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR0701MB1866;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR0701MB1866; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR0701MB1866;4:IgX5pbc9vWgwpvSYHv8s2KuWM6/LpKd392z0me9W?= =?us-ascii?Q?P+mlT5KJLLiV1QHr70ihRUWvhwI33RBlgMiJvx2Sgjx6GtmgGiEY8Z75Hasr?= =?us-ascii?Q?mtUsosi+L2eF2wldEoHNfSZvfA2j8Gz4Pz8oo/9xpAMoUso32JOENUC+RH+3?= =?us-ascii?Q?tPYDeGT2vs8/3qXqCTet0m0HXZMofmbv/5ztVpq/c51s0zLYfqw/u35ArNZg?= =?us-ascii?Q?rIic3aTDC2kLnh8w5lpW3KX6Sd+8d4ffGIfj+LwxqEq81Et+ugra+JUOpBBH?= =?us-ascii?Q?Isl3JhX0jkuiCm3b3UmyIArUWiJOikUu1ROUb2v8NwYwdz0dR97yhVbyRwnK?= =?us-ascii?Q?gey7Q1f26HcXnvwigiH7pSGJwySwbNMBR1WFvjOaaJXuguFKqZbFqKjAYgTE?= =?us-ascii?Q?JqAE+wflZgi+fdUy/7qMhc9QiI3/NSwCiYchSKbo+4f/Hvd+iG5i8qo7c3QJ?= =?us-ascii?Q?Cay8xNlw5MP1RAGNlqPZ5NBl1GauYV1KjgUYL1URpCo0n3mslgYk3RwGXp8/?= =?us-ascii?Q?cxG9Ix/T+fyAdmxmVisof22kdNyXXFzLNPav/qlv0HQ0gyjCh1ZhTyg6+XyP?= =?us-ascii?Q?xuQT6gk/GDCh1808lh6aTSoRb5hGf18n+2ssUUPHqNQ/Yp8GDlzPkI5Adywm?= =?us-ascii?Q?APi5Da7tmde5qmkf0MpgHAOF92Yu9FIIYP6c6dX5axvgSVCrVArLihOFc/6u?= =?us-ascii?Q?OIDGGtgiiOYTYY2La0d288t4guccakZ98QsxlrFllBntqf7I1T8B14zkD1TQ?= =?us-ascii?Q?gOKy9d8A+WgliC6FMzf+AjT8qlhwmpyxwzFKgTmIFBizHtaVfWycp69JQD+Z?= =?us-ascii?Q?NmCiLBdUnZqarPe++nKS+pGcdeAc/GQ43RhPN6Dr+T3E5r8nRbH0QSHNztmK?= =?us-ascii?Q?r+I4Cv9zcOtwXE2qQkK/G602DT0g91SK+HJlY/0na3KpFoALT81elF2h515J?= =?us-ascii?Q?953pWoT5sq35wyv+QUGdW60uTRzbv79Yy6g415BIO3v0xL+j7YVBL7k5sASQ?= =?us-ascii?Q?Fbp5y1h2M4tEYPnhMX4EewTw4xJIlQZKbPQ40ETmwmcnfBSUUerP60kzoH2P?= =?us-ascii?Q?vmxRuWFuHC1EuoQ5XxneE9rqYWrlEFaeNbachd5L3rrsCJaK6wvZ2uYWe8IT?= =?us-ascii?Q?f6zA97OtTX5o3Jt6/cZp6Ukz/vCnz+efR9pGZ60+J1b+t1rBpRtdSA=3D=3D?= X-Forefront-PRVS: 0343AC1D30 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(979002)(6009001)(6069001)(39840400002)(39410400002)(39400400002)(39850400002)(39450400003)(6666003)(305945005)(47776003)(42186005)(38730400002)(2950100002)(42882006)(1076002)(76506005)(6486002)(81166006)(25786009)(8676002)(7416002)(81156014)(4326008)(7406005)(5003940100001)(36756003)(50986999)(76176999)(6496005)(53936002)(54906002)(48376002)(7736002)(189998001)(50466002)(5660300001)(2906002)(3846002)(6116002)(66066001)(33646002)(50226002)(478600001)(72206003)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0701MB1866;H:localhost;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; X-Microsoft-Exchange-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7UetIP3hn2LTKWTyfU6vxNt6/OlRTCgA0ZR6MfuC6O/V1MMIeeQEKfaUXIhXPxqjIZcfdu1X8Sr6U4FnZLoMtLJjWL8L0HEgI4lDdCIvPWFh4= X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2017 15:53:42.2731 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0701MB1866 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3385 Lines: 112 ILP32 has context-related structures different from both aarch32 and aarch64/lp64. In this patch compat_arch_ptrace() renamed to compat_a32_ptrace(), and compat_arch_ptrace() only makes choice between compat_a32_ptrace() and new compat_ilp32_ptrace() handler. compat_ilp32_ptrace() calls generic compat_ptrace_request() for all requests except PTRACE_GETSIGMASK and PTRACE_SETSIGMASK, which need special handling. Signed-off-by: Yury Norov Signed-off-by: Bamvor Jian Zhang Signed-off-by: Chengming Zhou --- arch/arm64/kernel/ptrace.c | 65 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index e2b7c040bf84..28f96765e8cc 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -765,9 +765,11 @@ static const struct user_regset_view user_aarch64_view = { .regsets = aarch64_regsets, .n = ARRAY_SIZE(aarch64_regsets) }; -#ifdef CONFIG_AARCH32_EL0 +#ifdef CONFIG_COMPAT #include +#endif +#ifdef CONFIG_AARCH32_EL0 enum compat_regset { REGSET_COMPAT_GPR, REGSET_COMPAT_VFP, @@ -1223,7 +1225,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; @@ -1300,8 +1302,67 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, return ret; } + +#else +#define compat_a32_ptrace(child, request, caddr, cdata) (0) #endif /* CONFIG_AARCH32_EL0 */ +#ifdef CONFIG_ARM64_ILP32 +#include + +static long compat_ilp32_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); + } +} + +#else +#define compat_ilp32_ptrace(child, request, caddr, cdata) (0) +#endif + +#ifdef CONFIG_COMPAT +long compat_arch_ptrace(struct task_struct *child, compat_long_t request, + compat_ulong_t caddr, compat_ulong_t cdata) +{ + if (is_a32_compat_task()) + return compat_a32_ptrace(child, request, caddr, cdata); + + return compat_ilp32_ptrace(child, request, caddr, cdata); +} +#endif + const struct user_regset_view *task_user_regset_view(struct task_struct *task) { #ifdef CONFIG_AARCH32_EL0 -- 2.11.0