1. 23 Jan, 2019 2 commits
  2. 22 Jan, 2019 3 commits
  3. 21 Jan, 2019 2 commits
    • Xiaozhou Liu's avatar
      print_log2_hist(): check and skip possible paddings (#2155) · 3f7b5966
      Xiaozhou Liu authored
      Address issue 2154.
      
      When a struct S is used as key to a BPF_HISTOGRAM, it is assumed that the second
      member of S holds the slot. But when S is converted to python from bpf C,
      a padding may be inserted as a second member. This breaks print_log2_hist().
      
          root@debian:~/bcc/tools# ./softirqs.py -d
          Tracing soft irq event time... Hit Ctrl-C to end.
          ^C
          Traceback (most recent call last):
            File "./softirqs.py", line 144, in <module>
              dist.print_log2_hist(label, "softirq", section_print_fn=vec_to_name)
            File "/usr/local/lib/python2.7/dist-packages/bcc/table.py", line 326, in print_log2_hist
              vals[slot] = v.value
          TypeError: list indices must be integers, not str
      
      Fix it by skipping the possible padding. Future work would be fixing/working
      around in the library where the padding is introduced.
      3f7b5966
    • yonghong-song's avatar
      Merge pull request #2149 from iovisor/yhs_dev · dc1254ed
      yonghong-song authored
      use kernel libbpf in bcc
      dc1254ed
  4. 18 Jan, 2019 3 commits
  5. 17 Jan, 2019 5 commits
  6. 16 Jan, 2019 5 commits
  7. 15 Jan, 2019 2 commits
    • Joel's avatar
      Bcc build fixes for Android (#2142) · 98fd5030
      Joel authored
      * Mark unused parameters as unused
      
      In Android, we are building libbpf with -Wunused-parameter, mark the
      parameters in bpf_detach_tracepoint to prevent errors.
      
      Change-Id: I2d0011746af80898e55d456b973a95330ce6be71
      Signed-off-by: default avatarJoel Fernandes <joel@joelfernandes.org>
      
      * Avoid void pointer arithmetic
      
      In Android, we build libbpf with -Wpointer-arith, this causes warnings
      as below. Avoid void pointer arithmetic to prevent the warning.
      
      external/bcc/src/cc/perf_reader.c:189:26: error: arithmetic on a pointer
      to void is a GNU extension [-Werror,-Wpointer-arith] memcpy(reader->buf
      + len, base, e->size - len);                               ~~~~~~~~~~~ ^
      
      Change-Id: If06535459473c78799b38119786a91e74a208895
      Signed-off-by: default avatarJoel Fernandes <joel@joelfernandes.org>
      
      * Cast correctly for unsigned long format specifier
      
      In Android, -Wformat gets passed to the compiler causing a warning. Fix
      it by casting.
      
      external/bcc/src/cc/libbpf.c:972:58: error: format specifies type
      'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned lo
      ng long') [-Werror,-Wformat]
      
      Change-Id: I5e70eeff983f20a0b921e81aee7ddbee6d7de2b3
      Signed-off-by: default avatarJoel Fernandes <joel@joelfernandes.org>
      98fd5030
    • vijunag's avatar
      Add build_id support for BPF stackmap · 2ddbc077
      vijunag authored
      A separate build_id stackmap can be created with the help of new macro BPF_STACK_TRACE_BUILDID. The kernel BPF reports stacktrace in the 
      structure bpf_stack_build_id. Changes have been made to BPF modules to
      support resolving symbols mentioned in the above format.
      An example tool is also available in examples/tracing/stack_buildid_example.py. 
      Both python and C++ test cases are added.
      2ddbc077
  8. 14 Jan, 2019 1 commit
  9. 12 Jan, 2019 1 commit
  10. 11 Jan, 2019 8 commits
  11. 10 Jan, 2019 5 commits
    • Teng Qin's avatar
      Merge pull request #2132 from iovisor/yhs_dev2 · d0deb6b2
      Teng Qin authored
      fix several printb usage with python3
      d0deb6b2
    • Yonghong Song's avatar
      fix several printb usage with python3 · ebe1951d
      Yonghong Song authored
      The following three tools are recently changed to use
      printb in order to flush out the result.
        opensnoop.py, tcpaccept.py, tcpconnect.py
      
      With python3, however, these tools have errors like below:
        TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'str'
        Traceback (most recent call last):
          File "_ctypes/callbacks.c", line 234, in 'calling callback function'
          File "/usr/lib/python3.6/site-packages/bcc/table.py", line 572, in raw_cb_
            callback(cpu, data, size)
          File "../../tools/opensnoop.py", line 248, in print_event
            printb(b'%s' % event.fname.decode('utf-8', 'replace'))
      
      This patch fixed printb related issues for these three tools
      for python3. The python2 still works with the fix.
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      ebe1951d
    • Prashant Bhole's avatar
      tools: mountsnoop, change memset to __builtin_memset (#2127) · 419a7db4
      Prashant Bhole authored
      The bpf program generated with memset() call in this tool contains
      BPF_JMP|BPF_CALL instruction with imm=-1. The verifier rejects the
      program. Let's use llvm built-in function __builtin_memset
      419a7db4
    • yonghong-song's avatar
      remove unused extern variables (#2125) · ae839790
      yonghong-song authored
      On fc29, compiling bcc from source, the following
      compiler warnings are seen:
        /home/yhs/work/bcc/src/cc/bcc_elf.c: In function ‘bcc_free_memory_with_file’:
        /home/yhs/work/bcc/src/cc/bcc_elf.c:802:36: warning: unused variable ‘_fini’ [-Wunused-variable]
             extern unsigned long _start, _fini;
                                          ^~~~~
      /home/yhs/work/bcc/src/cc/bcc_elf.c:802:28: warning: unused variable ‘_start’ [-Wunused-variable]
             extern unsigned long _start, _fini;
                                  ^~~~~~
      
      These unused externs are accidentally introduced by
      Commit 51480d05 ("implement free_bcc_memory() API").
      This patch removed them.
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      ae839790
    • Alexey Ivanov's avatar
      cmake/python: fix build race condition (#2111) · 9b3b1274
      Alexey Ivanov authored
      * python: remove MANIFEST
      
      * cmake/python: fix build race condition
      9b3b1274
  12. 09 Jan, 2019 3 commits
    • Jerome Marchand's avatar
      Translate arch into source directory when ARCH is set (#2122) · 28949f17
      Jerome Marchand authored
      When ARCH is not defined, bcc get the architecture from uname. It then
      modifies it to get the name of arch directory in linux source.
      
      When ARCH is defined however, it just copy it as is, without the
      translation to the arch directory. If for instance ARCH is set to
      x86_64, it tries to look into the include directory
      build/arch/x86_64/, which doesn't exist.
      
      It fixes the following issue:
      $ echo $ARCH
      x86_64
      $ /usr/share/bcc/tools/bashreadline
      In file included from <built-in>:2:
      In file included from /virtual/include/bcc/bpf.h:12:
      In file included from /lib/modules/4.18.0-49.el8.x86_64/build/include/linux/types.h:6:
      /lib/modules/4.18.0-49.el8.x86_64/build/include/uapi/linux/types.h:5:10: fatal error: 'asm/types.h' file
            not found
               ^~~~~~~~~~~~~
      1 error generated.
      Traceback (most recent call last):
        File "/usr/share/bcc/tools/bashreadline", line 51, in <module>
          b = BPF(text=bpf_text)
        File "/usr/lib/python3.6/site-packages/bcc/__init__.py", line 318, in __init__
          raise Exception("Failed to compile BPF text")
      Exception: Failed to compile BPF text
      28949f17
    • Takuma Kume's avatar
      tcpconnect: support uid option (#2118) · b181a8e7
      Takuma Kume authored
      support uid option in tcpconnect.
      b181a8e7
    • Xiaozhou Liu's avatar
      docs: fix parameters of bpf_trace_printk() (#2121) · e96836d9
      Xiaozhou Liu authored
      bpf_trace_printk() does not have `fmt_size` as the second parameter in BCC.
      e96836d9