Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1942261rwn; Fri, 9 Sep 2022 06:28:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR6BOztp31+JT6h6Ga2WkeARZFBiW78xT1761Tb8eZMwjbCIGvVeQDa2ZdMAzPLm+yv8ix7C X-Received: by 2002:a19:5f45:0:b0:492:df3d:d678 with SMTP id a5-20020a195f45000000b00492df3dd678mr4834260lfj.217.1662730102434; Fri, 09 Sep 2022 06:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662730102; cv=none; d=google.com; s=arc-20160816; b=GGiKMqZGhL4FsKrT2tTmbM0RQrC0MfYNRFATpbw/wiA/shSfBbZ0VQYaGeSiDK4XzN 6X5wN1hguDJ7/TvRmoLtzk3DuRCobI2oCNet0XEeF+BtFXPbu+1DUCORc4Fh2CWn2wJI QDq7yzTm1hRXvXNC9ynEXPbWB2sg+M5WUJnFSMRyYW5TQcba78CIYZDz37yf+OtggRtQ KzUw1ZvMiiEWqpcjDIIxQ8wTuOE+QycAej/4ZIrSabza6P+c44czKsXU6Re+eHHSrggk sxXy6CrPxiz9vtXiBSydrE+7dZZBfGQd+1c7S1M8wvRVHlvSwKisrPm6CCD1pvtsqk3P 0MAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=9VKZaueGPj9uluaiPWyC/JRKXGOGBtjypKvaLob0Qzo=; b=A5v5EOjGeIbwIAT9i81cPblZNHTl/NaOsZYcBQTlyN9YV34yYGd05rSvemkazFvLXz PUmpmfS7txxOZ/Nrunp4MfpMoN4R8Stkx/FVYTB0m0MRI/USFjsKv4iVsAgZ0X3OFNbg p8F/i0KAjH4+9vlJ7PKMz7ikrHe6z45Qti7ywruwFHg6rdILZXaI5DZw0wvUwaQTHzkN 9Jh04FlO4j7lJYJlLDNc3zBVhd2Q2efIYbPW2lNfdzWY5FMzwpHwPOcq4/wWAdaLTp9h P/IaM/As+iQ9myY+v3Nc2jPvqdUJ1WIoroCUuXopIbDclpT9rGCwnRX/PpCNV6V+HzUf 5kjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IFoYbPTu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk39-20020a05651c23a700b0026445b6f526si308614ljb.67.2022.09.09.06.27.52; Fri, 09 Sep 2022 06:28:22 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IFoYbPTu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229930AbiIINJC (ORCPT + 99 others); Fri, 9 Sep 2022 09:09:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230100AbiIINIU (ORCPT ); Fri, 9 Sep 2022 09:08:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE77465C7 for ; Fri, 9 Sep 2022 06:07:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4113D61FDD for ; Fri, 9 Sep 2022 13:07:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4C5EC433C1; Fri, 9 Sep 2022 13:07:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662728870; bh=b1MPtaMvM1L/buh0iIgAugb7UJAFs0mTGZzDORsAF50=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IFoYbPTuJ6FtM0p/1M9xheFP73eQ6HODTq5Ps//iuLyRcXWpldmvAek0p+yVuGDsx i7qQAUE5g8qJc9/9yeUxo4aI8Cg35o4Rhlmee8s0isVtkFLzW9hGleMx/h1nvTS2Ho ErKz2vnxPsQAUYIiO67MWx5YYldURHHeQUeHEZT6uiY9xSabSnaHigNioLyCD37sJm ybgDxJHqe/x/oRFwwScB6fQKjOkpIaLNnLMLByVhFfmhmoWmgX3eOUHkkPlgaT10ge uXgBP5a4Mx80hzIlXfMykVV5zBSv9rl0W49g34WiKKHOR/eEJ2J3hVAfhidROQ61fT aYpIPYJwCKsxg== Date: Fri, 9 Sep 2022 22:07:46 +0900 From: Masami Hiramatsu (Google) To: Li Qiang Cc: naveen.n.rao@linux.ibm.com, anil.s.keshavamurthy@intel.com, davem@davemloft.net, linux-kernel@vger.kernel.org, liq3ea@gmail.com, Steven Rostedt Subject: Re: [PATCH] kprobe: reverse kp->flags when arm_kprobe failed Message-Id: <20220909220746.a7826cb2fb9da02171b38237@kernel.org> In-Reply-To: <20220902155820.34755-1-liq3ea@163.com> References: <20220902155820.34755-1-liq3ea@163.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,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 On Fri, 2 Sep 2022 08:58:20 -0700 Li Qiang wrote: > In aggregate kprobe case, when arm_kprobe failed, > we need set the kp->flags with KPROBE_FLAG_DISABLED again. > If not, the 'kp' kprobe will been considered as enabled > but it actually not enabled. > > Signed-off-by: Li Qiang Looks good to me. Acked-by: Masami Hiramatsu (Google) Thanks! > --- > kernel/kprobes.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/kernel/kprobes.c b/kernel/kprobes.c > index 08350e35a..333454df5 100644 > --- a/kernel/kprobes.c > +++ b/kernel/kprobes.c > @@ -2424,8 +2424,11 @@ int enable_kprobe(struct kprobe *kp) > if (!kprobes_all_disarmed && kprobe_disabled(p)) { > p->flags &= ~KPROBE_FLAG_DISABLED; > ret = arm_kprobe(p); > - if (ret) > + if (ret) { > p->flags |= KPROBE_FLAG_DISABLED; > + if (p != kp) > + kp->flags |= KPROBE_FLAG_DISABLED; > + } > } > out: > mutex_unlock(&kprobe_mutex); > -- > 2.25.1 > -- Masami Hiramatsu (Google)