1. 18 May, 2018 1 commit
    • Javier Honduvilla Coto's avatar
      usdt: fail when binary doesn't exist. Fixes #1749 · dcb9b9ad
      Javier Honduvilla Coto authored
      And add error message to hint if the problem is that the passed binary
      path is not absolute or if the binary doesn't exist.
      
      In case the PID is correct:
      
      * but the binary couldn't be found, it will print:
      
        ```
        HINT: Specified binary doesn't exist.
        [...]
        ```
      
      * but the binary is not absolute:
      
        ```
        HINT: Binary path should be absolute.
        [...]
        ```
      
      Otherwise, it should keep behaving as before.
      dcb9b9ad
  2. 15 May, 2018 1 commit
  3. 14 May, 2018 1 commit
    • Teng Qin's avatar
      Do not calculate syscall prefix proactively in C++ API (#1755) · db6e2931
      Teng Qin authored
      Currently do calculate the syscall prefix in BPF::init, which requires
      loading kallsyms etc. But a lot of times the functionality will not be
      used. This commit changes that we only calculate the syscall prefix the
      first time we call get_syscall_fnname
      
      Also change to use the KSym class directly for better destruct
      production
      db6e2931
  4. 11 May, 2018 2 commits
  5. 10 May, 2018 3 commits
  6. 09 May, 2018 3 commits
  7. 08 May, 2018 4 commits
    • Paul Chaignon's avatar
      Trace all external pointers passed through a first map (#1737) · ad2d0d9f
      Paul Chaignon authored
      * Trace all external pointers going through a first map
      
      Currently, MapVisitor only detects maps with external pointers as
      values if the value was directly passed from a function's argument.
      For example, in the following, the rewriter is currently unable to
      detect currsock has an external pointer as value because an
      intermediate variable is used instead of passing directly sk as the
      map's value.
      
          int test(struct pt_regs *ctx, struct sock *sk) {
              u32 pid = bpf_get_current_pid_tgid();
              struct sock **skp = &sk;
              currsock.update(&pid, skp);
              return 0;
          };
      
      With this commit, MapVisitor is able to trace any external pointer
      derived from the function's argument and used as a map value. This
      commit breaks the ProbeVisitor traversal in two distinct traversals.
      The first rewrites dereferences of external pointers originating
      from function's arguments and helpers, while the second rewrites only
      dereferences of external pointers passed through maps.
      Maps with external pointers as values are identified between the two
      ProbeVisitor traversals.
      
      * New tests for external pointers passed through maps
      
      test_ext_ptr_maps_reverse ensures dereferences are correctly replaced
      even if the update happens after the lookup (in the order of
      MapVisitor traversal).
      test_ext_ptr_maps_indirect ensures the rewriter is able to trace
      external pointers used as map values even if using an intermediate
      variable.
      ad2d0d9f
    • Javier Honduvilla Coto's avatar
      Fix USDT probes arguments' encoding in Python3 (#1736) · 42da08aa
      Javier Honduvilla Coto authored
      * Fix USDT probes arguments' encoding in Python3
      
      Running `trace` on a binary's USDT while fetching some arguments (
      `sudo python3 trace.py -p $(pidof ruby) 'u:ruby:array__create "%d",
      arg1'`) fails with `argument 2: <class 'TypeError'>: wrong type`.
      
      This PR fixes the encoding of the USDT probe name in
      udst.py `get_probe_arg_ctype` function. I've tested this works on Python 2 too.
      42da08aa
    • yonghong-song's avatar
      Merge pull request #1738 from pchaigno/links-circonus · 4139b198
      yonghong-song authored
      Link to article on how Circonus uses bcc
      4139b198
    • Paul Chaignon's avatar
      Link to article on how Circonus uses bcc · 6d822db9
      Paul Chaignon authored
      6d822db9
  8. 06 May, 2018 6 commits
  9. 05 May, 2018 2 commits
  10. 04 May, 2018 1 commit
  11. 03 May, 2018 4 commits
  12. 02 May, 2018 5 commits
  13. 01 May, 2018 3 commits
    • Paul Chaignon's avatar
      Detect external pointers from context pointers · b66a9c9b
      Paul Chaignon authored
      The bcc rewriter is currently unable to detect external pointers
      (i.e., to a memory address that requires calls to bpf_probe_read) if
      they are not declared as arguments, e.g., if they are retrieved
      through the context argument.
      For example, although the two following examples translate to the
      same C code in the end (the bcc rewriter translates the first into
      the second), the sk pointer is recognized as an external pointer only
      in the first example.
      
      int test1(struct pt_regs *ctx, struct sock *sk) {
          // sk is correctly recognized as an external pointer.
      }
      int test2(struct pt_regs *ctx) {
          struct sock *sk = (struct sock *)ctx->di;
          // sk is not recognized as an external pointer.
      }
      
      This commit fixes that by detecting member dereferences of the
      context argument (i.e., the first argument of externally visible
      functions). It also works for the TRACEPOINT_PROBE macro.
      b66a9c9b
    • Paul Chaignon's avatar
    • Yonghong Song's avatar
      fix lua compilation issue with latest clang/llvm 7.0 · eb88b35a
      Yonghong Song authored
      Commit 46ebd9ef ("fix compilation with latest clang/llvm 7.0")
      tried to fix a compilation introduced with latest clang change.
      It did not fix the lua compilation issue since unfortunately
      my bcc environment did not have lua setup properly for that commit.
      
      This commit intends to fix for lua compilation issue as well.
      The intermediate static library bcc-lua-static is removed and
      now bcc-lua-static is just a list of static libraries used
      for final linking to produce bcc-lua. This way, we do not
      need the special linker flags like -Wl,--whole-archive and
      -Wl,--no-whole-archive. The bcc-static and bcc-shared libraries
      did not change since they will be installed and may be used
      by the application.
      
      Tested on FC27 based system, with the workaround in issue #1685,
      all tests passed.
      
      Fixes: 46ebd9ef ("fix compilation with latest clang/llvm 7.0")
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      eb88b35a
  14. 30 Apr, 2018 4 commits