1. 18 11月, 2020 1 次提交
  2. 11 11月, 2020 1 次提交
  3. 10 11月, 2020 1 次提交
  4. 28 10月, 2020 1 次提交
  5. 22 10月, 2020 1 次提交
    • D
      bpf, libbpf: Guard bpf inline asm from bpf_tail_call_static · 3652c9a1
      Daniel Borkmann 提交于
      Yaniv reported a compilation error after pulling latest libbpf:
      
        [...]
        ../libbpf/src/root/usr/include/bpf/bpf_helpers.h:99:10: error:
        unknown register name 'r0' in asm
                           : "r0", "r1", "r2", "r3", "r4", "r5");
        [...]
      
      The issue got triggered given Yaniv was compiling tracing programs with native
      target (e.g. x86) instead of BPF target, hence no BTF generated vmlinux.h nor
      CO-RE used, and later llc with -march=bpf was invoked to compile from LLVM IR
      to BPF object file. Given that clang was expecting x86 inline asm and not BPF
      one the error complained that these regs don't exist on the former.
      
      Guard bpf_tail_call_static() with defined(__bpf__) where BPF inline asm is valid
      to use. BPF tracing programs on more modern kernels use BPF target anyway and
      thus the bpf_tail_call_static() function will be available for them. BPF inline
      asm is supported since clang 7 (clang <= 6 otherwise throws same above error),
      and __bpf_unreachable() since clang 8, therefore include the latter condition
      in order to prevent compilation errors for older clang versions. Given even an
      old Ubuntu 18.04 LTS has official LLVM packages all the way up to llvm-10, I did
      not bother to special case the __bpf_unreachable() inside bpf_tail_call_static()
      further.
      
      Also, undo the sockex3_kern's use of bpf_tail_call_static() sample given they
      still have the old hacky way to even compile networking progs with native instead
      of BPF target so bpf_tail_call_static() won't be defined there anymore.
      
      Fixes: 0e9f6841 ("bpf, libbpf: Add bpf_tail_call_static helper for bpf programs")
      Reported-by: NYaniv Agman <yanivagman@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAndrii Nakryiko <andrii@kernel.org>
      Acked-by: NYonghong Song <yhs@fb.com>
      Tested-by: NYaniv Agman <yanivagman@gmail.com>
      Link: https://lore.kernel.org/bpf/CAMy7=ZUk08w5Gc2Z-EKi4JFtuUCaZYmE4yzhJjrExXpYKR4L8w@mail.gmail.com
      Link: https://lore.kernel.org/bpf/20201021203257.26223-1-daniel@iogearbox.net
      3652c9a1
  6. 12 10月, 2020 3 次提交
  7. 07 10月, 2020 5 次提交
  8. 01 10月, 2020 1 次提交
  9. 19 9月, 2020 1 次提交
  10. 15 9月, 2020 3 次提交
  11. 04 9月, 2020 2 次提交
  12. 01 9月, 2020 3 次提交
  13. 25 8月, 2020 3 次提交
  14. 24 8月, 2020 1 次提交
  15. 19 8月, 2020 1 次提交
  16. 22 7月, 2020 1 次提交
  17. 16 7月, 2020 2 次提交
  18. 14 7月, 2020 1 次提交
  19. 11 7月, 2020 1 次提交
  20. 08 7月, 2020 3 次提交
    • D
      samples: bpf: Refactor BPF map performance test with libbpf · cc7f641d
      Daniel T. Lee 提交于
      Previously, in order to set the numa_node attribute at the time of map
      creation using "libbpf", it was necessary to call bpf_create_map_node()
      directly (bpf_load approach), instead of calling bpf_object_load()
      that handles everything on its own, including map creation. And because
      of this problem, this sample had problems with refactoring from bpf_load
      to libbbpf.
      
      However, by commit 1bdb6c9a ("libbpf: Add a bunch of attribute
      getters/setters for map definitions") added the numa_node attribute and
      allowed it to be set in the map.
      
      By using libbpf instead of bpf_load, the inner map definition has
      been explicitly declared with BTF-defined format. Also, the element of
      ARRAY_OF_MAPS was also statically specified using the BTF format. And
      for this reason some logic in fixup_map() was not needed and changed
      or removed.
      Signed-off-by: NDaniel T. Lee <danieltimlee@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/20200707184855.30968-4-danieltimlee@gmail.com
      cc7f641d
    • D
      samples: bpf: Refactor BPF map in map test with libbpf · 88795b4a
      Daniel T. Lee 提交于
      From commit 646f02ff ("libbpf: Add BTF-defined map-in-map
      support"), a way to define internal map in BTF-defined map has been
      added.
      
      Instead of using previous 'inner_map_idx' definition, the structure to
      be used for the inner map can be directly defined using array directive.
      
          __array(values, struct inner_map)
      
      This commit refactors map in map test program with libbpf by explicitly
      defining inner map with BTF-defined format.
      Signed-off-by: NDaniel T. Lee <danieltimlee@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/20200707184855.30968-3-danieltimlee@gmail.com
      88795b4a
    • D
      samples: bpf: Fix bpf programs with kprobe/sys_connect event · af9bd3e3
      Daniel T. Lee 提交于
      Currently, BPF programs with kprobe/sys_connect does not work properly.
      
      Commit 34745aed ("samples/bpf: fix kprobe attachment issue on x64")
      This commit modifies the bpf_load behavior of kprobe events in the x64
      architecture. If the current kprobe event target starts with "sys_*",
      add the prefix "__x64_" to the front of the event.
      
      Appending "__x64_" prefix with kprobe/sys_* event was appropriate as a
      solution to most of the problems caused by the commit below.
      
          commit d5a00528 ("syscalls/core, syscalls/x86: Rename struct
          pt_regs-based sys_*() to __x64_sys_*()")
      
      However, there is a problem with the sys_connect kprobe event that does
      not work properly. For __sys_connect event, parameters can be fetched
      normally, but for __x64_sys_connect, parameters cannot be fetched.
      
          ffffffff818d3520 <__x64_sys_connect>:
          ffffffff818d3520: e8 fb df 32 00        callq   0xffffffff81c01520
          <__fentry__>
          ffffffff818d3525: 48 8b 57 60           movq    96(%rdi), %rdx
          ffffffff818d3529: 48 8b 77 68           movq    104(%rdi), %rsi
          ffffffff818d352d: 48 8b 7f 70           movq    112(%rdi), %rdi
          ffffffff818d3531: e8 1a ff ff ff        callq   0xffffffff818d3450
          <__sys_connect>
          ffffffff818d3536: 48 98                 cltq
          ffffffff818d3538: c3                    retq
          ffffffff818d3539: 0f 1f 80 00 00 00 00  nopl    (%rax)
      
      As the assembly code for __x64_sys_connect shows, parameters should be
      fetched and set into rdi, rsi, rdx registers prior to calling
      __sys_connect.
      
      Because of this problem, this commit fixes the sys_connect event by
      first getting the value of the rdi register and then the value of the
      rdi, rsi, and rdx register through an offset based on that value.
      
      Fixes: 34745aed ("samples/bpf: fix kprobe attachment issue on x64")
      Signed-off-by: NDaniel T. Lee <danieltimlee@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/20200707184855.30968-2-danieltimlee@gmail.com
      af9bd3e3
  21. 16 6月, 2020 1 次提交
  22. 19 5月, 2020 3 次提交