Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1691913imm; Wed, 16 May 2018 01:25:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo+o/RKlr8r9AMVChjnPiB/z5CkxO2vrCpL3hd65kqwyazHnBoRcKP/30oAY32RhSydZFdD X-Received: by 2002:a65:4e03:: with SMTP id r3-v6mr15461716pgt.121.1526459125677; Wed, 16 May 2018 01:25:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526459125; cv=none; d=google.com; s=arc-20160816; b=GPZaX7Evq0PJzNdz08Dm+kOfx7SsdyrTl2xRj+wnehCR6e727HhbNNV/s8wlOsAQ/W HaoMTKzB4r342iX+PPD9KBIxMd0Dw6q29PCk52nbuR6sJelmzrmoAd77wo8wm6OZPgaE jqL+QOgq30fIa34WoNvIbetbZL8Gbvqn1Z2YDXyiX+PVK3BwmLPDwWIRqQqJhbARSMBc 21aS2jTM7yoOSYcAjVJuuDU32YLHaYMCj+Q6I0rHn6YH809zpr86haeNW5uE5h1U9ly/ v6gqlDmjnNO66sD7dl0z7PmBDQey4voV7SX/6EhZsqN4AMbqUCqnstJdoNRFjxsM/KnP EC3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=fEYtN73YklWNSL/ouDKKOITZB1KkAIwOpK5rGF++FNw=; b=GShTzpWMjFtOAW/mkIEUzuu+4jfdgMse5rbNNiwnlmvJOnaNp4apYEvHD9sBK0iqu8 T5WZyr7d5dl3ZMvqq7k77j2e2raSF6iD4Pd9NJsryXHamZO13x5m9UVjCGBnQN7M1f9y z52m9ptLjabhKagNvEVo9T/Vcw464Ig9GHsf0ce3f/rA6Hm0Y1vj/NA8abhEPn1MPEh0 Xr+i/xh69XwG+NWV+HuIZGhrMk9rni3uNYX/5WYsISbCYJ5DiYyt6DrW51XS4tsHcdc3 Wv8scLI9OOHdUNnMKPAoTFv7K/GNixCkUG1E9fBiGTjYVjYMKlY6z/jJRP04w+P079PH CYWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=ijXdEYVw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8-v6si2040523plo.245.2018.05.16.01.25.11; Wed, 16 May 2018 01:25:25 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=ijXdEYVw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753123AbeEPIXY (ORCPT + 99 others); Wed, 16 May 2018 04:23:24 -0400 Received: from mail-dm3nam03on0057.outbound.protection.outlook.com ([104.47.41.57]:31007 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753110AbeEPIXR (ORCPT ); Wed, 16 May 2018 04:23:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fEYtN73YklWNSL/ouDKKOITZB1KkAIwOpK5rGF++FNw=; b=ijXdEYVwUPCKP58F8bZQHjr4CYVnGg3Ec3i7EGuUAXl3byzHAwn01Y1lrXXBo8K6JoG6KcecwkSPnDyFDfzxzfiWtktAPxOfo+6mtAZ68LLFedMhy34szWJgPqVtfZIvh/UYDMfs2GktDDdbTdkODTnmu5H4d3bELuP7sjn/mjc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Received: from localhost (176.59.36.13) by BYAPR07MB4376.namprd07.prod.outlook.com (2603:10b6:a02:c0::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Wed, 16 May 2018 08:23:12 +0000 From: Yury Norov To: Catalin Marinas , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org Cc: Yury Norov , Adam Borowski , Alexander Graf , Alexey Klimov , Andreas Schwab , Andrew Pinski , Bamvor Zhangjian , Chris Metcalf , Christoph Muellner , Dave Martin , "David S . Miller" , Florian Weimer , Geert Uytterhoeven , Heiko Carstens , James Hogan , James Morse , Joseph Myers , Lin Yongting , Manuel Montezelo , Mark Brown , Martin Schwidefsky , Maxim Kuvyrkov , Nathan_Lynch , Philipp Tomsich , Prasun Kapoor , Ramana Radhakrishnan , Steve Ellcey , Szabolcs Nagy Subject: [PATCH 21/24] arm64: ptrace: handle ptrace_request differently for aarch32 and ilp32 Date: Wed, 16 May 2018 11:19:06 +0300 Message-Id: <20180516081910.10067-22-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180516081910.10067-1-ynorov@caviumnetworks.com> References: <20180516081910.10067-1-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [176.59.36.13] X-ClientProxiedBy: VI1PR08CA0111.eurprd08.prod.outlook.com (2603:10a6:800:d4::13) To BYAPR07MB4376.namprd07.prod.outlook.com (2603:10b6:a02:c0::19) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:BYAPR07MB4376; X-Microsoft-Exchange-Diagnostics: 1;BYAPR07MB4376;3:Fm93lf+BpGAn22gQo9W0Ym6Zvfk/C89Y59yPTG7qOG7Z5VZMX2gVuV6Uh066wp6gn2XYgd8U7xzYAfyBYz+XGpUuTga869AEdEZW+q7ESFCBN/0Q7wjdBgU0wMaKQUdFuOVPTII62vt7EO44OTx9d5S7dIBd4dMmBkwNj+m2CQkCygfBdSC5a95v3getQRvIXqrdyPD6bhytPGboUuTEmON2C0nsyP6HZVMkimACeRvQ8d9WE3dOd01PbdhoHPyg;25:6zQGuopHsPe+c4W3JQiSm/HlK+3hq7DqwlTN9Nm0TtDqIDW9hMMT4Yb7RWW787EWzAXb8o7oTX5QAJw0VD7SWRNBl/v1rs8CsIWRxgnIpE3w0NSHsJ8o3zfpWSKxLrXv8DuWSVB8PuTn0KoLgp+tt8xh/ohraCa+RrIH7kqL6Ci2wu0bumX86wWaM9XCuc4daMECxscFtHP/NCLNkHCF9Ut6Y5+FZIYl38BHe7AN/ZevLdIE1szaFQvUJHPIgXMa+CXxx3cWklgfrNAutEqr9K6GJrInPV7ZUUpIqVvDmwTM8xOlXIwg6RfA3GhD7TBJQ+LKdcnN8wt5mFqCgpaU8w==;31:BqGzgpRo3M3O0EyFzxUTvfrBCY85VLGd+ih+YkcqD4YUJywz3Vi3blRrl7k07SZBcc3aS2dM3WYFQsp5Z+IodUhLSIu8SG0tkgxBnKQaEmfC93hMO4PV13uX/fghEmdyTWhBCAlF3sXanmj5KENKmK9lajjaBOaAULYQxVXZu7Toue/S4BdLBk6nSW/osyNWkIAGo1KUNMPUYPMYy1Xla2CfUiJasg+rughk5LanDfU= X-MS-TrafficTypeDiagnostic: BYAPR07MB4376: X-Microsoft-Exchange-Diagnostics: 1;BYAPR07MB4376;20:rCscleQCR5nHWQumKNJrqQC6+QDQEhWHLX6qN/tOv4RPgJU2p6JCZ02VJy68YS1ULamanNEcy+/5mdrym35r4++mkxEYH5mBHLmivfsl343NrYNSBh/QSeBDglLumngE5w7mWplbfzTeg9HjDUVXTWX9VUs7gVqAN1PBRSINkQ1BXdONo6fLzW+NNNOXcOTOlCI09GWEBQnP9mMv/CpIQTzAW9e5YBW2dW4DxB4n4wKN/VJ9LHp66ZlgDt37w3/EcoSlkZtrQOfFNGoGSeR05MNHT4LYOK+76kVEa+8f6oiGG+TwcXhGNm9dmrHSWVU169/Z+OGKjQkAsTV6crNZV/JvWj29t9E7WaTS6C7RFF1zhgV4GyihJZm5U5rIolJsr9zCxkXZjZVZ7zg4baNQQYXnMYNM6AIK/VUgvUAqMOZ1JHkF5aM6hODfogJHefFw9Ja1GJwfNMlpysF3woHXRJAWVAhLeFT1hJRJ8BW+7+I73vzNuSOa1UQHvW2wjkDvM6DoEiG2eQy3smNsp7Q5nkIK9kdCfDLk63fLuTjyWIk6U4bQN4XQjvd6FCiKwc7Cdbr1wIoxx6libQwkea8GbxeykLMCArBKj8BZzosicdc=;4:KcdkdNhvFeJ9TlIw5yBRjEfkGzMoURwrHIInTPvNeNuoKUZu5eTuIF+Wfl0n3PKDBHLTfSEDN5hvbD6rxKLKHlfpXNtjM+Zy+yI+wubsHCt6uaiu9hSiIsDgaTcBKBUUImjK0p81TegXHMqozZ6jEAl+kO7fIxWoggq+rmeCPVeeVzFLb9yJyYU4+5t9oBpttpDAkiQLNgzZ8czZm1/oBB9bY87Q8ZZQFZ4tJInGBXZYiDdUnwLCY5bVKLOOpf5fVc7WoaiLMtRtT0YFppdG7r5eKCb+jaLA3HdZZP2AvhmRkROJ1RSnfnnHPuTTMiNe X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85827821059158); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(93006095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011);SRVR:BYAPR07MB4376;BCL:0;PCL:0;RULEID:;SRVR:BYAPR07MB4376; X-Forefront-PRVS: 0674DC6DD3 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(376002)(346002)(366004)(39850400004)(39380400002)(396003)(189003)(199004)(39060400002)(42882007)(59450400001)(6486002)(53936002)(6666003)(4326008)(51416003)(386003)(76176011)(52116002)(446003)(6496006)(50226002)(16586007)(305945005)(7736002)(72206003)(2616005)(26005)(316002)(478600001)(11346002)(36756003)(956004)(105586002)(186003)(16526019)(97736004)(2906002)(486006)(5660300001)(106356001)(8936002)(476003)(76506005)(575784001)(50466002)(48376002)(110136005)(47776003)(66066001)(25786009)(54906003)(7416002)(3846002)(81166006)(7406005)(1076002)(68736007)(81156014)(8676002)(6116002);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR07MB4376;H:localhost;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BYAPR07MB4376;23:HT4tsQZfYCSzueeBdyPKmOHX4ZeJ+a/wIO7VEN//V?= =?us-ascii?Q?u/+gQbJvnFcGt4HfFPxjznDIm9aVhAyRRsjJSsKi4T5r141J+xNdDX6rrVKg?= =?us-ascii?Q?HedZqlMC1xb+jezkjeoo5SKxFV0V5lvms3IRP5aINSpMZg95No+esNOtXA0P?= =?us-ascii?Q?GqoY7y/mnJtvsU0Lj3qaPqKh4wXxEVHlUQBUPUMDG+4SYmGL/mwwvlMpq2Eq?= =?us-ascii?Q?Wtx6GT1mL+9MVr7KXqEaO5KPtGvXfqAnc7FxEaNNQhPsffoPg25a62feWk6o?= =?us-asc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3IpIwTeMooucip6PCSvMk8v8DXaC1VIwnVxo11l09LOihCDAKK29YGv1ePhtJ1q2jsYowrijmtaog/tvPj9lgjdZbzE+rqGQ9d6MRcLErh+O9+3H8=;24:mUTysO5KCt/ubWUhuU/Ar3JAsuhq/2dAvRc4J1n0viWAcA4vUoed+08KgrENWxofwK/1dcYixtlMgtd7Ggb3XlRJRXW6eTJQWeiDWbmi5c0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BYAPR07MB4376;7:4hts6yOm7eN5fsJiN7e2PQwdx1SF/Sw3vobGs3OkryMDkyN6H1pL0JwqD6WBPPbhxIfQdktWSGeVlbfhZyPr0iuo18jgkuK7JLzQ3PIafJQeexOgv9iBVkLLqLN82mJAbcPPyPlkmZeTyc168vh4AkO3kpiilhXReFXi6Rf2HS2XA+Byac4VtwMIgnVBEU37vJEJnt+2+fn6dfvqVrrc38/7H449QZ40GNK/W6RdTz2q50UA6JWhH946/ySWrYnh X-MS-Office365-Filtering-Correlation-Id: 7c042f61-7387-4196-d703-08d5bb064464 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2018 08:23:12.5075 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7c042f61-7387-4196-d703-08d5bb064464 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4376 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/arm64/kernel/ptrace.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 4d0a541d049b..da7f47c7e586 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -1038,9 +1038,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, @@ -1503,7 +1505,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; @@ -1580,8 +1582,23 @@ 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_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); + + /* ILP32 */ + return compat_ptrace_request(child, request, caddr, cdata); +} +#endif + const struct user_regset_view *task_user_regset_view(struct task_struct *task) { #ifdef CONFIG_AARCH32_EL0 -- 2.17.0