Commit d3a61dd6 authored by Xiongfeng Wang's avatar Xiongfeng Wang Committed by Chen Jun
Browse files

ilp32: avoid clearing upper 32 bits of syscall return value for ilp32



hulk inclusion
category: bugfix
bugzilla: 46790
DTS: 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: 15956689 ("arm64: compat: Ensure upper 32 bits of x0 are zero on syscall return")
Signed-off-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
Acked-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: default avatarChen Jun <chenjun102@huawei.com>
parent 28cc1f4e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ static inline long syscall_get_error(struct task_struct *task,
{
	unsigned long error = regs->regs[0];

	if (is_compat_thread(task_thread_info(task)))
	if (is_a32_compat_thread(task_thread_info(task)))
		error = sign_extend64(error, 31);

	return IS_ERR_VALUE(error) ? error : 0;
@@ -58,7 +58,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;
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ static void invoke_syscall(struct pt_regs *regs, unsigned int scno,
		ret = do_ni_syscall(regs, scno);
	}

	if (is_compat_task())
	if (is_a32_compat_task())
		ret = lower_32_bits(ret);

	regs->regs[0] = ret;