From: Zhen Lei thunder.leizhen@huawei.com
hulk inclusion category: performance bugzilla: https://e.gitee.com/open_euler/issues/list?issue=I4SCW7 CVE: NA
-------------------------------------------------------------------------
This reverts commit 979046bd9bd925df987a09fd671613f1fdbe4857.
The macro 'USER_DS' and related assembly code is deleted by commit 3d2403fd10a1 ("arm64: uaccess: remove set_fs()", so the problem fixed by this patch is disappeared accordingly.
Signed-off-by: Zhen Lei thunder.leizhen@huawei.com Reviewed-by: Jiahao Chen chenjiahao16@huawei.com Reviewed-by: Hanjun Guo guohanjun@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/arm64/include/asm/processor.h | 3 +-- arch/arm64/kernel/entry.S | 3 +-- arch/arm64/kernel/process.c | 7 ------- 3 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index af8d540430ca..35a4f26f0144 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -9,8 +9,7 @@ #define __ASM_PROCESSOR_H
#define KERNEL_DS UL(-1) -#define USER_DS (is_compat_task() ? \ - (UL(0x100000000) - 1) : (TASK_SIZE - 1)) +#define USER_DS ((UL(1) << VA_BITS) - 1)
/* * On arm64 systems, unaligned accesses by the CPU are cheap, and so there is diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 91dc57c9a17c..e1c604d21a41 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -221,8 +221,7 @@ alternative_else_nop_endif /* Save the task's original addr_limit and set USER_DS */ ldr x20, [tsk, #TSK_TI_ADDR_LIMIT] str x20, [sp, #S_ORIG_ADDR_LIMIT] - /* expand USER_DS here using its value while is_compat_task() is false */ - mov x20, #((UL(1) << VA_BITS) - 1) + mov x20, #USER_DS str x20, [tsk, #TSK_TI_ADDR_LIMIT] /* No need to reset PSTATE.UAO, hardware's already set it to 0 for us */ .endif /* \el == 0 */ diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index a55d518ee868..47d5ee8120c3 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -628,13 +628,6 @@ unsigned long arch_align_stack(unsigned long sp) */ void arch_setup_new_exec(void) { - /* - * set the address limit for the new executable. - * Here we reset the addr_limit only for the scenario - * where is_compat_task() is set in AARCH64 kernel. - */ - set_fs(USER_DS); - current->mm->context.flags = is_compat_task() ? MMCF_AARCH32 : 0;
ptrauth_thread_init_user(current);