1. 20 9月, 2018 11 次提交
  2. 19 9月, 2018 12 次提交
  3. 18 9月, 2018 2 次提交
  4. 12 9月, 2018 4 次提交
    • A
      perf tools: Fix maps__find_symbol_by_name() · 03db8b58
      Adrian Hunter 提交于
      Commit 1c5aae77 ("perf machine: Create maps for x86 PTI entry
      trampolines") revealed a problem with maps__find_symbol_by_name() that
      resulted in probes not being found e.g.
      
      	$ sudo perf probe xsk_mmap
      	xsk_mmap is out of .text, skip it.
      	Probe point 'xsk_mmap' not found.
      	   Error: Failed to add events.
      
      maps__find_symbol_by_name() can optionally return the map of the found
      symbol. It can get the map wrong because, in fact, the symbol is found
      on the map's dso, not allowing for the possibility that the dso has more
      than one map. Fix by always checking the map contains the symbol.
      Reported-by: NBjörn Töpel <bjorn.topel@intel.com>
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NBjörn Töpel <bjorn.topel@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Fixes: 1c5aae77 ("perf machine: Create maps for x86 PTI entry trampolines")
      Link: http://lkml.kernel.org/r/20180907085116.25782-1-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      03db8b58
    • A
      tools headers uapi: Update tools's copy of linux/if_link.h · 5db48a8d
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
      	3e7a50ce ("net: report min and max mtu network device settings")
      	2756f68c ("net: bridge: add support for backup port")
      	a25717d2 ("xdp: support simultaneous driver and hw XDP attachment")
      	4f91da26 ("xdp: add per mode attributes for attached programs")
      	f203b76d ("xfrm: Add virtual xfrm interfaces")
      
      Silencing this libbpf build warning:
      
      	Warning: Kernel ABI header at 'tools/include/uapi/linux/if_link.h' differs from latest version at 'include/uapi/linux/if_link.h'
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Cc: Stephen Hemminger <stephen@networkplumber.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-xd9ztioa894zemv8ag8kg64u@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5db48a8d
    • A
      tools headers uapi: Update tools's copy of linux/vhost.h · 7f28785c
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
      	c48300c9 ("vhost: fix VHOST_GET_BACKEND_FEATURES ioctl request definition")
      
      This makes 'perf trace' and other tools in the future using its
      beautifiers in a libbeauty.so library be able to translate these new
      ioctl to strings:
      
        $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh  > /tmp/after
        $ diff -u /tmp/before /tmp/after
        --- /tmp/before	2018-09-11 13:10:57.923038244 -0300
        +++ /tmp/after	2018-09-11 13:11:20.329012685 -0300
        @@ -15,6 +15,7 @@
              [0x22] = "SET_VRING_ERR",
              [0x23] = "SET_VRING_BUSYLOOP_TIMEOUT",
              [0x24] = "GET_VRING_BUSYLOOP_TIMEOUT",
        +     [0x25] = "SET_BACKEND_FEATURES",
              [0x30] = "NET_SET_BACKEND",
              [0x40] = "SCSI_SET_ENDPOINT",
              [0x41] = "SCSI_CLEAR_ENDPOINT",
        @@ -27,4 +28,5 @@
         static const char *vhost_virtio_ioctl_read_cmds[] = {
              [0x00] = "GET_FEATURES",
              [0x12] = "GET_VRING_BASE",
        +	[0x26] = "GET_BACKEND_FEATURES",
        };
        $
      
      We'll also use this to be able to express syscall filters using symbolic
      these symbolic names, something like:
      
      	# perf trace --all-cpus -e ioctl(cmd=*GET_FEATURES)
      
      This silences the following warning during perf's build:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/vhost.h' differs from latest version at 'include/uapi/linux/vhost.h'
        diff -u tools/include/uapi/linux/vhost.h include/uapi/linux/vhost.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-35x71oei2hdui9u0tarpimbq@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7f28785c
    • A
      tools headers uapi: Update tools's copies of kvm headers · 0210c156
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
      	a4499382 ("KVM: s390: Add huge page enablement control")
      	8fcc4b59 ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE")
      	be26b3a7 ("arm64: KVM: export the capability to set guest SError syndrome")
      	b7b27fac ("arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS")
      	b0960b95 ("KVM: arm: Add 32bit get/set events support")
      	a3da7b4a ("KVM: s390: add etoken support for guests")
      
      This makes 'perf trace' automagically get aware of these new ioctls:
      
        $ cp include/uapi/linux/kvm.h tools/include/uapi/linux/kvm.h
        $ tools/perf/trace/beauty/kvm_ioctl.sh  > /tmp/after
        $ diff -u /tmp/before /tmp/after
        --- /tmp/before	2018-09-11 11:18:29.173207586 -0300
        +++ /tmp/after	2018-09-11 11:18:38.488200446 -0300
        @@ -84,6 +84,8 @@
              [0xbb] = "MEMORY_ENCRYPT_REG_REGION",
              [0xbc] = "MEMORY_ENCRYPT_UNREG_REGION",
              [0xbd] = "HYPERV_EVENTFD",
        +     [0xbe] = "GET_NESTED_STATE",
        +     [0xbf] = "SET_NESTED_STATE",
              [0xe0] = "CREATE_DEVICE",
              [0xe1] = "SET_DEVICE_ATTR",
              [0xe2] = "G
      
      And cures the following warning during perf's build:
      
      	Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
      	diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Cornelia Huck <cohuck@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Dongjiu Geng <gengdongjiu@huawei.com>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: James Morse <james.morse@arm.com>
      Cc: Janosch Frank <frankja@linux.ibm.com>
      Cc: Jim Mattson <jmattson@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-2vvwh2o19orn56di0ksrtgzr@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0210c156
  5. 11 9月, 2018 3 次提交
    • A
      tools headers uapi: Update tools's copy of drm/drm.h · 434ea1bf
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
      	d67b6a20 ("drm: writeback: Add client capability for exposing writeback connectors")
      
      This is for an argument to a DRM ioctl, which is not being prettyfied in
      the 'perf trace' DRM ioctl beautifier, but will now that syscalls are
      starting to have pointer arguments augmented via BPF.
      
      This time around this just cures the following warning during perf's
      build:
      
      	Warning: Kernel ABI header at 'tools/include/uapi/drm/drm.h' differs from latest version at 'include/uapi/drm/drm.h'
      	diff -u tools/include/uapi/drm/drm.h include/uapi/drm/drm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Brian Starkey <brian.starkey@arm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Eric Anholt <eric@anholt.net>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Liviu Dudau <liviu.dudau@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-n7qib1bac6mc6w9oke7r4qdc@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      434ea1bf
    • A
      tools headers uapi: Update tools's copy of asm-generic/unistd.h · f9e6e435
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
      	db7a2d18 ("asm-generic: unistd.h: Wire up sys_rseq")
      
      That wires up the new 'rsec' system call, which will automagically
      support that syscall in the syscall table used by 'perf trace' on
      arm/arm64.
      
      This cures the following warning during perf's build:
      
      	Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/unistd.h' differs from latest version at 'include/uapi/asm-generic/unistd.h'
      	diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      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: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: https://lkml.kernel.org/n/tip-vt7k2itnitp1t9p3dp7qeb08@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f9e6e435
    • A
      tools headers uapi: Update tools's copy of linux/perf_event.h · 0ee03d93
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
      	09121255 ("perf/UAPI: Clearly mark __PERF_SAMPLE_CALLCHAIN_EARLY as internal use")
      
      This cures the following warning during perf's build:
      
      	Warning: Kernel ABI header at 'tools/include/uapi/linux/perf_event.h' differs from latest version at 'include/uapi/linux/perf_event.h'
      	diff -u tools/include/uapi/linux/perf_event.h include/uapi/linux/perf_event.h
      
      Cc: Peter Zijlstra <peterz@infradead.org>
      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-2vvwh2o19orn56di0ksrtgzr@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0ee03d93
  6. 05 9月, 2018 6 次提交
    • 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
    • N
      tools/vm/page-types.c: fix "defined but not used" warning · 7ab660f8
      Naoya Horiguchi 提交于
      debugfs_known_mountpoints[] is not used any more, so let's remove it.
      
      Link: http://lkml.kernel.org/r/1535102651-19418-1-git-send-email-n-horiguchi@ah.jp.nec.comSigned-off-by: NNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Reviewed-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7ab660f8
    • N
      tools/vm/slabinfo.c: fix sign-compare warning · 90450656
      Naoya Horiguchi 提交于
      Currently we get the following compiler warning:
      
          slabinfo.c:854:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (s->object_size < min_objsize)
                                ^
      
      due to the mismatch of signed/unsigned comparison.  ->object_size and
      ->slab_size are never expected to be negative, so let's define them as
      unsigned int.
      
      [n-horiguchi@ah.jp.nec.com: convert everything - none of these can be negative]
        Link: http://lkml.kernel.org/r/20180826234947.GA9787@hori1.linux.bs1.fc.nec.co.jp
      Link: http://lkml.kernel.org/r/1535103134-20239-1-git-send-email-n-horiguchi@ah.jp.nec.comSigned-off-by: NNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Reviewed-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      90450656
    • 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 2 次提交
    • 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