From: Xiongfeng Wang wangxiongfeng2@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8JVJ3 CVE: NA
--------------------------------
The following commit clear upper 32 bits of x0 on syscall return for compat application. But it is only suitable for A32 applications. It is not correct for ilp32 applications.
Fixes: 15956689a0e60 ("arm64: compat: Ensure upper 32 bits of x0 are zero on syscall return") Signed-off-by: Xiongfeng Wang wangxiongfeng2@huawei.com Acked-by: Xie XiuQi xiexiuqi@huawei.com Signed-off-by: Chen Jun chenjun102@huawei.com Signed-off-by: Chen Jiahao chenjiahao16@huawei.com Signed-off-by: Jinjie Ruan ruanjinjie@huawei.com --- arch/arm64/include/asm/syscall.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h index 9a3d99c8aa80..37161bd87f57 100644 --- a/arch/arm64/include/asm/syscall.h +++ b/arch/arm64/include/asm/syscall.h @@ -38,7 +38,7 @@ static inline long syscall_get_return_value(struct task_struct *task, { unsigned long val = regs->regs[0];
- if (is_compat_thread(task_thread_info(task))) + if (is_a32_compat_thread(task_thread_info(task))) val = sign_extend64(val, 31);
return val; @@ -59,7 +59,7 @@ static inline void syscall_set_return_value(struct task_struct *task, if (error) val = error;
- if (is_compat_thread(task_thread_info(task))) + if (is_a32_compat_thread(task_thread_info(task))) val = lower_32_bits(val);
regs->regs[0] = val;