Skip to content
Snippets Groups Projects
  1. May 25, 2020
    • Sumanth Korikkar's avatar
      bcc: Error out when bpf_probe_read_user is not present · 112f5291
      Sumanth Korikkar authored
      
      1. For architecture with overlapping address space, error out when
         bpf_probe_read_user is not available.
      2. For arch with non overlapping address space, if bpf_probe_read_user
         is not available bpf_probe_read_user is implicitly converted to
         bpf_probe_read.
      3. Use bpf_probe_read_kernel instead of bpf_probe_read. When
         bpf_probe_read_kernel is not available, fallback to bpf_probe_read.
         If bpf_probe_read is not available, then bcc would fail anyways.
      4. See kernel commit 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{,
         str}() only to archs where they work")
      
      Signed-off-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Acked-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      112f5291
  2. May 23, 2020
    • Shohei YOSHIDA's avatar
      tool: trace process termination by default · a28337a7
      Shohei YOSHIDA authored
      `sched_process_exit` tracepoint is called when thread terminates.
      So exitsnoop shows line per each thread termination if the process
      is multi-thread process. This is not useful when people wants to
      know why process terminates, not thread.
      
      So this changes exitsnoop default behavior which traces process termination
      instead of thread termination. And add `--per-thread` option which behaves
      as original exitsnoop implementation.
      a28337a7
  3. May 22, 2020
    • Kunal Bhalla's avatar
      Spelling · 683ed9e1
      Kunal Bhalla authored
      (as title)
      683ed9e1
    • Alban Crequy's avatar
      tools: add filtering by mount namespace · 32ab8583
      Alban Crequy authored
      
      In previous patches, I added the option --cgroupmap to filter events
      belonging to a set of cgroup-v2. Although this approach works fine with
      systemd services and containers when cgroup-v2 is enabled, it does not
      work with containers when only cgroup-v1 is enabled because
      bpf_get_current_cgroup_id() only works with cgroup-v2. It also requires
      Linux 4.18 to get this bpf helper function.
      
      This patch adds an additional way to filter by containers, using mount
      namespaces.
      
      Note that this does not help with systemd services since they normally
      don't create a new mount namespace (unless you set some options like
      'ReadOnlyPaths=', see "man 5 systemd.exec").
      
      My goal with this patch is to filter Kubernetes pods, even on
      distributions with an older kernel (<4.18) or without cgroup-v2 enabled.
      
      - This is only implemented for tools that already support filtering by
        cgroup id (bindsnoop, capable, execsnoop, profile, tcpaccept, tcpconnect,
        tcptop and tcptracer).
      
      - I picked the mount namespace because the other namespaces could be
        disabled in Kubernetes (e.g. HostNetwork, HostPID, HostIPC).
      
      It can be tested by following the example in docs/special_filtering added
      in this commit, to avoid compiling locally the following command can be used
      
      ```
      sudo bpftool map create /sys/fs/bpf/mnt_ns_set type hash key 8 value 4 \
        entries 128 name mnt_ns_set flags 0
      docker run -ti --rm --privileged \
        -v /usr/src:/usr/src -v /lib/modules:/lib/modules \
        -v /sys/fs/bpf:/sys/fs/bpf --pid=host kinvolk/bcc:alban-containers-filters \
        /usr/share/bcc/tools/execsnoop --mntnsmap /sys/fs/bpf/mnt_ns_set
      
      ```
      
      Co-authored-by: default avatarAlban Crequy <alban@kinvolk.io>
      Co-authored-by: default avatarMauricio Vásquez <mauricio@kinvolk.io>
      32ab8583
  4. May 21, 2020
  5. May 20, 2020
    • Erwan Velu's avatar
      tools/dirtop: Adding dirtop utility (#2819) · 8c127942
      Erwan Velu authored
      
      This tools is about reporting IOs per directory.
      That's a clone of filetop but works in a different way :
      - user specify a set of globs to select a list of directories to watch
      - dirtop extracts the inode_id of the selected directories
      - the bpf program receives the list of top directories to consider
      - when vfs_{read|write} occurs, the bpf program check
        if one of the parents is part of the list we search for
      - if it matches, the io is accounted
      
      On the python side, the program will reconcilate IOs per directory and print stats.
      
      While filetop list the programs and filename, dirtop only list the directory name.
      
      A typical usages looks like :
      
      	[root@host]: dirtop.py -d '/hdfs/uuid/*/yarn'
      	14:56:33 loadavg: 52.21 48.81 37.78 53/2721 28720
      
      	READS  WRITES R_Kb     W_Kb     PATH
      	36821  7632   238219   149183   /hdfs/uuid/d04fccd8-bc72-4ed9-bda4-c5b6893f1405/yarn
      	20823  2      196290   3        /hdfs/uuid/b94cbf3f-76b1-4ced-9043-02d450b9887c/yarn
      	16059  12064  109748   85778    /hdfs/uuid/250b21c8-1714-45fe-8c08-d45d0271c6bd/yarn
      	14128  20360  106287   81440    /hdfs/uuid/4a833770-767e-43b3-b696-dc98901bce26/yarn
      	15883  4991   86014    82075    /hdfs/uuid/0cc3683f-4800-4c73-8075-8d77dc7cf116/yarn
      	11182  4485   28834    116917   /hdfs/uuid/7d512fe7-b20d-464c-a75a-dbf8b687ee1c/yarn
      	11848  7810   103139   31240    /hdfs/uuid/2c6a7223-cb18-4916-a1b6-8cd02bda1d31/yarn
      	10418  1272   114842   18       /hdfs/uuid/76dc0b77-e2fd-4476-818f-2b5c3c452396/yarn
      	10066  6630   93969    20218    /hdfs/uuid/c11da291-28de-4a77-873e-44bb452d238b/yarn
      	13648  15453  39450    53744    /hdfs/uuid/99c178d5-a209-4af2-8467-7382c7f03c1b/yarn
      	9509   2049   31363    48219    /hdfs/uuid/a78f846a-58c4-4d10-a9f5-42f16a6134a0/yarn
      	8112   2178   13765    63479    /hdfs/uuid/bf829d08-1455-45b8-81fa-05c3303e8c45/yarn
      	4327   0      37544    0        /hdfs/uuid/fada8004-53ff-48df-9396-165d8e42925b/yarn
      	2238   2742   72       50       /hdfs/uuid/b3b2a2ed-f6c1-4641-86bf-2989dd932411/yarn
      	3716   0      47       0        /hdfs/uuid/8138a53b-b942-44d3-82df-51575f1a3901/yarn
      
      Signed-off-by: default avatarErwan Velu <e.velu@criteo.com>
      
      Co-authored-by: default avatarErwan Velu <e.velu@criteo.com>
  6. May 19, 2020
  7. May 15, 2020
    • Chunmei Xu's avatar
      add -fPIC to compile examples/cpp and tests/cc · 0d87484b
      Chunmei Xu authored
      
      I use clang-8.0.1 and gcc-8.3.1 to compile bcc-0.8.1,
      without -fPIC, will get errors like this:
      /usr/bin/ld: CMakeFiles/test_libbcc.dir/test_libbcc.cc.o: relocation
      R_X86_64_32S against symbol `_ZTVN5Catch21LegacyReporterAdapterE' can
      not be used when making a PIE object; recompile with -fPIC
      /usr/bin/ld: CMakeFiles/test_libbcc.dir/test_c_api.cc.o: relocation
      R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE
      object; recompile with -fPIC
      /usr/bin/ld: CMakeFiles/CGroupTest.dir/CGroupTest.cc.o: relocation
      R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE
      object; recompile with -fPIC
      
      Signed-off-by: default avatarChunmei Xu <xuchunmei@linux.alibaba.com>
      0d87484b
  8. May 12, 2020
  9. May 06, 2020
  10. May 05, 2020
  11. May 03, 2020
  12. Apr 29, 2020
  13. Apr 28, 2020
  14. Apr 23, 2020
  15. Apr 21, 2020
  16. Apr 20, 2020
    • Yonghong Song's avatar
      fix llvm 11 compilation issues · 45e63f2b
      Yonghong Song authored
      The llvm CreateCall used in bcc is deprecated in llvm 11:
        https://reviews.llvm.org/D76269
      The llvm CreateMemCpy is changed in llvm 11 as well:
        https://reviews.llvm.org/D71473
      
      This caused bcc compilation error.
      
        /home/yhs/work/bcc/src/cc/frontends/b/codegen_llvm.cc: In member function
           ‘ebpf::StatusTuple ebpf::cc::CodegenLLVM::emit_log(ebpf::cc::Method CallExprNode*)’:
        /home/yhs/work/bcc/src/cc/frontends/b/codegen_llvm.cc:691:39: error: no matching function for call to
           ‘llvm::IRBuilder<>::CreateCall(llvm::Value*&, std::vector<llvm::Value*, std::allocator<llvm::Value*> >&)’
           expr_ = B.CreateCall(printk_fn, args);
                                             ^
        ...
      
        /home/yhs/work/bcc/src/cc/frontends/b/codegen_llvm.cc: In member function
           ‘virtual ebpf::StatusTuple ebpf::cc::CodegenLLVM::visit_string_exp_node(ebpf::cc::StringExprNode*)’:
        /home/yhs/work/bcc/src/cc/frontends/b/codegen_llvm.cc:440:55: error: no matching function for call to
           ‘llvm::IRBuilder<>::CreateMemCpy(llvm:Value*&, int, llvm::Value*&, int, std::__cxx11::basic_string<char>::size_type)’
         B.CreateMemCpy(ptr, 1, global, 1, n->val_.size() + 1);
                                                             ^
        ...
      
      This patch fixed the compilation issue.
      45e63f2b
    • Itay Shakury's avatar
      Improve ubuntu installation description · d3359b29
      Itay Shakury authored
      d3359b29
  17. Apr 19, 2020
  18. Apr 17, 2020
Loading