[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20240217212708.2e14a88e6c1e9733450459f6@kernel.org>
Date: Sat, 17 Feb 2024 21:27:08 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
Cc: linux-trace-kernel@...r.kernel.org, linux-kernel@...r.kernel.org, Steven
Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH RFC 1/5] tracing/probes: Fix to search structure fields
correctly
Let me pick this patch because this is a real bugfix.
On Wed, 14 Feb 2024 22:22:23 +0900
"Masami Hiramatsu (Google)" <mhiramat@...nel.org> wrote:
> From: Masami Hiramatsu (Google) <mhiramat@...nel.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@...r.kernel.org
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@...nel.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@...nel.org>
Powered by blists - more mailing lists