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

Commit 9ac08002 authored by Al Viro's avatar Al Viro
Browse files

arm64: sanitize copy_thread(), switch to generic fork/vfork/clone



Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent b9763ce3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ config ARM64
	select RTC_LIB
	select SPARSE_IRQ
	select SYSCTL_EXCEPTION_TRACE
	select CLONE_BACKWARDS
	help
	  ARM 64-bit (AArch64) Linux support.

+2 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ asmlinkage long sys_sigaltstack_wrapper(const stack_t __user *uss,
 * AArch64 sys_clone implementation has a different prototype than the generic
 * one (additional TLS value argument).
 */
asmlinkage long sys_clone(unsigned long, unsigned long, void __user *, int,
	       void __user *);
#define sys_clone	sys_clone

#include <asm-generic/syscalls.h>
+3 −0
Original line number Diff line number Diff line
@@ -24,6 +24,9 @@
#define __ARCH_WANT_SYS_SIGPROCMASK
#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
#define __ARCH_WANT_COMPAT_SYS_SENDFILE
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_VFORK
#endif
#define __ARCH_WANT_SYS_EXECVE
#define __ARCH_WANT_SYS_CLONE
#include <uapi/asm/unistd.h>
+2 −2
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@

__SYSCALL(0,   sys_restart_syscall)
__SYSCALL(1,   sys_exit)
__SYSCALL(2,   compat_sys_fork)
__SYSCALL(2,   sys_fork)
__SYSCALL(3,   sys_read)
__SYSCALL(4,   sys_write)
__SYSCALL(5,   compat_sys_open)
@@ -211,7 +211,7 @@ __SYSCALL(186, compat_sys_sigaltstack_wrapper)
__SYSCALL(187, compat_sys_sendfile)
__SYSCALL(188, sys_ni_syscall)			/* 188 reserved */
__SYSCALL(189, sys_ni_syscall)			/* 189 reserved */
__SYSCALL(190, compat_sys_vfork)
__SYSCALL(190, sys_vfork)
__SYSCALL(191, compat_sys_getrlimit)		/* SuS compliant getrlimit */
__SYSCALL(192, sys_mmap_pgoff)
__SYSCALL(193, compat_sys_truncate64_wrapper)
+4 −4
Original line number Diff line number Diff line
@@ -235,15 +235,15 @@ asmlinkage void ret_from_fork(void) asm("ret_from_fork");

int copy_thread(unsigned long clone_flags, unsigned long stack_start,
		unsigned long stk_sz, struct task_struct *p,
		struct pt_regs *regs)
		struct pt_regs *unused)
{
	struct pt_regs *childregs = task_pt_regs(p);
	unsigned long tls = p->thread.tp_value;

	memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context));

	if (likely(regs)) {
		*childregs = *regs;
	if (likely(!(p->flags & PF_KTHREAD))) {
		*childregs = *current_pt_regs();
		childregs->regs[0] = 0;
		if (is_compat_thread(task_thread_info(p))) {
			if (stack_start)
@@ -266,7 +266,7 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start,
		 * for the new thread.
		 */
		if (clone_flags & CLONE_SETTLS)
			tls = regs->regs[3];
			tls = childregs->regs[3];
	} else {
		memset(childregs, 0, sizeof(struct pt_regs));
		childregs->pstate = PSR_MODE_EL1h;
Loading