* [PATCH bpf v3 0/2] link to v1: https://lore.kernel.org/bpf/20230915103228.1196234-1-jolsa@kernel.org/
@ 2023-09-15 17:34 Nick Desaulniers
2023-09-15 17:34 ` [PATCH bpf v3 1/2] bpf: Fix BTF_ID symbol generation collision Nick Desaulniers
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Nick Desaulniers @ 2023-09-15 17:34 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Song Liu, Yonghong Song, KP Singh, Jiri Olsa
Cc: linux-kernel, bpf, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo,
Nick Desaulniers, stable, Satya Durga Srinivasu Prabhala,
Marcus Seyfarth, Nathan Chancellor
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
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/20230915-bpf_collision-v2-1-027670d38bdf@google.com
---
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 <ndesaulniers@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH bpf v3 1/2] bpf: Fix BTF_ID symbol generation collision
2023-09-15 17:34 [PATCH bpf v3 0/2] link to v1: https://lore.kernel.org/bpf/20230915103228.1196234-1-jolsa@kernel.org/ Nick Desaulniers
@ 2023-09-15 17:34 ` Nick Desaulniers
2023-09-15 18:30 ` Nathan Chancellor
2023-09-15 17:34 ` [PATCH bpf v3 2/2] bpf: Fix BTF_ID symbol generation collision in tools/ Nick Desaulniers
2023-09-15 19:20 ` [PATCH bpf v3 0/2] link to v1: https://lore.kernel.org/bpf/20230915103228.1196234-1-jolsa@kernel.org/ patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Nick Desaulniers @ 2023-09-15 17:34 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Song Liu, Yonghong Song, KP Singh, Jiri Olsa
Cc: linux-kernel, bpf, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo,
Nick Desaulniers, stable, Satya Durga Srinivasu Prabhala,
Marcus Seyfarth, Nathan Chancellor
From: Jiri Olsa <jolsa@kernel.org>
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>
Link: https://lore.kernel.org/bpf/CAEf4Bzb5KQ2_LmhN769ifMeSJaWfebccUasQOfQKaOd0nQ51tw@mail.gmail.com/
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH bpf v3 2/2] bpf: Fix BTF_ID symbol generation collision in tools/
2023-09-15 17:34 [PATCH bpf v3 0/2] link to v1: https://lore.kernel.org/bpf/20230915103228.1196234-1-jolsa@kernel.org/ Nick Desaulniers
2023-09-15 17:34 ` [PATCH bpf v3 1/2] bpf: Fix BTF_ID symbol generation collision Nick Desaulniers
@ 2023-09-15 17:34 ` Nick Desaulniers
2023-09-15 19:20 ` [PATCH bpf v3 0/2] link to v1: https://lore.kernel.org/bpf/20230915103228.1196234-1-jolsa@kernel.org/ patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Nick Desaulniers @ 2023-09-15 17:34 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Song Liu, Yonghong Song, KP Singh, Jiri Olsa
Cc: linux-kernel, bpf, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo,
Nick Desaulniers, stable, Satya Durga Srinivasu Prabhala,
Marcus Seyfarth, Nathan Chancellor
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>
---
tools/include/linux/btf_ids.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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
--
2.42.0.459.ge4e396fd5e-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH bpf v3 1/2] bpf: Fix BTF_ID symbol generation collision
2023-09-15 17:34 ` [PATCH bpf v3 1/2] bpf: Fix BTF_ID symbol generation collision Nick Desaulniers
@ 2023-09-15 18:30 ` Nathan Chancellor
0 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2023-09-15 18:30 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Song Liu, Yonghong Song, KP Singh, Jiri Olsa,
linux-kernel, bpf, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, stable,
Satya Durga Srinivasu Prabhala, Marcus Seyfarth
On Fri, Sep 15, 2023 at 10:34:27AM -0700, Nick Desaulniers wrote:
> From: Jiri Olsa <jolsa@kernel.org>
>
> 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>
> Link: https://lore.kernel.org/bpf/CAEf4Bzb5KQ2_LmhN769ifMeSJaWfebccUasQOfQKaOd0nQ51tw@mail.gmail.com/
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
> 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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bpf v3 0/2] link to v1: https://lore.kernel.org/bpf/20230915103228.1196234-1-jolsa@kernel.org/
2023-09-15 17:34 [PATCH bpf v3 0/2] link to v1: https://lore.kernel.org/bpf/20230915103228.1196234-1-jolsa@kernel.org/ Nick Desaulniers
2023-09-15 17:34 ` [PATCH bpf v3 1/2] bpf: Fix BTF_ID symbol generation collision Nick Desaulniers
2023-09-15 17:34 ` [PATCH bpf v3 2/2] bpf: Fix BTF_ID symbol generation collision in tools/ Nick Desaulniers
@ 2023-09-15 19:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-09-15 19:20 UTC (permalink / raw)
To: Nick Desaulniers
Cc: ast, daniel, andrii, martin.lau, song, yonghong.song, kpsingh,
jolsa, linux-kernel, bpf, kafai, songliubraving, yhs,
john.fastabend, kpsingh, sdf, haoluo, stable, quic_satyap,
m.seyfarth, nathan
Hello:
This series was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Fri, 15 Sep 2023 10:34:26 -0700 you wrote:
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> 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/20230915-bpf_collision-v2-1-027670d38bdf@google.com
>
> [...]
Here is the summary with links:
- [bpf,v3,1/2] bpf: Fix BTF_ID symbol generation collision
https://git.kernel.org/bpf/bpf/c/8f908db77782
- [bpf,v3,2/2] bpf: Fix BTF_ID symbol generation collision in tools/
https://git.kernel.org/bpf/bpf/c/c0bb9fb0e52a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-09-15 19:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-15 17:34 [PATCH bpf v3 0/2] link to v1: https://lore.kernel.org/bpf/20230915103228.1196234-1-jolsa@kernel.org/ Nick Desaulniers
2023-09-15 17:34 ` [PATCH bpf v3 1/2] bpf: Fix BTF_ID symbol generation collision Nick Desaulniers
2023-09-15 18:30 ` Nathan Chancellor
2023-09-15 17:34 ` [PATCH bpf v3 2/2] bpf: Fix BTF_ID symbol generation collision in tools/ Nick Desaulniers
2023-09-15 19:20 ` [PATCH bpf v3 0/2] link to v1: https://lore.kernel.org/bpf/20230915103228.1196234-1-jolsa@kernel.org/ patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox