2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1991, 1992 Linus Torvalds
7 * Copyright (C) 1994 - 2000, 2006 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
10 #include <linux/cache.h>
11 #include <linux/compat.h>
12 #include <linux/sched.h>
14 #include <linux/smp.h>
15 #include <linux/kernel.h>
16 #include <linux/signal.h>
17 #include <linux/syscalls.h>
18 #include <linux/errno.h>
19 #include <linux/wait.h>
20 #include <linux/ptrace.h>
21 #include <linux/suspend.h>
22 #include <linux/compiler.h>
23 #include <linux/uaccess.h>
27 #include <asm/compat-signal.h>
28 #include <linux/bitops.h>
29 #include <asm/cacheflush.h>
31 #include <asm/ucontext.h>
32 #include <asm/system.h>
36 #include "signal-common.h"
39 * Including <asm/unistd.h> would give use the 64-bit syscall numbers ...
41 #define __NR_O32_sigreturn 4119
42 #define __NR_O32_rt_sigreturn 4193
43 #define __NR_O32_restart_syscall 4253
45 /* 32-bit compatibility types */
47 typedef unsigned int __sighandler32_t
;
48 typedef void (*vfptr_t
)(void);
51 unsigned int sa_flags
;
52 __sighandler32_t sa_handler
;
53 compat_sigset_t sa_mask
;
56 /* IRIX compatible stack_t */
57 typedef struct sigaltstack32
{
59 compat_size_t ss_size
;
67 struct sigcontext32 uc_mcontext
;
68 compat_sigset_t uc_sigmask
; /* mask last for extensibility */
72 * Horribly complicated - with the bloody RM9000 workarounds enabled
73 * the signal trampolines is moving to the end of the structure so we can
74 * increase the alignment without breaking software compatibility.
76 #if ICACHE_REFILLS_WORKAROUND_WAR == 0
79 u32 sf_ass
[4]; /* argument save space for o32 */
80 u32 sf_code
[2]; /* signal trampoline */
81 struct sigcontext32 sf_sc
;
82 compat_sigset_t sf_mask
;
85 struct rt_sigframe32
{
86 u32 rs_ass
[4]; /* argument save space for o32 */
87 u32 rs_code
[2]; /* signal trampoline */
88 compat_siginfo_t rs_info
;
89 struct ucontext32 rs_uc
;
92 #else /* ICACHE_REFILLS_WORKAROUND_WAR */
95 u32 sf_ass
[4]; /* argument save space for o32 */
97 struct sigcontext32 sf_sc
; /* hw context */
98 compat_sigset_t sf_mask
;
99 u32 sf_code
[8] ____cacheline_aligned
; /* signal trampoline */
102 struct rt_sigframe32
{
103 u32 rs_ass
[4]; /* argument save space for o32 */
105 compat_siginfo_t rs_info
;
106 struct ucontext32 rs_uc
;
107 u32 rs_code
[8] __attribute__((aligned(32))); /* signal trampoline */
110 #endif /* !ICACHE_REFILLS_WORKAROUND_WAR */
113 * sigcontext handlers
115 static int protected_save_fp_context32(struct sigcontext32 __user
*sc
)
121 err
= save_fp_context32(sc
); /* this might fail */
125 /* touch the sigcontext and try again */
126 err
= __put_user(0, &sc
->sc_fpregs
[0]) |
127 __put_user(0, &sc
->sc_fpregs
[31]) |
128 __put_user(0, &sc
->sc_fpc_csr
);
130 break; /* really bad sigcontext */
135 static int protected_restore_fp_context32(struct sigcontext32 __user
*sc
)
141 err
= restore_fp_context32(sc
); /* this might fail */
145 /* touch the sigcontext and try again */
146 err
= __get_user(tmp
, &sc
->sc_fpregs
[0]) |
147 __get_user(tmp
, &sc
->sc_fpregs
[31]) |
148 __get_user(tmp
, &sc
->sc_fpc_csr
);
150 break; /* really bad sigcontext */
155 static int setup_sigcontext32(struct pt_regs
*regs
,
156 struct sigcontext32 __user
*sc
)
162 err
|= __put_user(regs
->cp0_epc
, &sc
->sc_pc
);
164 err
|= __put_user(0, &sc
->sc_regs
[0]);
165 for (i
= 1; i
< 32; i
++)
166 err
|= __put_user(regs
->regs
[i
], &sc
->sc_regs
[i
]);
168 err
|= __put_user(regs
->hi
, &sc
->sc_mdhi
);
169 err
|= __put_user(regs
->lo
, &sc
->sc_mdlo
);
171 err
|= __put_user(rddsp(DSP_MASK
), &sc
->sc_dsp
);
172 err
|= __put_user(mfhi1(), &sc
->sc_hi1
);
173 err
|= __put_user(mflo1(), &sc
->sc_lo1
);
174 err
|= __put_user(mfhi2(), &sc
->sc_hi2
);
175 err
|= __put_user(mflo2(), &sc
->sc_lo2
);
176 err
|= __put_user(mfhi3(), &sc
->sc_hi3
);
177 err
|= __put_user(mflo3(), &sc
->sc_lo3
);
180 used_math
= !!used_math();
181 err
|= __put_user(used_math
, &sc
->sc_used_math
);
185 * Save FPU state to signal context. Signal handler
186 * will "inherit" current FPU state.
188 err
|= protected_save_fp_context32(sc
);
194 check_and_restore_fp_context32(struct sigcontext32 __user
*sc
)
198 err
= sig
= fpcsr_pending(&sc
->sc_fpc_csr
);
201 err
|= protected_restore_fp_context32(sc
);
205 static int restore_sigcontext32(struct pt_regs
*regs
,
206 struct sigcontext32 __user
*sc
)
213 /* Always make any pending restarted system calls return -EINTR */
214 current_thread_info()->restart_block
.fn
= do_no_restart_syscall
;
216 err
|= __get_user(regs
->cp0_epc
, &sc
->sc_pc
);
217 err
|= __get_user(regs
->hi
, &sc
->sc_mdhi
);
218 err
|= __get_user(regs
->lo
, &sc
->sc_mdlo
);
220 err
|= __get_user(treg
, &sc
->sc_hi1
); mthi1(treg
);
221 err
|= __get_user(treg
, &sc
->sc_lo1
); mtlo1(treg
);
222 err
|= __get_user(treg
, &sc
->sc_hi2
); mthi2(treg
);
223 err
|= __get_user(treg
, &sc
->sc_lo2
); mtlo2(treg
);
224 err
|= __get_user(treg
, &sc
->sc_hi3
); mthi3(treg
);
225 err
|= __get_user(treg
, &sc
->sc_lo3
); mtlo3(treg
);
226 err
|= __get_user(treg
, &sc
->sc_dsp
); wrdsp(treg
, DSP_MASK
);
229 for (i
= 1; i
< 32; i
++)
230 err
|= __get_user(regs
->regs
[i
], &sc
->sc_regs
[i
]);
232 err
|= __get_user(used_math
, &sc
->sc_used_math
);
233 conditional_used_math(used_math
);
236 /* restore fpu context if we have used it before */
238 err
= check_and_restore_fp_context32(sc
);
240 /* signal handler may have used FPU. Give it up. */
250 extern void __put_sigset_unknown_nsig(void);
251 extern void __get_sigset_unknown_nsig(void);
253 static inline int put_sigset(const sigset_t
*kbuf
, compat_sigset_t __user
*ubuf
)
257 if (!access_ok(VERIFY_WRITE
, ubuf
, sizeof(*ubuf
)))
260 switch (_NSIG_WORDS
) {
262 __put_sigset_unknown_nsig();
264 err
|= __put_user (kbuf
->sig
[1] >> 32, &ubuf
->sig
[3]);
265 err
|= __put_user (kbuf
->sig
[1] & 0xffffffff, &ubuf
->sig
[2]);
267 err
|= __put_user (kbuf
->sig
[0] >> 32, &ubuf
->sig
[1]);
268 err
|= __put_user (kbuf
->sig
[0] & 0xffffffff, &ubuf
->sig
[0]);
274 static inline int get_sigset(sigset_t
*kbuf
, const compat_sigset_t __user
*ubuf
)
277 unsigned long sig
[4];
279 if (!access_ok(VERIFY_READ
, ubuf
, sizeof(*ubuf
)))
282 switch (_NSIG_WORDS
) {
284 __get_sigset_unknown_nsig();
286 err
|= __get_user (sig
[3], &ubuf
->sig
[3]);
287 err
|= __get_user (sig
[2], &ubuf
->sig
[2]);
288 kbuf
->sig
[1] = sig
[2] | (sig
[3] << 32);
290 err
|= __get_user (sig
[1], &ubuf
->sig
[1]);
291 err
|= __get_user (sig
[0], &ubuf
->sig
[0]);
292 kbuf
->sig
[0] = sig
[0] | (sig
[1] << 32);
299 * Atomically swap in the new signal mask, and wait for a signal.
302 asmlinkage
int sys32_sigsuspend(nabi_no_regargs
struct pt_regs regs
)
304 compat_sigset_t __user
*uset
;
307 uset
= (compat_sigset_t __user
*) regs
.regs
[4];
308 if (get_sigset(&newset
, uset
))
310 sigdelsetmask(&newset
, ~_BLOCKABLE
);
312 spin_lock_irq(¤t
->sighand
->siglock
);
313 current
->saved_sigmask
= current
->blocked
;
314 current
->blocked
= newset
;
316 spin_unlock_irq(¤t
->sighand
->siglock
);
318 current
->state
= TASK_INTERRUPTIBLE
;
320 set_thread_flag(TIF_RESTORE_SIGMASK
);
321 return -ERESTARTNOHAND
;
324 asmlinkage
int sys32_rt_sigsuspend(nabi_no_regargs
struct pt_regs regs
)
326 compat_sigset_t __user
*uset
;
330 /* XXX Don't preclude handling different sized sigset_t's. */
331 sigsetsize
= regs
.regs
[5];
332 if (sigsetsize
!= sizeof(compat_sigset_t
))
335 uset
= (compat_sigset_t __user
*) regs
.regs
[4];
336 if (get_sigset(&newset
, uset
))
338 sigdelsetmask(&newset
, ~_BLOCKABLE
);
340 spin_lock_irq(¤t
->sighand
->siglock
);
341 current
->saved_sigmask
= current
->blocked
;
342 current
->blocked
= newset
;
344 spin_unlock_irq(¤t
->sighand
->siglock
);
346 current
->state
= TASK_INTERRUPTIBLE
;
348 set_thread_flag(TIF_RESTORE_SIGMASK
);
349 return -ERESTARTNOHAND
;
352 asmlinkage
int sys32_sigaction(int sig
, const struct sigaction32 __user
*act
,
353 struct sigaction32 __user
*oact
)
355 struct k_sigaction new_ka
, old_ka
;
363 if (!access_ok(VERIFY_READ
, act
, sizeof(*act
)))
365 err
|= __get_user(handler
, &act
->sa_handler
);
366 new_ka
.sa
.sa_handler
= (void __user
*)(s64
)handler
;
367 err
|= __get_user(new_ka
.sa
.sa_flags
, &act
->sa_flags
);
368 err
|= __get_user(mask
, &act
->sa_mask
.sig
[0]);
372 siginitset(&new_ka
.sa
.sa_mask
, mask
);
375 ret
= do_sigaction(sig
, act
? &new_ka
: NULL
, oact
? &old_ka
: NULL
);
378 if (!access_ok(VERIFY_WRITE
, oact
, sizeof(*oact
)))
380 err
|= __put_user(old_ka
.sa
.sa_flags
, &oact
->sa_flags
);
381 err
|= __put_user((u32
)(u64
)old_ka
.sa
.sa_handler
,
383 err
|= __put_user(old_ka
.sa
.sa_mask
.sig
[0], oact
->sa_mask
.sig
);
384 err
|= __put_user(0, &oact
->sa_mask
.sig
[1]);
385 err
|= __put_user(0, &oact
->sa_mask
.sig
[2]);
386 err
|= __put_user(0, &oact
->sa_mask
.sig
[3]);
394 asmlinkage
int sys32_sigaltstack(nabi_no_regargs
struct pt_regs regs
)
396 const stack32_t __user
*uss
= (const stack32_t __user
*) regs
.regs
[4];
397 stack32_t __user
*uoss
= (stack32_t __user
*) regs
.regs
[5];
398 unsigned long usp
= regs
.regs
[29];
401 mm_segment_t old_fs
= get_fs();
405 if (!access_ok(VERIFY_READ
, uss
, sizeof(*uss
)))
407 err
|= __get_user(sp
, &uss
->ss_sp
);
408 kss
.ss_sp
= (void __user
*) (long) sp
;
409 err
|= __get_user(kss
.ss_size
, &uss
->ss_size
);
410 err
|= __get_user(kss
.ss_flags
, &uss
->ss_flags
);
416 ret
= do_sigaltstack(uss
? (stack_t __user
*)&kss
: NULL
,
417 uoss
? (stack_t __user
*)&koss
: NULL
, usp
);
421 if (!access_ok(VERIFY_WRITE
, uoss
, sizeof(*uoss
)))
423 sp
= (int) (unsigned long) koss
.ss_sp
;
424 err
|= __put_user(sp
, &uoss
->ss_sp
);
425 err
|= __put_user(koss
.ss_size
, &uoss
->ss_size
);
426 err
|= __put_user(koss
.ss_flags
, &uoss
->ss_flags
);
433 int copy_siginfo_to_user32(compat_siginfo_t __user
*to
, siginfo_t
*from
)
437 if (!access_ok (VERIFY_WRITE
, to
, sizeof(compat_siginfo_t
)))
440 /* If you change siginfo_t structure, please be sure
441 this code is fixed accordingly.
442 It should never copy any pad contained in the structure
443 to avoid security leaks, but must copy the generic
444 3 ints plus the relevant union member.
445 This routine must convert siginfo from 64bit to 32bit as well
447 err
= __put_user(from
->si_signo
, &to
->si_signo
);
448 err
|= __put_user(from
->si_errno
, &to
->si_errno
);
449 err
|= __put_user((short)from
->si_code
, &to
->si_code
);
450 if (from
->si_code
< 0)
451 err
|= __copy_to_user(&to
->_sifields
._pad
, &from
->_sifields
._pad
, SI_PAD_SIZE
);
453 switch (from
->si_code
>> 16) {
454 case __SI_TIMER
>> 16:
455 err
|= __put_user(from
->si_tid
, &to
->si_tid
);
456 err
|= __put_user(from
->si_overrun
, &to
->si_overrun
);
457 err
|= __put_user(from
->si_int
, &to
->si_int
);
459 case __SI_CHLD
>> 16:
460 err
|= __put_user(from
->si_utime
, &to
->si_utime
);
461 err
|= __put_user(from
->si_stime
, &to
->si_stime
);
462 err
|= __put_user(from
->si_status
, &to
->si_status
);
464 err
|= __put_user(from
->si_pid
, &to
->si_pid
);
465 err
|= __put_user(from
->si_uid
, &to
->si_uid
);
467 case __SI_FAULT
>> 16:
468 err
|= __put_user((unsigned long)from
->si_addr
, &to
->si_addr
);
470 case __SI_POLL
>> 16:
471 err
|= __put_user(from
->si_band
, &to
->si_band
);
472 err
|= __put_user(from
->si_fd
, &to
->si_fd
);
474 case __SI_RT
>> 16: /* This is not generated by the kernel as of now. */
475 case __SI_MESGQ
>> 16:
476 err
|= __put_user(from
->si_pid
, &to
->si_pid
);
477 err
|= __put_user(from
->si_uid
, &to
->si_uid
);
478 err
|= __put_user(from
->si_int
, &to
->si_int
);
485 asmlinkage
void sys32_sigreturn(nabi_no_regargs
struct pt_regs regs
)
487 struct sigframe32 __user
*frame
;
491 frame
= (struct sigframe32 __user
*) regs
.regs
[29];
492 if (!access_ok(VERIFY_READ
, frame
, sizeof(*frame
)))
494 if (__copy_conv_sigset_from_user(&blocked
, &frame
->sf_mask
))
497 sigdelsetmask(&blocked
, ~_BLOCKABLE
);
498 spin_lock_irq(¤t
->sighand
->siglock
);
499 current
->blocked
= blocked
;
501 spin_unlock_irq(¤t
->sighand
->siglock
);
503 sig
= restore_sigcontext32(®s
, &frame
->sf_sc
);
507 force_sig(sig
, current
);
510 * Don't let your children do this ...
512 __asm__
__volatile__(
520 force_sig(SIGSEGV
, current
);
523 asmlinkage
void sys32_rt_sigreturn(nabi_no_regargs
struct pt_regs regs
)
525 struct rt_sigframe32 __user
*frame
;
532 frame
= (struct rt_sigframe32 __user
*) regs
.regs
[29];
533 if (!access_ok(VERIFY_READ
, frame
, sizeof(*frame
)))
535 if (__copy_conv_sigset_from_user(&set
, &frame
->rs_uc
.uc_sigmask
))
538 sigdelsetmask(&set
, ~_BLOCKABLE
);
539 spin_lock_irq(¤t
->sighand
->siglock
);
540 current
->blocked
= set
;
542 spin_unlock_irq(¤t
->sighand
->siglock
);
544 sig
= restore_sigcontext32(®s
, &frame
->rs_uc
.uc_mcontext
);
548 force_sig(sig
, current
);
550 /* The ucontext contains a stack32_t, so we must convert! */
551 if (__get_user(sp
, &frame
->rs_uc
.uc_stack
.ss_sp
))
553 st
.ss_sp
= (void __user
*)(long) sp
;
554 if (__get_user(st
.ss_size
, &frame
->rs_uc
.uc_stack
.ss_size
))
556 if (__get_user(st
.ss_flags
, &frame
->rs_uc
.uc_stack
.ss_flags
))
559 /* It is more difficult to avoid calling this function than to
560 call it and ignore errors. */
563 do_sigaltstack((stack_t __user
*)&st
, NULL
, regs
.regs
[29]);
567 * Don't let your children do this ...
569 __asm__
__volatile__(
577 force_sig(SIGSEGV
, current
);
580 static int setup_frame_32(struct k_sigaction
* ka
, struct pt_regs
*regs
,
581 int signr
, sigset_t
*set
)
583 struct sigframe32 __user
*frame
;
586 frame
= get_sigframe(ka
, regs
, sizeof(*frame
));
587 if (!access_ok(VERIFY_WRITE
, frame
, sizeof (*frame
)))
590 err
|= install_sigtramp(frame
->sf_code
, __NR_O32_sigreturn
);
592 err
|= setup_sigcontext32(regs
, &frame
->sf_sc
);
593 err
|= __copy_conv_sigset_to_user(&frame
->sf_mask
, set
);
599 * Arguments to signal handler:
602 * a1 = 0 (should be cause)
603 * a2 = pointer to struct sigcontext
605 * $25 and c0_epc point to the signal handler, $29 points to the
608 regs
->regs
[ 4] = signr
;
610 regs
->regs
[ 6] = (unsigned long) &frame
->sf_sc
;
611 regs
->regs
[29] = (unsigned long) frame
;
612 regs
->regs
[31] = (unsigned long) frame
->sf_code
;
613 regs
->cp0_epc
= regs
->regs
[25] = (unsigned long) ka
->sa
.sa_handler
;
615 DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n",
616 current
->comm
, current
->pid
,
617 frame
, regs
->cp0_epc
, regs
->regs
[31]);
622 force_sigsegv(signr
, current
);
626 static int setup_rt_frame_32(struct k_sigaction
* ka
, struct pt_regs
*regs
,
627 int signr
, sigset_t
*set
, siginfo_t
*info
)
629 struct rt_sigframe32 __user
*frame
;
633 frame
= get_sigframe(ka
, regs
, sizeof(*frame
));
634 if (!access_ok(VERIFY_WRITE
, frame
, sizeof (*frame
)))
637 err
|= install_sigtramp(frame
->rs_code
, __NR_O32_rt_sigreturn
);
639 /* Convert (siginfo_t -> compat_siginfo_t) and copy to user. */
640 err
|= copy_siginfo_to_user32(&frame
->rs_info
, info
);
642 /* Create the ucontext. */
643 err
|= __put_user(0, &frame
->rs_uc
.uc_flags
);
644 err
|= __put_user(0, &frame
->rs_uc
.uc_link
);
645 sp
= (int) (long) current
->sas_ss_sp
;
646 err
|= __put_user(sp
,
647 &frame
->rs_uc
.uc_stack
.ss_sp
);
648 err
|= __put_user(sas_ss_flags(regs
->regs
[29]),
649 &frame
->rs_uc
.uc_stack
.ss_flags
);
650 err
|= __put_user(current
->sas_ss_size
,
651 &frame
->rs_uc
.uc_stack
.ss_size
);
652 err
|= setup_sigcontext32(regs
, &frame
->rs_uc
.uc_mcontext
);
653 err
|= __copy_conv_sigset_to_user(&frame
->rs_uc
.uc_sigmask
, set
);
659 * Arguments to signal handler:
662 * a1 = 0 (should be cause)
663 * a2 = pointer to ucontext
665 * $25 and c0_epc point to the signal handler, $29 points to
666 * the struct rt_sigframe32.
668 regs
->regs
[ 4] = signr
;
669 regs
->regs
[ 5] = (unsigned long) &frame
->rs_info
;
670 regs
->regs
[ 6] = (unsigned long) &frame
->rs_uc
;
671 regs
->regs
[29] = (unsigned long) frame
;
672 regs
->regs
[31] = (unsigned long) frame
->rs_code
;
673 regs
->cp0_epc
= regs
->regs
[25] = (unsigned long) ka
->sa
.sa_handler
;
675 DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n",
676 current
->comm
, current
->pid
,
677 frame
, regs
->cp0_epc
, regs
->regs
[31]);
682 force_sigsegv(signr
, current
);
687 * o32 compatibility on 64-bit kernels, without DSP ASE
689 struct mips_abi mips_abi_32
= {
690 .setup_frame
= setup_frame_32
,
691 .setup_rt_frame
= setup_rt_frame_32
,
692 .restart
= __NR_O32_restart_syscall
695 asmlinkage
int sys32_rt_sigaction(int sig
, const struct sigaction32 __user
*act
,
696 struct sigaction32 __user
*oact
,
697 unsigned int sigsetsize
)
699 struct k_sigaction new_sa
, old_sa
;
702 /* XXX: Don't preclude handling different sized sigset_t's. */
703 if (sigsetsize
!= sizeof(sigset_t
))
710 if (!access_ok(VERIFY_READ
, act
, sizeof(*act
)))
712 err
|= __get_user(handler
, &act
->sa_handler
);
713 new_sa
.sa
.sa_handler
= (void __user
*)(s64
)handler
;
714 err
|= __get_user(new_sa
.sa
.sa_flags
, &act
->sa_flags
);
715 err
|= get_sigset(&new_sa
.sa
.sa_mask
, &act
->sa_mask
);
720 ret
= do_sigaction(sig
, act
? &new_sa
: NULL
, oact
? &old_sa
: NULL
);
725 if (!access_ok(VERIFY_WRITE
, oact
, sizeof(*oact
)))
728 err
|= __put_user((u32
)(u64
)old_sa
.sa
.sa_handler
,
730 err
|= __put_user(old_sa
.sa
.sa_flags
, &oact
->sa_flags
);
731 err
|= put_sigset(&old_sa
.sa
.sa_mask
, &oact
->sa_mask
);
739 asmlinkage
int sys32_rt_sigprocmask(int how
, compat_sigset_t __user
*set
,
740 compat_sigset_t __user
*oset
, unsigned int sigsetsize
)
742 sigset_t old_set
, new_set
;
744 mm_segment_t old_fs
= get_fs();
746 if (set
&& get_sigset(&new_set
, set
))
750 ret
= sys_rt_sigprocmask(how
, set
? (sigset_t __user
*)&new_set
: NULL
,
751 oset
? (sigset_t __user
*)&old_set
: NULL
,
755 if (!ret
&& oset
&& put_sigset(&old_set
, oset
))
761 asmlinkage
int sys32_rt_sigpending(compat_sigset_t __user
*uset
,
762 unsigned int sigsetsize
)
766 mm_segment_t old_fs
= get_fs();
769 ret
= sys_rt_sigpending((sigset_t __user
*)&set
, sigsetsize
);
772 if (!ret
&& put_sigset(&set
, uset
))
778 asmlinkage
int sys32_rt_sigqueueinfo(int pid
, int sig
, compat_siginfo_t __user
*uinfo
)
782 mm_segment_t old_fs
= get_fs();
784 if (copy_from_user (&info
, uinfo
, 3*sizeof(int)) ||
785 copy_from_user (info
._sifields
._pad
, uinfo
->_sifields
._pad
, SI_PAD_SIZE
))
788 ret
= sys_rt_sigqueueinfo(pid
, sig
, (siginfo_t __user
*)&info
);
794 sys32_waitid(int which
, compat_pid_t pid
,
795 compat_siginfo_t __user
*uinfo
, int options
,
796 struct compat_rusage __user
*uru
)
801 mm_segment_t old_fs
= get_fs();
805 ret
= sys_waitid(which
, pid
, (siginfo_t __user
*) &info
, options
,
806 uru
? (struct rusage __user
*) &ru
: NULL
);
809 if (ret
< 0 || info
.si_signo
== 0)
812 if (uru
&& (ret
= put_compat_rusage(&ru
, uru
)))
815 BUG_ON(info
.si_code
& __SI_MASK
);
816 info
.si_code
|= __SI_CHLD
;
817 return copy_siginfo_to_user32(uinfo
, &info
);