linux-stable/tools/perf/arch
Ian Rogers 75d65c1cc4 perf tool x86: Fix perf_env memory leak
[ Upstream commit 99d4850062 ]

Found by leak sanitizer:
```
==1632594==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 21 byte(s) in 1 object(s) allocated from:
    #0 0x7f2953a7077b in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:439
    #1 0x556701d6fbbf in perf_env__read_cpuid util/env.c:369
    #2 0x556701d70589 in perf_env__cpuid util/env.c:465
    #3 0x55670204bba2 in x86__is_amd_cpu arch/x86/util/env.c:14
    #4 0x5567020487a2 in arch__post_evsel_config arch/x86/util/evsel.c:83
    #5 0x556701d8f78b in evsel__config util/evsel.c:1366
    #6 0x556701ef5872 in evlist__config util/record.c:108
    #7 0x556701cd6bcd in test__PERF_RECORD tests/perf-record.c:112
    #8 0x556701cacd07 in run_test tests/builtin-test.c:236
    #9 0x556701cacfac in test_and_print tests/builtin-test.c:265
    #10 0x556701cadddb in __cmd_test tests/builtin-test.c:402
    #11 0x556701caf2aa in cmd_test tests/builtin-test.c:559
    #12 0x556701d3b557 in run_builtin tools/perf/perf.c:323
    #13 0x556701d3bac8 in handle_internal_command tools/perf/perf.c:377
    #14 0x556701d3be90 in run_argv tools/perf/perf.c:421
    #15 0x556701d3c3f8 in main tools/perf/perf.c:537
    #16 0x7f2952a46189 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

SUMMARY: AddressSanitizer: 21 byte(s) leaked in 1 allocation(s).
```

Fixes: f7b58cbdb3 ("perf mem/c2c: Add load store event mappings for AMD")
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Ravi Bangoria <ravi.bangoria@amd.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Link: https://lore.kernel.org/r/20230613235416.1650755-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-19 16:21:38 +02:00
..
alpha
arc/annotate
arm perf auxtrace arm64: Add support for HiSilicon PCIe Tune and Trace device driver 2022-10-15 10:13:16 -03:00
arm64 perf auxtrace arm64: Add support for HiSilicon PCIe Tune and Trace device driver 2022-10-15 10:13:16 -03:00
csky perf arch: Support register names from all archs 2021-12-16 12:18:12 -03:00
mips tools headers UAPI: Sync files changed by new set_mempolicy_home_node syscall 2022-01-20 11:20:37 -03:00
parisc
powerpc tools headers UAPI: Sync powerpc syscall tables with the kernel sources 2022-10-25 17:40:48 -03:00
riscv perf jitdump: Add riscv64 support 2022-04-11 16:37:26 -03:00
riscv64/annotate perf annotate: Add riscv64 support 2021-09-27 09:33:44 -03:00
s390 perf auxtrace: Record whether an auxtrace mmap is needed 2022-05-10 14:27:19 -03:00
sh treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
sparc treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
x86 perf tool x86: Fix perf_env memory leak 2023-07-19 16:21:38 +02:00
xtensa treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
Build perf tools: Rename build libperf to perf 2019-02-14 15:18:08 -03:00
common.c perf debug: Remove needless include directives from debug.h 2019-08-31 19:10:19 -03:00
common.h perf env: Remove env.h from other headers where just a fwd decl is needed 2019-08-31 19:10:40 -03:00