aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-23 21:50:11 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-23 21:50:11 -0500
commit9e2d59ad580d590134285f361a0e80f0e98c0207 (patch)
treef3232be75781484193413f32ec82c21f6d8eb76e /arch/powerpc
parent5ce1a70e2f00f0bce0cab57f798ca354b9496169 (diff)
parent235b80226b986dabcbba844968f7807866bd0bfe (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull signal handling cleanups from Al Viro: "This is the first pile; another one will come a bit later and will contain SYSCALL_DEFINE-related patches. - a bunch of signal-related syscalls (both native and compat) unified. - a bunch of compat syscalls switched to COMPAT_SYSCALL_DEFINE (fixing several potential problems with missing argument validation, while we are at it) - a lot of now-pointless wrappers killed - a couple of architectures (cris and hexagon) forgot to save altstack settings into sigframe, even though they used the (uninitialized) values in sigreturn; fixed. - microblaze fixes for delivery of multiple signals arriving at once - saner set of helpers for signal delivery introduced, several architectures switched to using those." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (143 commits) x86: convert to ksignal sparc: convert to ksignal arm: switch to struct ksignal * passing alpha: pass k_sigaction and siginfo_t using ksignal pointer burying unused conditionals make do_sigaltstack() static arm64: switch to generic old sigaction() (compat-only) arm64: switch to generic compat rt_sigaction() arm64: switch compat to generic old sigsuspend arm64: switch to generic compat rt_sigqueueinfo() arm64: switch to generic compat rt_sigpending() arm64: switch to generic compat rt_sigprocmask() arm64: switch to generic sigaltstack sparc: switch to generic old sigsuspend sparc: COMPAT_SYSCALL_DEFINE does all sign-extension as well as SYSCALL_DEFINE sparc: kill sign-extending wrappers for native syscalls kill sparc32_open() sparc: switch to use of generic old sigaction sparc: switch sys_compat_rt_sigaction() to COMPAT_SYSCALL_DEFINE mips: switch to generic sys_fork() and sys_clone() ...
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/Kconfig3
-rw-r--r--arch/powerpc/include/asm/signal.h1
-rw-r--r--arch/powerpc/include/asm/syscalls.h15
-rw-r--r--arch/powerpc/include/asm/systbl.h63
-rw-r--r--arch/powerpc/include/asm/unistd.h4
-rw-r--r--arch/powerpc/include/uapi/asm/signal.h6
-rw-r--r--arch/powerpc/kernel/ppc32.h26
-rw-r--r--arch/powerpc/kernel/signal.c7
-rw-r--r--arch/powerpc/kernel/signal_32.c253
-rw-r--r--arch/powerpc/kernel/signal_64.c11
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c301
11 files changed, 50 insertions, 640 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index a5255f242be9..5c7470689a10 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -143,6 +143,8 @@ config PPC
143 select MODULES_USE_ELF_RELA 143 select MODULES_USE_ELF_RELA
144 select CLONE_BACKWARDS 144 select CLONE_BACKWARDS
145 select ARCH_USE_BUILTIN_BSWAP 145 select ARCH_USE_BUILTIN_BSWAP
146 select OLD_SIGSUSPEND
147 select OLD_SIGACTION if PPC32
146 148
147config EARLY_PRINTK 149config EARLY_PRINTK
148 bool 150 bool
@@ -153,6 +155,7 @@ config COMPAT
153 default y if PPC64 155 default y if PPC64
154 select COMPAT_BINFMT_ELF 156 select COMPAT_BINFMT_ELF
155 select ARCH_WANT_OLD_COMPAT_IPC 157 select ARCH_WANT_OLD_COMPAT_IPC
158 select COMPAT_OLD_SIGACTION
156 159
157config SYSVIPC_COMPAT 160config SYSVIPC_COMPAT
158 bool 161 bool
diff --git a/arch/powerpc/include/asm/signal.h b/arch/powerpc/include/asm/signal.h
index a101637725a2..fbe66c463891 100644
--- a/arch/powerpc/include/asm/signal.h
+++ b/arch/powerpc/include/asm/signal.h
@@ -1,6 +1,7 @@
1#ifndef _ASM_POWERPC_SIGNAL_H 1#ifndef _ASM_POWERPC_SIGNAL_H
2#define _ASM_POWERPC_SIGNAL_H 2#define _ASM_POWERPC_SIGNAL_H
3 3
4#define __ARCH_HAS_SA_RESTORER
4#include <uapi/asm/signal.h> 5#include <uapi/asm/signal.h>
5 6
6#endif /* _ASM_POWERPC_SIGNAL_H */ 7#endif /* _ASM_POWERPC_SIGNAL_H */
diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h
index b5308d3e6d39..23be8f1e7e64 100644
--- a/arch/powerpc/include/asm/syscalls.h
+++ b/arch/powerpc/include/asm/syscalls.h
@@ -5,11 +5,8 @@
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6#include <linux/linkage.h> 6#include <linux/linkage.h>
7#include <linux/types.h> 7#include <linux/types.h>
8#include <asm/signal.h>
9 8
10struct pt_regs;
11struct rtas_args; 9struct rtas_args;
12struct sigaction;
13 10
14asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, 11asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
15 unsigned long prot, unsigned long flags, 12 unsigned long prot, unsigned long flags,
@@ -17,20 +14,8 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
17asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len, 14asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len,
18 unsigned long prot, unsigned long flags, 15 unsigned long prot, unsigned long flags,
19 unsigned long fd, unsigned long pgoff); 16 unsigned long fd, unsigned long pgoff);
20asmlinkage long sys_pipe(int __user *fildes);
21asmlinkage long sys_pipe2(int __user *fildes, int flags);
22asmlinkage long sys_rt_sigaction(int sig,
23 const struct sigaction __user *act,
24 struct sigaction __user *oact, size_t sigsetsize);
25asmlinkage long ppc64_personality(unsigned long personality); 17asmlinkage long ppc64_personality(unsigned long personality);
26asmlinkage int ppc_rtas(struct rtas_args __user *uargs); 18asmlinkage int ppc_rtas(struct rtas_args __user *uargs);
27asmlinkage time_t sys64_time(time_t __user * tloc);
28
29asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset,
30 size_t sigsetsize);
31asmlinkage long sys_sigaltstack(const stack_t __user *uss,
32 stack_t __user *uoss, unsigned long r5, unsigned long r6,
33 unsigned long r7, unsigned long r8, struct pt_regs *regs);
34 19
35#endif /* __KERNEL__ */ 20#endif /* __KERNEL__ */
36#endif /* __ASM_POWERPC_SYSCALLS_H */ 21#endif /* __ASM_POWERPC_SYSCALLS_H */
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index 97909d3b1d7b..d906f33441c6 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -10,8 +10,8 @@ SYSCALL_SPU(read)
10SYSCALL_SPU(write) 10SYSCALL_SPU(write)
11COMPAT_SYS_SPU(open) 11COMPAT_SYS_SPU(open)
12SYSCALL_SPU(close) 12SYSCALL_SPU(close)
13COMPAT_SYS_SPU(waitpid) 13SYSCALL_SPU(waitpid)
14COMPAT_SYS_SPU(creat) 14SYSCALL_SPU(creat)
15SYSCALL_SPU(link) 15SYSCALL_SPU(link)
16SYSCALL_SPU(unlink) 16SYSCALL_SPU(unlink)
17COMPAT_SYS(execve) 17COMPAT_SYS(execve)
@@ -36,13 +36,13 @@ SYSCALL(pause)
36COMPAT_SYS(utime) 36COMPAT_SYS(utime)
37SYSCALL(ni_syscall) 37SYSCALL(ni_syscall)
38SYSCALL(ni_syscall) 38SYSCALL(ni_syscall)
39COMPAT_SYS_SPU(access) 39SYSCALL_SPU(access)
40COMPAT_SYS_SPU(nice) 40SYSCALL_SPU(nice)
41SYSCALL(ni_syscall) 41SYSCALL(ni_syscall)
42SYSCALL_SPU(sync) 42SYSCALL_SPU(sync)
43COMPAT_SYS_SPU(kill) 43SYSCALL_SPU(kill)
44SYSCALL_SPU(rename) 44SYSCALL_SPU(rename)
45COMPAT_SYS_SPU(mkdir) 45SYSCALL_SPU(mkdir)
46SYSCALL_SPU(rmdir) 46SYSCALL_SPU(rmdir)
47SYSCALL_SPU(dup) 47SYSCALL_SPU(dup)
48SYSCALL_SPU(pipe) 48SYSCALL_SPU(pipe)
@@ -60,10 +60,10 @@ SYSCALL(ni_syscall)
60COMPAT_SYS_SPU(ioctl) 60COMPAT_SYS_SPU(ioctl)
61COMPAT_SYS_SPU(fcntl) 61COMPAT_SYS_SPU(fcntl)
62SYSCALL(ni_syscall) 62SYSCALL(ni_syscall)
63COMPAT_SYS_SPU(setpgid) 63SYSCALL_SPU(setpgid)
64SYSCALL(ni_syscall) 64SYSCALL(ni_syscall)
65SYSX(sys_ni_syscall,sys_olduname, sys_olduname) 65SYSX(sys_ni_syscall,sys_olduname, sys_olduname)
66COMPAT_SYS_SPU(umask) 66SYSCALL_SPU(umask)
67SYSCALL_SPU(chroot) 67SYSCALL_SPU(chroot)
68COMPAT_SYS(ustat) 68COMPAT_SYS(ustat)
69SYSCALL_SPU(dup2) 69SYSCALL_SPU(dup2)
@@ -72,23 +72,24 @@ SYSCALL_SPU(getpgrp)
72SYSCALL_SPU(setsid) 72SYSCALL_SPU(setsid)
73SYS32ONLY(sigaction) 73SYS32ONLY(sigaction)
74SYSCALL_SPU(sgetmask) 74SYSCALL_SPU(sgetmask)
75COMPAT_SYS_SPU(ssetmask) 75SYSCALL_SPU(ssetmask)
76SYSCALL_SPU(setreuid) 76SYSCALL_SPU(setreuid)
77SYSCALL_SPU(setregid) 77SYSCALL_SPU(setregid)
78#define compat_sys_sigsuspend sys_sigsuspend
78SYS32ONLY(sigsuspend) 79SYS32ONLY(sigsuspend)
79COMPAT_SYS(sigpending) 80COMPAT_SYS(sigpending)
80COMPAT_SYS_SPU(sethostname) 81SYSCALL_SPU(sethostname)
81COMPAT_SYS_SPU(setrlimit) 82COMPAT_SYS_SPU(setrlimit)
82COMPAT_SYS(old_getrlimit) 83COMPAT_SYS(old_getrlimit)
83COMPAT_SYS_SPU(getrusage) 84COMPAT_SYS_SPU(getrusage)
84COMPAT_SYS_SPU(gettimeofday) 85COMPAT_SYS_SPU(gettimeofday)
85COMPAT_SYS_SPU(settimeofday) 86COMPAT_SYS_SPU(settimeofday)
86COMPAT_SYS_SPU(getgroups) 87SYSCALL_SPU(getgroups)
87COMPAT_SYS_SPU(setgroups) 88SYSCALL_SPU(setgroups)
88SYSX(sys_ni_syscall,sys_ni_syscall,ppc_select) 89SYSX(sys_ni_syscall,sys_ni_syscall,ppc_select)
89SYSCALL_SPU(symlink) 90SYSCALL_SPU(symlink)
90OLDSYS(lstat) 91OLDSYS(lstat)
91COMPAT_SYS_SPU(readlink) 92SYSCALL_SPU(readlink)
92SYSCALL(uselib) 93SYSCALL(uselib)
93SYSCALL(swapon) 94SYSCALL(swapon)
94SYSCALL(reboot) 95SYSCALL(reboot)
@@ -99,14 +100,14 @@ COMPAT_SYS_SPU(truncate)
99COMPAT_SYS_SPU(ftruncate) 100COMPAT_SYS_SPU(ftruncate)
100SYSCALL_SPU(fchmod) 101SYSCALL_SPU(fchmod)
101SYSCALL_SPU(fchown) 102SYSCALL_SPU(fchown)
102COMPAT_SYS_SPU(getpriority) 103SYSCALL_SPU(getpriority)
103COMPAT_SYS_SPU(setpriority) 104SYSCALL_SPU(setpriority)
104SYSCALL(ni_syscall) 105SYSCALL(ni_syscall)
105COMPAT_SYS(statfs) 106COMPAT_SYS(statfs)
106COMPAT_SYS(fstatfs) 107COMPAT_SYS(fstatfs)
107SYSCALL(ni_syscall) 108SYSCALL(ni_syscall)
108COMPAT_SYS_SPU(socketcall) 109COMPAT_SYS_SPU(socketcall)
109COMPAT_SYS_SPU(syslog) 110SYSCALL_SPU(syslog)
110COMPAT_SYS_SPU(setitimer) 111COMPAT_SYS_SPU(setitimer)
111COMPAT_SYS_SPU(getitimer) 112COMPAT_SYS_SPU(getitimer)
112COMPAT_SYS_SPU(newstat) 113COMPAT_SYS_SPU(newstat)
@@ -124,7 +125,7 @@ COMPAT_SYS(ipc)
124SYSCALL_SPU(fsync) 125SYSCALL_SPU(fsync)
125SYS32ONLY(sigreturn) 126SYS32ONLY(sigreturn)
126PPC_SYS(clone) 127PPC_SYS(clone)
127COMPAT_SYS_SPU(setdomainname) 128SYSCALL_SPU(setdomainname)
128SYSCALL_SPU(newuname) 129SYSCALL_SPU(newuname)
129SYSCALL(ni_syscall) 130SYSCALL(ni_syscall)
130COMPAT_SYS_SPU(adjtimex) 131COMPAT_SYS_SPU(adjtimex)
@@ -135,10 +136,10 @@ SYSCALL(init_module)
135SYSCALL(delete_module) 136SYSCALL(delete_module)
136SYSCALL(ni_syscall) 137SYSCALL(ni_syscall)
137SYSCALL(quotactl) 138SYSCALL(quotactl)
138COMPAT_SYS_SPU(getpgid) 139SYSCALL_SPU(getpgid)
139SYSCALL_SPU(fchdir) 140SYSCALL_SPU(fchdir)
140SYSCALL_SPU(bdflush) 141SYSCALL_SPU(bdflush)
141COMPAT_SYS(sysfs) 142SYSCALL_SPU(sysfs)
142SYSX_SPU(ppc64_personality,ppc64_personality,sys_personality) 143SYSX_SPU(ppc64_personality,ppc64_personality,sys_personality)
143SYSCALL(ni_syscall) 144SYSCALL(ni_syscall)
144SYSCALL_SPU(setfsuid) 145SYSCALL_SPU(setfsuid)
@@ -150,21 +151,21 @@ SYSCALL_SPU(flock)
150SYSCALL_SPU(msync) 151SYSCALL_SPU(msync)
151COMPAT_SYS_SPU(readv) 152COMPAT_SYS_SPU(readv)
152COMPAT_SYS_SPU(writev) 153COMPAT_SYS_SPU(writev)
153COMPAT_SYS_SPU(getsid) 154SYSCALL_SPU(getsid)
154SYSCALL_SPU(fdatasync) 155SYSCALL_SPU(fdatasync)
155COMPAT_SYS(sysctl) 156COMPAT_SYS(sysctl)
156SYSCALL_SPU(mlock) 157SYSCALL_SPU(mlock)
157SYSCALL_SPU(munlock) 158SYSCALL_SPU(munlock)
158SYSCALL_SPU(mlockall) 159SYSCALL_SPU(mlockall)
159SYSCALL_SPU(munlockall) 160SYSCALL_SPU(munlockall)
160COMPAT_SYS_SPU(sched_setparam) 161SYSCALL_SPU(sched_setparam)
161COMPAT_SYS_SPU(sched_getparam) 162SYSCALL_SPU(sched_getparam)
162COMPAT_SYS_SPU(sched_setscheduler) 163SYSCALL_SPU(sched_setscheduler)
163COMPAT_SYS_SPU(sched_getscheduler) 164SYSCALL_SPU(sched_getscheduler)
164SYSCALL_SPU(sched_yield) 165SYSCALL_SPU(sched_yield)
165COMPAT_SYS_SPU(sched_get_priority_max) 166SYSCALL_SPU(sched_get_priority_max)
166COMPAT_SYS_SPU(sched_get_priority_min) 167SYSCALL_SPU(sched_get_priority_min)
167SYSX_SPU(sys_sched_rr_get_interval,compat_sys_sched_rr_get_interval_wrapper,sys_sched_rr_get_interval) 168COMPAT_SYS_SPU(sched_rr_get_interval)
168COMPAT_SYS_SPU(nanosleep) 169COMPAT_SYS_SPU(nanosleep)
169SYSCALL_SPU(mremap) 170SYSCALL_SPU(mremap)
170SYSCALL_SPU(setresuid) 171SYSCALL_SPU(setresuid)
@@ -174,7 +175,7 @@ SYSCALL_SPU(poll)
174SYSCALL(ni_syscall) 175SYSCALL(ni_syscall)
175SYSCALL_SPU(setresgid) 176SYSCALL_SPU(setresgid)
176SYSCALL_SPU(getresgid) 177SYSCALL_SPU(getresgid)
177COMPAT_SYS_SPU(prctl) 178SYSCALL_SPU(prctl)
178COMPAT_SYS(rt_sigreturn) 179COMPAT_SYS(rt_sigreturn)
179COMPAT_SYS(rt_sigaction) 180COMPAT_SYS(rt_sigaction)
180COMPAT_SYS(rt_sigprocmask) 181COMPAT_SYS(rt_sigprocmask)
@@ -253,7 +254,7 @@ COMPAT_SYS_SPU(clock_gettime)
253COMPAT_SYS_SPU(clock_getres) 254COMPAT_SYS_SPU(clock_getres)
254COMPAT_SYS_SPU(clock_nanosleep) 255COMPAT_SYS_SPU(clock_nanosleep)
255SYSX(ppc64_swapcontext,ppc32_swapcontext,ppc_swapcontext) 256SYSX(ppc64_swapcontext,ppc32_swapcontext,ppc_swapcontext)
256COMPAT_SYS_SPU(tgkill) 257SYSCALL_SPU(tgkill)
257COMPAT_SYS_SPU(utimes) 258COMPAT_SYS_SPU(utimes)
258COMPAT_SYS_SPU(statfs64) 259COMPAT_SYS_SPU(statfs64)
259COMPAT_SYS_SPU(fstatfs64) 260COMPAT_SYS_SPU(fstatfs64)
@@ -276,8 +277,8 @@ COMPAT_SYS(add_key)
276COMPAT_SYS(request_key) 277COMPAT_SYS(request_key)
277COMPAT_SYS(keyctl) 278COMPAT_SYS(keyctl)
278COMPAT_SYS(waitid) 279COMPAT_SYS(waitid)
279COMPAT_SYS(ioprio_set) 280SYSCALL(ioprio_set)
280COMPAT_SYS(ioprio_get) 281SYSCALL(ioprio_get)
281SYSCALL(inotify_init) 282SYSCALL(inotify_init)
282SYSCALL(inotify_add_watch) 283SYSCALL(inotify_add_watch)
283SYSCALL(inotify_rm_watch) 284SYSCALL(inotify_rm_watch)
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index 1d4864a40e35..f25b5c45c435 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -44,17 +44,13 @@
44#define __ARCH_WANT_SYS_OLDUMOUNT 44#define __ARCH_WANT_SYS_OLDUMOUNT
45#define __ARCH_WANT_SYS_SIGPENDING 45#define __ARCH_WANT_SYS_SIGPENDING
46#define __ARCH_WANT_SYS_SIGPROCMASK 46#define __ARCH_WANT_SYS_SIGPROCMASK
47#define __ARCH_WANT_SYS_RT_SIGACTION
48#define __ARCH_WANT_SYS_RT_SIGSUSPEND
49#ifdef CONFIG_PPC32 47#ifdef CONFIG_PPC32
50#define __ARCH_WANT_OLD_STAT 48#define __ARCH_WANT_OLD_STAT
51#endif 49#endif
52#ifdef CONFIG_PPC64 50#ifdef CONFIG_PPC64
53#define __ARCH_WANT_COMPAT_SYS_TIME 51#define __ARCH_WANT_COMPAT_SYS_TIME
54#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
55#define __ARCH_WANT_SYS_NEWFSTATAT 52#define __ARCH_WANT_SYS_NEWFSTATAT
56#define __ARCH_WANT_COMPAT_SYS_SENDFILE 53#define __ARCH_WANT_COMPAT_SYS_SENDFILE
57#define __ARCH_WANT_COMPAT_SYS_SCHED_RR_GET_INTERVAL
58#endif 54#endif
59#define __ARCH_WANT_SYS_FORK 55#define __ARCH_WANT_SYS_FORK
60#define __ARCH_WANT_SYS_VFORK 56#define __ARCH_WANT_SYS_VFORK
diff --git a/arch/powerpc/include/uapi/asm/signal.h b/arch/powerpc/include/uapi/asm/signal.h
index e079fb39d5bc..6c69ee94fd8d 100644
--- a/arch/powerpc/include/uapi/asm/signal.h
+++ b/arch/powerpc/include/uapi/asm/signal.h
@@ -90,6 +90,7 @@ typedef struct {
90 90
91#include <asm-generic/signal-defs.h> 91#include <asm-generic/signal-defs.h>
92 92
93#ifndef __KERNEL__
93struct old_sigaction { 94struct old_sigaction {
94 __sighandler_t sa_handler; 95 __sighandler_t sa_handler;
95 old_sigset_t sa_mask; 96 old_sigset_t sa_mask;
@@ -103,10 +104,7 @@ struct sigaction {
103 __sigrestore_t sa_restorer; 104 __sigrestore_t sa_restorer;
104 sigset_t sa_mask; /* mask last for extensibility */ 105 sigset_t sa_mask; /* mask last for extensibility */
105}; 106};
106 107#endif
107struct k_sigaction {
108 struct sigaction sa;
109};
110 108
111typedef struct sigaltstack { 109typedef struct sigaltstack {
112 void __user *ss_sp; 110 void __user *ss_sp;
diff --git a/arch/powerpc/kernel/ppc32.h b/arch/powerpc/kernel/ppc32.h
index 02fb0ee26093..a27c914d5802 100644
--- a/arch/powerpc/kernel/ppc32.h
+++ b/arch/powerpc/kernel/ppc32.h
@@ -16,30 +16,6 @@
16 16
17/* These are here to support 32-bit syscalls on a 64-bit kernel. */ 17/* These are here to support 32-bit syscalls on a 64-bit kernel. */
18 18
19#define __old_sigaction32 old_sigaction32
20
21struct __old_sigaction32 {
22 compat_uptr_t sa_handler;
23 compat_old_sigset_t sa_mask;
24 unsigned int sa_flags;
25 compat_uptr_t sa_restorer; /* not used by Linux/SPARC yet */
26};
27
28
29
30struct sigaction32 {
31 compat_uptr_t sa_handler; /* Really a pointer, but need to deal with 32 bits */
32 unsigned int sa_flags;
33 compat_uptr_t sa_restorer; /* Another 32 bit pointer */
34 compat_sigset_t sa_mask; /* A 32 bit mask */
35};
36
37typedef struct sigaltstack_32 {
38 unsigned int ss_sp;
39 int ss_flags;
40 compat_size_t ss_size;
41} stack_32_t;
42
43struct pt_regs32 { 19struct pt_regs32 {
44 unsigned int gpr[32]; 20 unsigned int gpr[32];
45 unsigned int nip; 21 unsigned int nip;
@@ -75,7 +51,7 @@ struct mcontext32 {
75struct ucontext32 { 51struct ucontext32 {
76 unsigned int uc_flags; 52 unsigned int uc_flags;
77 unsigned int uc_link; 53 unsigned int uc_link;
78 stack_32_t uc_stack; 54 compat_stack_t uc_stack;
79 int uc_pad[7]; 55 int uc_pad[7];
80 compat_uptr_t uc_regs; /* points to uc_mcontext field */ 56 compat_uptr_t uc_regs; /* points to uc_mcontext field */
81 compat_sigset_t uc_sigmask; /* mask last for extensibility */ 57 compat_sigset_t uc_sigmask; /* mask last for extensibility */
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index 3003d890e9ef..cf12eae02de5 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -170,10 +170,3 @@ void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
170 tracehook_notify_resume(regs); 170 tracehook_notify_resume(regs);
171 } 171 }
172} 172}
173
174long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
175 unsigned long r5, unsigned long r6, unsigned long r7,
176 unsigned long r8, struct pt_regs *regs)
177{
178 return do_sigaltstack(uss, uoss, regs->gpr[1]);
179}
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index e4a88d340de6..3acb28e245b4 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -57,10 +57,7 @@
57#undef DEBUG_SIG 57#undef DEBUG_SIG
58 58
59#ifdef CONFIG_PPC64 59#ifdef CONFIG_PPC64
60#define sys_sigsuspend compat_sys_sigsuspend
61#define sys_rt_sigsuspend compat_sys_rt_sigsuspend
62#define sys_rt_sigreturn compat_sys_rt_sigreturn 60#define sys_rt_sigreturn compat_sys_rt_sigreturn
63#define sys_sigaction compat_sys_sigaction
64#define sys_swapcontext compat_sys_swapcontext 61#define sys_swapcontext compat_sys_swapcontext
65#define sys_sigreturn compat_sys_sigreturn 62#define sys_sigreturn compat_sys_sigreturn
66 63
@@ -69,6 +66,8 @@
69#define mcontext mcontext32 66#define mcontext mcontext32
70#define ucontext ucontext32 67#define ucontext ucontext32
71 68
69#define __save_altstack __compat_save_altstack
70
72/* 71/*
73 * Userspace code may pass a ucontext which doesn't include VSX added 72 * Userspace code may pass a ucontext which doesn't include VSX added
74 * at the end. We need to check for this case. 73 * at the end. We need to check for this case.
@@ -131,23 +130,6 @@ static inline int get_sigset_t(sigset_t *set,
131 return 0; 130 return 0;
132} 131}
133 132
134static inline int get_old_sigaction(struct k_sigaction *new_ka,
135 struct old_sigaction __user *act)
136{
137 compat_old_sigset_t mask;
138 compat_uptr_t handler, restorer;
139
140 if (get_user(handler, &act->sa_handler) ||
141 __get_user(restorer, &act->sa_restorer) ||
142 __get_user(new_ka->sa.sa_flags, &act->sa_flags) ||
143 __get_user(mask, &act->sa_mask))
144 return -EFAULT;
145 new_ka->sa.sa_handler = compat_ptr(handler);
146 new_ka->sa.sa_restorer = compat_ptr(restorer);
147 siginitset(&new_ka->sa.sa_mask, mask);
148 return 0;
149}
150
151#define to_user_ptr(p) ptr_to_compat(p) 133#define to_user_ptr(p) ptr_to_compat(p)
152#define from_user_ptr(p) compat_ptr(p) 134#define from_user_ptr(p) compat_ptr(p)
153 135
@@ -197,21 +179,6 @@ static inline int get_sigset_t(sigset_t *set, const sigset_t __user *uset)
197 return copy_from_user(set, uset, sizeof(*uset)); 179 return copy_from_user(set, uset, sizeof(*uset));
198} 180}
199 181
200static inline int get_old_sigaction(struct k_sigaction *new_ka,
201 struct old_sigaction __user *act)
202{
203 old_sigset_t mask;
204
205 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
206 __get_user(new_ka->sa.sa_handler, &act->sa_handler) ||
207 __get_user(new_ka->sa.sa_restorer, &act->sa_restorer) ||
208 __get_user(new_ka->sa.sa_flags, &act->sa_flags) ||
209 __get_user(mask, &act->sa_mask))
210 return -EFAULT;
211 siginitset(&new_ka->sa.sa_mask, mask);
212 return 0;
213}
214
215#define to_user_ptr(p) ((unsigned long)(p)) 182#define to_user_ptr(p) ((unsigned long)(p))
216#define from_user_ptr(p) ((void __user *)(p)) 183#define from_user_ptr(p) ((void __user *)(p))
217 184
@@ -235,50 +202,8 @@ static inline int restore_general_regs(struct pt_regs *regs,
235 return -EFAULT; 202 return -EFAULT;
236 return 0; 203 return 0;
237} 204}
238
239#endif /* CONFIG_PPC64 */
240
241/*
242 * Atomically swap in the new signal mask, and wait for a signal.
243 */
244long sys_sigsuspend(old_sigset_t mask)
245{
246 sigset_t blocked;
247 siginitset(&blocked, mask);
248 return sigsuspend(&blocked);
249}
250
251long sys_sigaction(int sig, struct old_sigaction __user *act,
252 struct old_sigaction __user *oact)
253{
254 struct k_sigaction new_ka, old_ka;
255 int ret;
256
257#ifdef CONFIG_PPC64
258 if (sig < 0)
259 sig = -sig;
260#endif 205#endif
261 206
262 if (act) {
263 if (get_old_sigaction(&new_ka, act))
264 return -EFAULT;
265 }
266
267 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
268 if (!ret && oact) {
269 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
270 __put_user(to_user_ptr(old_ka.sa.sa_handler),
271 &oact->sa_handler) ||
272 __put_user(to_user_ptr(old_ka.sa.sa_restorer),
273 &oact->sa_restorer) ||
274 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
275 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
276 return -EFAULT;
277 }
278
279 return ret;
280}
281
282/* 207/*
283 * When we have signals to deliver, we set up on the 208 * When we have signals to deliver, we set up on the
284 * user stack, going down from the original stack pointer: 209 * user stack, going down from the original stack pointer:
@@ -951,89 +876,6 @@ static long restore_tm_user_regs(struct pt_regs *regs,
951#endif 876#endif
952 877
953#ifdef CONFIG_PPC64 878#ifdef CONFIG_PPC64
954long compat_sys_rt_sigaction(int sig, const struct sigaction32 __user *act,
955 struct sigaction32 __user *oact, size_t sigsetsize)
956{
957 struct k_sigaction new_ka, old_ka;
958 int ret;
959
960 /* XXX: Don't preclude handling different sized sigset_t's. */
961 if (sigsetsize != sizeof(compat_sigset_t))
962 return -EINVAL;
963
964 if (act) {
965 compat_uptr_t handler;
966
967 ret = get_user(handler, &act->sa_handler);
968 new_ka.sa.sa_handler = compat_ptr(handler);
969 ret |= get_sigset_t(&new_ka.sa.sa_mask, &act->sa_mask);
970 ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
971 if (ret)
972 return -EFAULT;
973 }
974
975 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
976 if (!ret && oact) {
977 ret = put_user(to_user_ptr(old_ka.sa.sa_handler), &oact->sa_handler);
978 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask);
979 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
980 }
981 return ret;
982}
983
984/*
985 * Note: it is necessary to treat how as an unsigned int, with the
986 * corresponding cast to a signed int to insure that the proper
987 * conversion (sign extension) between the register representation
988 * of a signed int (msr in 32-bit mode) and the register representation
989 * of a signed int (msr in 64-bit mode) is performed.
990 */
991long compat_sys_rt_sigprocmask(u32 how, compat_sigset_t __user *set,
992 compat_sigset_t __user *oset, size_t sigsetsize)
993{
994 sigset_t s;
995 sigset_t __user *up;
996 int ret;
997 mm_segment_t old_fs = get_fs();
998
999 if (set) {
1000 if (get_sigset_t(&s, set))
1001 return -EFAULT;
1002 }
1003
1004 set_fs(KERNEL_DS);
1005 /* This is valid because of the set_fs() */
1006 up = (sigset_t __user *) &s;
1007 ret = sys_rt_sigprocmask((int)how, set ? up : NULL, oset ? up : NULL,
1008 sigsetsize);
1009 set_fs(old_fs);
1010 if (ret)
1011 return ret;
1012 if (oset) {
1013 if (put_sigset_t(oset, &s))
1014 return -EFAULT;
1015 }
1016 return 0;
1017}
1018
1019long compat_sys_rt_sigpending(compat_sigset_t __user *set, compat_size_t sigsetsize)
1020{
1021 sigset_t s;
1022 int ret;
1023 mm_segment_t old_fs = get_fs();
1024
1025 set_fs(KERNEL_DS);
1026 /* The __user pointer cast is valid because of the set_fs() */
1027 ret = sys_rt_sigpending((sigset_t __user *) &s, sigsetsize);
1028 set_fs(old_fs);
1029 if (!ret) {
1030 if (put_sigset_t(set, &s))
1031 return -EFAULT;
1032 }
1033 return ret;
1034}
1035
1036
1037int copy_siginfo_to_user32(struct compat_siginfo __user *d, siginfo_t *s) 879int copy_siginfo_to_user32(struct compat_siginfo __user *d, siginfo_t *s)
1038{ 880{
1039 int err; 881 int err;
@@ -1102,79 +944,6 @@ int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from)
1102 944
1103 return 0; 945 return 0;
1104} 946}
1105
1106/*
1107 * Note: it is necessary to treat pid and sig as unsigned ints, with the
1108 * corresponding cast to a signed int to insure that the proper conversion
1109 * (sign extension) between the register representation of a signed int
1110 * (msr in 32-bit mode) and the register representation of a signed int
1111 * (msr in 64-bit mode) is performed.
1112 */
1113long compat_sys_rt_sigqueueinfo(u32 pid, u32 sig, compat_siginfo_t __user *uinfo)
1114{
1115 siginfo_t info;
1116 int ret;
1117 mm_segment_t old_fs = get_fs();
1118
1119 ret = copy_siginfo_from_user32(&info, uinfo);
1120 if (unlikely(ret))
1121 return ret;
1122
1123 set_fs (KERNEL_DS);
1124 /* The __user pointer cast is valid becasuse of the set_fs() */
1125 ret = sys_rt_sigqueueinfo((int)pid, (int)sig, (siginfo_t __user *) &info);
1126 set_fs (old_fs);
1127 return ret;
1128}
1129/*
1130 * Start Alternate signal stack support
1131 *
1132 * System Calls
1133 * sigaltatck compat_sys_sigaltstack
1134 */
1135
1136int compat_sys_sigaltstack(u32 __new, u32 __old, int r5,
1137 int r6, int r7, int r8, struct pt_regs *regs)
1138{
1139 stack_32_t __user * newstack = compat_ptr(__new);
1140 stack_32_t __user * oldstack = compat_ptr(__old);
1141 stack_t uss, uoss;
1142 int ret;
1143 mm_segment_t old_fs;
1144 unsigned long sp;
1145 compat_uptr_t ss_sp;
1146
1147 /*
1148 * set sp to the user stack on entry to the system call
1149 * the system call router sets R9 to the saved registers
1150 */
1151 sp = regs->gpr[1];
1152
1153 /* Put new stack info in local 64 bit stack struct */
1154 if (newstack) {
1155 if (get_user(ss_sp, &newstack->ss_sp) ||
1156 __get_user(uss.ss_flags, &newstack->ss_flags) ||
1157 __get_user(uss.ss_size, &newstack->ss_size))
1158 return -EFAULT;
1159 uss.ss_sp = compat_ptr(ss_sp);
1160 }
1161
1162 old_fs = get_fs();
1163 set_fs(KERNEL_DS);
1164 /* The __user pointer casts are valid because of the set_fs() */
1165 ret = do_sigaltstack(
1166 newstack ? (stack_t __user *) &uss : NULL,
1167 oldstack ? (stack_t __user *) &uoss : NULL,
1168 sp);
1169 set_fs(old_fs);
1170 /* Copy the stack information to the user output buffer */
1171 if (!ret && oldstack &&
1172 (put_user(ptr_to_compat(uoss.ss_sp), &oldstack->ss_sp) ||
1173 __put_user(uoss.ss_flags, &oldstack->ss_flags) ||
1174 __put_user(uoss.ss_size, &oldstack->ss_size)))
1175 return -EFAULT;
1176 return ret;
1177}
1178#endif /* CONFIG_PPC64 */ 947#endif /* CONFIG_PPC64 */
1179 948
1180/* 949/*
@@ -1202,10 +971,7 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
1202 /* Put the siginfo & fill in most of the ucontext */ 971 /* Put the siginfo & fill in most of the ucontext */
1203 if (copy_siginfo_to_user(&rt_sf->info, info) 972 if (copy_siginfo_to_user(&rt_sf->info, info)
1204 || __put_user(0, &rt_sf->uc.uc_flags) 973 || __put_user(0, &rt_sf->uc.uc_flags)
1205 || __put_user(current->sas_ss_sp, &rt_sf->uc.uc_stack.ss_sp) 974 || __save_altstack(&rt_sf->uc.uc_stack, regs->gpr[1])
1206 || __put_user(sas_ss_flags(regs->gpr[1]),
1207 &rt_sf->uc.uc_stack.ss_flags)
1208 || __put_user(current->sas_ss_size, &rt_sf->uc.uc_stack.ss_size)
1209 || __put_user(to_user_ptr(&rt_sf->uc.uc_mcontext), 975 || __put_user(to_user_ptr(&rt_sf->uc.uc_mcontext),
1210 &rt_sf->uc.uc_regs) 976 &rt_sf->uc.uc_regs)
1211 || put_sigset_t(&rt_sf->uc.uc_sigmask, oldset)) 977 || put_sigset_t(&rt_sf->uc.uc_sigmask, oldset))
@@ -1494,14 +1260,11 @@ long sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
1494 * change it. -- paulus 1260 * change it. -- paulus
1495 */ 1261 */
1496#ifdef CONFIG_PPC64 1262#ifdef CONFIG_PPC64
1497 /* 1263 if (compat_restore_altstack(&rt_sf->uc.uc_stack))
1498 * We use the compat_sys_ version that does the 32/64 bits conversion 1264 goto bad;
1499 * and takes userland pointer directly. What about error checking ?
1500 * nobody does any...
1501 */
1502 compat_sys_sigaltstack((u32)(u64)&rt_sf->uc.uc_stack, 0, 0, 0, 0, 0, regs);
1503#else 1265#else
1504 do_sigaltstack(&rt_sf->uc.uc_stack, NULL, regs->gpr[1]); 1266 if (restore_altstack(&rt_sf->uc.uc_stack))
1267 goto bad;
1505#endif 1268#endif
1506 set_thread_flag(TIF_RESTOREALL); 1269 set_thread_flag(TIF_RESTOREALL);
1507 return 0; 1270 return 0;
@@ -1617,7 +1380,7 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
1617 * always done it up until now so it is probably better not to 1380 * always done it up until now so it is probably better not to
1618 * change it. -- paulus 1381 * change it. -- paulus
1619 */ 1382 */
1620 do_sigaltstack(&ctx->uc_stack, NULL, regs->gpr[1]); 1383 restore_altstack(&ctx->uc_stack);
1621 1384
1622 set_thread_flag(TIF_RESTOREALL); 1385 set_thread_flag(TIF_RESTOREALL);
1623 out: 1386 out:
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 7a76ee48a952..995f8543cb57 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -676,10 +676,8 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5,
676 if (restore_sigcontext(regs, NULL, 1, &uc->uc_mcontext)) 676 if (restore_sigcontext(regs, NULL, 1, &uc->uc_mcontext))
677 goto badframe; 677 goto badframe;
678 678
679 /* do_sigaltstack expects a __user pointer and won't modify 679 if (restore_altstack(&uc->uc_stack))
680 * what's in there anyway 680 goto badframe;
681 */
682 do_sigaltstack(&uc->uc_stack, NULL, regs->gpr[1]);
683 681
684 set_thread_flag(TIF_RESTOREALL); 682 set_thread_flag(TIF_RESTOREALL);
685 return 0; 683 return 0;
@@ -723,10 +721,7 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
723 721
724 /* Create the ucontext. */ 722 /* Create the ucontext. */
725 err |= __put_user(0, &frame->uc.uc_flags); 723 err |= __put_user(0, &frame->uc.uc_flags);
726 err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); 724 err |= __save_altstack(&frame->uc.uc_stack, regs->gpr[1]);
727 err |= __put_user(sas_ss_flags(regs->gpr[1]),
728 &frame->uc.uc_stack.ss_flags);
729 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
730#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 725#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
731 if (MSR_TM_ACTIVE(regs->msr)) { 726 if (MSR_TM_ACTIVE(regs->msr)) {
732 /* The ucontext_t passed to userland points to the second 727 /* The ucontext_t passed to userland points to the second
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 8a93778ed9f5..dbc44ba5b078 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -61,16 +61,6 @@ asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp,
61 return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x)); 61 return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x));
62} 62}
63 63
64/* Note: it is necessary to treat option as an unsigned int,
65 * with the corresponding cast to a signed int to insure that the
66 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
67 * and the register representation of a signed int (msr in 64-bit mode) is performed.
68 */
69asmlinkage long compat_sys_sysfs(u32 option, u32 arg1, u32 arg2)
70{
71 return sys_sysfs((int)option, arg1, arg2);
72}
73
74#ifdef CONFIG_SYSVIPC 64#ifdef CONFIG_SYSVIPC
75long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr, 65long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr,
76 u32 fifth) 66 u32 fifth)
@@ -156,125 +146,6 @@ asmlinkage long compat_sys_sendfile64_wrapper(u32 out_fd, u32 in_fd,
156 (off_t __user *)offset, count); 146 (off_t __user *)offset, count);
157} 147}
158 148
159/* Note: it is necessary to treat option as an unsigned int,
160 * with the corresponding cast to a signed int to insure that the
161 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
162 * and the register representation of a signed int (msr in 64-bit mode) is performed.
163 */
164asmlinkage long compat_sys_prctl(u32 option, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
165{
166 return sys_prctl((int)option,
167 (unsigned long) arg2,
168 (unsigned long) arg3,
169 (unsigned long) arg4,
170 (unsigned long) arg5);
171}
172
173/* Note: it is necessary to treat pid as an unsigned int,
174 * with the corresponding cast to a signed int to insure that the
175 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
176 * and the register representation of a signed int (msr in 64-bit mode) is performed.
177 */
178asmlinkage long compat_sys_sched_rr_get_interval_wrapper(u32 pid,
179 struct compat_timespec __user *interval)
180{
181 return compat_sys_sched_rr_get_interval((int)pid, interval);
182}
183
184/* Note: it is necessary to treat mode as an unsigned int,
185 * with the corresponding cast to a signed int to insure that the
186 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
187 * and the register representation of a signed int (msr in 64-bit mode) is performed.
188 */
189asmlinkage long compat_sys_access(const char __user * filename, u32 mode)
190{
191 return sys_access(filename, (int)mode);
192}
193
194
195/* Note: it is necessary to treat mode as an unsigned int,
196 * with the corresponding cast to a signed int to insure that the
197 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
198 * and the register representation of a signed int (msr in 64-bit mode) is performed.
199 */
200asmlinkage long compat_sys_creat(const char __user * pathname, u32 mode)
201{
202 return sys_creat(pathname, (int)mode);
203}
204
205
206/* Note: it is necessary to treat pid and options as unsigned ints,
207 * with the corresponding cast to a signed int to insure that the
208 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
209 * and the register representation of a signed int (msr in 64-bit mode) is performed.
210 */
211asmlinkage long compat_sys_waitpid(u32 pid, unsigned int __user * stat_addr, u32 options)
212{
213 return sys_waitpid((int)pid, stat_addr, (int)options);
214}
215
216
217/* Note: it is necessary to treat gidsetsize as an unsigned int,
218 * with the corresponding cast to a signed int to insure that the
219 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
220 * and the register representation of a signed int (msr in 64-bit mode) is performed.
221 */
222asmlinkage long compat_sys_getgroups(u32 gidsetsize, gid_t __user *grouplist)
223{
224 return sys_getgroups((int)gidsetsize, grouplist);
225}
226
227
228/* Note: it is necessary to treat pid as an unsigned int,
229 * with the corresponding cast to a signed int to insure that the
230 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
231 * and the register representation of a signed int (msr in 64-bit mode) is performed.
232 */
233asmlinkage long compat_sys_getpgid(u32 pid)
234{
235 return sys_getpgid((int)pid);
236}
237
238
239
240/* Note: it is necessary to treat pid as an unsigned int,
241 * with the corresponding cast to a signed int to insure that the
242 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
243 * and the register representation of a signed int (msr in 64-bit mode) is performed.
244 */
245asmlinkage long compat_sys_getsid(u32 pid)
246{
247 return sys_getsid((int)pid);
248}
249
250
251/* Note: it is necessary to treat pid and sig as unsigned ints,
252 * with the corresponding cast to a signed int to insure that the
253 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
254 * and the register representation of a signed int (msr in 64-bit mode) is performed.
255 */
256asmlinkage long compat_sys_kill(u32 pid, u32 sig)
257{
258 return sys_kill((int)pid, (int)sig);
259}
260
261
262/* Note: it is necessary to treat mode as an unsigned int,
263 * with the corresponding cast to a signed int to insure that the
264 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
265 * and the register representation of a signed int (msr in 64-bit mode) is performed.
266 */
267asmlinkage long compat_sys_mkdir(const char __user * pathname, u32 mode)
268{
269 return sys_mkdir(pathname, (int)mode);
270}
271
272long compat_sys_nice(u32 increment)
273{
274 /* sign extend increment */
275 return sys_nice((int)increment);
276}
277
278off_t ppc32_lseek(unsigned int fd, u32 offset, unsigned int origin) 149off_t ppc32_lseek(unsigned int fd, u32 offset, unsigned int origin)
279{ 150{
280 /* sign extend n */ 151 /* sign extend n */
@@ -293,172 +164,6 @@ long compat_sys_ftruncate(int fd, u32 length)
293 return sys_ftruncate(fd, (int)length); 164 return sys_ftruncate(fd, (int)length);
294} 165}
295 166
296/* Note: it is necessary to treat bufsiz as an unsigned int,
297 * with the corresponding cast to a signed int to insure that the
298 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
299 * and the register representation of a signed int (msr in 64-bit mode) is performed.
300 */
301asmlinkage long compat_sys_readlink(const char __user * path, char __user * buf, u32 bufsiz)
302{
303 return sys_readlink(path, buf, (int)bufsiz);
304}
305
306/* Note: it is necessary to treat option as an unsigned int,
307 * with the corresponding cast to a signed int to insure that the
308 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
309 * and the register representation of a signed int (msr in 64-bit mode) is performed.
310 */
311asmlinkage long compat_sys_sched_get_priority_max(u32 policy)
312{
313 return sys_sched_get_priority_max((int)policy);
314}
315
316
317/* Note: it is necessary to treat policy as an unsigned int,
318 * with the corresponding cast to a signed int to insure that the
319 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
320 * and the register representation of a signed int (msr in 64-bit mode) is performed.
321 */
322asmlinkage long compat_sys_sched_get_priority_min(u32 policy)
323{
324 return sys_sched_get_priority_min((int)policy);
325}
326
327
328/* Note: it is necessary to treat pid as an unsigned int,
329 * with the corresponding cast to a signed int to insure that the
330 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
331 * and the register representation of a signed int (msr in 64-bit mode) is performed.
332 */
333asmlinkage long compat_sys_sched_getparam(u32 pid, struct sched_param __user *param)
334{
335 return sys_sched_getparam((int)pid, param);
336}
337
338
339/* Note: it is necessary to treat pid as an unsigned int,
340 * with the corresponding cast to a signed int to insure that the
341 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
342 * and the register representation of a signed int (msr in 64-bit mode) is performed.
343 */
344asmlinkage long compat_sys_sched_getscheduler(u32 pid)
345{
346 return sys_sched_getscheduler((int)pid);
347}
348
349
350/* Note: it is necessary to treat pid as an unsigned int,
351 * with the corresponding cast to a signed int to insure that the
352 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
353 * and the register representation of a signed int (msr in 64-bit mode) is performed.
354 */
355asmlinkage long compat_sys_sched_setparam(u32 pid, struct sched_param __user *param)
356{
357 return sys_sched_setparam((int)pid, param);
358}
359
360
361/* Note: it is necessary to treat pid and policy as unsigned ints,
362 * with the corresponding cast to a signed int to insure that the
363 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
364 * and the register representation of a signed int (msr in 64-bit mode) is performed.
365 */
366asmlinkage long compat_sys_sched_setscheduler(u32 pid, u32 policy, struct sched_param __user *param)
367{
368 return sys_sched_setscheduler((int)pid, (int)policy, param);
369}
370
371
372/* Note: it is necessary to treat len as an unsigned int,
373 * with the corresponding cast to a signed int to insure that the
374 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
375 * and the register representation of a signed int (msr in 64-bit mode) is performed.
376 */
377asmlinkage long compat_sys_setdomainname(char __user *name, u32 len)
378{
379 return sys_setdomainname(name, (int)len);
380}
381
382
383/* Note: it is necessary to treat gidsetsize as an unsigned int,
384 * with the corresponding cast to a signed int to insure that the
385 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
386 * and the register representation of a signed int (msr in 64-bit mode) is performed.
387 */
388asmlinkage long compat_sys_setgroups(u32 gidsetsize, gid_t __user *grouplist)
389{
390 return sys_setgroups((int)gidsetsize, grouplist);
391}
392
393
394asmlinkage long compat_sys_sethostname(char __user *name, u32 len)
395{
396 /* sign extend len */
397 return sys_sethostname(name, (int)len);
398}
399
400
401/* Note: it is necessary to treat pid and pgid as unsigned ints,
402 * with the corresponding cast to a signed int to insure that the
403 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
404 * and the register representation of a signed int (msr in 64-bit mode) is performed.
405 */
406asmlinkage long compat_sys_setpgid(u32 pid, u32 pgid)
407{
408 return sys_setpgid((int)pid, (int)pgid);
409}
410
411long compat_sys_getpriority(u32 which, u32 who)
412{
413 /* sign extend which and who */
414 return sys_getpriority((int)which, (int)who);
415}
416
417long compat_sys_setpriority(u32 which, u32 who, u32 niceval)
418{
419 /* sign extend which, who and niceval */
420 return sys_setpriority((int)which, (int)who, (int)niceval);
421}
422
423long compat_sys_ioprio_get(u32 which, u32 who)
424{
425 /* sign extend which and who */
426 return sys_ioprio_get((int)which, (int)who);
427}
428
429long compat_sys_ioprio_set(u32 which, u32 who, u32 ioprio)
430{
431 /* sign extend which, who and ioprio */
432 return sys_ioprio_set((int)which, (int)who, (int)ioprio);
433}
434
435/* Note: it is necessary to treat newmask as an unsigned int,
436 * with the corresponding cast to a signed int to insure that the
437 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
438 * and the register representation of a signed int (msr in 64-bit mode) is performed.
439 */
440asmlinkage long compat_sys_ssetmask(u32 newmask)
441{
442 return sys_ssetmask((int) newmask);
443}
444
445asmlinkage long compat_sys_syslog(u32 type, char __user * buf, u32 len)
446{
447 /* sign extend len */
448 return sys_syslog(type, buf, (int)len);
449}
450
451
452/* Note: it is necessary to treat mask as an unsigned int,
453 * with the corresponding cast to a signed int to insure that the
454 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
455 * and the register representation of a signed int (msr in 64-bit mode) is performed.
456 */
457asmlinkage long compat_sys_umask(u32 mask)
458{
459 return sys_umask((int)mask);
460}
461
462unsigned long compat_sys_mmap2(unsigned long addr, size_t len, 167unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
463 unsigned long prot, unsigned long flags, 168 unsigned long prot, unsigned long flags,
464 unsigned long fd, unsigned long pgoff) 169 unsigned long fd, unsigned long pgoff)
@@ -467,12 +172,6 @@ unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
467 return sys_mmap(addr, len, prot, flags, fd, pgoff << 12); 172 return sys_mmap(addr, len, prot, flags, fd, pgoff << 12);
468} 173}
469 174
470long compat_sys_tgkill(u32 tgid, u32 pid, int sig)
471{
472 /* sign extend tgid, pid */
473 return sys_tgkill((int)tgid, (int)pid, sig);
474}
475
476/* 175/*
477 * long long munging: 176 * long long munging:
478 * The 32 bit ABI passes long longs in an odd even register pair. 177 * The 32 bit ABI passes long longs in an odd even register pair.