1. 21 9月, 2018 2 次提交
  2. 20 9月, 2018 13 次提交
  3. 19 9月, 2018 11 次提交
  4. 18 9月, 2018 1 次提交
  5. 12 9月, 2018 1 次提交
  6. 05 9月, 2018 4 次提交
    • A
      perf tests: Fix record+probe_libc_inet_pton.sh without ping's debuginfo · 16329364
      Arnaldo Carvalho de Melo 提交于
      When we don't have the iputils-debuginfo package installed, i.e. when we
      don't have the DWARF information needed to resolve ping's samples, we
      end up failing this 'perf test' entry:
      
        # perf test ping
        62: probe libc's inet_pton & backtrace it with ping       : Ok
        # rpm -e iputils-debuginfo
        # perf test ping
        62: probe libc's inet_pton & backtrace it with ping       : FAILED!
        #
      
      Fix it to accept "[unknown]" where the symbol + offset, when resolved,
      is expected.
      
      I think this will fail in the other arches as well, but since I can't
      test now, I'm leaving s390x and ppc cases as-is.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kim Phillips <kim.phillips@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
      Cc: Sandipan Das <sandipan@linux.vnet.ibm.com>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: 7903a708 ("perf script: Show symbol offsets by default")
      Link: https://lkml.kernel.org/n/tip-hnizqwqrs03vcq1b74yao0f6@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      16329364
    • A
      perf map: Turn some pr_warning() to pr_debug() · d8e75a11
      Arnaldo Carvalho de Melo 提交于
      Annoying when using it with --stdio/--stdio2, so just turn them debug,
      we can get those using -v.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-t3684lkugnf1w4lwcmpj9ivm@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d8e75a11
    • A
      perf trace: Use the raw_syscalls:sys_enter for the augmented syscalls · b1a9e253
      Arnaldo Carvalho de Melo 提交于
      Now we combine what comes from the "bpf-output" event, i.e. what is
      added in the augmented_syscalls.c BPF program via the
      __augmented_syscalls__ BPF map, i.e. the payload we get with
      raw_syscalls:sys_enter tracepoints plus the pointer contents, right
      after that payload, with the raw_syscall:sys_exit also added, without
      augmentation, in the augmented_syscalls.c program.
      
      The end result is that for the hooked syscalls, we get strace like
      output with pointer expansion, something that wasn't possible before
      with just raw_syscalls:sys_enter + raw_syscalls:sys_exit.
      
      E.g.:
      
        # perf trace -e tools/perf/examples/bpf/augmented_syscalls.c ping -c 2 ::1
           0.000 ( 0.008 ms): ping/19573 openat(dfd: CWD, filename: /etc/ld.so.cache, flags: CLOEXEC) = 3
           0.036 ( 0.006 ms): ping/19573 openat(dfd: CWD, filename: /lib64/libcap.so.2, flags: CLOEXEC) = 3
           0.070 ( 0.004 ms): ping/19573 openat(dfd: CWD, filename: /lib64/libidn.so.11, flags: CLOEXEC) = 3
           0.095 ( 0.004 ms): ping/19573 openat(dfd: CWD, filename: /lib64/libcrypto.so.1.1, flags: CLOEXEC) = 3
           0.127 ( 0.004 ms): ping/19573 openat(dfd: CWD, filename: /lib64/libresolv.so.2, flags: CLOEXEC) = 3
           0.156 ( 0.004 ms): ping/19573 openat(dfd: CWD, filename: /lib64/libm.so.6, flags: CLOEXEC) = 3
           0.181 ( 0.004 ms): ping/19573 openat(dfd: CWD, filename: /lib64/libc.so.6, flags: CLOEXEC) = 3
           0.212 ( 0.004 ms): ping/19573 openat(dfd: CWD, filename: /lib64/libz.so.1, flags: CLOEXEC) = 3
           0.242 ( 0.004 ms): ping/19573 openat(dfd: CWD, filename: /lib64/libdl.so.2, flags: CLOEXEC) = 3
           0.266 ( 0.003 ms): ping/19573 openat(dfd: CWD, filename: /lib64/libpthread.so.0, flags: CLOEXEC) = 3
           0.709 ( 0.006 ms): ping/19573 open(filename: /usr/lib/locale/locale-archive, flags: CLOEXEC) = 3
        PING ::1(::1) 56 data bytes
           1.133 ( 0.011 ms): ping/19573 connect(fd: 5, uservaddr: { .family: INET6, port: 1025, addr: ::1 }, addrlen: 28) = 0
        64 bytes from ::1: icmp_seq=1 ttl=64 time=0.033 ms
           1.234 ( 0.036 ms): ping/19573 sendto(fd: 4<socket:[1498931]>, buff: 0x555e5b975720, len: 64, addr: { .family: INET6, port: 58, addr: ::1 }, addr_len: 28) = 64
        64 bytes from ::1: icmp_seq=2 ttl=64 time=0.120 ms
      
        --- ::1 ping statistics ---
        2 packets transmitted, 2 received, 0% packet loss, time 1000ms
        rtt min/avg/max/mdev = 0.033/0.076/0.120/0.044 ms
        1002.060 ( 0.129 ms): ping/19573 sendto(fd: 4<socket:[1498931]>, buff: 0x555e5b975720, len: 64, flags: CONFIRM, addr: { .family: INET6, port: 58, addr: ::1 }, addr_len: 28) = 64
        #
        # perf trace -e tools/perf/examples/bpf/augmented_syscalls.c cat tools/perf/examples/bpf/hello.c
        #include <stdio.h>
      
        int syscall_enter(openat)(void *args)
        {
      	  puts("Hello, world\n");
      	  return 0;
        }
      
        license(GPL);
           0.000 ( 0.008 ms): cat/20054 openat(dfd: CWD, filename: /etc/ld.so.cache, flags: CLOEXEC) = 3
           0.020 ( 0.005 ms): cat/20054 openat(dfd: CWD, filename: /lib64/libc.so.6, flags: CLOEXEC) = 3
           0.176 ( 0.011 ms): cat/20054 open(filename: /usr/lib/locale/locale-archive, flags: CLOEXEC) = 3
           0.243 ( 0.006 ms): cat/20054 openat(dfd: CWD, filename: tools/perf/examples/bpf/hello.c) = 3
        #
      
      Now to think how to hook on all syscalls, fallbacking to the non-augmented
      raw_syscalls:sys_enter payload.
      
      Probably the best way is to use a BPF_MAP_TYPE_PROG_ARRAY just like
      samples/bpf/tracex5_kern.c does.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-nlt60y69o26xi59z5vtpdrj5@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b1a9e253
    • A
      perf trace: Setup augmented_args in the raw_syscalls:sys_enter handler · db2da3f8
      Arnaldo Carvalho de Melo 提交于
      Without using something to augment the raw_syscalls:sys_enter tracepoint
      payload with the pointer contents, this will work just like before, i.e.
      the augmented_args arg will be NULL and the augmented_args_size will be
      0.
      
      This just paves the way for the next cset where we will associate the
      trace__sys_enter tracepoint handler with the augmented "bpf-output"
      event named "__augmented_args__".
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-p8uvt2a6ug3uwlhja3cno4la@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      db2da3f8
  7. 04 9月, 2018 3 次提交
    • A
      perf trace: Introduce syscall__augmented_args() method · 8a041f86
      Arnaldo Carvalho de Melo 提交于
      That will be used by trace__sys_enter when we start combining the
      augmented syscalls:sys_enter_FOO + syscalls:sys_exit_FOO.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-iiseo3s0qbf9i3rzn8k597bv@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8a041f86
    • A
      perf augmented_syscalls: Avoid optimization to pass older BPF validators · 7538d163
      Arnaldo Carvalho de Melo 提交于
      See https://www.spinics.net/lists/netdev/msg480099.html for the whole
      discussio, but to make the augmented_syscalls.c BPF program to get built
      and loaded successfully in a greater range of kernels, add an extra
      check.
      
      Related patch:
      
        a60dd35d ("bpf: change bpf_perf_event_output arg5 type to ARG_CONST_SIZE_OR_ZERO")
      
      That is in the kernel since v4.15, I couldn't figure why this is hitting
      me with 4.17.17, but adding the workaround discussed there makes this
      work with this fedora kernel and with 4.18.recent.
      
      Before:
      
        # uname -a
        Linux seventh 4.17.17-100.fc27.x86_64 #1 SMP Mon Aug 20 15:53:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
        # perf trace -e tools/perf/examples/bpf/augmented_syscalls.c cat /etc/passwd > /dev/null
        libbpf: load bpf program failed: Permission denied
        libbpf: -- BEGIN DUMP LOG ---
        libbpf:
        0: (bf) r6 = r1
        1: (b7) r1 = 0
        2: (7b) *(u64 *)(r10 -8) = r1
        3: (7b) *(u64 *)(r10 -16) = r1
        4: (7b) *(u64 *)(r10 -24) = r1
        5: (7b) *(u64 *)(r10 -32) = r1
        6: (7b) *(u64 *)(r10 -40) = r1
        7: (7b) *(u64 *)(r10 -48) = r1
        8: (7b) *(u64 *)(r10 -56) = r1
        9: (7b) *(u64 *)(r10 -64) = r1
        10: (7b) *(u64 *)(r10 -72) = r1
        11: (7b) *(u64 *)(r10 -80) = r1
        12: (7b) *(u64 *)(r10 -88) = r1
        13: (7b) *(u64 *)(r10 -96) = r1
        14: (7b) *(u64 *)(r10 -104) = r1
        15: (7b) *(u64 *)(r10 -112) = r1
        16: (7b) *(u64 *)(r10 -120) = r1
        17: (7b) *(u64 *)(r10 -128) = r1
        18: (7b) *(u64 *)(r10 -136) = r1
        19: (7b) *(u64 *)(r10 -144) = r1
        20: (7b) *(u64 *)(r10 -152) = r1
        21: (7b) *(u64 *)(r10 -160) = r1
        22: (7b) *(u64 *)(r10 -168) = r1
        23: (7b) *(u64 *)(r10 -176) = r1
        24: (7b) *(u64 *)(r10 -184) = r1
        25: (7b) *(u64 *)(r10 -192) = r1
        26: (7b) *(u64 *)(r10 -200) = r1
        27: (7b) *(u64 *)(r10 -208) = r1
        28: (7b) *(u64 *)(r10 -216) = r1
        29: (7b) *(u64 *)(r10 -224) = r1
        30: (7b) *(u64 *)(r10 -232) = r1
        31: (7b) *(u64 *)(r10 -240) = r1
        32: (7b) *(u64 *)(r10 -248) = r1
        33: (7b) *(u64 *)(r10 -256) = r1
        34: (7b) *(u64 *)(r10 -264) = r1
        35: (7b) *(u64 *)(r10 -272) = r1
        36: (7b) *(u64 *)(r10 -280) = r1
        37: (7b) *(u64 *)(r10 -288) = r1
        38: (7b) *(u64 *)(r10 -296) = r1
        39: (7b) *(u64 *)(r10 -304) = r1
        40: (7b) *(u64 *)(r10 -312) = r1
        41: (bf) r7 = r10
        42: (07) r7 += -312
        43: (bf) r1 = r7
        44: (b7) r2 = 48
        45: (bf) r3 = r6
        46: (85) call bpf_probe_read#4
        47: (79) r3 = *(u64 *)(r6 +24)
        48: (bf) r1 = r10
        49: (07) r1 += -256
        50: (b7) r8 = 256
        51: (b7) r2 = 256
        52: (85) call bpf_probe_read_str#45
        53: (bf) r1 = r0
        54: (67) r1 <<= 32
        55: (77) r1 >>= 32
        56: (bf) r5 = r0
        57: (07) r5 += 56
        58: (2d) if r8 > r1 goto pc+1
         R0=inv(id=0) R1=inv(id=0,umin_value=256,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R5=inv(id=0) R6=ctx(id=0,off=0,imm=0) R7=fp-312,call_-1 R8=inv256 R10=fp0,call_-1 fp-264=0
        59: (b7) r5 = 312
        60: (63) *(u32 *)(r10 -264) = r0
        61: (67) r5 <<= 32
        62: (77) r5 >>= 32
        63: (bf) r1 = r6
        64: (18) r2 = 0xffff8b9120cc8500
        66: (18) r3 = 0xffffffff
        68: (bf) r4 = r7
        69: (85) call bpf_perf_event_output#25
        70: (b7) r0 = 0
        71: (95) exit
      
        from 58 to 60: R0=inv(id=0) R1=inv(id=0,umax_value=255,var_off=(0x0; 0xff)) R5=inv(id=0) R6=ctx(id=0,off=0,imm=0) R7=fp-312,call_-1 R8=inv256 R10=fp0,call_-1 fp-264=0
        60: (63) *(u32 *)(r10 -264) = r0
        61: (67) r5 <<= 32
        62: (77) r5 >>= 32
        63: (bf) r1 = r6
        64: (18) r2 = 0xffff8b9120cc8500
        66: (18) r3 = 0xffffffff
        68: (bf) r4 = r7
        69: (85) call bpf_perf_event_output#25
        R5 unbounded memory access, use 'var &= const' or 'if (var < const)'
      
        libbpf: -- END LOG --
        libbpf: failed to load program 'syscalls:sys_enter_openat'
        libbpf: failed to load object 'tools/perf/examples/bpf/augmented_syscalls.c'
        bpf: load objects failed: err=-4007: (Kernel verifier blocks program loading)
        event syntax error: 'tools/perf/examples/bpf/augmented_syscalls.c'
                             \___ Kernel verifier blocks program loading
      
      After:
      
        # perf trace -e tools/perf/examples/bpf/augmented_syscalls.c cat /etc/passwd > /dev/null
           0.000 cat/29249 openat(dfd: CWD, filename: /etc/ld.so.cache, flags: CLOEXEC)
           0.008 cat/29249 syscalls:sys_exit_openat:0x3
           0.021 cat/29249 openat(dfd: CWD, filename: /lib64/libc.so.6, flags: CLOEXEC)
           0.025 cat/29249 syscalls:sys_exit_openat:0x3
           0.180 cat/29249 open(filename: /usr/lib/locale/locale-archive, flags: CLOEXEC)
           0.185 cat/29249 syscalls:sys_exit_open:0x3
           0.242 cat/29249 openat(dfd: CWD, filename: /etc/passwd)
           0.245 cat/29249 syscalls:sys_exit_openat:0x3
        #
      
      It also works with a more recent kernel:
      
        # uname -a
        Linux jouet 4.18.0-00014-g4e67b2a5 #6 SMP Thu Aug 30 17:34:17 -03 2018 x86_64 x86_64 x86_64 GNU/Linux
        # perf trace -e tools/perf/examples/bpf/augmented_syscalls.c cat /etc/passwd > /dev/null
           0.000 cat/26451 openat(dfd: CWD, filename: /etc/ld.so.cache, flags: CLOEXEC)
           0.020 cat/26451 syscalls:sys_exit_openat:0x3
           0.039 cat/26451 openat(dfd: CWD, filename: /lib64/libc.so.6, flags: CLOEXEC)
           0.044 cat/26451 syscalls:sys_exit_openat:0x3
           0.231 cat/26451 open(filename: /usr/lib/locale/locale-archive, flags: CLOEXEC)
           0.238 cat/26451 syscalls:sys_exit_open:0x3
           0.278 cat/26451 openat(dfd: CWD, filename: /etc/passwd)
           0.282 cat/26451 syscalls:sys_exit_openat:0x3
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Gianluca Borello <g.borello@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Yonghong Song <yhs@fb.com>
      Link: https://lkml.kernel.org/n/tip-wkpsivs1a9afwldbul46btbv@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7538d163
    • A
      perf augmented_syscalls: Check probe_read_str() return separately · 21d7eb9a
      Arnaldo Carvalho de Melo 提交于
      Using a value returned from probe_read_str() to tell how many bytes to
      copy using perf_event_output() has issues in some older kernels, like
      4.17.17-100.fc27.x86_64, so separate the bounds checking done on how
      many bytes to copy to a separate variable, so that the next patch has
      only what is being done to make the test pass on older BPF validators.
      
      For reference, see the discussion in this thread:
      
        https://www.spinics.net/lists/netdev/msg480099.html
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Yonghong Song <yhs@fb.com>
      Link: https://lkml.kernel.org/n/tip-jtsapwibyxrnv1xjfsgzp0fj@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      21d7eb9a
  8. 31 8月, 2018 5 次提交