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

Commit 26689452 authored by Heiko Carstens's avatar Heiko Carstens
Browse files

[CVE-2009-0029] s390 specific system call wrappers

parent 2b664219
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -547,7 +547,7 @@ sys32_setdomainname_wrapper:
	.globl	sys32_newuname_wrapper
sys32_newuname_wrapper:
	llgtr	%r2,%r2			# struct new_utsname *
	jg	s390x_newuname		# branch to system call
	jg	sys_s390_newuname	# branch to system call

	.globl	compat_sys_adjtimex_wrapper
compat_sys_adjtimex_wrapper:
@@ -615,7 +615,7 @@ sys32_sysfs_wrapper:
	.globl	sys32_personality_wrapper
sys32_personality_wrapper:
	llgfr	%r2,%r2			# unsigned long
	jg	s390x_personality	# branch to system call
	jg	sys_s390_personality	# branch to system call

	.globl	sys32_setfsuid16_wrapper
sys32_setfsuid16_wrapper:
+8 −7
Original line number Diff line number Diff line
@@ -31,21 +31,22 @@ struct old_sigaction;
struct sel_arg_struct;

long sys_mmap2(struct mmap_arg_struct __user  *arg);
long old_mmap(struct mmap_arg_struct __user *arg);
long sys_s390_old_mmap(struct mmap_arg_struct __user *arg);
long sys_ipc(uint call, int first, unsigned long second,
	     unsigned long third, void __user *ptr);
long s390x_newuname(struct new_utsname __user *name);
long s390x_personality(unsigned long personality);
long s390_fadvise64(int fd, u32 offset_high, u32 offset_low,
long sys_s390_newuname(struct new_utsname __user *name);
long sys_s390_personality(unsigned long personality);
long sys_s390_fadvise64(int fd, u32 offset_high, u32 offset_low,
		    size_t len, int advice);
long s390_fadvise64_64(struct fadvise64_64_args __user *args);
long s390_fallocate(int fd, int mode, loff_t offset, u32 len_high, u32 len_low);
long sys_s390_fadvise64_64(struct fadvise64_64_args __user *args);
long sys_s390_fallocate(int fd, int mode, loff_t offset, u32 len_high,
			u32 len_low);
long sys_fork(void);
long sys_clone(void);
long sys_vfork(void);
void execve_tail(void);
long sys_execve(void);
int sys_sigsuspend(int history0, int history1, old_sigset_t mask);
long sys_sigsuspend(int history0, int history1, old_sigset_t mask);
long sys_sigaction(int sig, const struct old_sigaction __user *act,
		   struct old_sigaction __user *oact);
long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss);
+5 −4
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
#include <linux/tick.h>
#include <linux/elfcore.h>
#include <linux/kernel_stat.h>
#include <linux/syscalls.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/system.h>
@@ -225,13 +226,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp,
        return 0;
}

asmlinkage long sys_fork(void)
SYSCALL_DEFINE0(fork)
{
	struct pt_regs *regs = task_pt_regs(current);
	return do_fork(SIGCHLD, regs->gprs[15], regs, 0, NULL, NULL);
}

asmlinkage long sys_clone(void)
SYSCALL_DEFINE0(clone)
{
	struct pt_regs *regs = task_pt_regs(current);
	unsigned long clone_flags;
@@ -258,7 +259,7 @@ asmlinkage long sys_clone(void)
 * do not have enough call-clobbered registers to hold all
 * the information you need.
 */
asmlinkage long sys_vfork(void)
SYSCALL_DEFINE0(vfork)
{
	struct pt_regs *regs = task_pt_regs(current);
	return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
@@ -278,7 +279,7 @@ asmlinkage void execve_tail(void)
/*
 * sys_execve() executes a new program.
 */
asmlinkage long sys_execve(void)
SYSCALL_DEFINE0(execve)
{
	struct pt_regs *regs = task_pt_regs(current);
	char *filename;
+8 −11
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <linux/personality.h>
#include <linux/binfmts.h>
#include <linux/tracehook.h>
#include <linux/syscalls.h>
#include <asm/ucontext.h>
#include <asm/uaccess.h>
#include <asm/lowcore.h>
@@ -53,8 +54,7 @@ typedef struct
/*
 * Atomically swap in the new signal mask, and wait for a signal.
 */
asmlinkage int
sys_sigsuspend(int history0, int history1, old_sigset_t mask)
SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask)
{
	mask &= _BLOCKABLE;
	spin_lock_irq(&current->sighand->siglock);
@@ -70,9 +70,8 @@ sys_sigsuspend(int history0, int history1, old_sigset_t mask)
	return -ERESTARTNOHAND;
}

asmlinkage long
sys_sigaction(int sig, const struct old_sigaction __user *act,
	      struct old_sigaction __user *oact)
SYSCALL_DEFINE3(sigaction, int, sig, const struct old_sigaction __user *, act,
		struct old_sigaction __user *, oact)
{
	struct k_sigaction new_ka, old_ka;
	int ret;
@@ -102,15 +101,13 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
	return ret;
}

asmlinkage long
sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss,
		stack_t __user *, uoss)
{
	struct pt_regs *regs = task_pt_regs(current);
	return do_sigaltstack(uss, uoss, regs->gprs[15]);
}



/* Returns non-zero on fault. */
static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
{
@@ -164,7 +161,7 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
	return 0;
}

asmlinkage long sys_sigreturn(void)
SYSCALL_DEFINE0(sigreturn)
{
	struct pt_regs *regs = task_pt_regs(current);
	sigframe __user *frame = (sigframe __user *)regs->gprs[15];
@@ -191,7 +188,7 @@ asmlinkage long sys_sigreturn(void)
	return 0;
}

asmlinkage long sys_rt_sigreturn(void)
SYSCALL_DEFINE0(rt_sigreturn)
{
	struct pt_regs *regs = task_pt_regs(current);
	rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15];
+21 −14
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <linux/personality.h>
#include <linux/unistd.h>
#include <linux/ipc.h>
#include <linux/syscalls.h>
#include <asm/uaccess.h>
#include "entry.h"

@@ -74,7 +75,7 @@ struct mmap_arg_struct {
	unsigned long offset;
};

asmlinkage long sys_mmap2(struct mmap_arg_struct __user  *arg)
SYSCALL_DEFINE1(mmap2, struct mmap_arg_struct __user *, arg)
{
	struct mmap_arg_struct a;
	int error = -EFAULT;
@@ -86,7 +87,7 @@ asmlinkage long sys_mmap2(struct mmap_arg_struct __user *arg)
	return error;
}

asmlinkage long old_mmap(struct mmap_arg_struct __user *arg)
SYSCALL_DEFINE1(s390_old_mmap, struct mmap_arg_struct __user *, arg)
{
	struct mmap_arg_struct a;
	long error = -EFAULT;
@@ -108,8 +109,8 @@ asmlinkage long old_mmap(struct mmap_arg_struct __user *arg)
 *
 * This is really horribly ugly.
 */
asmlinkage long sys_ipc(uint call, int first, unsigned long second,
				  unsigned long third, void __user *ptr)
SYSCALL_DEFINE5(ipc, uint, call, int, first, unsigned long, second,
		unsigned long, third, void __user *, ptr)
{
        struct ipc_kludge tmp;
	int ret;
@@ -175,7 +176,7 @@ asmlinkage long sys_ipc(uint call, int first, unsigned long second,
}

#ifdef CONFIG_64BIT
asmlinkage long s390x_newuname(struct new_utsname __user *name)
SYSCALL_DEFINE1(s390_newuname, struct new_utsname __user *, name)
{
	int ret = sys_newuname(name);

@@ -186,7 +187,7 @@ asmlinkage long s390x_newuname(struct new_utsname __user *name)
	return ret;
}

asmlinkage long s390x_personality(unsigned long personality)
SYSCALL_DEFINE1(s390_personality, unsigned long, personality)
{
	int ret;

@@ -205,15 +206,13 @@ asmlinkage long s390x_personality(unsigned long personality)
 */
#ifndef CONFIG_64BIT

asmlinkage long
s390_fadvise64(int fd, u32 offset_high, u32 offset_low, size_t len, int advice)
SYSCALL_DEFINE5(s390_fadvise64, int, fd, u32, offset_high, u32, offset_low,
		size_t, len, int, advice)
{
	return sys_fadvise64(fd, (u64) offset_high << 32 | offset_low,
			len, advice);
}

#endif

struct fadvise64_64_args {
	int fd;
	long long offset;
@@ -221,8 +220,7 @@ struct fadvise64_64_args {
	int advice;
};

asmlinkage long
s390_fadvise64_64(struct fadvise64_64_args __user *args)
SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, args)
{
	struct fadvise64_64_args a;

@@ -231,7 +229,6 @@ s390_fadvise64_64(struct fadvise64_64_args __user *args)
	return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice);
}

#ifndef CONFIG_64BIT
/*
 * This is a wrapper to call sys_fallocate(). For 31 bit s390 the last
 * 64 bit argument "len" is split into the upper and lower 32 bits. The
@@ -244,9 +241,19 @@ s390_fadvise64_64(struct fadvise64_64_args __user *args)
 * to
 *   %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len
 */
asmlinkage long s390_fallocate(int fd, int mode, loff_t offset,
SYSCALL_DEFINE(s390_fallocate)(int fd, int mode, loff_t offset,
			       u32 len_high, u32 len_low)
{
	return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low);
}
#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
asmlinkage long SyS_s390_fallocate(long fd, long mode, loff_t offset,
				   long len_high, long len_low)
{
	return SYSC_s390_fallocate((int) fd, (int) mode, offset,
				   (u32) len_high, (u32) len_low);
}
SYSCALL_ALIAS(sys_s390_fallocate, SyS_s390_fallocate);
#endif

#endif
Loading