1. 02 4月, 2021 11 次提交
  2. 31 3月, 2021 1 次提交
  3. 26 3月, 2021 2 次提交
  4. 24 3月, 2021 4 次提交
    • N
      perf record: Fix memory leak in vDSO found using ASAN · 41d58541
      Namhyung Kim 提交于
      I got several memory leak reports from Asan with a simple command.  It
      was because VDSO is not released due to the refcount.  Like in
      __dsos_addnew_id(), it should put the refcount after adding to the list.
      
        $ perf record true
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.030 MB perf.data (10 samples) ]
      
        =================================================================
        ==692599==ERROR: LeakSanitizer: detected memory leaks
      
        Direct leak of 439 byte(s) in 1 object(s) allocated from:
          #0 0x7fea52341037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
          #1 0x559bce4aa8ee in dso__new_id util/dso.c:1256
          #2 0x559bce59245a in __machine__addnew_vdso util/vdso.c:132
          #3 0x559bce59245a in machine__findnew_vdso util/vdso.c:347
          #4 0x559bce50826c in map__new util/map.c:175
          #5 0x559bce503c92 in machine__process_mmap2_event util/machine.c:1787
          #6 0x559bce512f6b in machines__deliver_event util/session.c:1481
          #7 0x559bce515107 in perf_session__deliver_event util/session.c:1551
          #8 0x559bce51d4d2 in do_flush util/ordered-events.c:244
          #9 0x559bce51d4d2 in __ordered_events__flush util/ordered-events.c:323
          #10 0x559bce519bea in __perf_session__process_events util/session.c:2268
          #11 0x559bce519bea in perf_session__process_events util/session.c:2297
          #12 0x559bce2e7a52 in process_buildids /home/namhyung/project/linux/tools/perf/builtin-record.c:1017
          #13 0x559bce2e7a52 in record__finish_output /home/namhyung/project/linux/tools/perf/builtin-record.c:1234
          #14 0x559bce2ed4f6 in __cmd_record /home/namhyung/project/linux/tools/perf/builtin-record.c:2026
          #15 0x559bce2ed4f6 in cmd_record /home/namhyung/project/linux/tools/perf/builtin-record.c:2858
          #16 0x559bce422db4 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:313
          #17 0x559bce2acac8 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:365
          #18 0x559bce2acac8 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:409
          #19 0x559bce2acac8 in main /home/namhyung/project/linux/tools/perf/perf.c:539
          #20 0x7fea51e76d09 in __libc_start_main ../csu/libc-start.c:308
      
        Indirect leak of 32 byte(s) in 1 object(s) allocated from:
          #0 0x7fea52341037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
          #1 0x559bce520907 in nsinfo__copy util/namespaces.c:169
          #2 0x559bce50821b in map__new util/map.c:168
          #3 0x559bce503c92 in machine__process_mmap2_event util/machine.c:1787
          #4 0x559bce512f6b in machines__deliver_event util/session.c:1481
          #5 0x559bce515107 in perf_session__deliver_event util/session.c:1551
          #6 0x559bce51d4d2 in do_flush util/ordered-events.c:244
          #7 0x559bce51d4d2 in __ordered_events__flush util/ordered-events.c:323
          #8 0x559bce519bea in __perf_session__process_events util/session.c:2268
          #9 0x559bce519bea in perf_session__process_events util/session.c:2297
          #10 0x559bce2e7a52 in process_buildids /home/namhyung/project/linux/tools/perf/builtin-record.c:1017
          #11 0x559bce2e7a52 in record__finish_output /home/namhyung/project/linux/tools/perf/builtin-record.c:1234
          #12 0x559bce2ed4f6 in __cmd_record /home/namhyung/project/linux/tools/perf/builtin-record.c:2026
          #13 0x559bce2ed4f6 in cmd_record /home/namhyung/project/linux/tools/perf/builtin-record.c:2858
          #14 0x559bce422db4 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:313
          #15 0x559bce2acac8 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:365
          #16 0x559bce2acac8 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:409
          #17 0x559bce2acac8 in main /home/namhyung/project/linux/tools/perf/perf.c:539
          #18 0x7fea51e76d09 in __libc_start_main ../csu/libc-start.c:308
      
        SUMMARY: AddressSanitizer: 471 byte(s) leaked in 2 allocation(s).
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20210315045641.700430-1-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      41d58541
    • T
      perf test: Remove now useless failing sub test "BPF relocation checker" · eb8f998b
      Thomas Richter 提交于
      For some time now the 'perf test 42: BPF filter' returns an error on bpf
      relocation subtest, at least on x86 and s390. This is caused by
      
        d859900c ("bpf, libbpf: support global data/bss/rodata sections")
      
      which introduces support for global variables in eBPF programs.
      
      Perf test 42.4 checks that the eBPF relocation fails when the eBPF program
      contains a global variable. It returns OK when the eBPF program
      could not be loaded and FAILED otherwise.
      
      With above commit the test logic for the eBPF relocation is obsolete.
      The loading of the eBPF now succeeds and the test always shows FAILED.
      
      This patch removes the sub test completely.
      Also a lot of eBPF program testing is done in the eBPF test suite,
      it also contains tests for global variables.
      
      Output before:
       42: BPF filter                          :
       42.1: Basic BPF filtering               : Ok
       42.2: BPF pinning                       : Ok
       42.3: BPF prologue generation           : Ok
       42.4: BPF relocation checker            : Failed
       #
      
      Output after:
       # ./perf test -F 42
       42: BPF filter                          :
       42.1: Basic BPF filtering               : Ok
       42.2: BPF pinning                       : Ok
       42.3: BPF prologue generation           : Ok
       #
      Signed-off-by: NThomas Richter <tmricht@linux.ibm.com>
      Suggested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: http://lore.kernel.org/lkml/20210324083734.1953123-1-tmricht@linux.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      eb8f998b
    • J
      perf daemon: Return from kill functions · 9f177fd8
      Jiri Olsa 提交于
      We should return correctly and warn in both daemon_session__kill() and
      daemon__kill() after we tried everything to kill sessions.  The current
      code will keep on looping and waiting.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20210320221013.1619613-2-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9f177fd8
    • J
      perf daemon: Force waipid for all session on SIGCHLD delivery · 1833b64f
      Jiri Olsa 提交于
      If we don't process SIGCHLD before another comes, we will see just one
      SIGCHLD as a result. In this case current code will miss exit
      notification for a session and wait forever.
      
      Adding extra waitpid check for all sessions when SIGCHLD is received, to
      make sure we don't miss any session exit.
      
      Also fix close condition for signal_fd.
      Reported-by: NIan Rogers <irogers@google.com>
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20210320221013.1619613-1-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1833b64f
  5. 22 3月, 2021 1 次提交
    • A
      kselftest/arm64: sve: Do not use non-canonical FFR register value · 7011d725
      Andre Przywara 提交于
      The "First Fault Register" (FFR) is an SVE register that mimics a
      predicate register, but clears bits when a load or store fails to handle
      an element of a vector. The supposed usage scenario is to initialise
      this register (using SETFFR), then *read* it later on to learn about
      elements that failed to load or store. Explicit writes to this register
      using the WRFFR instruction are only supposed to *restore* values
      previously read from the register (for context-switching only).
      As the manual describes, this register holds only certain values, it:
      "... contains a monotonic predicate value, in which starting from bit 0
      there are zero or more 1 bits, followed only by 0 bits in any remaining
      bit positions."
      Any other value is UNPREDICTABLE and is not supposed to be "restored"
      into the register.
      
      The SVE test currently tries to write a signature pattern into the
      register, which is *not* a canonical FFR value. Apparently the existing
      setups treat UNPREDICTABLE as "read-as-written", but a new
      implementation actually only stores canonical values. As a consequence,
      the sve-test fails immediately when comparing the FFR value:
      -----------
       # ./sve-test
      Vector length:  128 bits
      PID:    207
      Mismatch: PID=207, iteration=0, reg=48
              Expected [cf00]
              Got      [0f00]
      Aborted
      -----------
      
      Fix this by only populating the FFR with proper canonical values.
      Effectively the requirement described above limits us to 17 unique
      values over 16 bits worth of FFR, so we condense our signature down to 4
      bits (2 bits from the PID, 2 bits from the generation) and generate the
      canonical pattern from it. Any bits describing elements above the
      minimum 128 bit are set to 0.
      
      This aligns the FFR usage to the architecture and fixes the test on
      microarchitectures implementing FFR in a more restricted way.
      Signed-off-by: NAndre Przywara <andre.przywara@arm.com>
      Reviwed-by: NMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20210319120128.29452-1-andre.przywara@arm.comSigned-off-by: NWill Deacon <will@kernel.org>
      7011d725
  6. 20 3月, 2021 3 次提交
    • J
      selftests/bpf: Add selftest for pointer-to-array-of-struct BTF dump · f118aac6
      Jean-Philippe Brucker 提交于
      Bpftool used to issue forward declarations for a struct used as part of
      a pointer to array, which is invalid. Add a test to check that the
      struct is fully defined in this case:
      
      	@@ -134,9 +134,9 @@
      	 	};
      	 };
      
      	-struct struct_in_array {};
      	+struct struct_in_array;
      
      	-struct struct_in_array_typed {};
      	+struct struct_in_array_typed;
      
      	 typedef struct struct_in_array_typed struct_in_array_t[2];
      
      	@@ -189,3 +189,7 @@
      	 	struct struct_with_embedded_stuff _14;
      	 };
      
      	+struct struct_in_array {};
      	+
      	+struct struct_in_array_typed {};
      	+
      	...
      	#13/1 btf_dump: syntax:FAIL
      Suggested-by: NAndrii Nakryiko <andrii.nakryiko@gmail.com>
      Signed-off-by: NJean-Philippe Brucker <jean-philippe@linaro.org>
      Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20210319112554.794552-3-jean-philippe@linaro.org
      f118aac6
    • J
      libbpf: Fix BTF dump of pointer-to-array-of-struct · 901ee1d7
      Jean-Philippe Brucker 提交于
      The vmlinux.h generated from BTF is invalid when building
      drivers/phy/ti/phy-gmii-sel.c with clang:
      
      vmlinux.h:61702:27: error: array type has incomplete element type ‘struct reg_field’
      61702 |  const struct reg_field (*regfields)[3];
            |                           ^~~~~~~~~
      
      bpftool generates a forward declaration for this struct regfield, which
      compilers aren't happy about. Here's a simplified reproducer:
      
      	struct inner {
      		int val;
      	};
      	struct outer {
      		struct inner (*ptr_to_array)[2];
      	} A;
      
      After build with clang -> bpftool btf dump c -> clang/gcc:
      ./def-clang.h:11:23: error: array has incomplete element type 'struct inner'
              struct inner (*ptr_to_array)[2];
      
      Member ptr_to_array of struct outer is a pointer to an array of struct
      inner. In the DWARF generated by clang, struct outer appears before
      struct inner, so when converting BTF of struct outer into C, bpftool
      issues a forward declaration to struct inner. With GCC the DWARF info is
      reversed so struct inner gets fully defined.
      
      That forward declaration is not sufficient when compilers handle an
      array of the struct, even when it's only used through a pointer. Note
      that we can trigger the same issue with an intermediate typedef:
      
      	struct inner {
      	        int val;
      	};
      	typedef struct inner inner2_t[2];
      	struct outer {
      	        inner2_t *ptr_to_array;
      	} A;
      
      Becomes:
      
      	struct inner;
      	typedef struct inner inner2_t[2];
      
      And causes:
      
      ./def-clang.h:10:30: error: array has incomplete element type 'struct inner'
      	typedef struct inner inner2_t[2];
      
      To fix this, clear through_ptr whenever we encounter an intermediate
      array, to make the inner struct part of a strong link and force full
      declaration.
      
      Fixes: 351131b5 ("libbpf: add btf_dump API for BTF-to-C conversion")
      Signed-off-by: NJean-Philippe Brucker <jean-philippe@linaro.org>
      Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20210319112554.794552-2-jean-philippe@linaro.org
      901ee1d7
    • H
      selftests: forwarding: vxlan_bridge_1d: Fix vxlan ecn decapsulate value · 5aa3c334
      Hangbin Liu 提交于
      The ECN bit defines ECT(1) = 1, ECT(0) = 2. So inner 0x02 + outer 0x01
      should be inner ECT(0) + outer ECT(1). Based on the description of
      __INET_ECN_decapsulate, the final decapsulate value should be
      ECT(1). So fix the test expect value to 0x01.
      
      Before the fix:
      TEST: VXLAN: ECN decap: 01/02->0x02                                 [FAIL]
              Expected to capture 10 packets, got 0.
      
      After the fix:
      TEST: VXLAN: ECN decap: 01/02->0x01                                 [ OK ]
      
      Fixes: a0b61f3d ("selftests: forwarding: vxlan_bridge_1d: Add an ECN decap test")
      Signed-off-by: NHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5aa3c334
  7. 19 3月, 2021 4 次提交
  8. 18 3月, 2021 5 次提交
  9. 17 3月, 2021 1 次提交
  10. 16 3月, 2021 2 次提交
  11. 15 3月, 2021 6 次提交