1. 20 Apr, 2024 5 commits
  2. 18 Apr, 2024 1 commit
  3. 17 Apr, 2024 2 commits
    • Quentin Deslandes's avatar
      libbpf: Fix dump of subsequent char arrays · e739e01d
      Quentin Deslandes authored
      When dumping a character array, libbpf will watch for a '\0' and set
      is_array_terminated=true if found. This prevents libbpf from printing
      the remaining characters of the array, treating it as a nul-terminated
      string.
      
      However, once this flag is set, it's never reset, leading to subsequent
      characters array not being printed properly:
      
      .str_multi = (__u8[2][16])[
          [
              'H',
              'e',
              'l',
          ],
      ],
      
      This patch saves the is_array_terminated flag and restores its
      default (false) value before looping over the elements of an array,
      then restores it afterward. This way, libbpf's behavior is unchanged
      when dumping the characters of an array, but subsequent arrays are
      printed properly:
      
      .str_multi = (__u8[2][16])[
          [
              'H',
              'e',
              'l',
          ],
          [
              'l',
              'o',
          ],
      ],
      Signed-off-by: default avatarQuentin Deslandes <qde@naccy.de>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20240413211258.134421-3-qde@naccy.de
      e739e01d
    • Quentin Deslandes's avatar
      libbpf: Fix misaligned array closing bracket · 9213e529
      Quentin Deslandes authored
      In btf_dump_array_data(), libbpf will call btf_dump_dump_type_data() for
      each element. For an array of characters, each element will be
      processed the following way:
      
      - btf_dump_dump_type_data() is called to print the character
      - btf_dump_data_pfx() prefixes the current line with the proper number
        of indentations
      - btf_dump_int_data() is called to print the character
      - After the last character is printed, btf_dump_dump_type_data() calls
        btf_dump_data_pfx() before writing the closing bracket
      
      However, for an array containing characters, btf_dump_int_data() won't
      print any '\0' and subsequent characters. This leads to situations where
      the line prefix is written, no character is added, then the prefix is
      written again before adding the closing bracket:
      
      (struct sk_metadata){
          .str_array = (__u8[14])[
              'H',
              'e',
              'l',
              'l',
              'o',
                      ],
      
      This change solves this issue by printing the '\0' character, which
      has two benefits:
      
      - The bracket closing the array is properly aligned
      - It's clear from a user point of view that libbpf uses '\0' as a
        terminator for arrays of characters.
      Signed-off-by: default avatarQuentin Deslandes <qde@naccy.de>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20240413211258.134421-2-qde@naccy.de
      9213e529
  4. 16 Apr, 2024 5 commits
  5. 12 Apr, 2024 2 commits
  6. 11 Apr, 2024 11 commits
  7. 09 Apr, 2024 2 commits
  8. 08 Apr, 2024 1 commit
  9. 06 Apr, 2024 4 commits
  10. 05 Apr, 2024 7 commits