Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752227AbdHEOku (ORCPT ); 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 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; 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 Content-Type: text/plain 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+e6llzC3nyYUAx7AKS6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Zn6Km3YfueV0sbufkW0x46UFLe0kfK9lGER/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; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM3PR07MB2124;23:mLcSesj4KTh1hPUDRKKoXphDphoQXL+eh8HPyn8QK?= =?us-ascii?Q?pjC2TQi3WAWuWeSDncJ1wMGSpHVvuHdGWfMzEFTK7q3kYC8YPRupip6oNGmV?= =?us-ascii?Q?fb20Gnd4eweyP57+ra7E/KdzKyUN4VGdEe3RfCdRgq5y8AoLdHABsoffh/w5?= =?us-ascii?Q?BIIwMrBnVnHuCd3Sk/z0KMLy3WuUUKL7l9ipcZHaCdSodYifvqduUpyodwMh?= =?us-ascii?Q?IyWnhdWRCKGxquASEREjEwSqftzrV5XqzswkXq+8VOPhzrdOHs+XLPvwJOLQ?= =?us-ascii?Q?kRB0ZlZi5vR2pfWljbBoLyA0HiObwKwQ+pfGehdt+vvbG34rd+pende2XW0R?= =?us-ascii?Q?/fhuTUgWWwWUkgm6dubeDV+Miy5pF2O/xcp46VsM6TW+VYJC5WVAcMUITRAZ?= =?us-ascii?Q?OnlNwg4DGmW+bnCcI5ndRMO6xa1Q/QdJrcYAUiyIaDNcmWHhiTgC6Z1lEUg6?= =?us-ascii?Q?7sRIPvh4i2RyBoJRzCL1jI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gyBYXI+E+nuM3o/8YvxmPMkJlNxJwFx7CoWdPCE3R?= X-Microsoft-Exchange-Diagnostics: 1;DM3PR07MB2124;6:9KRxMPQDLZuGpCCIS7RknQrG4OjMiwA18D/LQTkJf3XMYYgYPIxWc/iXpqRP94zJ7K1qt9dxu4JItdwphwXJ7i9bo9urKXNfrgUavvCpuID0X6QeSLnbK894ln0Wzv3yrCf8vLNCK6GYGz4HZ6+4FxTi5UKKu1DwL7oyfmnM14okYLN6i3LvX4Tu2iIGnCOY9oDiYH8qI7NkV7YHano4rHlEjbnRCXfzyeF1wP6dIvTxCl7dJe8nzwW4lnBewtiDh43z1aqmL8QzXqYGVntgpEzto7uNNJzFSaQr9/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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2649 Lines: 71 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(-) 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; -- 2.11.0