xtensa: prevent arbitrary read in ptrace
authorDan Rosenberg <[email protected]>
Tue, 26 Jul 2011 00:11:53 +0000 (17:11 -0700)
committerLinus Torvalds <[email protected]>
Tue, 26 Jul 2011 03:57:07 +0000 (20:57 -0700)
Prevent an arbitrary kernel read.  Check the user pointer with access_ok()
before copying data in.

[[email protected]: s/EIO/EFAULT/]
Signed-off-by: Dan Rosenberg <[email protected]>
Cc: Christian Zankel <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
arch/xtensa/kernel/ptrace.c

index c72c9473ef9913f9666ff54f869fe35fdfd27509..a0d042aa296755e441fe4266a7103b315a581a34 100644 (file)
@@ -147,6 +147,9 @@ int ptrace_setxregs(struct task_struct *child, void __user *uregs)
        elf_xtregs_t *xtregs = uregs;
        int ret = 0;
 
+       if (!access_ok(VERIFY_READ, uregs, sizeof(elf_xtregs_t)))
+               return -EFAULT;
+
 #if XTENSA_HAVE_COPROCESSORS
        /* Flush all coprocessors before we overwrite them. */
        coprocessor_flush_all(ti);