Message ID | 1682214146-3756-1-git-send-email-yangtiezhu@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1990267vqo; Sat, 22 Apr 2023 19:38:50 -0700 (PDT) X-Google-Smtp-Source: AKy350YnrRdaV/JEEK4woWJ3BQbD1GzPooLsrs2ft15KWwfVkaM7CT0dSTW4FBl4s+fC8Fa2L5CC X-Received: by 2002:a05:6a21:340a:b0:f2:5a2:c05f with SMTP id yn10-20020a056a21340a00b000f205a2c05fmr9608459pzb.13.1682217530155; Sat, 22 Apr 2023 19:38:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682217530; cv=none; d=google.com; s=arc-20160816; b=z0G/VHB7ekLEOMuIv0VlDfd8PI3SrObz7Ce8e/Ahuj4/Nhu28XdghE11joA6qenI67 jfENMhwYYWgqS8ktP3unVGBT3z2dhwbPZq3PnaNJTmUTxRJOwL4Q+zglIH/sFoN83SrS jWa5/dSqZDoT39F/z3cCUSd/GffnxCv9bm/JBAgioSKVolxnauILSS64+0LZNeTB7R17 SGY3QU5W50CKmq3ApOMcy4SQVSB3DiKMFANrx1OK5FORDoNfWCIV4o40oFkGQMtCBcyO 2s3WIXvL+EdDOTHH4Yxj/YzwgyXIOlViw+sJ5owQW6otyuuOY63dd+OhDeQkHhQ8mDRt w1JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=gDFnDq0ihowXxL9oc/caR+gRQOrCaOOHed2UBLgee30=; b=Nx8rFe8W6UOeojBf/Skqeqx4frhOAhJ7++KTfxUb5bVyW8dm0fL7SavBG32er0g6MK dtd6ElAL2xg5xNNjeal/5DZ8+pbgdmsZMTpuxqQwwNwPOfmjiAwj9C9+e7AzxLnKNbV3 tpx/1sPPETUo1fcbUtBDJaLH2D2TDjTgZ8kjkEytNh3fuZCjRh2rRHl7SdtPcPpoRg/T FXtBh600xaPa53VlhLmOKKGVTpyqaHbYPxPFTBrntr47M6paq1YRMFrI88S0F1x6cy6t bMNprCwtchtZOXNyEeV1kPWjy9mO+lEl7atCx6LA7qBog0fKwFgZyaGZlzv4+rsyrv2+ mqZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r29-20020a63515d000000b00513162c223bsi7929212pgl.298.2023.04.22.19.38.36; Sat, 22 Apr 2023 19:38:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230144AbjDWBmd (ORCPT <rfc822;fengqi706@gmail.com> + 99 others); Sat, 22 Apr 2023 21:42:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbjDWBmc (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 22 Apr 2023 21:42:32 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A2ADB2110 for <linux-kernel@vger.kernel.org>; Sat, 22 Apr 2023 18:42:30 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8Axz_8DjURkKdIgAA--.51159S3; Sun, 23 Apr 2023 09:42:27 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxJLUCjURkI_s1AA--.7750S2; Sun, 23 Apr 2023 09:42:27 +0800 (CST) From: Tiezhu Yang <yangtiezhu@loongson.cn> To: Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu> Cc: Guo Ren <guoren@kernel.org>, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH] riscv: uprobes: Restore thread.bad_cause Date: Sun, 23 Apr 2023 09:42:26 +0800 Message-Id: <1682214146-3756-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8CxJLUCjURkI_s1AA--.7750S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7XrW3Cry3GF1DXF18CFW3KFg_yoW8Jryfpa 1DCr4rt3WDJws3t345JaykWw10vF95Wr47Wr17AayfJanrKrW5Zw4IqFW7tF4YyFs5K3Wr XFyjqryjyay7GrJanT9S1TB71UUUUjDqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bfAYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26F4j6r4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UM2kK e7AKxVWUAVWUtwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI 0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUtVWrXwAv7VC2z280 aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxkF7I0En4 kS14v26r126r1DMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCIbckI 1I0E14v26r126r1DMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_Jr Wlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r4j 6ryUMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr 0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUv cSsGvfC2KfnxnUUI43ZEXa7IU8_gA5UUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763932928924702313?= X-GMAIL-MSGID: =?utf-8?q?1763932928924702313?= |
Series |
riscv: uprobes: Restore thread.bad_cause
|
|
Commit Message
Tiezhu Yang
April 23, 2023, 1:42 a.m. UTC
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(+)
Comments
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
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>
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 >
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
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,
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!
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.