aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/ia32/sys_ia32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/ia32/sys_ia32.c')
-rw-r--r--arch/x86/ia32/sys_ia32.c171
1 files changed, 0 insertions, 171 deletions
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index d0b689ba7be2..592f5a9a9c0e 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -172,183 +172,12 @@ asmlinkage long sys32_mprotect(unsigned long start, size_t len,
172 return sys_mprotect(start, len, prot); 172 return sys_mprotect(start, len, prot);
173} 173}
174 174
175asmlinkage long sys32_rt_sigaction(int sig, struct sigaction32 __user *act,
176 struct sigaction32 __user *oact,
177 unsigned int sigsetsize)
178{
179 struct k_sigaction new_ka, old_ka;
180 int ret;
181 compat_sigset_t set32;
182
183 /* XXX: Don't preclude handling different sized sigset_t's. */
184 if (sigsetsize != sizeof(compat_sigset_t))
185 return -EINVAL;
186
187 if (act) {
188 compat_uptr_t handler, restorer;
189
190 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
191 __get_user(handler, &act->sa_handler) ||
192 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
193 __get_user(restorer, &act->sa_restorer) ||
194 __copy_from_user(&set32, &act->sa_mask,
195 sizeof(compat_sigset_t)))
196 return -EFAULT;
197 new_ka.sa.sa_handler = compat_ptr(handler);
198 new_ka.sa.sa_restorer = compat_ptr(restorer);
199
200 /*
201 * FIXME: here we rely on _COMPAT_NSIG_WORS to be >=
202 * than _NSIG_WORDS << 1
203 */
204 switch (_NSIG_WORDS) {
205 case 4: new_ka.sa.sa_mask.sig[3] = set32.sig[6]
206 | (((long)set32.sig[7]) << 32);
207 case 3: new_ka.sa.sa_mask.sig[2] = set32.sig[4]
208 | (((long)set32.sig[5]) << 32);
209 case 2: new_ka.sa.sa_mask.sig[1] = set32.sig[2]
210 | (((long)set32.sig[3]) << 32);
211 case 1: new_ka.sa.sa_mask.sig[0] = set32.sig[0]
212 | (((long)set32.sig[1]) << 32);
213 }
214 }
215
216 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
217
218 if (!ret && oact) {
219 /*
220 * FIXME: here we rely on _COMPAT_NSIG_WORS to be >=
221 * than _NSIG_WORDS << 1
222 */
223 switch (_NSIG_WORDS) {
224 case 4:
225 set32.sig[7] = (old_ka.sa.sa_mask.sig[3] >> 32);
226 set32.sig[6] = old_ka.sa.sa_mask.sig[3];
227 case 3:
228 set32.sig[5] = (old_ka.sa.sa_mask.sig[2] >> 32);
229 set32.sig[4] = old_ka.sa.sa_mask.sig[2];
230 case 2:
231 set32.sig[3] = (old_ka.sa.sa_mask.sig[1] >> 32);
232 set32.sig[2] = old_ka.sa.sa_mask.sig[1];
233 case 1:
234 set32.sig[1] = (old_ka.sa.sa_mask.sig[0] >> 32);
235 set32.sig[0] = old_ka.sa.sa_mask.sig[0];
236 }
237 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
238 __put_user(ptr_to_compat(old_ka.sa.sa_handler),
239 &oact->sa_handler) ||
240 __put_user(ptr_to_compat(old_ka.sa.sa_restorer),
241 &oact->sa_restorer) ||
242 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
243 __copy_to_user(&oact->sa_mask, &set32,
244 sizeof(compat_sigset_t)))
245 return -EFAULT;
246 }
247
248 return ret;
249}
250
251asmlinkage long sys32_sigaction(int sig, struct old_sigaction32 __user *act,
252 struct old_sigaction32 __user *oact)
253{
254 struct k_sigaction new_ka, old_ka;
255 int ret;
256
257 if (act) {
258 compat_old_sigset_t mask;
259 compat_uptr_t handler, restorer;
260
261 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
262 __get_user(handler, &act->sa_handler) ||
263 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
264 __get_user(restorer, &act->sa_restorer) ||
265 __get_user(mask, &act->sa_mask))
266 return -EFAULT;
267
268 new_ka.sa.sa_handler = compat_ptr(handler);
269 new_ka.sa.sa_restorer = compat_ptr(restorer);
270
271 siginitset(&new_ka.sa.sa_mask, mask);
272 }
273
274 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
275
276 if (!ret && oact) {
277 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
278 __put_user(ptr_to_compat(old_ka.sa.sa_handler),
279 &oact->sa_handler) ||
280 __put_user(ptr_to_compat(old_ka.sa.sa_restorer),
281 &oact->sa_restorer) ||
282 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
283 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
284 return -EFAULT;
285 }
286
287 return ret;
288}
289
290asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int __user *stat_addr, 175asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int __user *stat_addr,
291 int options) 176 int options)
292{ 177{
293 return compat_sys_wait4(pid, stat_addr, options, NULL); 178 return compat_sys_wait4(pid, stat_addr, options, NULL);
294} 179}
295 180
296/* 32-bit timeval and related flotsam. */
297
298asmlinkage long sys32_sched_rr_get_interval(compat_pid_t pid,
299 struct compat_timespec __user *interval)
300{
301 struct timespec t;
302 int ret;
303 mm_segment_t old_fs = get_fs();
304
305 set_fs(KERNEL_DS);
306 ret = sys_sched_rr_get_interval(pid, (struct timespec __user *)&t);
307 set_fs(old_fs);
308 if (put_compat_timespec(&t, interval))
309 return -EFAULT;
310 return ret;
311}
312
313asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *set,
314 compat_size_t sigsetsize)
315{
316 sigset_t s;
317 compat_sigset_t s32;
318 int ret;
319 mm_segment_t old_fs = get_fs();
320
321 set_fs(KERNEL_DS);
322 ret = sys_rt_sigpending((sigset_t __user *)&s, sigsetsize);
323 set_fs(old_fs);
324 if (!ret) {
325 switch (_NSIG_WORDS) {
326 case 4: s32.sig[7] = (s.sig[3] >> 32); s32.sig[6] = s.sig[3];
327 case 3: s32.sig[5] = (s.sig[2] >> 32); s32.sig[4] = s.sig[2];
328 case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1];
329 case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0];
330 }
331 if (copy_to_user(set, &s32, sizeof(compat_sigset_t)))
332 return -EFAULT;
333 }
334 return ret;
335}
336
337asmlinkage long sys32_rt_sigqueueinfo(int pid, int sig,
338 compat_siginfo_t __user *uinfo)
339{
340 siginfo_t info;
341 int ret;
342 mm_segment_t old_fs = get_fs();
343
344 if (copy_siginfo_from_user32(&info, uinfo))
345 return -EFAULT;
346 set_fs(KERNEL_DS);
347 ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *)&info);
348 set_fs(old_fs);
349 return ret;
350}
351
352/* warning: next two assume little endian */ 181/* warning: next two assume little endian */
353asmlinkage long sys32_pread(unsigned int fd, char __user *ubuf, u32 count, 182asmlinkage long sys32_pread(unsigned int fd, char __user *ubuf, u32 count,
354 u32 poslo, u32 poshi) 183 u32 poslo, u32 poshi)