ARM: 7337/1: ptrace: fix ptrace_read_user for !CONFIG_MMU platforms

Commit 68b7f715 ("nommu: ptrace support") added definitions for
PT_TEXT_ADDR and friends, as well as adding ptrace support for reading
from these magic offsets.

Unfortunately, this has probably never worked, since ptrace_read_user
predicates reading on off < sizeof(struct user), returning -EIO
otherwise.

This patch moves the offset size check until after we have tried to
match it against either a magic value or an offset into pt_regs.

Cc: Paul Brook <paul@codesourcery.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Will Deacon 2012-02-21 12:29:03 +01:00 коммит произвёл Russell King
Родитель fa0d1dbf7f
Коммит 5a4f5da543
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -256,7 +256,7 @@ static int ptrace_read_user(struct task_struct *tsk, unsigned long off,
{ {
unsigned long tmp; unsigned long tmp;
if (off & 3 || off >= sizeof(struct user)) if (off & 3)
return -EIO; return -EIO;
tmp = 0; tmp = 0;
@ -268,6 +268,8 @@ static int ptrace_read_user(struct task_struct *tsk, unsigned long off,
tmp = tsk->mm->end_code; tmp = tsk->mm->end_code;
else if (off < sizeof(struct pt_regs)) else if (off < sizeof(struct pt_regs))
tmp = get_user_reg(tsk, off >> 2); tmp = get_user_reg(tsk, off >> 2);
else if (off >= sizeof(struct user))
return -EIO;
return put_user(tmp, ret); return put_user(tmp, ret);
} }