Skip to contentSkip to conversation

RISC-V: Fix PTRACE_SETREGSET bug.

PATCH In review Jim Wilson 2 participants 3 messages Jun 11, 2018 – Jun 12, 2018

Subsystems (2)
lore
Share & tools
lore

Jim Wilson

author
#0 lore raw

PATCH 1/1 RISC-V: Fix PTRACE_SETREGSET bug.

In riscv_gpr_set, pass regs instead of &regs to user_regset_copyin to fix gdb segfault.

---
 arch/riscv/kernel/ptrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/ptrace.c +1 -1
index ba3e80712797..9f82a7e34c64 100644
@@ -50,7 +50,7 @@ static int riscv_gpr_set(struct task_struct *target,
 	struct pt_regs *regs;
 
 	regs = task_pt_regs(target);
-	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &regs, 0, -1);
+	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, regs, 0, -1);
 	return ret;
 }
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 13 lines · Jim Wilson

In riscv_gpr_set, pass regs instead of &regs to user_regset_copyin to fix gdb segfault.

---
 arch/riscv/kernel/ptrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/ptrace.c +0 -0
index ba3e80712797..9f82a7e34c64 100644

arch/riscv/kernel/ptrace.c static int riscv_gpr_set(struct task_struct *target, · line 55

Quoted 7 lines
arch/riscv/kernel/ptrace.c +1 -1
@@ -50,7 +50,7 @@ static int riscv_gpr_set(struct task_struct *target,
 	struct pt_regs *regs;
 
 	regs = task_pt_regs(target);
-	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &regs, 0, -1);
+	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, regs, 0, -1);
 	return ret;
 }

Whoops, that's embarassing :). I poked around and didn't see this anywhere else, so I'm not sure where we managed to obtain this particular pathology.

Thanks for the patch!

author
#2 lore raw
Quoted 2 lines · Palmer Dabbelt

Whoops, that's embarassing :). I poked around and didn't see this anywhere else, so I'm not sure where we managed to obtain this particular pathology.

Comment say it was copied from tile which I think was just recently removed. But looking at older copy, tile has "struct pt_regs regs" whereas riscv has "struct pt_regs *regs" and so tile needed the & and riscv does not, but only one of the two ampersands was removed in the riscv port. My patch removes the other one.

Jim