Message ID | 170791694361.389532.10047514554799419688.stgit@devnote2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-65267-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp1207386dyb; Wed, 14 Feb 2024 05:22:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWKdIpupm9mkxJZ3rQAMdF+kAqkd74A+Y8Y7wlhVLbgaDU30jabFaY0N37z3Tq5mCCKygbPKPi/uCjv/+y+5PLbnkK8Qg== X-Google-Smtp-Source: AGHT+IEk+7YLjlNUe1zEbMvvaHzHraAwIEkoKPH57W7hA0ZXmhL5IUTu/lC9wW1s6zwa8ThQFggA X-Received: by 2002:a05:620a:1a95:b0:783:c7c1:3814 with SMTP id bl21-20020a05620a1a9500b00783c7c13814mr3446056qkb.26.1707916972103; Wed, 14 Feb 2024 05:22:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707916972; cv=pass; d=google.com; s=arc-20160816; b=sp3tp07MmurKz7pQ+G3fkh97ls9wU2hGmf/MzCd1TyuywLOYH2ijM/QqL/l1qqTzzc /cAzTvaVyZIKd0Jv9xb5+sFLQ9E7+cC25ZaJRbJiqVDkA3IIi9BK4QjRH0HPkWqDeiGh g/QGUEhAedGrP8/br7omMeugSKk0rXh+5BZKMqlpi7MQKYlkQB/Ewo3Kk8Q95aDhT0+d /mbUxiDF/jstf6TPR2EY9Sa2rkq5kBqPuc/Y0jcnuYhY7tDrjQgWEIRnyRGBsl2oo/Fc /rXjfvA7FVJ6JigpWy4j35xrI4SMTuBVEy1lvW30dDfa0nmk2iJtYsoc7j8iIRckygrq TvQw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Hi5TdHCU92m/Da3Q9M581ex8WENc3t14/Yipn4BIVCE=; fh=aRhPRZU1MouGLTiWygkiAYLp9Yaq1YDs8jgNFf647OU=; b=KGnJ3TlXGpJA+M2AFgngty+LqX2UF+j4GR2EIcgDYHzjUTK2XZl1RDJ4BN/yYhtuS+ 5q+INeqog1H2+e6NmoTdFTkEl1NkuJOAtGxj/sW4CtzzDE2rE3iH/hmjda6+8Zu4V2bv Tb6VETkWfDuPZy/cSiRhtPMIjXO2YWS+1HpCjJ/olLLhIF06nsn5BfUq9/wCAYPhjBdh 7qaLcz9EETGogw+BYZBkknPfiYa9HoaLhCbDO64XG3Q2+vfzcmQTG7+89lMrCDLLzmKi 9xPQ+OafyP7WmWin7cdv1lQ5nUsq6cLZt2t6DeyaUTB40M1E55bKNrFo0BnmeFQggPFH kAtQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KhlP+mtw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-65267-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65267-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCWbXK9WCEV3eYS4XrJP0Er/v4hQOnvKQNgdXBWOEJvhO12cFDwVbJSoFgPLHVO4ZqDMoDY7NlAAhFSlSR+MD2EdYnYNKg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id pe28-20020a05620a851c00b00785d37680cdsi7697987qkn.733.2024.02.14.05.22.51 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 05:22:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65267-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KhlP+mtw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-65267-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65267-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DF01F1C20C6A for <ouuuleilei@gmail.com>; Wed, 14 Feb 2024 13:22:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D47C54BE9; Wed, 14 Feb 2024 13:22:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KhlP+mtw" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFC7754670; Wed, 14 Feb 2024 13:22:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707916948; cv=none; b=KSvdU+fsRkmncM0lJZHgBxD9835P8RrjGeJQKTt5mUNQgM1XQCNNYERzxprzGdHK0Yw3DlRWTaqov9dbhX8gJUvJTNtFFTUF38z0SAxs1DZxjzFTlwFQXxmXHNaVMUUJF3RMIjzgQLze+5cB8F4qFMpBQJ9rX/D/5d735yiCzo0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707916948; c=relaxed/simple; bh=VG0MktVwabnUwipPLIf3jQPx5AW1d8Ms9iB0R5HsZLM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=DpK0buTCf2ZXq4VtVWJJ20nvMQYAyCTk4KbU47unmgScskGHtmPCJy8edS3mCexj5HD+1ASoVfj3f+gTiJxuD7qzMVJuweIkVTQcpi5plZ5DPymYu0trzya1DLUGgFdfpPh5mecgkVA0MPC3zu5XAKH1pRsFmllmRTLY3faGikM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KhlP+mtw; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60B9DC433F1; Wed, 14 Feb 2024 13:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707916947; bh=VG0MktVwabnUwipPLIf3jQPx5AW1d8Ms9iB0R5HsZLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KhlP+mtw5Bf4V+dPyp3lg0cekg2L2ynWetLOiRWpvw9Abm+7ips+UHJ7N2BI6Sl71 FdarhNIIPmOPBISl3ZDC0DFRfXj+xWD1UKSdsNj4522KYs4QZ+GT7Zp8O5E0UDbFDS qHxEWBTEqRlU78XLQkqvE0fD3p2zSZ+fhoTjodO4V8KLzL93rOvevt6CgwE3hpwA4Q Q5R89ZDItmQW/IL2L8cJwPrGn+xWPIIYTCxuq0R0JCDJ8tIHqzPbnFUW8RSHeZrrI6 hmSB8tFbE7JvC8xjOOoKqdTSUbkdPvhT+85hYdY3tHBKqYgEDY+dofCHR4UKJ7dzp0 uTzQMvb3K+uog== From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org> To: linux-trace-kernel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>, mhiramat@kernel.org Subject: [PATCH RFC 1/5] tracing/probes: Fix to search structure fields correctly Date: Wed, 14 Feb 2024 22:22:23 +0900 Message-Id: <170791694361.389532.10047514554799419688.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <170791693437.389532.6816883363982512874.stgit@devnote2> References: <170791693437.389532.6816883363982512874.stgit@devnote2> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790880747075536740 X-GMAIL-MSGID: 1790880747075536740 |
Series |
tracing/probes: Support function parameter access from return probe
|
|
Commit Message
Masami Hiramatsu (Google)
Feb. 14, 2024, 1:22 p.m. UTC
From: Masami Hiramatsu (Google) <mhiramat@kernel.org> Fix to search a field from the structure which has anonymous union correctly. Since the reference `type` pointer was updated in the loop, the search loop suddenly aborted where it hits an anonymous union. Thus it can not find the field after the anonymous union. This avoids updating the cursor `type` pointer in the loop. Fixes: 302db0f5b3d8 ("tracing/probes: Add a function to search a member of a struct/union") Cc: stable@vger.kernel.org Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> --- kernel/trace/trace_btf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
Let me pick this patch because this is a real bugfix. On Wed, 14 Feb 2024 22:22:23 +0900 "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote: > From: Masami Hiramatsu (Google) <mhiramat@kernel.org> > > Fix to search a field from the structure which has anonymous union > correctly. > Since the reference `type` pointer was updated in the loop, the search > loop suddenly aborted where it hits an anonymous union. Thus it can not > find the field after the anonymous union. This avoids updating the > cursor `type` pointer in the loop. > > Fixes: 302db0f5b3d8 ("tracing/probes: Add a function to search a member of a struct/union") > Cc: stable@vger.kernel.org > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> > --- > kernel/trace/trace_btf.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/trace/trace_btf.c b/kernel/trace/trace_btf.c > index ca224d53bfdc..5bbdbcbbde3c 100644 > --- a/kernel/trace/trace_btf.c > +++ b/kernel/trace/trace_btf.c > @@ -91,8 +91,8 @@ const struct btf_member *btf_find_struct_member(struct btf *btf, > for_each_member(i, type, member) { > if (!member->name_off) { > /* Anonymous union/struct: push it for later use */ > - type = btf_type_skip_modifiers(btf, member->type, &tid); > - if (type && top < BTF_ANON_STACK_MAX) { > + if (btf_type_skip_modifiers(btf, member->type, &tid) && > + top < BTF_ANON_STACK_MAX) { > anon_stack[top].tid = tid; > anon_stack[top++].offset = > cur_offset + member->offset; >
diff --git a/kernel/trace/trace_btf.c b/kernel/trace/trace_btf.c index ca224d53bfdc..5bbdbcbbde3c 100644 --- a/kernel/trace/trace_btf.c +++ b/kernel/trace/trace_btf.c @@ -91,8 +91,8 @@ const struct btf_member *btf_find_struct_member(struct btf *btf, for_each_member(i, type, member) { if (!member->name_off) { /* Anonymous union/struct: push it for later use */ - type = btf_type_skip_modifiers(btf, member->type, &tid); - if (type && top < BTF_ANON_STACK_MAX) { + if (btf_type_skip_modifiers(btf, member->type, &tid) && + top < BTF_ANON_STACK_MAX) { anon_stack[top].tid = tid; anon_stack[top++].offset = cur_offset + member->offset;