linux-next: manual merge of the bpf-next tree with the bpf tree

Started by Mark Brown on Nov 17, 2026 · 3 messages from 3 authors · Last reply Nov 19, 2026

open the first message on its own page

Message details and related content
Hi all,

Today's linux-next merge of the bpf-next tree got a conflict in:

  kernel/bpf/btf.c

between commit:

  b7cc45994c3f9 ("bpf: Check variable-offset accesses against special fields")

from the bpf tree and commit:

  ca4395aade31a ("bpf: Walk each type once when looking for special fields")

from the bpf-next tree.  I'm not confident of this merge, it discards
the bpf commit on the basis that it looks like there is some new
handling of special fields in the bpf-next tree but I'm not sure that
overlaps with the fix.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

diff --combined kernel/bpf/btf.c
index 49fcd32d418a9,e95ca39f990c6..0000000000000
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@@ -281,6 -281,7 +281,7 @@@ struct btf 
  	char name[MODULE_NAME_LEN];
  	bool kernel_btf;
  	__u32 *base_id_map; /* map from distilled base BTF -> vmlinux BTF ids */
+ 	u32 *next_tag; /* see btf_link_decl_tags() */
  };
  
  enum verifier_phase {
@@@ -308,6 -309,9 +309,9 @@@ enum resolve_mode 
  					 */
  };
  
+ /* It bounds the time of the loops that compare or print names */
+ #define BTF_MAX_NAME_LEN 4096
+ 
  #define MAX_RESOLVE_DEPTH 32
  
  struct btf_sec_info {
@@@ -319,6 -323,7 +323,7 @@@ struct btf_verifier_env 
  	struct btf *btf;
  	u8 *visit_states;
  	struct resolve_vertex stack[MAX_RESOLVE_DEPTH];
+ 	unsigned long *names;	/* offsets of the strings that can be names */
  	struct bpf_verifier_log log;
  	u32 log_type_id;
  	u32 top_stack;
@@@ -684,10 -689,15 +689,15 @@@ s32 btf_find_by_name_kind(const struct 
  				return id;
  		}
  	} else {
+ 		/* only the tags in BTF of a program have long names */
+ 		bool slow = !btf->kernel_btf && strlen(name) > KSYM_NAME_LEN;
+ 
  		for (id = btf_start_id(btf); id < total; id++) {
  			t = btf_type_by_id(btf, id);
  			if (BTF_INFO_KIND(t->info) != kind)
  				continue;
+ 			if (slow && bpf_must_abort())
+ 				return -EINTR;
  			tname = btf_name_by_offset(btf, t->name_off);

910 more lines

Message details and related content
On Wed, 18 Nov 2026 at 05:36, Mark Brown [off-list ref] wrote:
Hi all,

Today's linux-next merge of the bpf-next tree got a conflict in:

  kernel/bpf/btf.c

between commit:

  b7cc45994c3f9 ("bpf: Check variable-offset accesses against special fields")

from the bpf tree and commit:

  ca4395aade31a ("bpf: Walk each type once when looking for special fields")

from the bpf-next tree.  I'm not confident of this merge, it discards
the bpf commit on the basis that it looks like there is some new
handling of special fields in the bpf-next tree but I'm not sure that
overlaps with the fix.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
Hi Mark,

Thanks for the report.

I reproduced this on bpf-next master: the rewrite does not cover the fix,
the check in btf_struct_access() now only looks at min_off again. I will
send a v4 rebased on top of the bpf-next series shortly.

Thanks,
Shihuang
quoted hunk
diff --combined kernel/bpf/btf.c
index 49fcd32d418a9,e95ca39f990c6..0000000000000
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@@ -281,6 -281,7 +281,7 @@@ struct btf
        char name[MODULE_NAME_LEN];
        bool kernel_btf;
        __u32 *base_id_map; /* map from distilled base BTF -> vmlinux BTF ids */
+       u32 *next_tag; /* see btf_link_decl_tags() */
  };

  enum verifier_phase {
@@@ -308,6 -309,9 +309,9 @@@ enum resolve_mode
                                         */
  };

+ /* It bounds the time of the loops that compare or print names */
+ #define BTF_MAX_NAME_LEN 4096
+
  #define MAX_RESOLVE_DEPTH 32

  struct btf_sec_info {
@@@ -319,6 -323,7 +323,7 @@@ struct btf_verifier_env
        struct btf *btf;
        u8 *visit_states;
        struct resolve_vertex stack[MAX_RESOLVE_DEPTH];
+       unsigned long *names;   /* offsets of the strings that can be names */
        struct bpf_verifier_log log;
        u32 log_type_id;
        u32 top_stack;
@@@ -684,10 -689,15 +689,15 @@@ s32 btf_find_by_name_kind(const struct
                                return id;
                }
        } else {
+               /* only the tags in BTF of a program have long names */
+               bool slow = !btf->kernel_btf && strlen(name) > KSYM_NAME_LEN;
+
                for (id = btf_start_id(btf); id < total; id++) {
                        t = btf_type_by_id(btf, id);
                        if (BTF_INFO_KIND(t->info) != kind)

914 more quoted lines

Message details and related content
On Wed Nov 18, 2026 at 3:47 PM UTC, J4f J4f wrote:
On Wed, 18 Nov 2026 at 05:36, Mark Brown [off-list ref] wrote:
quoted
Hi all,

Today's linux-next merge of the bpf-next tree got a conflict in:

  kernel/bpf/btf.c

between commit:

  b7cc45994c3f9 ("bpf: Check variable-offset accesses against special fields")

from the bpf tree and commit:

  ca4395aade31a ("bpf: Walk each type once when looking for special fields")

from the bpf-next tree.  I'm not confident of this merge, it discards
the bpf commit on the basis that it looks like there is some new
handling of special fields in the bpf-next tree but I'm not sure that
overlaps with the fix.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
Hi Mark,

Thanks for the report.

I reproduced this on bpf-next master: the rewrite does not cover the fix,
the check in btf_struct_access() now only looks at min_off again. I will
send a v4 rebased on top of the bpf-next series shortly.
Pls ask your bot to stop doing stupid things.
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help