Skip to content

Commit 7aae231

Browse files
iamkafaiAlexei Starovoitov
authored andcommitted
bpf: tcp: Limit calling some tcp cc functions to CONFIG_DYNAMIC_FTRACE
pahole currently only generates the btf_id for external function and ftrace-able function. Some functions in the bpf_tcp_ca_kfunc_ids are static (e.g. cubictcp_init). Thus, unless CONFIG_DYNAMIC_FTRACE is set, btf_ids for those functions will not be generated and the compilation fails during resolve_btfids. This patch limits those functions to CONFIG_DYNAMIC_FTRACE. I will address the pahole generation in a followup and then remove the CONFIG_DYNAMIC_FTRACE limitation. Fixes: e78aea8 ("bpf: tcp: Put some tcp cong functions in allowlist for bpf-tcp-cc") Reported-by: Cong Wang <xiyou.wangcong@gmail.com> Reported-by: Lorenz Bauer <lmb@cloudflare.com> Signed-off-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20210329221357.834438-1-kafai@fb.com
1 parent 21cfd2d commit 7aae231

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/ipv4/bpf_tcp_ca.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ BTF_ID(func, tcp_reno_cong_avoid)
185185
BTF_ID(func, tcp_reno_undo_cwnd)
186186
BTF_ID(func, tcp_slow_start)
187187
BTF_ID(func, tcp_cong_avoid_ai)
188+
#ifdef CONFIG_DYNAMIC_FTRACE
188189
#if IS_BUILTIN(CONFIG_TCP_CONG_CUBIC)
189190
BTF_ID(func, cubictcp_init)
190191
BTF_ID(func, cubictcp_recalc_ssthresh)
@@ -211,6 +212,7 @@ BTF_ID(func, bbr_ssthresh)
211212
BTF_ID(func, bbr_min_tso_segs)
212213
BTF_ID(func, bbr_set_state)
213214
#endif
215+
#endif /* CONFIG_DYNAMIC_FTRACE */
214216
BTF_SET_END(bpf_tcp_ca_kfunc_ids)
215217

216218
static bool bpf_tcp_ca_check_kfunc_call(u32 kfunc_btf_id)

0 commit comments

Comments
 (0)