mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pratyush Anand <panand@redhat.com>
To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com
Cc: linux@arm.linux.org.uk, will.deacon@arm.com,
	linux-kernel@vger.kernel.org, wcohen@redhat.com, oleg@redhat.com,
	dave.long@linaro.org, steve.capper@linaro.org,
	srikar@linux.vnet.ibm.com, vijaya.kumar@caviumnetworks.com,
	panand@redhat.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	[thread overview]
Message-ID: <733fc72f15938b422bd0428be3b36d47e36afa26.1474960629.git.panand@redhat.com> (raw)
In-Reply-To: <cover.1474960629.git.panand@redhat.com>
In-Reply-To: <cover.1474960629.git.panand@redhat.com>

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 <panand@redhat.com>
---
 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, &current->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, &current->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;
 
 /*
-- 
2.7.4

  parent reply	other threads:[~2016-09-27  7:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-27  7:43 [PATCH V2 0/6] ARM64: Uprobe support added Pratyush Anand
2016-09-27  7:47 ` [PATCH V2 1/6] arm64: kprobe: protect/rename few definitions to be reused by uprobe Pratyush Anand
2016-09-27  7:47 ` [PATCH V2 2/6] arm64: kgdb_step_brk_fn: ignore other's exception Pratyush Anand
2016-09-27  7:47 ` [PATCH V2 3/6] arm64: Handle TRAP_TRACE for user mode as well Pratyush Anand
2016-09-27  7:47 ` [PATCH V2 4/6] arm64: Handle TRAP_BRKPT " Pratyush Anand
2016-09-27  7:47 ` Pratyush Anand [this message]
2016-09-27  7:48 ` [PATCH V2 6/6] arm64: Add uprobe support Pratyush Anand
2016-10-30 14:09   ` Catalin Marinas
2016-10-31  8:40     ` Pratyush Anand
2016-10-31 20:32       ` Catalin Marinas
2016-10-31 20:34   ` Catalin Marinas
2016-10-26  3:17 ` [PATCH V2 0/6] ARM64: Uprobe support added Pratyush Anand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=733fc72f15938b422bd0428be3b36d47e36afa26.1474960629.git.panand@redhat.com \
    --to=panand@redhat.com \
    --cc=catalin.marinas@arm.com \
    --cc=dave.long@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=oleg@redhat.com \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=steve.capper@linaro.org \
    --cc=vijaya.kumar@caviumnetworks.com \
    --cc=wcohen@redhat.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®