Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp10101176rwd; Wed, 21 Jun 2023 16:39:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ54YqUZn+6bq6RXXNm9uFooPw8IlKU/NkX5MBnklbesiVTLqeJDxOM2A1BGz1NzLPAdJWyU X-Received: by 2002:a05:6214:262b:b0:626:2e07:c080 with SMTP id gv11-20020a056214262b00b006262e07c080mr24867327qvb.15.1687390746671; Wed, 21 Jun 2023 16:39:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687390746; cv=none; d=google.com; s=arc-20160816; b=gOCls33MKQilus2eQDxuYk717xIZcLy3gkLKowUxZipvUvs3pLtIobiauf4tBQAE9Y PBExeXi9ojN5PXE0cjiwlwFOSAkTrJD4/3CXLSZffZV+k6qSz3i/Ie5jYwc82BWpy/4+ wD9RdW+zDnIM5SmmeK2xRwQZ8Grp74cz63dWLuv4HBojgz4HJ8KzhjNi/txRh7yK+urL El6uykzHNbhPTVO/qRcCnpOqnWCbhfyxvIMx5nD8bgb6Op5Ii6iLTDVV7kS4gDSj7kMS ItfX+NW4bfrYKPmyG+aKgxHTF2ecC+GpZkitudK98D+4mRUfRqw8lzbvFy+45RMseMU7 u7rQ== 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; bh=cWFRAwzIWapwdSv057gSaCBsjKggkgovAls0sHa8Bh4=; b=SAaTGMokC6IzTpKrSZls0gRSSHEILTBwUn6uJgxwI4qbHi/MIYEqQeA9mM0sY10Gx5 0Vh9dXJhR66q9FLyZTPy59hH0+kuar9lXdmwYaReCTyIgU0S+FYcyqmDQ7H3AqUr3cmy W7aAn6TCxFP/pWlhGilAMS92A1+UrSV5yDaItkNmX7pQDGQjosOtD9YihDpvJNUIZ9sF wehD+JulZEfIzurdZN92vbxa4pOu6F4qGxv9jJhCJFaYHz08BZoTlJOOjxOk+cfksPbT qRAkjW1HAo3LWndp+Fk0DdjH4iaQvvIQYcXC6WuXEozv9oojH+RBV5gF4so/SWTB0DBU Q50g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q19-20020a637513000000b00557221f00c7si3623870pgc.335.2023.06.21.16.38.53; Wed, 21 Jun 2023 16:39:06 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230165AbjFUXDw (ORCPT + 99 others); Wed, 21 Jun 2023 19:03:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbjFUXDo (ORCPT ); Wed, 21 Jun 2023 19:03:44 -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 B5FBC1BCB; Wed, 21 Jun 2023 16:03:42 -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 393A4616FA; Wed, 21 Jun 2023 23:03:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C78FC433C0; Wed, 21 Jun 2023 23:03:40 +0000 (UTC) Date: Wed, 21 Jun 2023 19:03:37 -0400 From: Steven Rostedt To: "Masami Hiramatsu (Google)" Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, Florent Revest , Mark Rutland , Will Deacon , Mathieu Desnoyers , Martin KaFai Lau , bpf@vger.kernel.org, Bagas Sanjaya , kernel test robot Subject: Re: [PATCH] tracing/probes: Fix tracepoint event with $arg* to fetch correct argument Message-ID: <20230621190337.4635ead7@gandalf.local.home> In-Reply-To: <168657113778.3038017.12245893750241701312.stgit@mhiramat.roam.corp.google.com> References: <168657113778.3038017.12245893750241701312.stgit@mhiramat.roam.corp.google.com> X-Mailer: Claws Mail 3.17.8 (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.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,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, 12 Jun 2023 20:58:57 +0900 "Masami Hiramatsu (Google)" wrote: > From: Masami Hiramatsu (Google) > > To hide the first dummy 'data' argument on the tracepoint probe events, > the BTF argument array was modified (skip the first argument for tracepoint), > but the '$arg*' meta argument parser missed that. > > Fix to increment the argument index if it is tracepoint probe. And decrement > the index when searching the type of the argument. I'm curious. What if we want a variable that points to that data argument? ;-) Probably just add a new type I guess. Anyway, Reviewed-by: Steven Rostedt (Google) -- Steve > > Signed-off-by: Masami Hiramatsu (Google) > --- > kernel/trace/trace_probe.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c > index 473e1c43bc57..643aa3a51d5a 100644 > --- a/kernel/trace/trace_probe.c > +++ b/kernel/trace/trace_probe.c > @@ -456,7 +456,10 @@ static int parse_btf_arg(const char *varname, struct fetch_insn *code, > > if (name && !strcmp(name, varname)) { > code->op = FETCH_OP_ARG; > - code->param = i; > + if (ctx->flags & TPARG_FL_TPOINT) > + code->param = i + 1; > + else > + code->param = i; > return 0; > } > } > @@ -470,8 +473,11 @@ static const struct fetch_type *parse_btf_arg_type(int arg_idx, > struct btf *btf = traceprobe_get_btf(); > const char *typestr = NULL; > > - if (btf && ctx->params) > + if (btf && ctx->params) { > + if (ctx->flags & TPARG_FL_TPOINT) > + arg_idx--; > typestr = type_from_btf_id(btf, ctx->params[arg_idx].type); > + } > > return find_fetch_type(typestr, ctx->flags); > }