Re: [PATCH bpf-next 04/15] bpf: Support bpf program calling kernel function

2021-03-19 Thread Martin KaFai Lau
On Thu, Mar 18, 2021 at 06:03:49PM -0700, Andrii Nakryiko wrote: > On Tue, Mar 16, 2021 at 12:01 AM Martin KaFai Lau wrote: > > > > This patch adds support to BPF verifier to allow bpf program calling > > kernel function directly. > > > > The use case included in this set is to allow bpf-tcp-cc to

Re: [PATCH bpf-next 04/15] bpf: Support bpf program calling kernel function

2021-03-18 Thread Alexei Starovoitov
On 3/18/21 6:03 PM, Andrii Nakryiko wrote: + desc->imm = BPF_CAST_CALL(addr) - __bpf_call_base; Is this difference guaranteed to always fit within s32? we have this restriction in many places: JIT, dispatcher, trampoline, and bpf interpreter. Modules and kernel .text are in the same 4G

Re: [PATCH bpf-next 04/15] bpf: Support bpf program calling kernel function

2021-03-18 Thread Andrii Nakryiko
On Tue, Mar 16, 2021 at 12:01 AM Martin KaFai Lau wrote: > > This patch adds support to BPF verifier to allow bpf program calling > kernel function directly. > > The use case included in this set is to allow bpf-tcp-cc to directly > call some tcp-cc helper functions (e.g. "tcp_cong_avoid_ai()").

[PATCH bpf-next 04/15] bpf: Support bpf program calling kernel function

2021-03-15 Thread Martin KaFai Lau
This patch adds support to BPF verifier to allow bpf program calling kernel function directly. The use case included in this set is to allow bpf-tcp-cc to directly call some tcp-cc helper functions (e.g. "tcp_cong_avoid_ai()"). Those functions have already been used by some kernel tcp-cc implemen