1. 27 7月, 2021 3 次提交
  2. 24 7月, 2021 1 次提交
  3. 23 7月, 2021 3 次提交
  4. 20 7月, 2021 1 次提交
  5. 17 7月, 2021 2 次提交
  6. 16 7月, 2021 2 次提交
  7. 13 7月, 2021 1 次提交
    • M
      libbpf: Fix reuse of pinned map on older kernel · 97eb3138
      Martynas Pumputis 提交于
      When loading a BPF program with a pinned map, the loader checks whether
      the pinned map can be reused, i.e. their properties match. To derive
      such of the pinned map, the loader invokes BPF_OBJ_GET_INFO_BY_FD and
      then does the comparison.
      
      Unfortunately, on < 4.12 kernels the BPF_OBJ_GET_INFO_BY_FD is not
      available, so loading the program fails with the following error:
      
      	libbpf: failed to get map info for map FD 5: Invalid argument
      	libbpf: couldn't reuse pinned map at
      		'/sys/fs/bpf/tc/globals/cilium_call_policy': parameter
      		mismatch"
      	libbpf: map 'cilium_call_policy': error reusing pinned map
      	libbpf: map 'cilium_call_policy': failed to create:
      		Invalid argument(-22)
      	libbpf: failed to load object 'bpf_overlay.o'
      
      To fix this, fallback to derivation of the map properties via
      /proc/$PID/fdinfo/$MAP_FD if BPF_OBJ_GET_INFO_BY_FD fails with EINVAL,
      which can be used as an indicator that the kernel doesn't support
      the latter.
      Signed-off-by: NMartynas Pumputis <m@lambda.lt>
      Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
      Acked-by: NJohn Fastabend <john.fastabend@gmail.com>
      Link: https://lore.kernel.org/bpf/20210712125552.58705-1-m@lambda.lt
      97eb3138
  8. 07 7月, 2021 1 次提交
  9. 21 6月, 2021 1 次提交
  10. 16 6月, 2021 1 次提交
  11. 12 6月, 2021 1 次提交
  12. 09 6月, 2021 1 次提交
  13. 26 5月, 2021 2 次提交
  14. 25 5月, 2021 1 次提交
  15. 19 5月, 2021 6 次提交
  16. 15 5月, 2021 1 次提交
  17. 14 5月, 2021 1 次提交
  18. 12 5月, 2021 1 次提交
  19. 06 5月, 2021 1 次提交
  20. 27 4月, 2021 1 次提交
  21. 24 4月, 2021 4 次提交
  22. 16 4月, 2021 1 次提交
  23. 09 4月, 2021 1 次提交
  24. 27 3月, 2021 2 次提交
    • M
      libbpf: Support extern kernel function · 5bd022ec
      Martin KaFai Lau 提交于
      This patch is to make libbpf able to handle the following extern
      kernel function declaration and do the needed relocations before
      loading the bpf program to the kernel.
      
      extern int foo(struct sock *) __attribute__((section(".ksyms")))
      
      In the collect extern phase, needed changes is made to
      bpf_object__collect_externs() and find_extern_btf_id() to collect
      extern function in ".ksyms" section.  The func in the BTF datasec also
      needs to be replaced by an int var.  The idea is similar to the existing
      handling in extern var.  In case the BTF may not have a var, a dummy ksym
      var is added at the beginning of bpf_object__collect_externs()
      if there is func under ksyms datasec.  It will also change the
      func linkage from extern to global which the kernel can support.
      It also assigns a param name if it does not have one.
      
      In the collect relo phase, it will record the kernel function
      call as RELO_EXTERN_FUNC.
      
      bpf_object__resolve_ksym_func_btf_id() is added to find the func
      btf_id of the running kernel.
      
      During actual relocation, it will patch the BPF_CALL instruction with
      src_reg = BPF_PSEUDO_FUNC_CALL and insn->imm set to the running
      kernel func's btf_id.
      
      The required LLVM patch: https://reviews.llvm.org/D93563Signed-off-by: NMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20210325015234.1548923-1-kafai@fb.com
      5bd022ec
    • M
      libbpf: Record extern sym relocation first · aa0b8d43
      Martin KaFai Lau 提交于
      This patch records the extern sym relocs first before recording
      subprog relocs.  The later patch will have relocs for extern
      kernel function call which is also using BPF_JMP | BPF_CALL.
      It will be easier to handle the extern symbols first in
      the later patch.
      
      is_call_insn() helper is added.  The existing is_ldimm64() helper
      is renamed to is_ldimm64_insn() for consistency.
      Signed-off-by: NMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20210325015227.1548623-1-kafai@fb.com
      aa0b8d43