aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
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/kernel
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/kernel')
-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
5 files changed, 12 insertions, 586 deletions
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.