1. 08 Jun, 2018 8 commits
  2. 06 Jun, 2018 5 commits
  3. 05 Jun, 2018 4 commits
  4. 03 Jun, 2018 1 commit
  5. 02 Jun, 2018 5 commits
    • Yonghong Song's avatar
      skip probe rewriter for bpf_probe_read() · 20fb64cd
      Yonghong Song authored
      bpf_probe_read() is often used to access pointees in bpf programs.
      Recent rewriter has become smarter so a lot of bpf_probe_read()
      can be replaced with simple pointer/member access.
      
      In certain cases, bpf_probe_read() is still preferred though.
      For example, kernel net/tcp.h defined TCP_SKB_CB as below
        #define TCP_SKB_CB(__skb)	((struct tcp_skb_cb *)&((__skb)->cb[0]))
      User can use below to access tcp_gso_size of a skb data structure.
        TCP_SKB_CB(skb)->tcp_gso_size
      The rewriter will fail as it attempts to rewrite (__skb)->cb[0].
      
      Instead of chasing down to prevent exactly the above pattern,
      this patch detects function bpf_probe_read() in ProbeVisitor and
      will skip it so bpf_probe_read()'s third parameter is a AddrOf.
      This can also help other cases where rewriter is not
      capable and user used bpf_probe_read() as the workaround.
      
      Also fixed tcptop.py to use direct assignment instead of
      bpf_probe_read. Otherwise, rewriter will actually rewrite
      src address reference inside the bpf_probe_read().
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      20fb64cd
    • 4ast's avatar
      Merge pull request #1795 from iovisor/yhs_dev2 · db093366
      4ast authored
      Add "-D __BPF_TRACING__" to frontend compilation flags
      db093366
    • Yonghong Song's avatar
      Add "-D __BPF_TRACING__" to frontend compilation flags · 7c4311f6
      Yonghong Song authored
      In 4.17 kernel, x86 build requires compiler asm-goto support. clang
      does not support asm-goto and bpf program compilation started to break.
      The following kernel commit
      
        commit b1ae32dbab50ed19cfc16d225b0fb0114fb13025
        Author: Alexei Starovoitov <ast@kernel.org>
        Date:   Sun May 13 12:32:22 2018 -0700
      
            x86/cpufeature: Guard asm_volatile_goto usage for BPF compilation
      
            Workaround for the sake of BPF compilation which utilizes kernel
            headers, but clang does not support ASM GOTO and fails the build.
      
      workarounded the issue by permitting native clang compilation.
      A warning message, however, is issued:
      
        ./arch/x86/include/asm/cpufeature.h:150:2: warning: "Compiler lacks ASM_GOTO support.
              Add -D __BPF_TRACING__ to your compiler arguments" [-W#warnings]
        #warning "Compiler lacks ASM_GOTO support. Add -D __BPF_TRACING__ to your compil...
         ^
        1 warning generated.
      
      This patch added "-D __BPF_TRACING__" to clang frontend compilation to
      suppress the warning.
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      7c4311f6
    • yonghong-song's avatar
      Merge pull request #1792 from pchaigno/refactor-ext-ptr-assignments · d8bb097d
      yonghong-song authored
      Refactor external pointer assignments
      d8bb097d
    • yonghong-song's avatar
      Merge pull request #1793 from qmonnet/kernelfeatures · c817cfd6
      yonghong-song authored
      sync BPF compat headers with latest bpf-next, update BPF features list
      c817cfd6
  6. 01 Jun, 2018 4 commits
  7. 31 May, 2018 1 commit
  8. 30 May, 2018 6 commits
  9. 29 May, 2018 5 commits
    • yonghong-song's avatar
      Merge pull request #1786 from andihit/zfsdist-py3-fix · 548332bb
      yonghong-song authored
      zfsdist: fix for python3
      548332bb
    • yonghong-song's avatar
      Merge pull request #1785 from kernel-z/master · 4e479815
      yonghong-song authored
      within tc_perf_event.py,ping command fix
      4e479815
    • Andreas Gerstmayr's avatar
      zfsdist: fix for python3 · 0d08989d
      Andreas Gerstmayr authored
      The BPF.get_kprobe_functions method tests if the passed argument
      matches with a line of kallsyms, which is opened in binary mode.
      Therefore the regex pattern must be bytes as well.
      0d08989d
    • kernel-z's avatar
      tc_perf_event.py command fix · a82bfb03
      kernel-z authored
      a82bfb03
    • Yonghong Song's avatar
      let rewriter add code to define CONFIG_CC_STACKPROTECTOR · bace5f24
      Yonghong Song authored
      Fix issue #1730
      
      Linux kernel commit 2bc2f688fdf8 ("Makefile: move stack-protector
      availability out of Kconfig") moved CONFIG_CC_STACKPROTECTOR
      from Kconfig to Makefile. Commit 44c6dc940b19 ("Makefile: introduce
      CONFIG_CC_STACKPROTECTOR_AUTO") introduced CONFIG_CC_STACKPROTECTOR_AUTO.
      
      Whether CONFIG_CC_STACKPROTECTOR is defined depends on
      CONFIG_CC_STACKPROTECTOR_{AUTO,REGULAR,STRONG}. Since the clang supports
      stack-protector, CONFIG_CC_STACKPROTECTOR_AUTO will imply
      CONFIG_CC_STACKPROTECTOR for gcc/clang based compilation.
      
      Such changes are introduced in 4.16. For example, the following code
      is defined in linux/include/linux/sched.h,
      ```
              pid_t                           pid;
              pid_t                           tgid;
      
              /* Canary value for the -fstack-protector GCC feature: */
              unsigned long                   stack_canary;
              /*
               * Pointers to the (original) parent process, youngest child, younger sibling,
               * older sibling, respectively.  (p->father can be replaced with
               * p->real_parent->pid)
               */
      
              /* Real parent process: */
              struct task_struct __rcu        *real_parent;
      ```
      If kernel config has CONFIG_CC_STACKPROTECTOR_{STRONG,REGULAR,AUTO} defined,
      CONFIG_CC_STACKPROTECTOR will be defined in compilation flags by kernel toplevel Makefile.
      But since CONFIG_CC_STACKPROTECTOR is not defined in configuration file autoconf.h,
      bcc will consider it is not defined. This will cause bcc to access wrong data
      in task_struct for any fields after the above stack_canary.
      
      Instead to fix any individual tool, in this patch the bcc rewriter added necessary
      macro definition for CONFIG_CC_STACKPROTECTOR in the source code, depending on
      CONFIG_CC_STACKPROTECTOR_{AUTO,REGULAR,STRONG}.
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      bace5f24
  10. 25 May, 2018 1 commit