From patchwork Sat Aug 5 14:40:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 109485 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp664421qge; Sat, 5 Aug 2017 07:41:01 -0700 (PDT) X-Received: by 10.99.120.68 with SMTP id t65mr5852644pgc.415.1501944061514; Sat, 05 Aug 2017 07:41:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501944061; cv=none; d=google.com; s=arc-20160816; b=vK7n9CPPBcmjkCawohSbNXGC6t/8opTZ3TfZUNXwjxaalmr7Pe8bSJA8Xdf3FaeqHZ NuH+DeEEbGREV7pD00J8c8A5toIhRDjX8Of8aHG2Ld9Xc8OIkqMwVopV3qJE/7TdIh6t 1MkCSXJErCra2hQtdPArHsCoJjlzPKHrFbjbwwIUR2rXwFNuIU6dnNHOMCKXViwzzksV 6QhkK10cO7RRKskkDV+2dfHa8pjbNRQ1sQw8kWJRxVx2lnkBIwtcFZgY/r677QJkJm9C 7iw8vfaWjBDSOeAjGZN6/ePdm3hTlKtrc+lzwqV/5AbNi6fmvekPPT/E+hDCiCkrA3PN vSeQ== 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=ASX71b9FCFap6p9vBr256O9WtPXLyDbW8wC18qyXq10=; b=Op3CJxYVut66TC+pk6u4la7gtnVaxyg4b3MgvNfmkCnFZtC/Za3NbyX21h8KguWZle eU1px+CeshIj4euypOUbn6sYqZ6W+eSirVPVeiAFHvur+YiPXXnaO9JnAdYu9WiPK9eo FcxEaAFPkLvqpPasMGVvUG2iTtgQ22O6YtNGsMxDhMc/xhTaxNz6eM81TjoLkERrIMgT LA+xGaaIa4kp1qc3/PTFzzIDP7dnAWnkTr1eG+Zh6qFSg/4WvRuYQNs+pQIZTZYn8T1D OKLEvwca7RJqODQw/oUK1cYP7hlaWla/gquYtW6qvye+vABWvLa4NPZJOB8cBjV+5gsO /ZeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.b=ezAOBcfQ; 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 1si2752896pln.153.2017.08.05.07.41.01; Sat, 05 Aug 2017 07:41:01 -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.b=ezAOBcfQ; 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 S1752260AbdHEOku (ORCPT + 25 others); Sat, 5 Aug 2017 10:40:50 -0400 Received: from mail-bn3nam01on0057.outbound.protection.outlook.com ([104.47.33.57]:35345 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751878AbdHEOkr (ORCPT ); Sat, 5 Aug 2017 10:40:47 -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; bh=ASX71b9FCFap6p9vBr256O9WtPXLyDbW8wC18qyXq10=; b=ezAOBcfQUOuWu+h4jsw4C8KfLltd2VWDswhf5ArJBOJ7GI6uEdQUHKGbWSSwAzL40200K4MdffJ3Fj3mQi8ml5bmSAjUM4MB9o/ekmISDbQfWn9fq6OVcIFkdHwxoA8jnWzrkXte/Xswhh225MnGnqPsZiV8/SYWkeGazQaesJc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Received: from localhost (196.71.79.105) by DM3PR07MB2124.namprd07.prod.outlook.com (10.164.4.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1304.22; Sat, 5 Aug 2017 14:40:44 +0000 From: Yury Norov To: Catalin Marinas , Pratyush Anand , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Yury Norov Subject: [PATCH 1/2] arm64: introduce separated bits for mm_context_t flags Date: Sat, 5 Aug 2017 17:40:21 +0300 Message-Id: <20170805144022.17260-2-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170805144022.17260-1-ynorov@caviumnetworks.com> References: <20170805144022.17260-1-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [196.71.79.105] X-ClientProxiedBy: DB6PR02CA0020.eurprd02.prod.outlook.com (10.170.218.161) To DM3PR07MB2124.namprd07.prod.outlook.com (10.164.4.142) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6afc4e43-8703-41ef-779d-08d4dc0ff4bd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM3PR07MB2124; X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2124; 3:pB8JXS6fEteXLh7oOU7KYJYfk/55du+20WWbxUU77VUc7pTvxkD1uamCzegAvzPovtRGt2toQsOcHH1IFGnWVt2vU1z1Q+e6llzC3nyYUA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NZ4G2dq5Zn6Km3YfueV0sbufkW0x46UFLe0kfK9lGER/vk5qZNjeUpEFF1XuGEkTT/i45KHQZeCoByRs/h7kYWtlqRvtugKYt+M+GJK36IGr7OVuGbH/+mcEn/P7usKPS6j47X1l3b+7r+Co6qhHbu3rvfIRbu5Ai2kwZgQ55wKTgVZFm2iSkhvT7wgnb2iJ0MaUIB7VuJHvFuyX9WEx05DeRvJhEZ0Kg3qJV22xkKA3wGKvYHF2+fklh5UVU4EMrvZ42duFMpPXM7Azcd+j3UO17fMbTryMTZ9q9L+NLNtGjAVP7b6N/6gVcfppPT+IH4D18lk8a34lY0U=; 4:9iL/LskzE1NB/nMhLg8i/Ik+xqTXdOPskO3aE3WAG6t7qcvYjJgmS+PM6uA1lJgdKE4HJRTd2uNg/8HUGKXJeoxoVpvAHFYAC2zbgRjl/TtsH7WnxQoIlr1d7XlS99iGjOQcqBwKuK8WRIHC8rv/hYssHOE7phmHEmCQ/+hw04nVHqb92XZjRjmDxjLJduF4fA2zz3vxT+7GAYgi/HPHCQsAVHbIY/j9013+Tm5ef5rW1NT1GiMIJrBKOI4Pakj7rM8EKd7/108SFbY8N6g0QD+wGz5+XzlUe6/JzPiNe4I= X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123555025)(20161123558100)(20161123560025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM3PR07MB2124; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM3PR07MB2124; X-Forefront-PRVS: 0390DB4BDA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6069001)(6009001)(39400400002)(39850400002)(39410400002)(39840400002)(39450400003)(199003)(189002)(10806002)(101416001)(76176999)(25786009)(6486002)(38730400002)(6306002)(106356001)(50986999)(6496005)(42186005)(105586002)(68736007)(4326008)(53936002)(966005)(6116002)(107886003)(3846002)(2950100002)(1076002)(6666003)(42882006)(5001810100001)(72206003)(10916006)(478600001)(47776003)(81156014)(36756003)(5660300001)(81166006)(33646002)(50226002)(48376002)(7736002)(305945005)(66066001)(2906002)(97736004)(7350300001)(76506005)(50466002)(5003940100001)(8676002)(189998001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM3PR07MB2124; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2124; 23:mLcSesj4KTh1hPUDRKKoXphDphoQXL+eh8HPyn8QKpjC2TQi3WAWuWeSDncJ1wMGSpHVvuHdGWfMzEFTK7q3kYC8YPRupip6oNGmVfb20Gnd4eweyP57+ra7E/KdzKyUN4VGdEe3RfCdRgq5y8AoLdHABsoffh/w5BIIwMrBnVnHuCd3Sk/z0KMLy3WuUUKL7l9ipcZHaCdSodYifvqduUpyodwMhIyWnhdWRCKGxquASEREjEwSqftzrV5XqzswkXq+8VOPhzrdOHs+XLPvwJOLQkRB0ZlZi5vR2pfWljbBoLyA0HiObwKwQ+pfGehdt+vvbG34rd+pende2XW0R/fhuTUgWWwWUkgm6dubeDV+Miy5pF2O/xcp46VsM6TW+VYJC5WVAcMUITRAZOnlNwg4DGmW+bnCcI5ndRMO6xa1Q/QdJrcYAUiyIaDNcmWHhiTgC6Z1lEUg67sRIPvh4i2RyBoJRzCL1jI45WW7ufbwfeq6nL0uB5CSTZbPUJk5DfMH0sf6wXvDoOXP1UQhYrjcnUse1BHZdhQZthqlEFhD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8qI7NkV7YHano4rHlEjbnRCXfzyeF1wP6dIvTxCl7dJe8nzwW4lnBewtiDh43z1aqmL8QzXqYGVntgpEzto7uNNJzFSaQr9/OiUByjTnxiedBVsnOmFRZ9QuEw/Mon1MF0rjUaXQZzVeYeyQ==; 5:YoIvEghH200UmTDix+2kP1bGGFMtgpeub0N2kS/la0gdOBWfvxBkBdveDsPNjV9o6cbYtAkTYyBQKSEoO64UBzSi6ulWhSTCBVP/IUH5sjL99SpkRmIJRhlWbYM6E6oF9xZwpptjJi0/R98mmIMkXQ==; 24:ub3yD6JEimcoOYr00TcKymYIz2WIWfJyvzC5VrOeEmkPmCOvpctLQjkxgA2uZ9nTtmt6HHRXmLtQw+DS8mGbfiWZpkUcrbzq8VtBxglWfA0=; 7:lfwFCucdkdMhZ3GLgVnnXI3a+eyinFCyDuvMAhBuDuYU/iOX/pqGHBXPIHQnT7w1dhQL4oHNrML5ROzTO2UXysaPFFaCqrj7kOeURuBZPIyg6i8BXQofAhcUOaIHhHLMvgyW1om6Q/jXlH61mRS0bXBwIS8pE9DZsF+FgRAA7kLO7O6rgysQv6MVjKM6LBjh5v6LGjE0hjs/A7jBmb2/uR12NioRXmK/GONvKYT+rIY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2017 14:40:44.9291 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR07MB2124 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently mm->context.flags field uses thread_info flags which is not the best idea for many reasons. For example, mm_context_t doesn't need most of thread_info flags. And it would be difficult to add new mm-related flag if needed because it may easily interfere with TIF ones. To deal with it, the new MMCF_AARCH32 flag is introduced for mm_context_t flags, where MMCF prefix stands for mm_context_t flags. RFC: https://lkml.org/lkml/2017/7/31/454 v1: - changed the MMCF_AARCH32 bit number from 0x1 to 0x0 and added comment. Signed-off-by: Yury Norov CC: Pratyush Anand CC: Catalin Marinas --- arch/arm64/include/asm/elf.h | 4 ++-- arch/arm64/include/asm/mmu.h | 2 ++ arch/arm64/kernel/probes/uprobes.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) -- 2.11.0 diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index acae781f7359..de11ed1484e3 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -139,7 +139,7 @@ typedef struct user_fpsimd_state elf_fpregset_t; #define SET_PERSONALITY(ex) \ ({ \ - clear_bit(TIF_32BIT, ¤t->mm->context.flags); \ + clear_bit(MMCF_AARCH32, ¤t->mm->context.flags); \ clear_thread_flag(TIF_32BIT); \ current->personality &= ~READ_IMPLIES_EXEC; \ }) @@ -195,7 +195,7 @@ typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; */ #define COMPAT_SET_PERSONALITY(ex) \ ({ \ - set_bit(TIF_32BIT, ¤t->mm->context.flags); \ + set_bit(MMCF_AARCH32, ¤t->mm->context.flags); \ set_thread_flag(TIF_32BIT); \ }) #define COMPAT_ARCH_DLINFO diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h index 5468c834b072..2c57b06b2883 100644 --- a/arch/arm64/include/asm/mmu.h +++ b/arch/arm64/include/asm/mmu.h @@ -16,6 +16,8 @@ #ifndef __ASM_MMU_H #define __ASM_MMU_H +#define MMCF_AARCH32 0x0 /* MM hosts AArch32 executables */ + typedef struct { atomic64_t id; void *vdso; diff --git a/arch/arm64/kernel/probes/uprobes.c b/arch/arm64/kernel/probes/uprobes.c index 26c998534dca..f29ef6b297e4 100644 --- a/arch/arm64/kernel/probes/uprobes.c +++ b/arch/arm64/kernel/probes/uprobes.c @@ -40,7 +40,7 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, probe_opcode_t insn; /* TODO: Currently we do not support AARCH32 instruction probing */ - if (test_bit(TIF_32BIT, &mm->context.flags)) + if (test_bit(MMCF_AARCH32, &mm->context.flags)) return -ENOTSUPP; else if (!IS_ALIGNED(addr, AARCH64_INSN_SIZE)) return -EINVAL; From patchwork Sat Aug 5 14:40:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 109486 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp664518qge; Sat, 5 Aug 2017 07:41:07 -0700 (PDT) X-Received: by 10.99.120.68 with SMTP id t65mr6064912pgc.104.1501944067722; Sat, 05 Aug 2017 07:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501944067; cv=none; d=google.com; s=arc-20160816; b=o6iaYS3t6pElhBvbF0czgwLvtn+C6t6ti7MeazqTSI+9lS2En20NK1N/PvdX2/iGc8 ygOZwyo38hZzxODAGcB+ifziRyna3qredljfgTIJFccGxSrjkmELjZoQszOiZ4wxG4VZ IyQSSEvkc1APu9mDgX2wcbI64UETUwSDMfwKPUSndpLxZ4PdVWcbdIW9cQgJvVLmJK99 lFBBdAGaH+rLAdG7HXQkyPrwm982w7vU1esEiYhELVhkCJJhIU8IaRpGZgDRg7597oao MGBzl23ndfHSJMw5QauStcYG6e5/tpXrEVjjWKP2Yf++zh4wVa4XN2dcEBrelLkcY+EO a7cw== 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=5c8Ql/ey3Fc3Ak0M62SbzYZ4AbYJU6JHI9Qi+x1lUIo=; b=xZ9A8XodXb4k9Ju3v+i2LEPXmhOM6brsJEjk9NVSEj78kfST61ATgRa/76hOgkyZzJ 2AaH3UO2Nivq4+XRvKwtoIrk8fpHaEeH9h2a3eALSy81QpE3wAjqmn9MIlqdSur9aR75 iVx943dyrK+LWSMup9Mjr+lNFrlByq8sGKdcPEA3PVWA3/MdXw5TdG1T5KzCvjqYvWh2 udU80RWFGFV2RbZk3QihaQTKtJ568YGRSszOMhP6zU56UGbIF/cJREDfyCO4szUffsu9 DvhNxDI1ETpb4USAIH5Mqt/DagcraHxr0NYDpK4mPaYJGEGdOZajYzjWk/lTDko3NMrp ZXGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.b=TQ7DrBfl; 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 e193si2277971pgc.167.2017.08.05.07.41.07; Sat, 05 Aug 2017 07:41:07 -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.b=TQ7DrBfl; 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 S1752515AbdHEOlC (ORCPT + 25 others); Sat, 5 Aug 2017 10:41:02 -0400 Received: from mail-cys01nam02on0071.outbound.protection.outlook.com ([104.47.37.71]:37616 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752280AbdHEOk6 (ORCPT ); Sat, 5 Aug 2017 10:40:58 -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; bh=5c8Ql/ey3Fc3Ak0M62SbzYZ4AbYJU6JHI9Qi+x1lUIo=; b=TQ7DrBflWR1VXGczQMn2stEPzoEwQN4Fi5Lc118VGYF4Dfo8QrEYIcPAfKwNefn3R8rjfuqYoMO+6FVClL9YSByQIPssjpIlph4EicubzzbfuPKXLJKKuqWbTkv/SN/skENHpQpRaT2QQukH92KhSMDVsOyErCDcs2+ksb69XWM= Received: from localhost (196.71.79.105) by SN1PR07MB2127.namprd07.prod.outlook.com (10.164.46.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1304.22; Sat, 5 Aug 2017 14:40:54 +0000 From: Yury Norov To: Catalin Marinas , Pratyush Anand , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Yury Norov Subject: [PATCH 2/2] arm64: cleanup {COMPAT_,}SET_PERSONALITY() macro Date: Sat, 5 Aug 2017 17:40:22 +0300 Message-Id: <20170805144022.17260-3-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170805144022.17260-1-ynorov@caviumnetworks.com> References: <20170805144022.17260-1-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [196.71.79.105] X-ClientProxiedBy: DB6PR02CA0016.eurprd02.prod.outlook.com (10.170.218.157) To SN1PR07MB2127.namprd07.prod.outlook.com (10.164.46.157) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: beb24a4d-e19b-43fe-7f1f-08d4dc0ffaa1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:SN1PR07MB2127; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2127; 3:p5A7OLimTw1nPrW/rTFVrjLnfSsUrGLD4WXXkIOMDHBroh+BcP4h2GiNm99pvnuEaBBibRh2gcrpxnRy6qUtWSu2KG2PMWPZzci/qUVSL193ilZB13dR8g3/BDxB7LY+la1jvo7ToU4gJRg4o9/Km24/RdQPPYiabR/6QTJf2PfmaqQ0w8MYw4oXZM5Xz/K4hO3AUbSHhBWz/rBUeMRiJwYY13ECJvxuy8yumuvgqg4jY17fE70HALPnHdxBPskA; 25:dCvZBHfpRViBanHCV58eg0wyy84v3tHQn/rDWjyQHOZjC5mHlt2BilRUdbLGKv/asZhnN2shth72Zd7VIL8zN4rncSL0mtDMQUEaLT51cCcNjmOsk96tPkZks6QdnsWgIvMiywYwMy3IM3cUWY9JZwLuFer2zGEAqHwXA9DDFZyy6FhK01wVbdb/ubaVLA8vKw4GNxAb2eLi+3xLU6u+0UH5yiwyNmP2XMwPLEvMrJN3PSODZnoH1lGcTBTYkfEBRAp/P60au6CkG6MB3LyNjnGxBBMsMuYOzA3mGTHqzRN5VS6/zFT2yPuziW/BkN3hSv1mcx4xHMqpzn3l+aCWSg==; 31:1/D6im72L8bZ0vy511jjiGgCBt9sVJciU3UlIZNxDq96r+sO68d0DOLBS17am4QJCheugx4L8EYHpctAddaYcuRzko7RdhC2CVdsfMjTZuK96JeDmQ0ZSSuAtRZveJ5rk8pqDYeV4p3qhfZNoEQyEU12dslZ6uFLykmzPkexnVsB0sF5muKNJZjmwDwrwaZcxfLeUVZkK7HaRTUJYpUexDfe2ggqTvQ9cgMl55r+cLE= X-MS-TrafficTypeDiagnostic: SN1PR07MB2127: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2127; 20:CGYEQHEJc2Nfue3K4mHcCYGL76wXzFY389WssrmOTCiCS1mA4HErrXJMfwFYeaxc6hCyh3I8B1ppGDa9KoKbWTRhe2gn5EDLNL5lhympVSXmQ/dgeGTssiInzK6BmkXBDBfAFxdXWkkluFj34cMu75DdRwURgDJvZsVCHrIZ/ghXl8EtBMOs/SVWVWw715XERtxx9TQ1EvOqlpKIYhMl6UoxLSTwVfqYJmB7fSwZmFPz5ARsl1JME8IzrkVqezC/gwztlnW/jmSvEZZ9EWWbmrwyOOom6P8EuSyp42Rh3mAJqqrLVrSqptzo/l4pJK2l0xNzNfZAwZ68dd5wH7NB9VyFrIAxp99CFBYuZ9SI/tkopi3VsXLdHYeshwIztD+YQchIjqFTXlAVe/yRV2xXkOo30ElS3NZlkhF+rrd4SZLmlHyJCKiLxF093JODB2fShhr26bGMdCqMCHV1OKenfuMJX5FVuFEbbHvvND3OP3ygDx+riH8tu/NkkBhChAJmb0uxoUhu/LGTxXUNSmpR3F+gN9W5mXHIr2p9ix/GaOaNAU3M60pLmOSF/wiFwqTmVKfUBncTpu5NhV52YjqRyC+RvWivC84T6sKSFyryt0E=; 4:gThX8IKKdE136+OPNfVvmOxufgdP/SzOH29vXqTGmRnvbVYvt2AID15r0nF4cO2tq3RXtuvOq8j5GJY4k5V15JrcIDT7ulJnDcllMLWF7v+InG5cU/jte8Z2lOjrTTR1o9znYFdFSGvoZqIFV9f4LnBgeGH0Kk7FrDt2XqT7v88jsaQdHLE6jnzX+Bs7o38CmWL9b5JGRfjaUMkYUeCrs/fbhFDvnajlVmFn52jsmv68AWnwtjlesbkJgwl9E7DqNgWLnWvmz8ZxIHvh4k/hxj8gu+DmyhlON8pN+j2JW/I= X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(10201501046)(93006095)(3002001)(6041248)(20161123562025)(20161123564025)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN1PR07MB2127; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN1PR07MB2127; X-Forefront-PRVS: 0390DB4BDA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(6069001)(39450400003)(39410400002)(39850400002)(39400400002)(39840400002)(189002)(199003)(8676002)(6116002)(106356001)(105586002)(3846002)(33646002)(101416001)(10806002)(76176999)(68736007)(50986999)(76506005)(966005)(48376002)(50466002)(1076002)(42186005)(305945005)(7736002)(5003940100001)(4326008)(6486002)(7350300001)(53936002)(6496005)(6306002)(38730400002)(107886003)(478600001)(72206003)(5001810100001)(97736004)(25786009)(47776003)(2906002)(66066001)(36756003)(81166006)(81156014)(10916006)(50226002)(5660300001)(6666003)(2950100002)(42882006)(189998001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2127; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2127; 23:rXu0h9OlXafzTZcN62lfnyclaY5PLO9JT/Vtx0mbJbdVGrU69zBcan/FQUwaSMo31p/6RIWZp89rA6Jn+RIZUcqK8rEtamdurkAnwkX3uSRUn6y/qi/scfTfZIGO1zeWKshkE6lg1z1S2bLLg3KjLSZudP5+gi5OH03zoWBOkUPlXcq4skfMk7JtSO9sb+uFkE5hjQwH+u3taFuA3D5ywcwZ+2geSGCzaVrxO3xEvY5uSqhhKOnG3SiHDBQu/n6X8qcYURFtteAa1QAP94HXWBQ4j8pWHt9wewRTVZQdPKefUdzRP0qNKFDtQzj7fHEZt27jxvlHDdpdwoMmcIhjsw4id4zTB90hcLGP5crwUFSBuIT/f39nYEAvNS2kC/FWQKL6CzrlzdP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/n88a0hm3F54jL236deJ9C7XCntS7VrICt0pyWsoL7SH45iPKqJLDFty10UrZqS9XpF6MF3NUJoaqdtmUDKy2MdP6+gAWe7d5/CTtHSvu1kKJYaXCXvRPJbU99cIINIXeaJjX+mYk//uW/mcUx8E8rgMiHcY0Liwn+jwECi3OYtkJlobCt1YpfHa6sD2Z7C7fHuVvhdsx9CQUmCEiZi/ndDWZeeOhDDsO0qsMBwJ8m6O36ePO8XReJ7wLT4IWb8EBQh1oILhxLA+ZJUaUT1kVE1OPikrpT5yQBYRTTRxhXv9hlb/ZriG3p3/c2Rh+G0TLWy4Opw==; 5:ayo//m9k7B/2m4iCbY3HUzRrjoc1dqX88KDsRr2ivWi/PWxXYi4HwYw8nkj2HMH41yDPFs6rzJpr09Vgn6PJiKhlv94fEFMarBMSszrhkY4mEJvvK1d0WU/SiEHdMVRbfUY/sZiApHLM9rY0TJQZ3Q==; 24:hGvKtIQlcouujZ5+sA9Qfd0aQ8UgXv9R85oGUveTDalkLArLr0ILrIB80vkCqcc73dk2PxmW1gOl+E3et9JoiqIKoEaBDEPuZoE7pLW1BkY=; 7:l0xeQb+XJiiC3ndHDRuvn0bRw1KFhSxMvCBOmybf3DWEKwl/FgHHWCmxIFipIc5w3zs7sh038Hly+9Uw3ZWInPe8ANpAff6XGeQ5fwuKZYN6LokBsnhfYV3+STz9TIQtsIHaqCJTL7jtfOsFhkcaNbtskoBPmCDJMnxu+IEsqoLh+GWZvbSpUGY7XTXatoOligHvSGg/Tc2jVST208SoJIaoHdmo5kvVt35bmbkUVqg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2017 14:40:54.7965 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2127 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Originally {COMPAT_,}SET_PERSONALITY() only sets the 32-bit flag in thread_info structure. But there is some work that should be done after setting the personality. Currently it's done in the macro, which is not the best idea. In this patch new arch_setup_new_exec() routine is introduced, and all setup code is moved there, as suggested by Catalin: https://lkml.org/lkml/2017/8/4/494 Note: mm->context.flags doesn't require the atomic strong ordered acceess to the field, so use __set_bit() there; Signed-off-by: Yury Norov CC: Pratyush Anand CC: Catalin Marinas --- arch/arm64/include/asm/elf.h | 15 +++++++++------ arch/arm64/include/asm/thread_info.h | 3 +++ arch/arm64/kernel/process.c | 17 +++++++++++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) -- 2.11.0 diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index de11ed1484e3..615953243961 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -137,11 +137,14 @@ typedef struct user_fpsimd_state elf_fpregset_t; */ #define ELF_PLAT_INIT(_r, load_addr) (_r)->regs[0] = 0 +/* + * Don't modify this macro unless you add new personality. + * All personality-related setup should be done at proper place. + * If not sure, consider the arch_setup_new_exec() function. + */ #define SET_PERSONALITY(ex) \ ({ \ - clear_bit(MMCF_AARCH32, ¤t->mm->context.flags); \ clear_thread_flag(TIF_32BIT); \ - current->personality &= ~READ_IMPLIES_EXEC; \ }) /* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */ @@ -188,14 +191,14 @@ typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; ((x)->e_flags & EF_ARM_EABI_MASK)) #define compat_start_thread compat_start_thread + /* - * Unlike the native SET_PERSONALITY macro, the compat version inherits - * READ_IMPLIES_EXEC across a fork() since this is the behaviour on - * arch/arm/. + * Don't modify this macro unless you add new personality. + * All personality-related setup should be done at proper place. + * If not sure, consider the arch_setup_new_exec() function. */ #define COMPAT_SET_PERSONALITY(ex) \ ({ \ - set_bit(MMCF_AARCH32, ¤t->mm->context.flags); \ set_thread_flag(TIF_32BIT); \ }) #define COMPAT_ARCH_DLINFO diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h index 46c3b93cf865..c823d2f12b4c 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -68,6 +68,9 @@ struct thread_info { #define thread_saved_fp(tsk) \ ((unsigned long)(tsk->thread.cpu_context.fp)) +void arch_setup_new_exec(void); +#define arch_setup_new_exec arch_setup_new_exec + #endif /* diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 659ae8094ed5..ebca9e4f62c7 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -417,3 +417,20 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) else return randomize_page(mm->brk, SZ_1G); } + +/* + * Called immediately after a successful exec. + */ +void arch_setup_new_exec(void) +{ + current->mm->context.flags = 0; + + /* + * Unlike the native one, the compat version of exec() inherits + * READ_IMPLIES_EXEC since this is the behaviour on arch/arm/. + */ + if (is_compat_task()) + __set_bit(MMCF_AARCH32, ¤t->mm->context.flags); + else + current->personality &= ~READ_IMPLIES_EXEC; +}