Skip to contentSkip to conversation

small ptrace fixes

PATCH Applied Sven Schnelle 2 participants 4 messages Apr 4, 2019

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

cover small ptrace fixes

Hi,

while working on kprobes i found two small issues in ptrace.h.

Sven Schnelle (2):
parisc: regs_return_value() should return gpr28
parisc: also set iaoq_b in instruction_pointer_set()

 arch/parisc/include/asm/ptrace.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/2 parisc: regs_return_value() should return gpr28

While working on kretprobes for PA-RISC i was wondering while the kprobes sanity test always fails on kretprobes. This is caused by returning gpr20 instead of gpr28.

---
 arch/parisc/include/asm/ptrace.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/include/asm/ptrace.h +1 -1
index 2a27b275ab09..4a87b3d600c6 100644
@@ -22,7 +22,7 @@ unsigned long profile_pc(struct pt_regs *);
 
 static inline unsigned long regs_return_value(struct pt_regs *regs)
 {
-	return regs->gr[20];
+	return regs->gr[28];
 }
 
 static inline void instruction_pointer_set(struct pt_regs *regs,
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/2 parisc: also set iaoq_b in instruction_pointer_set()

In reply to Sven Schnelle

When setting the instruction pointer on PA-RISC we also need to set the back of the instruction queue to the new offset, otherwise we will execute on instruction from the new location, and jumping back to the old location stored in iaoq_b.

---
 arch/parisc/include/asm/ptrace.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/parisc/include/asm/ptrace.h +2 -1
index 4a87b3d600c6..9ff033d261ab 100644
@@ -28,7 +28,8 @@ static inline unsigned long regs_return_value(struct pt_regs *regs)
 static inline void instruction_pointer_set(struct pt_regs *regs,
 						unsigned long val)
 {
-        regs->iaoq[0] = val;
+	regs->iaoq[0] = val;
+	regs->iaoq[1] = val + 4;
 }
 
 /* Query offset/name of register from its name/offset */
Signature · 1 line
2.20.1
maintainer Applied
#3 lore raw
In reply to Sven Schnelle
Quoted 8 lines · Sven Schnelle

while working on kprobes i found two small issues in ptrace.h.

Sven Schnelle (2):
parisc: regs_return_value() should return gpr28
parisc: also set iaoq_b in instruction_pointer_set()

 arch/parisc/include/asm/ptrace.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Thanks, applied to my for-next tree.

Helge