Skip to contentSkip to conversation

ARM: ptrace: fix register indexing in GETHBPREGS request

PATCH New Will Deacon 1 participant 1 message Feb 22, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: ptrace: fix register indexing in GETHBPREGS request

The GETHBPREGS ptrace request incorrectly maps its index argument onto the thread's saved debug state when the index != 0. This has not yet been seen from userspace because GDB (the only user of this request) only reads from register 0.

This patch fixes the indexing.

---
 arch/arm/kernel/ptrace.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/kernel/ptrace.c +3 -3
index eace844..2bf27f3 100644
@@ -615,10 +615,10 @@ static int ptrace_gethbpregs(struct task_struct *tsk, long num,
 		while (!(arch_ctrl.len & 0x1))
 			arch_ctrl.len >>= 1;
 
-		if (idx & 0x1)
-			reg = encode_ctrl_reg(arch_ctrl);
-		else
+		if (num & 0x1)
 			reg = bp->attr.bp_addr;
+		else
+			reg = encode_ctrl_reg(arch_ctrl);
 	}
 
 put:
Signature · 1 line
1.7.0.4