1. 26 12月, 2019 1 次提交
    • A
      libbpf: Support CO-RE relocations for LDX/ST/STX instructions · 8ab9da57
      Andrii Nakryiko 提交于
      Clang patch [0] enables emitting relocatable generic ALU/ALU64 instructions
      (i.e, shifts and arithmetic operations), as well as generic load/store
      instructions. The former ones are already supported by libbpf as is. This
      patch adds further support for load/store instructions. Relocatable field
      offset is encoded in BPF instruction's 16-bit offset section and are adjusted
      by libbpf based on target kernel BTF.
      
      These Clang changes and corresponding libbpf changes allow for more succinct
      generated BPF code by encoding relocatable field reads as a single
      ST/LDX/STX instruction. It also enables relocatable access to BPF context.
      Previously, if context struct (e.g., __sk_buff) was accessed with CO-RE
      relocations (e.g., due to preserve_access_index attribute), it would be
      rejected by BPF verifier due to modified context pointer dereference. With
      Clang patch, such context accesses are both relocatable and have a fixed
      offset from the point of view of BPF verifier.
      
        [0] https://reviews.llvm.org/D71790Signed-off-by: NAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NYonghong Song <yhs@fb.com>
      Link: https://lore.kernel.org/bpf/20191223180305.86417-1-andriin@fb.com
      8ab9da57
  2. 23 12月, 2019 1 次提交
  3. 20 12月, 2019 1 次提交
    • A
      libbpf: Introduce bpf_prog_attach_xattr · cdbee383
      Andrey Ignatov 提交于
      Introduce a new bpf_prog_attach_xattr function that, in addition to
      program fd, target fd and attach type, accepts an extendable struct
      bpf_prog_attach_opts.
      
      bpf_prog_attach_opts relies on DECLARE_LIBBPF_OPTS macro to maintain
      backward and forward compatibility and has the following "optional"
      attach attributes:
      
      * existing attach_flags, since it's not required when attaching in NONE
        mode. Even though it's quite often used in MULTI and OVERRIDE mode it
        seems to be a good idea to reduce number of arguments to
        bpf_prog_attach_xattr;
      
      * newly introduced attribute of BPF_PROG_ATTACH command: replace_prog_fd
        that is fd of previously attached cgroup-bpf program to replace if
        BPF_F_REPLACE flag is used.
      
      The new function is named to be consistent with other xattr-functions
      (bpf_prog_test_run_xattr, bpf_create_map_xattr, bpf_load_program_xattr).
      
      The struct bpf_prog_attach_opts is supposed to be used with
      DECLARE_LIBBPF_OPTS macro.
      Signed-off-by: NAndrey Ignatov <rdna@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/bd6e0732303eb14e4b79cb128268d9e9ad6db208.1576741281.git.rdna@fb.com
      cdbee383
  4. 19 12月, 2019 7 次提交
  5. 18 12月, 2019 3 次提交
  6. 17 12月, 2019 3 次提交
  7. 16 12月, 2019 18 次提交
  8. 14 12月, 2019 3 次提交
  9. 13 12月, 2019 1 次提交
  10. 11 12月, 2019 1 次提交
  11. 05 12月, 2019 1 次提交