public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] riscv: uprobes: Restore thread.bad_cause
@ 2023-04-23  1:42 Tiezhu Yang
  2023-04-24 11:49 ` Tiezhu Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Tiezhu Yang @ 2023-04-23  1:42 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou
  Cc: Guo Ren, linux-riscv, linux-kernel, loongson-kernel

thread.bad_cause is saved in arch_uprobe_pre_xol(), it should be restored
in arch_uprobe_{post,abort}_xol() accordingly, otherwise the save operation
is meaningless, this change is similar with x86 and powerpc.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 arch/riscv/kernel/probes/uprobes.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/riscv/kernel/probes/uprobes.c b/arch/riscv/kernel/probes/uprobes.c
index c976a21..194f166 100644
--- a/arch/riscv/kernel/probes/uprobes.c
+++ b/arch/riscv/kernel/probes/uprobes.c
@@ -67,6 +67,7 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
 	struct uprobe_task *utask = current->utask;
 
 	WARN_ON_ONCE(current->thread.bad_cause != UPROBE_TRAP_NR);
+	current->thread.bad_cause = utask->autask.saved_cause;
 
 	instruction_pointer_set(regs, utask->vaddr + auprobe->insn_size);
 
@@ -102,6 +103,7 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
 {
 	struct uprobe_task *utask = current->utask;
 
+	current->thread.bad_cause = utask->autask.saved_cause;
 	/*
 	 * Task has received a fatal signal, so reset back to probbed
 	 * address.
-- 
2.1.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] riscv: uprobes: Restore thread.bad_cause
  2023-04-23  1:42 [PATCH] riscv: uprobes: Restore thread.bad_cause Tiezhu Yang
@ 2023-04-24 11:49 ` Tiezhu Yang
  2023-04-24 15:28   ` Oleg Nesterov
  2023-05-05 10:01 ` Guo Ren
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Tiezhu Yang @ 2023-04-24 11:49 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou
  Cc: Guo Ren, linux-riscv, linux-kernel, loongson-kernel,
	Oleg Nesterov, Srikar Dronamraju

Cc:
Oleg Nesterov <oleg@redhat.com>
Srikar Dronamraju <srikar@linux.vnet.ibm.com>

On 04/23/2023 09:42 AM, Tiezhu Yang wrote:
> thread.bad_cause is saved in arch_uprobe_pre_xol(), it should be restored
> in arch_uprobe_{post,abort}_xol() accordingly, otherwise the save operation
> is meaningless, this change is similar with x86 and powerpc.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  arch/riscv/kernel/probes/uprobes.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/kernel/probes/uprobes.c b/arch/riscv/kernel/probes/uprobes.c
> index c976a21..194f166 100644
> --- a/arch/riscv/kernel/probes/uprobes.c
> +++ b/arch/riscv/kernel/probes/uprobes.c
> @@ -67,6 +67,7 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
>  	struct uprobe_task *utask = current->utask;
>
>  	WARN_ON_ONCE(current->thread.bad_cause != UPROBE_TRAP_NR);
> +	current->thread.bad_cause = utask->autask.saved_cause;
>
>  	instruction_pointer_set(regs, utask->vaddr + auprobe->insn_size);
>
> @@ -102,6 +103,7 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
>  {
>  	struct uprobe_task *utask = current->utask;
>
> +	current->thread.bad_cause = utask->autask.saved_cause;
>  	/*
>  	 * Task has received a fatal signal, so reset back to probbed
>  	 * address.
>

Hi Oleg and Srikar,

Could you please review this patch, thank you.

Thanks,
Tiezhu


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] riscv: uprobes: Restore thread.bad_cause
  2023-04-24 11:49 ` Tiezhu Yang
@ 2023-04-24 15:28   ` Oleg Nesterov
  0 siblings, 0 replies; 7+ messages in thread
From: Oleg Nesterov @ 2023-04-24 15:28 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren, linux-riscv,
	linux-kernel, loongson-kernel, Srikar Dronamraju

On 04/24, Tiezhu Yang wrote:
>
> >diff --git a/arch/riscv/kernel/probes/uprobes.c b/arch/riscv/kernel/probes/uprobes.c
> >index c976a21..194f166 100644
> >--- a/arch/riscv/kernel/probes/uprobes.c
> >+++ b/arch/riscv/kernel/probes/uprobes.c
> >@@ -67,6 +67,7 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
> > 	struct uprobe_task *utask = current->utask;
> >
> > 	WARN_ON_ONCE(current->thread.bad_cause != UPROBE_TRAP_NR);
> >+	current->thread.bad_cause = utask->autask.saved_cause;
> >
> > 	instruction_pointer_set(regs, utask->vaddr + auprobe->insn_size);
> >
> >@@ -102,6 +103,7 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
> > {
> > 	struct uprobe_task *utask = current->utask;
> >
> >+	current->thread.bad_cause = utask->autask.saved_cause;
> > 	/*
> > 	 * Task has received a fatal signal, so reset back to probbed
> > 	 * address.
> >

Acked-by: Oleg Nesterov <oleg@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] riscv: uprobes: Restore thread.bad_cause
  2023-04-23  1:42 [PATCH] riscv: uprobes: Restore thread.bad_cause Tiezhu Yang
  2023-04-24 11:49 ` Tiezhu Yang
@ 2023-05-05 10:01 ` Guo Ren
  2023-06-15 15:30   ` Tiezhu Yang
  2023-06-20 19:27 ` Palmer Dabbelt
  2023-06-20 19:40 ` patchwork-bot+linux-riscv
  3 siblings, 1 reply; 7+ messages in thread
From: Guo Ren @ 2023-05-05 10:01 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-riscv,
	linux-kernel, loongson-kernel

Thx for fixup.

Reviewed-by: Guo Ren <guoren@kernel.org>

On Sun, Apr 23, 2023 at 9:42 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>
> thread.bad_cause is saved in arch_uprobe_pre_xol(), it should be restored
> in arch_uprobe_{post,abort}_xol() accordingly, otherwise the save operation
> is meaningless, this change is similar with x86 and powerpc.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  arch/riscv/kernel/probes/uprobes.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/kernel/probes/uprobes.c b/arch/riscv/kernel/probes/uprobes.c
> index c976a21..194f166 100644
> --- a/arch/riscv/kernel/probes/uprobes.c
> +++ b/arch/riscv/kernel/probes/uprobes.c
> @@ -67,6 +67,7 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
>         struct uprobe_task *utask = current->utask;
>
>         WARN_ON_ONCE(current->thread.bad_cause != UPROBE_TRAP_NR);
> +       current->thread.bad_cause = utask->autask.saved_cause;
>
>         instruction_pointer_set(regs, utask->vaddr + auprobe->insn_size);
>
> @@ -102,6 +103,7 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
>  {
>         struct uprobe_task *utask = current->utask;
>
> +       current->thread.bad_cause = utask->autask.saved_cause;
>         /*
>          * Task has received a fatal signal, so reset back to probbed
>          * address.
> --
> 2.1.0
>


-- 
Best Regards
 Guo Ren

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] riscv: uprobes: Restore thread.bad_cause
  2023-05-05 10:01 ` Guo Ren
@ 2023-06-15 15:30   ` Tiezhu Yang
  0 siblings, 0 replies; 7+ messages in thread
From: Tiezhu Yang @ 2023-06-15 15:30 UTC (permalink / raw)
  To: guoren
  Cc: aou, linux-kernel, linux-riscv, loongson-kernel, palmer,
	paul.walmsley, yangtiezhu

ping, what is the status of this patch which has been received Acked-by
and Reviewed-by:

https://lore.kernel.org/linux-riscv/1682214146-3756-1-git-send-email-yangtiezhu@loongson.cn/

Thanks,
Tiezhu


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] riscv: uprobes: Restore thread.bad_cause
  2023-04-23  1:42 [PATCH] riscv: uprobes: Restore thread.bad_cause Tiezhu Yang
  2023-04-24 11:49 ` Tiezhu Yang
  2023-05-05 10:01 ` Guo Ren
@ 2023-06-20 19:27 ` Palmer Dabbelt
  2023-06-20 19:40 ` patchwork-bot+linux-riscv
  3 siblings, 0 replies; 7+ messages in thread
From: Palmer Dabbelt @ 2023-06-20 19:27 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Tiezhu Yang
  Cc: Guo Ren, linux-riscv, linux-kernel, loongson-kernel


On Sun, 23 Apr 2023 09:42:26 +0800, Tiezhu Yang wrote:
> thread.bad_cause is saved in arch_uprobe_pre_xol(), it should be restored
> in arch_uprobe_{post,abort}_xol() accordingly, otherwise the save operation
> is meaningless, this change is similar with x86 and powerpc.
> 
> 

Applied, thanks!

[1/1] riscv: uprobes: Restore thread.bad_cause
      https://git.kernel.org/palmer/c/58b1294dd1d6

Best regards,
-- 
Palmer Dabbelt <palmer@rivosinc.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] riscv: uprobes: Restore thread.bad_cause
  2023-04-23  1:42 [PATCH] riscv: uprobes: Restore thread.bad_cause Tiezhu Yang
                   ` (2 preceding siblings ...)
  2023-06-20 19:27 ` Palmer Dabbelt
@ 2023-06-20 19:40 ` patchwork-bot+linux-riscv
  3 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+linux-riscv @ 2023-06-20 19:40 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: linux-riscv, paul.walmsley, palmer, aou, guoren, linux-kernel,
	loongson-kernel

Hello:

This patch was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Sun, 23 Apr 2023 09:42:26 +0800 you wrote:
> thread.bad_cause is saved in arch_uprobe_pre_xol(), it should be restored
> in arch_uprobe_{post,abort}_xol() accordingly, otherwise the save operation
> is meaningless, this change is similar with x86 and powerpc.
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  arch/riscv/kernel/probes/uprobes.c | 2 ++
>  1 file changed, 2 insertions(+)

Here is the summary with links:
  - riscv: uprobes: Restore thread.bad_cause
    https://git.kernel.org/riscv/c/58b1294dd1d6

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2023-06-20 19:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-23  1:42 [PATCH] riscv: uprobes: Restore thread.bad_cause Tiezhu Yang
2023-04-24 11:49 ` Tiezhu Yang
2023-04-24 15:28   ` Oleg Nesterov
2023-05-05 10:01 ` Guo Ren
2023-06-15 15:30   ` Tiezhu Yang
2023-06-20 19:27 ` Palmer Dabbelt
2023-06-20 19:40 ` patchwork-bot+linux-riscv

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