1. 15 9月, 2021 2 次提交
  2. 07 8月, 2021 1 次提交
  3. 31 7月, 2021 1 次提交
  4. 30 7月, 2021 3 次提交
  5. 26 5月, 2021 1 次提交
  6. 24 4月, 2021 1 次提交
  7. 19 3月, 2021 5 次提交
  8. 05 3月, 2021 2 次提交
  9. 22 1月, 2021 1 次提交
  10. 13 1月, 2021 1 次提交
  11. 04 12月, 2020 2 次提交
  12. 17 11月, 2020 1 次提交
  13. 06 11月, 2020 6 次提交
    • A
      libbpf: Accomodate DWARF/compiler bug with duplicated identical arrays · 6b6e6b1d
      Andrii Nakryiko 提交于
      In some cases compiler seems to generate distinct DWARF types for identical
      arrays within the same CU. That seems like a bug, but it's already out there
      and breaks type graph equivalence checks, so accommodate it anyway by checking
      for identical arrays, regardless of their type ID.
      Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NSong Liu <songliubraving@fb.com>
      Link: https://lore.kernel.org/bpf/20201105043402.2530976-10-andrii@kernel.org
      6b6e6b1d
    • A
      libbpf: Support BTF dedup of split BTFs · f86524ef
      Andrii Nakryiko 提交于
      Add support for deduplication split BTFs. When deduplicating split BTF, base
      BTF is considered to be immutable and can't be modified or adjusted. 99% of
      BTF deduplication logic is left intact (module some type numbering adjustments).
      There are only two differences.
      
      First, each type in base BTF gets hashed (expect VAR and DATASEC, of course,
      those are always considered to be self-canonical instances) and added into
      a table of canonical table candidates. Hashing is a shallow, fast operation,
      so mostly eliminates the overhead of having entire base BTF to be a part of
      BTF dedup.
      
      Second difference is very critical and subtle. While deduplicating split BTF
      types, it is possible to discover that one of immutable base BTF BTF_KIND_FWD
      types can and should be resolved to a full STRUCT/UNION type from the split
      BTF part.  This is, obviously, can't happen because we can't modify the base
      BTF types anymore. So because of that, any type in split BTF that directly or
      indirectly references that newly-to-be-resolved FWD type can't be considered
      to be equivalent to the corresponding canonical types in base BTF, because
      that would result in a loss of type resolution information. So in such case,
      split BTF types will be deduplicated separately and will cause some
      duplication of type information, which is unavoidable.
      
      With those two changes, the rest of the algorithm manages to deduplicate split
      BTF correctly, pointing all the duplicates to their canonical counter-parts in
      base BTF, but also is deduplicating whatever unique types are present in split
      BTF on their own.
      
      Also, theoretically, split BTF after deduplication could end up with either
      empty type section or empty string section. This is handled by libbpf
      correctly in one of previous patches in the series.
      Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NSong Liu <songliubraving@fb.com>
      Link: https://lore.kernel.org/bpf/20201105043402.2530976-9-andrii@kernel.org
      f86524ef
    • A
      libbpf: Fix BTF data layout checks and allow empty BTF · d8123624
      Andrii Nakryiko 提交于
      Make data section layout checks stricter, disallowing overlap of types and
      strings data.
      
      Additionally, allow BTFs with no type data. There is nothing inherently wrong
      with having BTF with no types (put potentially with some strings). This could
      be a situation with kernel module BTFs, if module doesn't introduce any new
      type information.
      
      Also fix invalid offset alignment check for btf->hdr->type_off.
      
      Fixes: 8a138aed ("bpf: btf: Add BTF support to libbpf")
      Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20201105043402.2530976-8-andrii@kernel.org
      d8123624
    • A
      libbpf: Implement basic split BTF support · ba451366
      Andrii Nakryiko 提交于
      Support split BTF operation, in which one BTF (base BTF) provides basic set of
      types and strings, while another one (split BTF) builds on top of base's types
      and strings and adds its own new types and strings. From API standpoint, the
      fact that the split BTF is built on top of the base BTF is transparent.
      
      Type numeration is transparent. If the base BTF had last type ID #N, then all
      types in the split BTF start at type ID N+1. Any type in split BTF can
      reference base BTF types, but not vice versa. Programmatically construction of
      a split BTF on top of a base BTF is supported: one can create an empty split
      BTF with btf__new_empty_split() and pass base BTF as an input, or pass raw
      binary data to btf__new_split(), or use btf__parse_xxx_split() variants to get
      initial set of split types/strings from the ELF file with .BTF section.
      
      String offsets are similarly transparent and are a logical continuation of
      base BTF's strings. When building BTF programmatically and adding a new string
      (explicitly with btf__add_str() or implicitly through appending new
      types/members), string-to-be-added would first be looked up from the base
      BTF's string section and re-used if it's there. If not, it will be looked up
      and/or added to the split BTF string section. Similarly to type IDs, types in
      split BTF can refer to strings from base BTF absolutely transparently (but not
      vice versa, of course, because base BTF doesn't "know" about existence of
      split BTF).
      
      Internal type index is slightly adjusted to be zero-indexed, ignoring a fake
      [0] VOID type. This allows to handle split/base BTF type lookups transparently
      by using btf->start_id type ID offset, which is always 1 for base/non-split
      BTF and equals btf__get_nr_types(base_btf) + 1 for the split BTF.
      
      BTF deduplication is not yet supported for split BTF and support for it will
      be added in separate patch.
      Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NSong Liu <songliubraving@fb.com>
      Link: https://lore.kernel.org/bpf/20201105043402.2530976-5-andrii@kernel.org
      ba451366
    • A
      libbpf: Unify and speed up BTF string deduplication · 88a82c2a
      Andrii Nakryiko 提交于
      Revamp BTF dedup's string deduplication to match the approach of writable BTF
      string management. This allows to transfer deduplicated strings index back to
      BTF object after deduplication without expensive extra memory copying and hash
      map re-construction. It also simplifies the code and speeds it up, because
      hashmap-based string deduplication is faster than sort + unique approach.
      Signed-off-by: NAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NSong Liu <songliubraving@fb.com>
      Link: https://lore.kernel.org/bpf/20201105043402.2530976-4-andrii@kernel.org
      88a82c2a
    • A
      libbpf: Factor out common operations in BTF writing APIs · c81ed6d8
      Andrii Nakryiko 提交于
      Factor out commiting of appended type data. Also extract fetching the very
      last type in the BTF (to append members to). These two operations are common
      across many APIs and will be easier to refactor with split BTF, if they are
      extracted into a single place.
      Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NSong Liu <songliubraving@fb.com>
      Link: https://lore.kernel.org/bpf/20201105043402.2530976-2-andrii@kernel.org
      c81ed6d8
  14. 01 10月, 2020 1 次提交
  15. 30 9月, 2020 2 次提交
  16. 29 9月, 2020 8 次提交
  17. 22 9月, 2020 1 次提交
  18. 19 8月, 2020 1 次提交