Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3085e164 authored by Mark Rutland's avatar Mark Rutland Committed by Will Deacon
Browse files

arm64: remove sigreturn wrappers



The arm64 sigreturn* syscall handlers are non-standard. Rather than
taking a number of user parameters in registers as per the AAPCS,
they expect the pt_regs as their sole argument.

To make this work, we override the syscall definitions to invoke
wrappers written in assembly, which mov the SP into x0, and branch to
their respective C functions.

On other architectures (such as x86), the sigreturn* functions take no
argument and instead use current_pt_regs() to acquire the user
registers. This requires less boilerplate code, and allows for other
features such as interposing C code in this path.

This patch takes the same approach for arm64.

Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
Tentatively-reviewed-by: default avatarDave Martin <dave.martin@arm.com>
Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent f9209e26
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -260,7 +260,7 @@ __SYSCALL(117, sys_ni_syscall)
#define __NR_fsync 118
#define __NR_fsync 118
__SYSCALL(__NR_fsync, sys_fsync)
__SYSCALL(__NR_fsync, sys_fsync)
#define __NR_sigreturn 119
#define __NR_sigreturn 119
__SYSCALL(__NR_sigreturn, compat_sys_sigreturn_wrapper)
__SYSCALL(__NR_sigreturn, compat_sys_sigreturn)
#define __NR_clone 120
#define __NR_clone 120
__SYSCALL(__NR_clone, sys_clone)
__SYSCALL(__NR_clone, sys_clone)
#define __NR_setdomainname 121
#define __NR_setdomainname 121
@@ -368,7 +368,7 @@ __SYSCALL(__NR_getresgid, sys_getresgid16)
#define __NR_prctl 172
#define __NR_prctl 172
__SYSCALL(__NR_prctl, sys_prctl)
__SYSCALL(__NR_prctl, sys_prctl)
#define __NR_rt_sigreturn 173
#define __NR_rt_sigreturn 173
__SYSCALL(__NR_rt_sigreturn, compat_sys_rt_sigreturn_wrapper)
__SYSCALL(__NR_rt_sigreturn, compat_sys_rt_sigreturn)
#define __NR_rt_sigaction 174
#define __NR_rt_sigaction 174
__SYSCALL(__NR_rt_sigaction, compat_sys_rt_sigaction)
__SYSCALL(__NR_rt_sigaction, compat_sys_rt_sigaction)
#define __NR_rt_sigprocmask 175
#define __NR_rt_sigprocmask 175
+0 −8
Original line number Original line Diff line number Diff line
@@ -1139,14 +1139,6 @@ __entry_tramp_data_start:
#endif /* CONFIG_RANDOMIZE_BASE */
#endif /* CONFIG_RANDOMIZE_BASE */
#endif /* CONFIG_UNMAP_KERNEL_AT_EL0 */
#endif /* CONFIG_UNMAP_KERNEL_AT_EL0 */


/*
 * Special system call wrappers.
 */
ENTRY(sys_rt_sigreturn_wrapper)
	mov	x0, sp
	b	sys_rt_sigreturn
ENDPROC(sys_rt_sigreturn_wrapper)

/*
/*
 * Register switch for AArch64. The callee-saved registers need to be saved
 * Register switch for AArch64. The callee-saved registers need to be saved
 * and restored. On entry:
 * and restored. On entry:
+0 −10
Original line number Original line Diff line number Diff line
@@ -30,16 +30,6 @@
 * System call wrappers for the AArch32 compatibility layer.
 * System call wrappers for the AArch32 compatibility layer.
 */
 */


ENTRY(compat_sys_sigreturn_wrapper)
	mov	x0, sp
	b	compat_sys_sigreturn
ENDPROC(compat_sys_sigreturn_wrapper)

ENTRY(compat_sys_rt_sigreturn_wrapper)
	mov	x0, sp
	b	compat_sys_rt_sigreturn
ENDPROC(compat_sys_rt_sigreturn_wrapper)

ENTRY(compat_sys_statfs64_wrapper)
ENTRY(compat_sys_statfs64_wrapper)
	mov	w3, #84
	mov	w3, #84
	cmp	w1, #88
	cmp	w1, #88
+2 −1
Original line number Original line Diff line number Diff line
@@ -539,8 +539,9 @@ static int restore_sigframe(struct pt_regs *regs,
	return err;
	return err;
}
}


asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
asmlinkage long sys_rt_sigreturn(void)
{
{
	struct pt_regs *regs = current_pt_regs();
	struct rt_sigframe __user *frame;
	struct rt_sigframe __user *frame;


	/* Always make any pending restarted system calls return -EINTR */
	/* Always make any pending restarted system calls return -EINTR */
+4 −2
Original line number Original line Diff line number Diff line
@@ -285,8 +285,9 @@ static int compat_restore_sigframe(struct pt_regs *regs,
	return err;
	return err;
}
}


asmlinkage int compat_sys_sigreturn(struct pt_regs *regs)
asmlinkage int compat_sys_sigreturn(void)
{
{
	struct pt_regs *regs = current_pt_regs();
	struct compat_sigframe __user *frame;
	struct compat_sigframe __user *frame;


	/* Always make any pending restarted system calls return -EINTR */
	/* Always make any pending restarted system calls return -EINTR */
@@ -315,8 +316,9 @@ asmlinkage int compat_sys_sigreturn(struct pt_regs *regs)
	return 0;
	return 0;
}
}


asmlinkage int compat_sys_rt_sigreturn(struct pt_regs *regs)
asmlinkage int compat_sys_rt_sigreturn(void)
{
{
	struct pt_regs *regs = current_pt_regs();
	struct compat_rt_sigframe __user *frame;
	struct compat_rt_sigframe __user *frame;


	/* Always make any pending restarted system calls return -EINTR */
	/* Always make any pending restarted system calls return -EINTR */
Loading