mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Fix PTRACE_SETREGSET bug.
@ 2018-06-11 21:48 Jim Wilson
  2018-06-12  0:46 ` Palmer Dabbelt
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Wilson @ 2018-06-11 21:48 UTC (permalink / raw)
  To: linux-riscv; +Cc: jimw, Oleg Nesterov, Palmer Dabbelt, Albert Ou, linux-kernel

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

Signed-off-by: Jim Wilson <jimw@sifive.com>
---
 arch/riscv/kernel/ptrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c
index ba3e80712797..9f82a7e34c64 100644
--- a/arch/riscv/kernel/ptrace.c
+++ b/arch/riscv/kernel/ptrace.c
@@ -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;
 }
 
-- 
2.17.1


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

* Re: [PATCH] RISC-V: Fix PTRACE_SETREGSET bug.
  2018-06-11 21:48 [PATCH] RISC-V: Fix PTRACE_SETREGSET bug Jim Wilson
@ 2018-06-12  0:46 ` Palmer Dabbelt
  2018-06-12  3:27   ` Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Palmer Dabbelt @ 2018-06-12  0:46 UTC (permalink / raw)
  To: Jim Wilson; +Cc: linux-riscv, Jim Wilson, oleg, albert, linux-kernel

On Mon, 11 Jun 2018 14:48:22 PDT (-0700), Jim Wilson wrote:
> In riscv_gpr_set, pass regs instead of &regs to user_regset_copyin to fix
> gdb segfault.
>
> Signed-off-by: Jim Wilson <jimw@sifive.com>
> ---
>  arch/riscv/kernel/ptrace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c
> index ba3e80712797..9f82a7e34c64 100644
> --- a/arch/riscv/kernel/ptrace.c
> +++ b/arch/riscv/kernel/ptrace.c
> @@ -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!

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

* Re: [PATCH] RISC-V: Fix PTRACE_SETREGSET bug.
  2018-06-12  0:46 ` Palmer Dabbelt
@ 2018-06-12  3:27   ` Jim Wilson
  0 siblings, 0 replies; 3+ messages in thread
From: Jim Wilson @ 2018-06-12  3:27 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: linux-riscv, Oleg Nesterov, Albert Ou, linux-kernel

On Mon, Jun 11, 2018 at 5:46 PM, Palmer Dabbelt <palmer@sifive.com> wrote:
> 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

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

end of thread, other threads:[~2018-06-12  3:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-11 21:48 [PATCH] RISC-V: Fix PTRACE_SETREGSET bug Jim Wilson
2018-06-12  0:46 ` Palmer Dabbelt
2018-06-12  3:27   ` Jim Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®