Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp25901402rwd; Mon, 3 Jul 2023 02:37:35 -0700 (PDT) X-Google-Smtp-Source: APBJJlF+tZcsTZHl4EJXMXvmqY2KpyRR4+MhtucioPgHc1jTsLO+hQSknPPDBcZ3LKx+TD0yq5q9 X-Received: by 2002:a05:6358:cb17:b0:134:c1e1:3b0e with SMTP id gr23-20020a056358cb1700b00134c1e13b0emr4796381rwb.8.1688377055346; Mon, 03 Jul 2023 02:37:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688377055; cv=none; d=google.com; s=arc-20160816; b=imXPgYhD0agVb2LMqu4okJsrxiyCfUCtZk1WlScxJBYMwMFJqHFmYef4j4b8LHFQZu Ggl2bdQrx3/z2AgTyiX6rMlG8tjgxUhqnAx0eUpGB5HP+5gjyOjxVLQ7dHExVdcwcEnO eH/kW3p9AEBp5sbotVIacpBHIuUs30K/z+7NIwyfA9Gk2XeYskGGitcjyxFPKClrDMn0 XOT03rx4aJJO4aOyjZQSTmARDTyVL21CBSdeaFZYMLS1OK7oZYnsq4EO4JpPFWgdv1f5 6VqOyDT6cq4y41ieyd4p5OVG6O5e3SCEXEhmtnE9U809C7ZRHx7vnyqPe42iGXVIZfKu N4FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=P11oD5Wt8lVLUJsAnVFWdlZQbTH5DYoOiFhKucDw5A0=; fh=L19Zp9IkhAXXVE84eqJTG9h1YGlurt6U6PH7CND0W+E=; b=hoj7/A4PY4Y9ENtwxYabolNEZ2b9iN5Zlx0Kj1HNV6zYxn3mILpRN+NfNqAmcB/ZG8 72SS3D7JEJNvW5OQ8u+tAtlfImGDi2FqswTc+niApm+1/SrvtfcjKYssYHb4+flB0WYV +0PN+90zeJOir+wnalL2r6JJ0B6Wr+VT/QALs81Uf3cY4AUuOId4NyuuWa6TY2dvgHAe HSrKm9Ffd4TymGONmsTh7ng0H90uvYxWiyyUFZeC/jHXNgrkngktSD7YJGc4TGqsHYbE 6pCMT/EuUP0vCG47LJYL1g84rm7g208f2+FFbP+GGOUc4RAetSGwtpYJKqBacFh/pmin +KHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=h0gcHvLy; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bs1-20020a632801000000b0055b618c77efsi6938026pgb.179.2023.07.03.02.36.56; Mon, 03 Jul 2023 02:37:35 -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=@gmail.com header.s=20221208 header.b=h0gcHvLy; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230093AbjGCJ1A (ORCPT + 99 others); Mon, 3 Jul 2023 05:27:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbjGCJ07 (ORCPT ); Mon, 3 Jul 2023 05:26:59 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C09F192; Mon, 3 Jul 2023 02:26:58 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-51d885b0256so5483057a12.2; Mon, 03 Jul 2023 02:26:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688376417; x=1690968417; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=P11oD5Wt8lVLUJsAnVFWdlZQbTH5DYoOiFhKucDw5A0=; b=h0gcHvLyFxZey4lxC2a6scRwqHOGqGkCOjh4sHkD/VgtfdS2owQdPP46w7anuw2jtX NJwGRqLqYK6mxsQSqPuq49PQPDQ2ofYOnucAo588Q7m4cboFkazrAViBOFTN8hcNzrU9 xiPdKvtEPII1/AjNRyhlJvfkEsVuPfp22S6S9baKumVuLtutkjh+jAUDqFezj25pirUC uikRt3ubxgMurq4K2RrnonuuEll+G7d9XOmX/zk4KnpjpCEmwa6UoxnN3m6PvEcXx663 r7HqY0DswsgCvNu+RDdEkHMgLJu9DWzx8/VoDkzP4BnMG5GEQjYifZ0osKKUWh7/xoHH 1VCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688376417; x=1690968417; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P11oD5Wt8lVLUJsAnVFWdlZQbTH5DYoOiFhKucDw5A0=; b=T+ARnBWbf9pXL0eHacDgJKOoQzFB43RaMtxxnFSxIf8wH+omwZ7+hYWq57C2S680JL MS18ixjMkczO7zjuXF6B7kXwJOTZkczCqhrAj5Mv7GxWfm/gbs3UaJUVlhRCz76c/KPH yitBcHm519OqzcecPpSdYOtFR3HTkf3ryEE1OcKJJU/4jHG6iZAEn5gwtbNYYF9fjLBI Ufaq40rWc54b463C4eLvDdg0ieU6KAn7ziixQeuUK3HgUYBA7PO+tH1WD98YOuZvzckr 0XyONAAm/KGlZkl9ugQlgnURB4TQ80piYQtUoKzW9qSg6UT7/0jcheWK53Nia83XS+JR 7OIA== X-Gm-Message-State: ABy/qLa57oiQgHAqmRjlKfHXgAZwCiEbIR3x+9nIwKVWGb0OvQEYUpiu RYi37FIV0aHjONyT29i+rQIOFKpsw1k4jub4BMdJLjAQa54= X-Received: by 2002:aa7:d617:0:b0:51e:166a:ac7f with SMTP id c23-20020aa7d617000000b0051e166aac7fmr853741edr.28.1688376417058; Mon, 03 Jul 2023 02:26:57 -0700 (PDT) MIME-Version: 1.0 References: <20230703071640.106204-1-zegao@tencent.com> <20230703171905.ef83b1a7f4db82012db471fc@kernel.org> In-Reply-To: <20230703171905.ef83b1a7f4db82012db471fc@kernel.org> From: Ze Gao Date: Mon, 3 Jul 2023 17:26:45 +0800 Message-ID: Subject: Re: [PATCH] fprobe: add unlock to match a succeeded ftrace_test_recursion_trylock To: Masami Hiramatsu Cc: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Ze Gao , Yafang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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 Good suggestion! Will amend and push v2 ASAP. Thanks, Ze On Mon, Jul 3, 2023 at 4:19=E2=80=AFPM Masami Hiramatsu wrote: > > 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/CALOAHbC6UpfFOOibdDi= C7xFc5YFUgZnk3MZ=3D3Ny6we=3DAcrNbew@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 i= p, 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)