All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: ptrace: fix ptrace_read_user for !CONFIG_MMU platforms
@ 2012-02-20 18:37 Will Deacon
  2012-02-20 19:46 ` Russell King - ARM Linux
  0 siblings, 1 reply; 14+ messages in thread
From: Will Deacon @ 2012-02-20 18:37 UTC (permalink / raw)
  To: linux-arm-kernel

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 -EOI
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>
---
 arch/arm/kernel/ptrace.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index e33870f..b68b52b 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -256,7 +256,7 @@ static int ptrace_read_user(struct task_struct *tsk, unsigned long off,
 {
 	unsigned long tmp;
 
-	if (off & 3 || off >= sizeof(struct user))
+	if (off & 3)
 		return -EIO;
 
 	tmp = 0;
@@ -268,6 +268,8 @@ static int ptrace_read_user(struct task_struct *tsk, unsigned long off,
 		tmp = tsk->mm->end_code;
 	else if (off < sizeof(struct pt_regs))
 		tmp = get_user_reg(tsk, off >> 2);
+	else if (off >= sizeof(struct user))
+		return -EIO;
 
 	return put_user(tmp, ret);
 }
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-03-26 12:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-20 18:37 [PATCH] ARM: ptrace: fix ptrace_read_user for !CONFIG_MMU platforms Will Deacon
2012-02-20 19:46 ` Russell King - ARM Linux
2012-02-21  1:24   ` Paul Brook
2012-02-21  8:36     ` Russell King - ARM Linux
2012-02-21 10:00       ` Will Deacon
2012-02-21 10:10         ` Russell King - ARM Linux
2012-02-21 10:52           ` Will Deacon
2012-02-21 11:35             ` Russell King - ARM Linux
2012-02-21 13:22               ` Will Deacon
2012-02-24 14:36                 ` Will Deacon
2012-02-24 18:16                   ` Russell King - ARM Linux
2012-02-29 18:52                     ` Will Deacon
2012-03-26 12:43                       ` Will Deacon
2012-02-22  1:33           ` Greg Ungerer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.