M Mark Brown #
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);