Signed-off-by: Nick Desaulniers <[email protected]>
---
Changes in v3:
- combine v1 and v2 into a series; I didn't recognize that this macro
appeared twice in the kernel sources.
- Use __PASTE twice.
- Link to v2: https://lore.kernel.org/r/[email protected]
---
Jiri Olsa (1):
bpf: Fix BTF_ID symbol generation collision
Nick Desaulniers (1):
bpf: Fix BTF_ID symbol generation collision in tools/
include/linux/btf_ids.h | 2 +-
tools/include/linux/btf_ids.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
base-commit: 9fdfb15a3dbf818e06be514f4abbfc071004cbe7
change-id: 20230915-bpf_collision-36889a391d44
Best regards,
--
Nick Desaulniers <[email protected]>
From: Jiri Olsa <[email protected]>
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: [email protected]
Reported-by: Satya Durga Srinivasu Prabhala <[email protected]>
Reported-by: Marcus Seyfarth <[email protected]>
Closes: https://github.com/ClangBuiltLinux/linux/issues/1913
Debugged-by: Nathan Chancellor <[email protected]>
Link: https://lore.kernel.org/bpf/CAEf4Bzb5KQ2_LmhN769ifMeSJaWfebccUasQOfQKaOd0nQ51tw@mail.gmail.com/
Signed-off-by: Jiri Olsa <[email protected]>
Signed-off-by: Nick Desaulniers <[email protected]>
---
include/linux/btf_ids.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h
index a3462a9b8e18..a9cb10b0e2e9 100644
--- a/include/linux/btf_ids.h
+++ b/include/linux/btf_ids.h
@@ -49,7 +49,7 @@ word \
____BTF_ID(symbol, word)
#define __ID(prefix) \
- __PASTE(prefix, __COUNTER__)
+ __PASTE(__PASTE(prefix, __COUNTER__), __LINE__)
/*
* The BTF_ID defines unique symbol for each ID pointing
--
2.42.0.459.ge4e396fd5e-goog