diff options
author | Dan Rosenberg <drosenberg@vsecurity.com> | 2011-07-25 17:11:53 -0700 |
---|---|---|
committer | Andi Kleen <ak@linux.intel.com> | 2011-08-01 13:55:00 -0700 |
commit | ef8b14b4fd36fbf79a7823b5741fa901755ee62d (patch) | |
tree | 17d7f205da9f675b939aa8b17655efb094988a74 | |
parent | 6b1ffd2fa340aca8687ec0d1795c0be19f72a29c (diff) |
xtensa: prevent arbitrary read in ptrace
[ upstream commit 0d0138ebe24b94065580bd2601f8bb7eb6152f56 ]
Prevent an arbitrary kernel read. Check the user pointer with access_ok()
before copying data in.
[akpm@linux-foundation.org: s/EIO/EFAULT/]
Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>
Cc: Christian Zankel <chris@zankel.net>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
-rw-r--r-- | arch/xtensa/kernel/ptrace.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c index 9d4e1ceb3f0..f0ccfc76346 100644 --- a/arch/xtensa/kernel/ptrace.c +++ b/arch/xtensa/kernel/ptrace.c @@ -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); |