summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/prog_tests/stacktrace_map.c
diff options
context:
space:
mode:
authorAndrea Righi <arighi@nvidia.com>2025-09-24 10:14:26 +0200
committerAlexei Starovoitov <ast@kernel.org>2025-09-24 02:48:05 -0700
commitd4680a11e14c7baf683cb8453d91d71d2e0b9d3e (patch)
tree6d0e0372106d7f0c62d8985a861bd0021a67029a /tools/testing/selftests/bpf/prog_tests/stacktrace_map.c
parentceeaa7135723d77eb1bdab90379125d7c5a56696 (diff)
bpf: Mark kfuncs as __noclone
Some distributions (e.g., CachyOS) support building the kernel with -O3, but doing so may break kfuncs, resulting in their symbols not being properly exported. In fact, with gcc -O3, some kfuncs may be optimized away despite being annotated as noinline. This happens because gcc can still clone the function during IPA optimizations, e.g., by duplicating or inlining it into callers, and then dropping the standalone symbol. This breaks BTF ID resolution since resolve_btfids relies on the presence of a global symbol for each kfunc. Currently, this is not an issue for upstream, because we don't allow building the kernel with -O3, but it may be safer to address it anyway, to prevent potential issues in the future if compilers become more aggressive with optimizations. Therefore, add __noclone to __bpf_kfunc to ensure kfuncs are never cloned and remain distinct, globally visible symbols, regardless of the optimization level. Fixes: 57e7c169cd6af ("bpf: Add __bpf_kfunc tag for marking kernel functions as kfuncs") Acked-by: David Vernet <void@manifault.com> Acked-by: Yonghong Song <yonghong.song@linux.dev> Signed-off-by: Andrea Righi <arighi@nvidia.com> Link: https://lore.kernel.org/r/20250924081426.156934-1-arighi@nvidia.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/stacktrace_map.c')
0 files changed, 0 insertions, 0 deletions