public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* duplicate BTF_IDs leading to symbol redefinition errors?
@ 2023-09-07 19:01 Nick Desaulniers
  2023-09-07 20:33 ` Jiri Olsa
  0 siblings, 1 reply; 16+ messages in thread
From: Nick Desaulniers @ 2023-09-07 19:01 UTC (permalink / raw)
  To: bpf; +Cc: clang-built-linux, Stanislav Fomichev, Nathan Chancellor,
	Yonghong Song

So we've got a curious report recently:
https://github.com/ClangBuiltLinux/linux/issues/1913

ld.lld: error: ld-temp.o <inline asm>:14577:1: symbol
'__BTF_ID__struct__cgroup__624' is already defined
__BTF_ID__struct__cgroup__624:
^

It's been hard to pin down a SHA and .config to reproduce this, but
looking at the definition of BTF_ID's usage of __ID's usage of
__COUNTER__, and the two statements:

kernel/bpf/helpers.c:2460:BTF_ID(struct, cgroup)
kernel/bpf/verifier.c:5075:BTF_ID(struct, cgroup)

Is it possible that __COUNTER__ could evaluate to the same value
across 2 different translation units, leading to a name collision like
the above?

looking at another usage of BTF_ID other than struct
cgroup;kernel/bpf/helpers.c:2461:BTF_ID(func, bpf_cgroup_release)
is only defined in one translation unit

Should one of those two `BTF_ID(struct, cgroup)` be removed? Is there
some other way we can avoid these collisions in the future?

Was this a previously observed/fixed issue?

-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-09-24 13:27 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-07 19:01 duplicate BTF_IDs leading to symbol redefinition errors? Nick Desaulniers
2023-09-07 20:33 ` Jiri Olsa
2023-09-08 11:47   ` Jiri Olsa
2023-09-08 17:14     ` Nick Desaulniers
2023-09-08 20:15       ` Jiri Olsa
2023-09-11 16:21         ` Nick Desaulniers
     [not found]         ` <CA+FbhJNz4i4pU+8nT7JBvQKSa0VCkzcNzaJ=dRdRn+JCSTdgKQ@mail.gmail.com>
2023-09-11 18:17           ` Marcus Seyfarth
2023-09-14  8:17         ` Jiri Olsa
2023-09-14  8:30           ` Masahiro Yamada
2023-09-14  9:52             ` Jiri Olsa
2023-09-14 18:14               ` Andrii Nakryiko
2023-09-15  8:28                 ` Jiri Olsa
2023-09-15 16:47                   ` Nick Desaulniers
2023-09-15 20:41                   ` Andrii Nakryiko
2023-09-17 14:09                     ` Jiri Olsa
2023-09-24 13:27                       ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox