Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp55677rwn; Wed, 7 Sep 2022 19:59:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR4bNJHdx40Vh+uXacjz/LJEtxoV3uB2cwVjSVHW8kYi2njyViHVZPphHp5+pdsSmmpDAXcX X-Received: by 2002:a17:90a:4805:b0:1f5:39ab:29a9 with SMTP id a5-20020a17090a480500b001f539ab29a9mr1725535pjh.202.1662605966704; Wed, 07 Sep 2022 19:59:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662605966; cv=none; d=google.com; s=arc-20160816; b=Vv2WdMen58gq8n9A9v7P+5BEBEAxR31kgWHMDh0SeGA5Z6N3ZSUR2CmRzL3hbM6bGs W4ZEoRNgT2FhoV5CkPV7gACmC4MRLja1sogXr8kkFFSHK4DxkUE6afqoLPO2vKcLOHpM 0CdCm2PVy3ANI9laxZxW6e4kdYmiHZpeZ+pbmi/V9z0KwrYYAxLi1du1Y7PjhLKA2oec W5GULxA9M3OBF8jvK3cpJ/dGX55mKUYS6YW0GOqSkrP+ct9Fq72WbxRTdPBi3dnBrhlj aCA3q7AW+NGQncdc4it5SbYOdlh7bWsIXPxIwZUavGN+V/iaj1OnK4ZsAPKJD6wt3+RY n8GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=gghNlu+MfPkH0VdLEicOgAf8eSKor/ra4MOap62kNes=; b=xaDKXl6cVumk0TH2pQob2VWiMG+KL5pGW4ZqIlwfiReomoGSwf65KgF2VnBfkiZ3HF HvQVTXcX+QDQQO9k9MLiu3y1ZeLxw2++LsIsxEsOCtqh5glBhy2NaVm3P0oypAZ03VCy Vt1h1D6D6WpLta+GjNa1KoFESzDuRSm/pC4bv/u+W5d81gSskvhDsGNlWicdu4O6IWsy AYD5nX9QC8FrZhjPehytOZiLa/dkJ/mueGozAThhkXASuH7AntmrZ6E7JIuTPpZ2tMCo 7vDkqkrzbXqLCKeIR8kNlB79JSGz5RxU0u7cyg050BAyjtrxVI49WTkvoJRB4u7dX2o+ A67w== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f16-20020a170902ce9000b00176d424c965si6847573plg.577.2022.09.07.19.59.15; Wed, 07 Sep 2022 19:59:26 -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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230070AbiIHByf (ORCPT + 99 others); Wed, 7 Sep 2022 21:54:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbiIHByd (ORCPT ); Wed, 7 Sep 2022 21:54:33 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 139D095AD for ; Wed, 7 Sep 2022 18:54:32 -0700 (PDT) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MNMXJ5fkWzkWv0; Thu, 8 Sep 2022 09:50:40 +0800 (CST) Received: from [10.67.110.108] (10.67.110.108) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 8 Sep 2022 09:54:30 +0800 Message-ID: <819b4964-0f81-74d4-1dd5-e836326447ec@huawei.com> Date: Thu, 8 Sep 2022 09:54:29 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH] riscv: kprobes: Free instruction in arch_remove_kprobe() To: Tiezhu Yang CC: , References: <1662601156-25802-1-git-send-email-yangtiezhu@loongson.cn> From: "liaochang (A)" In-Reply-To: <1662601156-25802-1-git-send-email-yangtiezhu@loongson.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.110.108] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,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 Hi, Tiezhu, This bug is fixed already, see https://lore.kernel.org/all/cd9a856b-ed8a-88f1-da69-4fb628c28f34@huawei.com/T/ 在 2022/9/8 9:39, Tiezhu Yang 写道: > Call free_insn_slot() to free instruction in arch_remove_kprobe() > as other arches do. > > Signed-off-by: Tiezhu Yang > --- > arch/riscv/kernel/probes/kprobes.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/riscv/kernel/probes/kprobes.c b/arch/riscv/kernel/probes/kprobes.c > index e6e950b..f12eb1f 100644 > --- a/arch/riscv/kernel/probes/kprobes.c > +++ b/arch/riscv/kernel/probes/kprobes.c > @@ -110,6 +110,10 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p) > > void __kprobes arch_remove_kprobe(struct kprobe *p) > { > + if (p->ainsn.api.insn) { > + free_insn_slot(p->ainsn.api.insn, 0); > + p->ainsn.api.insn = NULL; > + } > } > > static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) -- BR, Liao, Chang