vserver 2.0 rc7
[linux-2.6.git] / arch / ppc / kernel / signal.c
index 4b8b96d..7c8437d 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/elf.h>
 #include <linux/tty.h>
 #include <linux/binfmts.h>
+#include <linux/suspend.h>
 #include <asm/ucontext.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -118,7 +119,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
 
        if (act) {
                old_sigset_t mask;
-               if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
+               if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
                    __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
                    __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
                        return -EFAULT;
@@ -130,7 +131,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
        ret = do_sigaction(sig, (act? &new_ka: NULL), (oact? &old_ka: NULL));
 
        if (!ret && oact) {
-               if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) ||
+               if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
                    __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
                    __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
                        return -EFAULT;
@@ -376,7 +377,7 @@ handle_rt_signal(unsigned long sig, struct k_sigaction *ka,
        /* create a stack frame for the caller of the handler */
        newsp -= __SIGNAL_FRAMESIZE + 16;
 
-       if (verify_area(VERIFY_WRITE, (void __user *) newsp, origsp - newsp))
+       if (!access_ok(VERIFY_WRITE, (void __user *) newsp, origsp - newsp))
                goto badframe;
 
        /* Put the siginfo & fill in most of the ucontext */
@@ -445,7 +446,7 @@ int sys_swapcontext(struct ucontext __user *old_ctx,
                return -EINVAL;
 
        if (old_ctx != NULL) {
-               if (verify_area(VERIFY_WRITE, old_ctx, sizeof(*old_ctx))
+               if (!access_ok(VERIFY_WRITE, old_ctx, sizeof(*old_ctx))
                    || save_user_regs(regs, &old_ctx->uc_mcontext, 0)
                    || __copy_to_user(&old_ctx->uc_sigmask,
                                      &current->blocked, sizeof(sigset_t))
@@ -454,7 +455,7 @@ int sys_swapcontext(struct ucontext __user *old_ctx,
        }
        if (new_ctx == NULL)
                return 0;
-       if (verify_area(VERIFY_READ, new_ctx, sizeof(*new_ctx))
+       if (!access_ok(VERIFY_READ, new_ctx, sizeof(*new_ctx))
            || __get_user(tmp, (u8 __user *) new_ctx)
            || __get_user(tmp, (u8 __user *) (new_ctx + 1) - 1))
                return -EFAULT;
@@ -464,7 +465,7 @@ int sys_swapcontext(struct ucontext __user *old_ctx,
         * image of the user's registers, we can't just return -EFAULT
         * because the user's registers will be corrupted.  For instance
         * the NIP value may have been updated but not some of the
-        * other registers.  Given that we have done the verify_area
+        * other registers.  Given that we have done the access_ok
         * and successfully read the first and last bytes of the region
         * above, this should only happen in an out-of-memory situation
         * or if another thread unmaps the region containing the context.
@@ -487,7 +488,7 @@ int sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
 
        rt_sf = (struct rt_sigframe __user *)
                (regs->gpr[1] + __SIGNAL_FRAMESIZE + 16);
-       if (verify_area(VERIFY_READ, rt_sf, sizeof(struct rt_sigframe)))
+       if (!access_ok(VERIFY_READ, rt_sf, sizeof(struct rt_sigframe)))
                goto bad;
        if (do_setcontext(&rt_sf->uc, regs, 1))
                goto bad;
@@ -510,7 +511,7 @@ int sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
 }
 
 int sys_debug_setcontext(struct ucontext __user *ctx,
-                        int ndbg, struct sig_dbg_op *dbg,
+                        int ndbg, struct sig_dbg_op __user *dbg,
                         int r6, int r7, int r8,
                         struct pt_regs *regs)
 {
@@ -572,7 +573,7 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
         * image of the user's registers, we can't just return -EFAULT
         * because the user's registers will be corrupted.  For instance
         * the NIP value may have been updated but not some of the
-        * other registers.  Given that we have done the verify_area
+        * other registers.  Given that we have done the access_ok
         * and successfully read the first and last bytes of the region
         * above, this should only happen in an out-of-memory situation
         * or if another thread unmaps the region containing the context.
@@ -622,7 +623,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
        /* create a stack frame for the caller of the handler */
        newsp -= __SIGNAL_FRAMESIZE;
 
-       if (verify_area(VERIFY_WRITE, (void __user *) newsp, origsp - newsp))
+       if (!access_ok(VERIFY_WRITE, (void __user *) newsp, origsp - newsp))
                goto badframe;
 
 #if _NSIG != 64
@@ -631,7 +632,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
        if (__put_user((unsigned long) ka->sa.sa_handler, &sc->handler)
            || __put_user(oldset->sig[0], &sc->oldmask)
            || __put_user(oldset->sig[1], &sc->_unused[3])
-           || __put_user((struct pt_regs *)frame, &sc->regs)
+           || __put_user((struct pt_regs __user *)frame, &sc->regs)
            || __put_user(sig, &sc->signal))
                goto badframe;
 
@@ -680,7 +681,7 @@ int sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
        restore_sigmask(&set);
 
        sr = (struct mcontext __user *) sigctx.regs;
-       if (verify_area(VERIFY_READ, sr, sizeof(*sr))
+       if (!access_ok(VERIFY_READ, sr, sizeof(*sr))
            || restore_user_regs(regs, sr, 1))
                goto badframe;
 
@@ -704,13 +705,20 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
        unsigned long frame, newsp;
        int signr, ret;
 
+       if (current->flags & PF_FREEZE) {
+               refrigerator(PF_FREEZE);
+               signr = 0;
+               if (!signal_pending(current))
+                       goto no_signal;
+       }
+
        if (!oldset)
                oldset = &current->blocked;
 
        newsp = frame = 0;
 
        signr = get_signal_to_deliver(&info, &ka, regs, NULL);
-
+ no_signal:
        if (TRAP(regs) == 0x0C00                /* System Call! */
            && regs->ccr & 0x10000000           /* error signalled */
            && ((ret = regs->gpr[3]) == ERESTARTSYS