Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp25838928rwd; Mon, 3 Jul 2023 01:33:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlEzKQJYvXo7+ADS2cSG81XNA5GTNIXxDCMXRC1U83Qh1+jK1USTSPBar8Ly9kYkgF+fOhRH X-Received: by 2002:a17:90a:198:b0:263:9118:29cb with SMTP id 24-20020a17090a019800b00263911829cbmr6288327pjc.13.1688373199299; Mon, 03 Jul 2023 01:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688373199; cv=none; d=google.com; s=arc-20160816; b=enaxNi4mZalVSAz9EIY6wK6hnQYcNUFMcHsEvAV6NO0zXixlFwtzxhw7kIawEUetud zO/2Ig0hdteXwqCppLGpC0qpcV/ccnYPZnYYRnjtU7wkkwquzWfWpGhrjfGqUktBfM6P 4fc41ByCgbRG3v4s8ah4uoxUnW0dCDVECO4J07DfnTgbSP4HMu/xSRK0GUaZd8QCIKv9 3hHsn/SEb/6fcPMjGUsAxOk5CQsVoCc6NRGIaiigU3wiTx/Ti8HP8gHf0w9ZPhhYDPbs muvTU2aBeTmjqRbVHNWOWsq+RfeUq1Jzz9BVKl7JofpKDxrWBERFPqiEZDR5IH8J89OW rcUg== 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=K1EHenPkonNVlZGHjSQw/ouqb4Z3pOsXhNxiEhhgEB0=; fh=3SIM7FUAVXjyDgB93RMfCUUX7qV/nzrO3/4Hzj5xo08=; b=cOvClBxxHkga8wG+Wo1wybH34rC9H+S//Cf5EGHMz1GxPc1mbcNkcaPLN4/unEKz7P Hj2qlZv37JVPr6sPtVydk39NQ9H05CRe9RLzIOwqpI48vT9T6hIG+8tH3C+5LAT4X0zU MFO4S4FXTbs5DJhp56X9xrlxVHQkJPIDCdWr7IKe4MU3Yk6CYdPywKxA/NmzO36Du8h3 VRLNJ3gzqGObwoqlbMuBbN06wA03TeCCOZoQY6m5edsFyMv63n5woX4k4axKiLYOxCg0 gwmmEWd11Xjg1CWNHvYGjJT0O99x/WEKGSJrgCj2r3gRamOeKkKif3EecVg4V3vg+vY4 7gSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YxwKUOyi; 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 i9-20020a17090a650900b0025c1d114af0si17182292pjj.93.2023.07.03.01.33.06; Mon, 03 Jul 2023 01:33:19 -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=YxwKUOyi; 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 S231414AbjGCITT (ORCPT + 99 others); Mon, 3 Jul 2023 04:19:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231396AbjGCITP (ORCPT ); Mon, 3 Jul 2023 04:19:15 -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 AC2751BC; Mon, 3 Jul 2023 01:19:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4154C60E03; Mon, 3 Jul 2023 08:19:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 753B2C433C7; Mon, 3 Jul 2023 08:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688372348; bh=S6K5lbYba39Qtr6yqajXnkhBq5MftnwZTHANEwn50OU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=YxwKUOyiwj2JWrtI4HkQ8chRNGbJZYVqAQLc170isvJdA41at3zf8JLdHNDCeTSF4 SG84RUYvLC1foPz7IHr+CPyUhHLQSQ9x4/J5BCNK+JvgnCr69/0BwrFfLNoIDrVQWd lx2+4USKiENJ3DKmrb971MZ7TFvj9zT0Hix0XhLF8hAUcORaLwsDIV2GBS/e8HOFJH oXIxdyApz2cGITzJCk7IX+6+E0T5YAxPadke81wJy78GCLpNvsK9QqK2Z7jZE2hRru wTvmnW3tWJ816231stuf6uc4nXLmpbR1xi3F1n3FrrJOkasrpAjLIcmMA7Gf22vFSp VRvlid3jrNxfQ== Date: Mon, 3 Jul 2023 17:19:05 +0900 From: Masami Hiramatsu (Google) To: Ze Gao Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Ze Gao , Yafang Subject: Re: [PATCH] fprobe: add unlock to match a succeeded ftrace_test_recursion_trylock Message-Id: <20230703171905.ef83b1a7f4db82012db471fc@kernel.org> In-Reply-To: <20230703071640.106204-1-zegao@tencent.com> References: <20230703071640.106204-1-zegao@tencent.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; 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=-4.5 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_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 On Mon, 3 Jul 2023 15:16:40 +0800 Ze Gao wrote: Good catch! but please add description here, something like; ---- Unlock ftrace recursion lock when fprobe_kprobe_handler() is failed because another kprobe is running. ---- The code itself is OK to me. > Fixes: 3cc4e2c5fbae ("fprobe: make fprobe_kprobe_handler recursion free") > Reported-by: Yafang > Closes: https://lore.kernel.org/linux-trace-kernel/CALOAHbC6UpfFOOibdDiC7xFc5YFUgZnk3MZ=3Ny6we=AcrNbew@mail.gmail.com/ > Signed-off-by: Ze Gao > --- > kernel/trace/fprobe.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c > index 18d36842faf5..93b3e361bb97 100644 > --- a/kernel/trace/fprobe.c > +++ b/kernel/trace/fprobe.c > @@ -102,12 +102,14 @@ static void fprobe_kprobe_handler(unsigned long ip, unsigned long parent_ip, > > if (unlikely(kprobe_running())) { > fp->nmissed++; > - return; > + goto recursion_unlock; > } > > kprobe_busy_begin(); > __fprobe_handler(ip, parent_ip, ops, fregs); > kprobe_busy_end(); > + > +recursion_unlock: > ftrace_test_recursion_unlock(bit); > } > > -- > 2.40.1 > -- Masami Hiramatsu (Google)