Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4038022rwr; Sat, 22 Apr 2023 18:58:33 -0700 (PDT) X-Google-Smtp-Source: AKy350bfzXxJoVUmI/f1nSi6w0d2EgZUcMicKPUKctSdqvoMf4VWmZKvlCiI15NOVdhBboB60Kop X-Received: by 2002:a05:6a00:1951:b0:63d:3a18:49fd with SMTP id s17-20020a056a00195100b0063d3a1849fdmr10550319pfk.2.1682215112663; Sat, 22 Apr 2023 18:58:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682215112; cv=none; d=google.com; s=arc-20160816; b=GRMJUO+BLMJQ/FLWAqwpUvIjCb3GM/UQrU008IIFREafu5RILycTMORd2hZuda9KTV 6qY6SunGbNsQ9jfqTFm5IAxtoBrQNOuz8mVWoDQtJr8UMwkCe7LjeJr8M5G2t1B6HRWK luga++ciltZbtAKbKGc7SmqE/jWpVXjQYaayg3x80Fbx6raQ+fuu8JyjMjR5wzMmCgmc /3cNHNgbs+9qmfYlegn0oUiRHucuzaoFXyucfXtQQTaFnS9enaFLYUVDpsnQoFBOtmbm 4tqgSrQmsdQR3Vnn2/sKtU55QlnY31j3m0ecjuCRnLWKrVzo0IXQE9NZemG3g0bHFsDm 6v8A== 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=ZdFbkpN28uwouGz0ykXs6TfDqpWTThio+WGB9EHDHQY=; b=CQMGpIR5Hdu3aLaeJj3RnSZn7byl++yskpB5KCrudRePA3hBqGaEizBtO7vKpZ4p81 +bVx3HlFPrLopKkOZrJSu1aIk/xHQm3ptdMNTO0BIVOzMetMhXnJQz6cGGY6efMwDjZ+ 3OQqtbStYPSpll3HptPPIDsyURQZqgD6SptgkLUyiCgTNmIxM6I5pi+SrT2okv7t/JO4 1zzn+KDZSQsZK0rWZUsj7D2ddy61iH/02IKNv5pQIiUc32giH1G6a9CFCdMvls6HvOfz RbdkBrpVcZ4+7tC1oL3+jb2hfBLy7GO0ls1PheRVN5zpYkIeexJITPUr6BrFsqMcvTDQ XWkg== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z19-20020aa79493000000b005e1cabb612fsi7879565pfk.67.2023.04.22.18.58.21; Sat, 22 Apr 2023 18:58:32 -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 S230123AbjDWBkD (ORCPT + 99 others); Sat, 22 Apr 2023 21:40:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229794AbjDWBkC (ORCPT ); Sat, 22 Apr 2023 21:40:02 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5E97010FD; Sat, 22 Apr 2023 18:39:59 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8Dxj81ujERkzdEgAA--.51391S3; Sun, 23 Apr 2023 09:39:58 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Dxib1ujERkGfo1AA--.7609S2; Sun, 23 Apr 2023 09:39:58 +0800 (CST) From: Tiezhu Yang To: Guo Ren Cc: linux-csky@vger.kernel.org, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH] csky: uprobes: Restore thread.trap_no Date: Sun, 23 Apr 2023 09:39:47 +0800 Message-Id: <1682213987-3708-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8Dxib1ujERkGfo1AA--.7609S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoWrZw13uw1rWw1UKry7KF4rZrb_yoW8Jr4fpa 1DA345t3WUJr1ftFWUJaykZ3ySva4kXr47Wr47Ca4fJ3yDKrWYqF4IqFWjyF4Yvrs5Kw10 qFyvyryDta97AF7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b78YFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVWUCVW8JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4j6F4UM28EF7xvwVC2z280aVCY1x0267AKxVW8JVW8Jr1le2I2 62IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2IEw4 CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JF0_Jw1lYx0Ex4A2jsIE14v26r1j6r4UMcvj eVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwIxGrwCFx2IqxV CFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r10 6r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxV WUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG 6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_Gr UvcSsGvfC2KfnxnUUI43ZEXa7IU1LiSJUUUUU== 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: X-Mailing-List: linux-kernel@vger.kernel.org thread.trap_no 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 --- arch/csky/kernel/probes/uprobes.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/csky/kernel/probes/uprobes.c b/arch/csky/kernel/probes/uprobes.c index 2d31a12..6277f2b 100644 --- a/arch/csky/kernel/probes/uprobes.c +++ b/arch/csky/kernel/probes/uprobes.c @@ -64,6 +64,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.trap_no != UPROBE_TRAP_NR); + current->thread.trap_no = utask->autask.saved_trap_no; instruction_pointer_set(regs, utask->vaddr + auprobe->insn_size); @@ -101,6 +102,7 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) { struct uprobe_task *utask = current->utask; + current->thread.trap_no = utask->autask.saved_trap_no; /* * Task has received a fatal signal, so reset back to probed * address. -- 2.1.0