Skip to content

Commit 06beb72

Browse files
Pratyush Anandctmarinas
authored andcommitted
arm64: introduce mm context flag to keep 32 bit task information
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 <[email protected]> Signed-off-by: Catalin Marinas <[email protected]>
1 parent 53d07e2 commit 06beb72

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

arch/arm64/include/asm/elf.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@ typedef struct user_fpsimd_state elf_fpregset_t;
138138
*/
139139
#define ELF_PLAT_INIT(_r, load_addr) (_r)->regs[0] = 0
140140

141-
#define SET_PERSONALITY(ex) clear_thread_flag(TIF_32BIT);
141+
#define SET_PERSONALITY(ex) \
142+
({ \
143+
clear_bit(TIF_32BIT, &current->mm->context.flags); \
144+
clear_thread_flag(TIF_32BIT); \
145+
})
142146

143147
/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
144148
#define ARCH_DLINFO \
@@ -183,7 +187,11 @@ typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG];
183187
((x)->e_flags & EF_ARM_EABI_MASK))
184188

185189
#define compat_start_thread compat_start_thread
186-
#define COMPAT_SET_PERSONALITY(ex) set_thread_flag(TIF_32BIT);
190+
#define COMPAT_SET_PERSONALITY(ex) \
191+
({ \
192+
set_bit(TIF_32BIT, &current->mm->context.flags); \
193+
set_thread_flag(TIF_32BIT); \
194+
})
187195
#define COMPAT_ARCH_DLINFO
188196
extern int aarch32_setup_vectors_page(struct linux_binprm *bprm,
189197
int uses_interp);

arch/arm64/include/asm/mmu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
typedef struct {
2020
atomic64_t id;
2121
void *vdso;
22+
unsigned long flags;
2223
} mm_context_t;
2324

2425
/*

0 commit comments

Comments
 (0)