From patchwork Sun Apr 23 01:39:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 86650 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1978017vqo; Sat, 22 Apr 2023 18:55:52 -0700 (PDT) X-Google-Smtp-Source: AKy350ZDb3fDkXD1MNRiL6+WH2Vpu7wcuteT+rUYrydbnoZQn8ZAVxYa3YOZr1DJiZmhxC6nImY+ X-Received: by 2002:a17:90b:3108:b0:247:7597:9382 with SMTP id gc8-20020a17090b310800b0024775979382mr9521517pjb.47.1682214952660; Sat, 22 Apr 2023 18:55:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682214952; cv=none; d=google.com; s=arc-20160816; b=zObboF76h6j6rJOjldFv57v7x4muAPcTfTYYo6QS1YbUomUrAQukbzdm/mMFDTSlHv Kt0fYJnNkRckWy7CT52jF2Nf0+5yrwDzZPWPeM6kmfx69eXT8lXKGW4c/wtY2MG3+jhz YAHxDmsqIbAqNHV5tFwhdgnLw3sBRbH+vsS3iVS3RsBTo9NRLRab0tr1nwv34eyahsay 4iXqSCaNLZZgmfGzZDbSrPiaDyH0ibT1d3NMf5ARscfP8Nqe3iWKKYoXnEQ4ASVLYH8h Tv5e0aNuuy3Tvryme+rt3Km51UHbPIn5s6pM4dfYKjrncy5JO1tLwpFK9CNI/IDxoPpy UlEw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l6-20020a17090ab70600b00235dc16de3asi10165887pjr.16.2023.04.22.18.55.39; Sat, 22 Apr 2023 18:55:52 -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 S230124AbjDWBkD (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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763930226495227574?= X-GMAIL-MSGID: =?utf-8?q?1763930226495227574?= 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 Acked-by: Oleg Nesterov --- 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.