From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH RFC 1/5] tracing/probes: Fix to search structure fields correctly
Date: Sat, 17 Feb 2024 21:27:08 +0900 [thread overview]
Message-ID: <20240217212708.2e14a88e6c1e9733450459f6@kernel.org> (raw)
In-Reply-To: <170791694361.389532.10047514554799419688.stgit@devnote2>
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;
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2024-02-17 12:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-14 13:22 [PATCH RFC 0/5] tracing/probes: Support function parameter access from return probe Masami Hiramatsu (Google)
2024-02-14 13:22 ` [PATCH RFC 1/5] tracing/probes: Fix to search structure fields correctly Masami Hiramatsu (Google)
2024-02-17 12:27 ` Masami Hiramatsu [this message]
2024-02-14 13:22 ` [PATCH RFC 2/5] tracing/fprobe-event: cleanup: Fix a wrong comment in fprobe event Masami Hiramatsu (Google)
2024-02-14 13:22 ` [PATCH RFC 3/5] tracing/probes: Cleanup probe argument parser Masami Hiramatsu (Google)
2024-02-14 13:22 ` [PATCH RFC 4/5] tracing/probes: cleanup: Set trace_probe::nr_args at trace_probe_init Masami Hiramatsu (Google)
2024-02-14 13:22 ` [PATCH RFC 5/5] tracing/probes: Support $argN in return probe (kprobe and fprobe) Masami Hiramatsu (Google)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240217212708.2e14a88e6c1e9733450459f6@kernel.org \
--to=mhiramat@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox