RISC-V: Fix PTRACE_SETREGSET bug.
Subsystems (2)
PATCH 1/1 RISC-V: Fix PTRACE_SETREGSET bug.
In riscv_gpr_set, pass regs instead of ®s 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
@@ -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, ®s,0 ,-1 ); + ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, regs,0 ,-1 );return ret; }
Signature · 1 line
2.17.1
Quoted 13 lines · Jim Wilson
In
riscv_gpr_set, pass regs instead of ®s touser_regset_copyinto fix gdb segfault.Signed-off-by Jim Wilson <[email protected]>--- arch/riscv/kernel/ptrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/kernel/ptrace.c +0
-0
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, ®s,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!
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