From patchwork Tue Sep 27 07:47:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pratyush Anand X-Patchwork-Id: 9351567 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 4635F6077A for ; Tue, 27 Sep 2016 07:51:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37F6628F8D for ; Tue, 27 Sep 2016 07:51:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C605290D0; Tue, 27 Sep 2016 07:51:49 +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 9007728F8D for ; Tue, 27 Sep 2016 07:51:48 +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 1bon9j-00080z-LU; Tue, 27 Sep 2016 07:50:23 +0000 Received: from mail-yb0-f177.google.com ([209.85.213.177]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bon8D-0006Nd-8o for linux-arm-kernel@lists.infradead.org; Tue, 27 Sep 2016 07:48:51 +0000 Received: by mail-yb0-f177.google.com with SMTP id t5so23984888yba.2 for ; Tue, 27 Sep 2016 00:48:28 -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=TaKVmKrpkhdqXogA8r5CuzPvqD+0Gzq2FdYiv1fuiNa6k4WoJM2Se0J1iYyYA+8mlV RXPKbuKXlsPEz2a5G6LsHFrDYONU9l2rS4yIIhxP8i8bVZaWmN2vMoTWyXhLl8EVt/Aj /7ZOccdOs4w2Vc4rS1VMdHOjTigOyiPM3agJL7ge34EpqcxJZk/BRv3ER4dluMoD9Vlq 3Udnduda9yQBsR1XyUxy4kJn//lzOSoRdVs1g24CP3dhTBh1kQIDcc1aatpkhGtqHjbz V8E+LvLkQaTa0d+7ZxHwyl691RVShL0zQ1HvLDhJbsa1qgyzAyNrr8woDUw67t4sX/xE mkEQ== X-Gm-Message-State: AE9vXwO+Ug1UPcTifyWxAow3E4gzMguExpJNoaVzOjjmf044fSuVxnUKvayn9I1jN8AdpHYw X-Received: by 10.37.24.11 with SMTP id 11mr20416306yby.123.1474962508101; Tue, 27 Sep 2016 00:48:28 -0700 (PDT) Received: from localhost ([182.68.8.143]) by smtp.gmail.com with ESMTPSA id i5sm490179ywg.54.2016.09.27.00.48.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Sep 2016 00:48:27 -0700 (PDT) From: Pratyush Anand To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com Subject: [PATCH V2 5/6] arm64: introduce mm context flag to keep 32 bit task information Date: Tue, 27 Sep 2016 13:17:59 +0530 Message-Id: <733fc72f15938b422bd0428be3b36d47e36afa26.1474960629.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-20160927_004849_451190_2BE86C28 X-CRM114-Status: GOOD ( 12.63 ) 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, linux@arm.linux.org.uk, srikar@linux.vnet.ibm.com, vijaya.kumar@caviumnetworks.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, oleg@redhat.com, dave.long@linaro.org, steve.capper@linaro.org, wcohen@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; /*