Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5629696rwb; Mon, 14 Nov 2022 07:22:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Ur9AJkiJbbc1K03hs9U7XEeGR0fQv+Udqn981EvwMNE0QdaqOAfUrRdnoRuKug3MgEc/+ X-Received: by 2002:a17:90a:4e8a:b0:20a:75ae:8276 with SMTP id o10-20020a17090a4e8a00b0020a75ae8276mr14366577pjh.51.1668439335414; Mon, 14 Nov 2022 07:22:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668439335; cv=none; d=google.com; s=arc-20160816; b=dmzyKygzpbWMYze17rzdqELJ8+gWgnkntR0LorV2JDHRA7EJjrnvZpxoEQpPDBwu/G AlgqTkEALr1m430TtkoxzETzZ/AkLaTadMTOqRxmdViD/ufh0qQ2E8/PvOTHSVzP4AUn +yh9R5qrdTzAoLl7ssdz3ewf8dhOxgE4GVilu9JV+fj8V7RKhHq6HJXscly/EybDrnpW vxAiY8rZSPLeMbQmVizRhfWCRCQ6rLW0/eLthrvBp3oUXt650kq1wzDQIWNVa3w2vryT FgETY56bSJ2sqKuIewUDl5gWmU8nu/8jKJ+inKZSnxTPwG4mdqiwNAF2Zvkvn902NOMg z1/Q== 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=KU4w1cpzM/lo2lTHBROoPB6GYwB0OwInX7Ei89ev1Rg=; b=upk1caetQ93YhGpy9NxbUJl9dOTfr02HspSAq2NSGi0erITuMHfRW28myj7naFQI+f IZlQ17JFyZELCZZWw83kL/OKkLCK4OWDmnhHz0H3lBjs+jpiO5EsF71+XKDtny2gdIDQ mOwrEaTo73QYSmXh7h6GqXm+mlYnSIFtlJVxFU1yI9or/KdpkMkCkSEbnuAKSbTb3sge 9ynlzQ9cje0cPpRxPX0v22mE2wHtMivwKkq5CGA9SCmCPXeujtwAXbEcZbLUmGqGmNq/ MzvB6cWpwOMgGFAOL/hYegGW8A0ud5WrtWfGzXIpkKcgW7jpFIjj/ccSmr+SUojlulKe /g3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bt2nmWii; 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 s32-20020a056a0017a000b00571855d566asi10455731pfg.10.2022.11.14.07.22.03; Mon, 14 Nov 2022 07:22:15 -0800 (PST) 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=bt2nmWii; 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 S236881AbiKNPCv (ORCPT + 87 others); Mon, 14 Nov 2022 10:02:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237087AbiKNPCo (ORCPT ); Mon, 14 Nov 2022 10:02:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35C9E1EAD7; Mon, 14 Nov 2022 07:02:39 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id D7C01B81038; Mon, 14 Nov 2022 15:02:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D907C433C1; Mon, 14 Nov 2022 15:02:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668438156; bh=7CAEYSQMfjcDUPQC16wFpV9kd4a6q+ilf+y2gMaEQDc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=bt2nmWiimKzSqf9W+Tt6BWa8hKEt0IDkvXjO493SDSPt5E5s7Avdqfc7daAU7CE93 bseK3u6+OdTrPzr9XuuUYwMGlT2wrwtmku7b/BWEbZMwdSrbXyIOeuPZRRmDOT81A9 Zw1bjauOGz5ba7poUVGdv7RsDagIKQ94MKuxUpbijQnHYVImSMD/8FKQn4SmBS7kWV WX3T+BvBlu9rK1FY9zYx9/eLSXquc8Sp53V+Kjy/HIaWND9z7t1WvkKWWY4cKpIums KstexYEro5AlBSaJEepww7EqOVHIFqncUCM0mi56V6lvCVw+yPLEsynBhJ8X3QCb81 BECIfb54ThBVA== Date: Tue, 15 Nov 2022 00:02:33 +0900 From: Masami Hiramatsu (Google) To: Rafael Mendonca Cc: Linux Trace Kernel , Steven Rostedt , LKML , Tzvetomir Stoyanov Subject: Re: [PATCH] tracing/eprobe: Fix eprobe filter to make a filter correctly Message-Id: <20221115000233.cbf65c1bd38bfbe060002acf@kernel.org> In-Reply-To: References: <166823166395.1385292.8931770640212414483.stgit@devnote3> 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=-7.1 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 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, 14 Nov 2022 11:24:32 -0300 Rafael Mendonca wrote: > On Sat, Nov 12, 2022 at 02:41:04PM +0900, Masami Hiramatsu (Google) wrote: > > From: Masami Hiramatsu (Google) > > > > Since the eprobe filter was defined based on the eprobe's trace event > > itself, it doesn't work correctly. Use the original trace event of > > the eprobe when making the filter so that the filter works correctly. > > > > Without this fix: > > > > # echo 'e syscalls/sys_enter_openat \ > > flags_rename=$flags:u32 if flags < 1000' >> dynamic_events > > # echo 1 > events/eprobes/sys_enter_openat/enable > > [ 114.551550] event trace: Could not enable event sys_enter_openat > > -bash: echo: write error: Invalid argument > > > > With this fix: > > # echo 'e syscalls/sys_enter_openat \ > > flags_rename=$flags:u32 if flags < 1000' >> dynamic_events > > # echo 1 > events/eprobes/sys_enter_openat/enable > > # tail trace > > cat-241 [000] ...1. 266.498449: sys_enter_openat: (syscalls.sys_enter_openat) flags_rename=0 > > cat-242 [000] ...1. 266.977640: sys_enter_openat: (syscalls.sys_enter_openat) flags_rename=0 > > > > Fixes: 752be5c5c910 ("tracing/eprobe: Add eprobe filter support") > > Reported-by: Rafael Mendonca > > Signed-off-by: Masami Hiramatsu (Google) > > --- > > kernel/trace/trace_eprobe.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > Hi Masami, > > Tested this on top of v6.1-rc5 and the event filtering seems to be > working fine now. Tested with multiple events and conditions. Thanks. > > Tested-by: Rafael Mendonca Thanks a lot! > > > > > diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c > > index fe4833a7b7b3..1c3096ab2fe7 100644 > > --- a/kernel/trace/trace_eprobe.c > > +++ b/kernel/trace/trace_eprobe.c > > @@ -643,7 +643,7 @@ new_eprobe_trigger(struct trace_eprobe *ep, struct trace_event_file *file) > > INIT_LIST_HEAD(&trigger->list); > > > > if (ep->filter_str) { > > - ret = create_event_filter(file->tr, file->event_call, > > + ret = create_event_filter(file->tr, ep->event, > > ep->filter_str, false, &filter); > > if (ret) > > goto error; > > -- Masami Hiramatsu (Google)