summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Desaulniers <ndesaulniers@google.com>2023-09-15 10:34:28 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-06 14:57:04 +0200
commit4fb56e82d939eb949bfa6b142cf54b394b7514a6 (patch)
tree1d8662c5a05404ae0a99c8336392267a954cab5f
parent4f1e3e02777b2ccc915da4db681133eb585a7a3b (diff)
downloadlinux-stable-4fb56e82d939eb949bfa6b142cf54b394b7514a6.tar.gz
linux-stable-4fb56e82d939eb949bfa6b142cf54b394b7514a6.tar.bz2
linux-stable-4fb56e82d939eb949bfa6b142cf54b394b7514a6.zip
bpf: Fix BTF_ID symbol generation collision in tools/
commit c0bb9fb0e52a64601d38b3739b729d9138d4c8a1 upstream. Marcus and Satya reported an issue where BTF_ID macro generates same symbol in separate objects and that breaks final vmlinux link. ld.lld: error: ld-temp.o <inline asm>:14577:1: symbol '__BTF_ID__struct__cgroup__624' is already defined This can be triggered under specific configs when __COUNTER__ happens to be the same for the same symbol in two different translation units, which is already quite unlikely to happen. Add __LINE__ number suffix to make BTF_ID symbol more unique, which is not a complete fix, but it would help for now and meanwhile we can work on better solution as suggested by Andrii. Cc: stable@vger.kernel.org Reported-by: Satya Durga Srinivasu Prabhala <quic_satyap@quicinc.com> Reported-by: Marcus Seyfarth <m.seyfarth@gmail.com> Closes: https://github.com/ClangBuiltLinux/linux/issues/1913 Debugged-by: Nathan Chancellor <nathan@kernel.org> Co-developed-by: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/bpf/CAEf4Bzb5KQ2_LmhN769ifMeSJaWfebccUasQOfQKaOd0nQ51tw@mail.gmail.com/ Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Link: https://lore.kernel.org/r/20230915-bpf_collision-v3-2-263fc519c21f@google.com Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--tools/include/linux/btf_ids.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/include/linux/btf_ids.h b/tools/include/linux/btf_ids.h
index 71e54b1e3796..2f882d5cb30f 100644
--- a/tools/include/linux/btf_ids.h
+++ b/tools/include/linux/btf_ids.h
@@ -38,7 +38,7 @@ asm( \
____BTF_ID(symbol)
#define __ID(prefix) \
- __PASTE(prefix, __COUNTER__)
+ __PASTE(__PASTE(prefix, __COUNTER__), __LINE__)
/*
* The BTF_ID defines unique symbol for each ID pointing