FAILED: patch "[PATCH] tracing/probes: Fix anon_stack check for unnamed bitfields in" failed to apply to 6.18-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x f36d94a20ca185bcadef3a10b980cd2cfd72d53a
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090810-jasmine-divided-a4e9@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From f36d94a20ca185bcadef3a10b980cd2cfd72d53a Mon Sep 17 00:00:00 2001
From: "Masami Hiramatsu (Google)" <[email protected]>
Date: Tue, 1 Sep 2026 23:21:37 +0900
Subject: [PATCH] tracing/probes: Fix anon_stack check for unnamed bitfields in
btf_find_struct_member
btf_find_struct_member() traverses into nested anonymous structures and unions by pushing members with !member->name_off onto anon_stack. However, it does not consider the unnamed bitfields (e.g. int : 5 or unsigned int : 0) which also have member->name_off == 0.
If such an unnamed bitfield is pushed to anon_stack, the btf_find_struct_member() return an error even if there are other valid entries in anon_stack.
To fix this, only push unnamed struct/union members to anon_stack. Also move the btf_type_is_struct() check to the entry of this function because now it is sure only struct/union are pushed to anon_stack.
kernel/trace/trace_btf.c +6 -6
@@ -74,24 +74,24 @@ const struct btf_member *btf_find_struct_member(struct btf *btf, {struct btf_anon_stack *anon_stack;const struct btf_member *member; +const struct btf_type *mtype;u32 tid, cur_offset =0 ;const char *name;int i, top =0 ; +if (!btf_type_is_struct (type)) +return ERR_PTR (-EINVAL ); + anon_stack =kzalloc_objs (*anon_stack,BTF_ANON_STACK_MAX );if (!anon_stack)return ERR_PTR (-ENOMEM ); retry: -if (!btf_type_is_struct (type)) { - member =ERR_PTR (-EINVAL ); - goto out; - } -for_each_member (i, type, member) {if (!member->name_off) {/* Anonymous union/struct: push it for later use */ -if (btf_type_skip_modifiers (btf, member->type, &tid) && + mtype =btf_type_skip_modifiers (btf, member->type, &tid); +if (mtype &&btf_type_is_struct (mtype) && top <BTF_ANON_STACK_MAX ) { anon_stack[top].tid = tid; anon_stack[top++].offset =
Sasha Levin
maintainerPATCH 1/1 tracing/probes: Fix anon_stack check for unnamed bitfields in btf_find_struct_member
From: "Masami Hiramatsu (Google)" <[email protected]>
[ Upstream commit f36d94a20ca185bcadef3a10b980cd2cfd72d53a ]
btf_find_struct_member() traverses into nested anonymous structures and unions by pushing members with !member->name_off onto anon_stack. However, it does not consider the unnamed bitfields (e.g. int : 5 or unsigned int : 0) which also have member->name_off == 0.
If such an unnamed bitfield is pushed to anon_stack, the btf_find_struct_member() return an error even if there are other valid entries in anon_stack.
To fix this, only push unnamed struct/union members to anon_stack. Also move the btf_type_is_struct() check to the entry of this function because now it is sure only struct/union are pushed to anon_stack.
--- kernel/trace/trace_btf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/trace/trace_btf.c +6 -6
@@ -74,24 +74,24 @@ const struct btf_member *btf_find_struct_member(struct btf *btf, {struct btf_anon_stack *anon_stack;const struct btf_member *member; +const struct btf_type *mtype;u32 tid, cur_offset =0 ;const char *name;int i, top =0 ; +if (!btf_type_is_struct (type)) +return ERR_PTR (-EINVAL ); + anon_stack =kcalloc (BTF_ANON_STACK_MAX ,sizeof (*anon_stack),GFP_KERNEL );if (!anon_stack)return ERR_PTR (-ENOMEM ); retry: -if (!btf_type_is_struct (type)) { - member =ERR_PTR (-EINVAL ); - goto out; - } -for_each_member (i, type, member) {if (!member->name_off) {/* Anonymous union/struct: push it for later use */ -if (btf_type_skip_modifiers (btf, member->type, &tid) && + mtype =btf_type_skip_modifiers (btf, member->type, &tid); +if (mtype &&btf_type_is_struct (mtype) && top <BTF_ANON_STACK_MAX ) { anon_stack[top].tid = tid; anon_stack[top++].offset =
Signature · 1 line
2.53.0