Skip to content
  1. Jan 28, 2022
  2. Jan 27, 2022
    • Jakub Kicinski's avatar
      bpf: remove unused static inlines · 8033c6c2
      Jakub Kicinski authored
      
      
      Remove two dead stubs, sk_msg_clear_meta() was never
      used, use of xskq_cons_is_full() got replaced by
      xsk_tx_writeable() in v5.10.
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Link: https://lore.kernel.org/r/20220126185412.2776254-1-kuba@kernel.org
      
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      8033c6c2
    • Andrii Nakryiko's avatar
      selftests/bpf: fix uprobe offset calculation in selftests · ff943683
      Andrii Nakryiko authored
      
      
      Fix how selftests determine relative offset of a function that is
      uprobed. Previously, there was an assumption that uprobed function is
      always in the first executable region, which is not always the case
      (libbpf CI hits this case now). So get_base_addr() approach in isolation
      doesn't work anymore. So teach get_uprobe_offset() to determine correct
      memory mapping and calculate uprobe offset correctly.
      
      While at it, I merged together two implementations of
      get_uprobe_offset() helper, moving powerpc64-specific logic inside (had
      to add extra {} block to avoid unused variable error for insn).
      
      Also ensured that uprobed functions are never inlined, but are still
      static (and thus local to each selftest), by using a no-op asm volatile
      block internally. I didn't want to keep them global __weak, because some
      tests use uprobe's ref counter offset (to test USDT-like logic) which is
      not compatible with non-refcounted uprobe. So it's nicer to have each
      test uprobe target local to the file and guaranteed to not be inlined or
      skipped by the compiler (which can happen with static functions,
      especially if compiling selftests with -O2).
      
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/r/20220126193058.3390292-1-andrii@kernel.org
      
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      ff943683
    • Yonghong Song's avatar
      selftests/bpf: Fix a clang compilation error · e5465a90
      Yonghong Song authored
      
      
      Compiling kernel and selftests/bpf with latest llvm like blow:
        make -j LLVM=1
        make -C tools/testing/selftests/bpf -j LLVM=1
      I hit the following compilation error:
        /.../prog_tests/log_buf.c:215:6: error: variable 'log_buf' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                if (!ASSERT_OK_PTR(raw_btf_data, "raw_btf_data_good"))
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /.../prog_tests/log_buf.c:264:7: note: uninitialized use occurs here
                free(log_buf);
                     ^~~~~~~
        /.../prog_tests/log_buf.c:215:2: note: remove the 'if' if its condition is always false
                if (!ASSERT_OK_PTR(raw_btf_data, "raw_btf_data_good"))
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /.../prog_tests/log_buf.c:205:15: note: initialize the variable 'log_buf' to silence this warning
                char *log_buf;
                             ^
                              = NULL
        1 error generated.
      
      Compiler rightfully detected that log_buf is uninitialized in one of failure path as indicated
      in the above.
      
      Proper initialization of 'log_buf' variable fixed the issue.
      
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20220126181940.4105997-1-yhs@fb.com
      e5465a90
  3. Jan 26, 2022
  4. Jan 25, 2022