[PATCH 09/11] Get rid of verify_area() - arch/ppc/, arch/ppc64/, arch/m68k/, arch/m68knommu/.

[PATCH 09/11] Get rid of verify_area() - arch/ppc/, arch/ppc64/, arch/m68k/, arch/m68knommu/.

Post by Jesper Juh » Wed, 19 Jan 2005 11:10:09


Convert a bunch of verify_area()'s to access_ok().
arch/ppc/, arch/ppc64/, arch/m68k/, arch/m68knommu/.


Signed-off-by: Jesper Juhl < XXXX@XXXXX.COM >

--- linux-2.6.11-rc1-bk4-orig/arch/ppc/kernel/signal.c 2005-01-12 23:26:02.000000000 +0100
+++ linux-2.6.11-rc1-bk4/arch/ppc/kernel/signal.c 2005-01-16 22:23:08.000000000 +0100
@@ -118,7 +118,7 @@ sys_sigaction(int sig, const struct old_

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 +130,7 @@ sys_sigaction(int sig, const struct old_
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 +376,7 @@ handle_rt_signal(unsigned long sig, stru
/* 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 +445,7 @@ int sys_swapcontext(struct ucontext __us
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,
¤t->blocked, sizeof(sigset_t))
@@ -454,7 +454,7 @@ int sys_swapcontext(struct ucontext __us
}
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 +464,7 @@ int sys_swapcontext(struct ucontext __us
* 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 +487,7 @@ int sys_rt_sigreturn(int r3, int r4, int

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;
@@ -572,7 +572,7 @@ int sys_debug_setcontext(struct ucontext
* 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.