From patchwork Wed Nov 2 09:10:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pratyush Anand X-Patchwork-Id: 9408823 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 37A3160585 for ; Wed, 2 Nov 2016 09:14:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C5CA29F9E for ; Wed, 2 Nov 2016 09:14:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FEE629FA4; Wed, 2 Nov 2016 09:14:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9991D29F9E for ; Wed, 2 Nov 2016 09:14:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c1rb8-0002xS-5d; Wed, 02 Nov 2016 09:12:42 +0000 Received: from mail-qk0-f174.google.com ([209.85.220.174]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c1raA-0002Ck-Tz for linux-arm-kernel@lists.infradead.org; Wed, 02 Nov 2016 09:11:45 +0000 Received: by mail-qk0-f174.google.com with SMTP id o68so10439894qkf.3 for ; Wed, 02 Nov 2016 02:11:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=DIxZlEDZX34apnVFktg2gz2pwSeyLl08jdy6cI89L2M=; b=Fn3jit/rot5HawhKMjxbdEd/NzwC3RyFt61q/YD+5bZgQXXkT3xQCeoaMpGgWqeZA5 fd/H+sU/ZPWYf4SaLMqQtgQGTdlelb8xaHEUSCuxVbYZVmLw1aitHcIT8kN42oDM/E98 R3m61nQzskRg6A7icUUZoHHTGa4I+CqpcQkMTAhjJ2Fn+qcSi/p9TRRg7H5QKFGFa0yO IdU4LyqF40gm7E20JcDh16jhZBppZqmijJJZoArjz1RZ/esD1DtPDwYCQbxagwxwZLW7 v436nFvUTLQQKv+Qh7j7qgtJieNgr6AiUeev273EA+4F28FYOUJuiq6+/KL3Wtsgb7HW 9E2g== X-Gm-Message-State: ABUngvfB2H/vUYEGxWCI2WfsmbJkE7ybZAwxsJ5z0K6z5T2ZF4cgSp9izk5boU7JZnU5T5Y3 X-Received: by 10.55.5.145 with SMTP id 139mr2094926qkf.77.1478077881577; Wed, 02 Nov 2016 02:11:21 -0700 (PDT) Received: from localhost ([122.180.204.166]) by smtp.gmail.com with ESMTPSA id j8sm587602qtc.44.2016.11.02.02.11.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Nov 2016 02:11:21 -0700 (PDT) From: Pratyush Anand To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com Subject: [PATCH V3 5/6] arm64: introduce mm context flag to keep 32 bit task information Date: Wed, 2 Nov 2016 14:40:45 +0530 Message-Id: <0277724c3e80c2d2e74e6c59e564bc839facb3d1.1478068479.git.panand@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161102_021143_208316_EE3BC5EA X-CRM114-Status: GOOD ( 12.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: panand@redhat.com, steve.capper@linaro.org, srikar@linux.vnet.ibm.com, vijaya.kumar@caviumnetworks.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, oleg@redhat.com, wcohen@redhat.com, dave.long@redhat.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We need to decide in some cases like uprobe instruction analysis that whether the current mm context belongs to a 32 bit task or 64 bit. This patch has introduced an unsigned flag variable in mm_context_t. Currently, we set and clear TIF_32BIT depending on the condition that whether an elf binary load sets personality for 32 bit or 64 bit respectively. Signed-off-by: Pratyush Anand --- arch/arm64/include/asm/elf.h | 12 ++++++++++-- arch/arm64/include/asm/mmu.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index a55384f4a5d7..5d1700425efe 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -138,7 +138,11 @@ typedef struct user_fpsimd_state elf_fpregset_t; */ #define ELF_PLAT_INIT(_r, load_addr) (_r)->regs[0] = 0 -#define SET_PERSONALITY(ex) clear_thread_flag(TIF_32BIT); +#define SET_PERSONALITY(ex) \ +({ \ + clear_bit(TIF_32BIT, ¤t->mm->context.flags); \ + clear_thread_flag(TIF_32BIT); \ +}) /* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */ #define ARCH_DLINFO \ @@ -183,7 +187,11 @@ 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 -#define COMPAT_SET_PERSONALITY(ex) set_thread_flag(TIF_32BIT); +#define COMPAT_SET_PERSONALITY(ex) \ +({ \ + set_bit(TIF_32BIT, ¤t->mm->context.flags); \ + set_thread_flag(TIF_32BIT); \ + }) #define COMPAT_ARCH_DLINFO extern int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp); diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h index 8d9fce037b2f..d4fa21543771 100644 --- a/arch/arm64/include/asm/mmu.h +++ b/arch/arm64/include/asm/mmu.h @@ -19,6 +19,7 @@ typedef struct { atomic64_t id; void *vdso; + unsigned long flags; } mm_context_t; /*