1. 01 Apr, 2021 9 commits
  2. 31 Mar, 2021 2 commits
  3. 30 Mar, 2021 25 commits
  4. 29 Mar, 2021 1 commit
  5. 28 Mar, 2021 1 commit
  6. 27 Mar, 2021 2 commits
    • Alexei Starovoitov's avatar
      Merge branch 'bpf: Support calling kernel function' · fddbf4b6
      Alexei Starovoitov authored
      Martin KaFai says:
      
      ====================
      
      This series adds support to allow bpf program calling kernel function.
      
      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 implementations.
      
      This set will also allow the bpf-tcp-cc program to directly call the
      kernel tcp-cc implementation,  For example, a bpf_dctcp may only want to
      implement its own dctcp_cwnd_event() and reuse other dctcp_*() directly
      from the kernel tcp_dctcp.c instead of reimplementing (or
      copy-and-pasting) them.
      
      The tcp-cc kernel functions mentioned above will be white listed
      for the struct_ops bpf-tcp-cc programs to use in a later patch.
      The white listed functions are not bounded to a fixed ABI contract.
      Those functions have already been used by the existing kernel tcp-cc.
      If any of them has changed, both in-tree and out-of-tree kernel tcp-cc
      implementations have to be changed.  The same goes for the struct_ops
      bpf-tcp-cc programs which have to be adjusted accordingly.
      
      Please see individual patch for details.
      
      v2:
      - Patch 2 in v1 is removed.  No need to support extern func in kernel.
        Changed libbpf to adjust the .ksyms datasec for extern func
        in patch 11. (Andrii)
      - Name change: btf_check_func_arg_match() and btf_check_subprog_arg_match()
        in patch 2. (Andrii)
      - Always set unreliable on any error in patch 2 since it does not
        matter. (Andrii)
      - s/kern_func/kfunc/ and s/descriptor/desc/ in this set. (Andrii)
      - Remove some unnecessary changes in disasm.h and disasm.c
        in patch 3.  In particular, no need to change the function
        signature in bpf_insn_revmap_call_t.  Also, removed the changes
        in print_bpf_insn().
      - Fixed an issue in check_kfunc_call() when the calling kernel function
        returns a pointer in patch 3.  Added a selftest.
      - Adjusted the verifier selftests due to the changes in the verifier log
        in patch 3.
      - Fixed a comparison issue in kfunc_desc_cmp_by_imm() in patch 3. (Andrii)
      - Name change: is_ldimm64_insn(),
        new helper: is_call_insn() in patch 10 (Andrii)
      - Move btf_func_linkage() from btf.h to libbpf.c in patch 11. (Andrii)
      - Fixed the linker error when CONFIG_BPF_SYSCALL is not defined.
        Moved the check_kfunc_call from filter.c to test_run.c in patch 14.
        (kernel test robot)
      ====================
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      fddbf4b6
    • Martin KaFai Lau's avatar
      bpf: selftests: Add kfunc_call test · 7bd1590d
      Martin KaFai Lau authored
      This patch adds a few kernel function bpf_kfunc_call_test*() for the
      selftest's test_run purpose.  They will be allowed for tc_cls prog.
      
      The selftest calling the kernel function bpf_kfunc_call_test*()
      is also added in this patch.
      Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20210325015252.1551395-1-kafai@fb.com
      7bd1590d