From patchwork Sat Nov 12 05:41:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 19115 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1132536wru; Fri, 11 Nov 2022 22:08:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf6l7KQx8U8lQniw2F2MOtvJh4Wq3hTC8qcamNe4GzlyL0ZE1WR81k/DLfVdnmHBwgrFbA6z X-Received: by 2002:a17:90a:24d:b0:212:e2e9:4b1f with SMTP id t13-20020a17090a024d00b00212e2e94b1fmr5117126pje.20.1668233286492; Fri, 11 Nov 2022 22:08:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668233286; cv=none; d=google.com; s=arc-20160816; b=L8kKxHOxiUWjfGbwM3/P7okIPosHXn+BVNSH2FoVSZeVBlx+fIkJ7PqKVW5Ub5z+fp a+/Xoq1awB4BkpJBzolYXVs07LSTEJoSfDFexGMdFqC0ctMNKo3sv+IuZwFPW9/cvKM4 c8GNudRPZQyC5rqag0mZb9AtggstH8B1aj7TFh9tVNB4HNOtY2R4Jpz2whpRMB1rS72B Ai5y37mt2UD94Uyofpm8ZQz5ZNpOBnSDJ8ASyEgTYnZtiCOYMMTN46/NVMGKj3/lyIq8 JvgFNyUlE6/EsX2KpzNvyoFFQhQGf+vLa9Np5R1oa9xpARpQEIZCnZpumoDkjhijMX0D zUnw== 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 :user-agent:message-id:date:subject:cc:to:from:dkim-signature; bh=fxlzZn7jb+IydN6hPXw1IT58vW/JTb5kk8C4x1r8E0U=; b=C1FgNlsvHQ2O6I3fmYtck8JuWx4j4styDEsMc16umU/MKnFd5unF5bo8t01ML5D2iq XBDHc+a59oQEPaiMXbmBu4JocmFP5ZD+sjcrzCyfUSGNdzBhy9+pUlWj6soaLkKD6nnx +1pz/1wrKYhrrRtEDowAcg6Du7rldadWl0mIxSgK/BoQQV25EHxKp3NI9LvRX6IYKwVz InG+M1kcsrvU73wc40ITATOAh3dNbO9Noa/RSyp8JXit+j0rtXn1bf3K+ldliV3nxh/C /Dx95yM5BkCNHqcOiS+VwR0sugs6TS0ug0FG1HCLj5eImjhWlIt372ryX5+CUUjgQqCE VYbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rr8H0yKF; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h36-20020a631224000000b0043c9fcccbd9si4301441pgl.685.2022.11.11.22.07.49; Fri, 11 Nov 2022 22:08:06 -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=rr8H0yKF; 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 S234387AbiKLFlM (ORCPT + 99 others); Sat, 12 Nov 2022 00:41:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbiKLFlL (ORCPT ); Sat, 12 Nov 2022 00:41:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 916B25B5B9; Fri, 11 Nov 2022 21:41:10 -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 50C58B828AD; Sat, 12 Nov 2022 05:41:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CD44C433D6; Sat, 12 Nov 2022 05:41:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668231668; bh=h5v5hN9bTBwVsyIV+aYUcCjEowuSsRchhaboUL7kJ14=; h=From:To:Cc:Subject:Date:From; b=rr8H0yKFVtlPtqvDoEpveRSVQnF4aBh2sd1MG1GIGa51MMEj8d+HQusslaVzpisjB Lux2qPQ8vloiIxGWmR6muh565u6I+tpZr+94VaqEsmf61BPashuRFvDBUd5g5fXOiH GI67VwHs60c/w6qmHHioppd4f8VJErV7SdVqjvVdlpnXstmuRJtFSYnVv8EtKZb80i LSxxqM9Tlvaq6OYO8zITVOnEipskvmlE+fTCMcw7t1st8tTdpNWTZ6HTOFalv3YDh9 3RqfRfj4oaS+pU0BWWK8W/buNkwDIkZOjtzJwdyKbIMM5iNa1h5aHpQXNhUQDx+xue NgAf6tadiCQbA== From: "Masami Hiramatsu (Google)" To: Linux Trace Kernel Cc: Rafael Mendonca , Masami Hiramatsu , Steven Rostedt , LKML , Tzvetomir Stoyanov Subject: [PATCH] tracing/eprobe: Fix eprobe filter to make a filter correctly Date: Sat, 12 Nov 2022 14:41:04 +0900 Message-Id: <166823166395.1385292.8931770640212414483.stgit@devnote3> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog User-Agent: StGit/0.19 MIME-Version: 1.0 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,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749269386666997385?= X-GMAIL-MSGID: =?utf-8?q?1749269386666997385?= 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) Tested-by: Rafael Mendonca --- kernel/trace/trace_eprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;