2023-07-28 01:32:39

by kernel test robot

[permalink] [raw]
Subject: [linus:master] [perf pmu] a0c41caeba: kmsg.sanitizer.direct_leak/__interceptor_malloc/perf_cpu_map__alloc/perf_cpu_map__empty_new/cpu_map__from_range/cpu_map__new_data/perf_event__fprintf_event_update



Hello,

kernel test robot noticed "kmsg.sanitizer.direct_leak/__interceptor_malloc/perf_cpu_map__alloc/perf_cpu_map__empty_new/cpu_map__from_range/cpu_map__new_data/perf_event__fprintf_event_update" on:

commit: a0c41caebab2fa224454d50dd4e29ae008ead25f ("perf pmu: Add CPU map for "cpu" PMUs")
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master

[test failed on linus/master 18b44bc5a67275641fb26f2c54ba7eef80ac5950]
[test failed on linux-next/master 0ba5d07205771c50789fd9063950aa75e7f1183f]

in testcase: perf-test
version: perf-test-x86_64-git-1_20220520
with following parameters:

type: lkp
group: group-01

test-description: The internal Perf Test suite.


compiler: gcc-12
test machine: 224 threads 2 sockets Intel(R) Xeon(R) Platinum 8480+ (Sapphire Rapids) with 256G memory

(please refer to attached dmesg/kmsg for entire log/backtrace)


we also noticed there are 2 other "Direct leak" but exist on both this commit
and parent. (there are 3 "Indrect leak", but since exist on both this commit
and parent, we don't highlight below, details are in attached dmesg)

we are not sure enough the impact of those 2 other "Direct leak", which we will
check further if we can capture the first commit caused them. we just report
this difference we found in our tests FYI.


1578e63d3ac292ab a0c41caebab2fa224454d50dd4e
---------------- ---------------------------
fail:runs %reproduction fail:runs
| | |
6:6 0% 6:6 kmsg.sanitizer.direct_leak/__interceptor_calloc/map__new2/machine__addnew_module_map/machine__process_kernel_mmap_event/machine__process_mmap_event/perf_event__process_mmap
6:6 0% 6:6 kmsg.sanitizer.direct_leak/__interceptor_malloc/__maps__insert/maps__insert/thread__insert_map/machine__process_mmap2_event/perf_event__process_mmap2
:6 100% 6:6 kmsg.sanitizer.direct_leak/__interceptor_malloc/perf_cpu_map__alloc/perf_cpu_map__empty_new/cpu_map__from_range/cpu_map__new_data/perf_event__fprintf_event_update



If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]



=================================================================
==16107==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 17544 byte(s) in 51 object(s) allocated from: <----- also happens on parent
#0 0x7f77a26ad037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x55eae21bcf4a in map__new2 util/map.c:226
#2 0x55eae21a1b8b in machine__addnew_module_map util/machine.c:1039
#3 0x55eae21a80d9 in machine__process_kernel_mmap_event util/machine.c:1809
#4 0x55eae21aa396 in machine__process_mmap_event util/machine.c:1996
#5 0x55eae2069f1c in perf_event__process_mmap util/event.c:371
#6 0x55eae21daa15 in machines__deliver_event util/session.c:1565
#7 0x55eae21dc2f5 in perf_session__deliver_event util/session.c:1645
#8 0x55eae21df380 in perf_session__process_event util/session.c:1881
#9 0x55eae21e622c in process_simple util/session.c:2442
#10 0x55eae21e527c in reader__read_event util/session.c:2371
#11 0x55eae21e5bbc in reader__process_events util/session.c:2420
#12 0x55eae21e69e5 in __perf_session__process_events util/session.c:2467
#13 0x55eae21e991d in perf_session__process_events util/session.c:2633
#14 0x55eae1d248dc in __cmd_report /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/builtin-report.c:989
#15 0x55eae1d30f76 in cmd_report /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/builtin-report.c:1709
#16 0x55eae200824f in run_builtin /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:323
#17 0x55eae2008ad1 in handle_internal_command /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:377
#18 0x55eae2009003 in run_argv /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:421
#19 0x55eae200972f in main /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:537
#20 0x7f77a1854d09 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x23d09)

Direct leak of 904 byte(s) in 1 object(s) allocated from:
#0 0x7f77a26ace8f in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x55eae2648cdd in perf_cpu_map__alloc (/usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf+0x19a5cdd)
#2 0x55eae22f7525 in perf_cpu_map__empty_new util/cpumap.c:163
#3 0x55eae22f6dae in cpu_map__from_range util/cpumap.c:121
#4 0x55eae22f7278 in cpu_map__new_data util/cpumap.c:144
#5 0x55eae2179b4c in perf_event__fprintf_event_update util/header.c:4348
#6 0x55eae217a084 in perf_event__process_event_update util/header.c:4410
#7 0x55eae21dcbb1 in perf_session__process_user_event util/session.c:1679
#8 0x55eae21df1b7 in perf_session__process_event util/session.c:1867
#9 0x55eae21e622c in process_simple util/session.c:2442
#10 0x55eae21e527c in reader__read_event util/session.c:2371
#11 0x55eae21e5bbc in reader__process_events util/session.c:2420
#12 0x55eae21e69e5 in __perf_session__process_events util/session.c:2467
#13 0x55eae21e991d in perf_session__process_events util/session.c:2633
#14 0x55eae1d248dc in __cmd_report /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/builtin-report.c:989
#15 0x55eae1d30f76 in cmd_report /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/builtin-report.c:1709
#16 0x55eae200824f in run_builtin /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:323
#17 0x55eae2008ad1 in handle_internal_command /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:377
#18 0x55eae2009003 in run_argv /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:421
#19 0x55eae200972f in main /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:537
#20 0x7f77a1854d09 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x23d09)

Direct leak of 64 byte(s) in 2 object(s) allocated from: <----- also happens on parent
#0 0x7f77a26ace8f in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x55eae21c15b1 in __maps__insert util/maps.c:43
#2 0x55eae21c1a2a in maps__insert util/maps.c:70
#3 0x55eae22038ba in thread__insert_map util/thread.c:355
#4 0x55eae21a9bed in machine__process_mmap2_event util/machine.c:1959
#5 0x55eae2069f70 in perf_event__process_mmap2 util/event.c:379
#6 0x55eae21dac1e in machines__deliver_event util/session.c:1569
#7 0x55eae21dc2f5 in perf_session__deliver_event util/session.c:1645
#8 0x55eae21c7f35 in ordered_events__deliver_event util/session.c:188
#9 0x55eae21f7824 in do_flush util/ordered-events.c:245
#10 0x55eae21f863f in __ordered_events__flush util/ordered-events.c:324
#11 0x55eae21f8b1a in ordered_events__flush util/ordered-events.c:342
#12 0x55eae21e6a08 in __perf_session__process_events util/session.c:2471
#13 0x55eae21e991d in perf_session__process_events util/session.c:2633
#14 0x55eae1d248dc in __cmd_report /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/builtin-report.c:989
#15 0x55eae1d30f76 in cmd_report /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/builtin-report.c:1709
#16 0x55eae200824f in run_builtin /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:323
#17 0x55eae2008ad1 in handle_internal_command /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:377
#18 0x55eae2009003 in run_argv /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:421
#19 0x55eae200972f in main /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:537
#20 0x7f77a1854d09 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x23d09)



To reproduce:

git clone https://github.com/intel/lkp-tests.git
cd lkp-tests
sudo bin/lkp install job.yaml # job file is attached in this email
bin/lkp split-job --compatible job.yaml # generate the yaml file for lkp run
sudo bin/lkp run generated-yaml-file

# if come across any failure that blocks the test,
# please remove ~/.lkp and /lkp dir to run from a clean state.



--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



Attachments:
(No filename) (9.24 kB)
config-6.4.0-rc1-00139-ga0c41caebab2 (166.22 kB)
job-script (5.31 kB)
dmesg.xz (143.05 kB)
perf-test (868.08 kB)
job.yaml (4.82 kB)
reproduce (604.00 B)
Download all attachments

2023-07-28 04:42:20

by Ian Rogers

[permalink] [raw]
Subject: Re: [linus:master] [perf pmu] a0c41caeba: kmsg.sanitizer.direct_leak/__interceptor_malloc/perf_cpu_map__alloc/perf_cpu_map__empty_new/cpu_map__from_range/cpu_map__new_data/perf_event__fprintf_event_update

On Thu, Jul 27, 2023 at 6:07 PM kernel test robot <[email protected]> wrote:
>
>
>
> Hello,
>
> kernel test robot noticed "kmsg.sanitizer.direct_leak/__interceptor_malloc/perf_cpu_map__alloc/perf_cpu_map__empty_new/cpu_map__from_range/cpu_map__new_data/perf_event__fprintf_event_update" on:
>
> commit: a0c41caebab2fa224454d50dd4e29ae008ead25f ("perf pmu: Add CPU map for "cpu" PMUs")
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
>
> [test failed on linus/master 18b44bc5a67275641fb26f2c54ba7eef80ac5950]
> [test failed on linux-next/master 0ba5d07205771c50789fd9063950aa75e7f1183f]
>
> in testcase: perf-test
> version: perf-test-x86_64-git-1_20220520
> with following parameters:
>
> type: lkp
> group: group-01
>
> test-description: The internal Perf Test suite.
>
>
> compiler: gcc-12
> test machine: 224 threads 2 sockets Intel(R) Xeon(R) Platinum 8480+ (Sapphire Rapids) with 256G memory
>
> (please refer to attached dmesg/kmsg for entire log/backtrace)
>
>
> we also noticed there are 2 other "Direct leak" but exist on both this commit
> and parent. (there are 3 "Indrect leak", but since exist on both this commit
> and parent, we don't highlight below, details are in attached dmesg)
>
> we are not sure enough the impact of those 2 other "Direct leak", which we will
> check further if we can capture the first commit caused them. we just report
> this difference we found in our tests FYI.
>
>
> 1578e63d3ac292ab a0c41caebab2fa224454d50dd4e
> ---------------- ---------------------------
> fail:runs %reproduction fail:runs
> | | |
> 6:6 0% 6:6 kmsg.sanitizer.direct_leak/__interceptor_calloc/map__new2/machine__addnew_module_map/machine__process_kernel_mmap_event/machine__process_mmap_event/perf_event__process_mmap
> 6:6 0% 6:6 kmsg.sanitizer.direct_leak/__interceptor_malloc/__maps__insert/maps__insert/thread__insert_map/machine__process_mmap2_event/perf_event__process_mmap2
> :6 100% 6:6 kmsg.sanitizer.direct_leak/__interceptor_malloc/perf_cpu_map__alloc/perf_cpu_map__empty_new/cpu_map__from_range/cpu_map__new_data/perf_event__fprintf_event_update
>
>
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <[email protected]>
> | Closes: https://lore.kernel.org/oe-lkp/[email protected]
>
>
>
> =================================================================
> ==16107==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 17544 byte(s) in 51 object(s) allocated from: <----- also happens on parent
> #0 0x7f77a26ad037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
> #1 0x55eae21bcf4a in map__new2 util/map.c:226
> #2 0x55eae21a1b8b in machine__addnew_module_map util/machine.c:1039
> #3 0x55eae21a80d9 in machine__process_kernel_mmap_event util/machine.c:1809
> #4 0x55eae21aa396 in machine__process_mmap_event util/machine.c:1996
> #5 0x55eae2069f1c in perf_event__process_mmap util/event.c:371
> #6 0x55eae21daa15 in machines__deliver_event util/session.c:1565
> #7 0x55eae21dc2f5 in perf_session__deliver_event util/session.c:1645
> #8 0x55eae21df380 in perf_session__process_event util/session.c:1881
> #9 0x55eae21e622c in process_simple util/session.c:2442
> #10 0x55eae21e527c in reader__read_event util/session.c:2371
> #11 0x55eae21e5bbc in reader__process_events util/session.c:2420
> #12 0x55eae21e69e5 in __perf_session__process_events util/session.c:2467
> #13 0x55eae21e991d in perf_session__process_events util/session.c:2633
> #14 0x55eae1d248dc in __cmd_report /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/builtin-report.c:989
> #15 0x55eae1d30f76 in cmd_report /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/builtin-report.c:1709
> #16 0x55eae200824f in run_builtin /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:323
> #17 0x55eae2008ad1 in handle_internal_command /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:377
> #18 0x55eae2009003 in run_argv /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:421
> #19 0x55eae200972f in main /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:537
> #20 0x7f77a1854d09 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x23d09)

This was already fixed by:
https://lore.kernel.org/r/[email protected]

Thanks,
Ian

> Direct leak of 904 byte(s) in 1 object(s) allocated from:
> #0 0x7f77a26ace8f in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
> #1 0x55eae2648cdd in perf_cpu_map__alloc (/usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf+0x19a5cdd)
> #2 0x55eae22f7525 in perf_cpu_map__empty_new util/cpumap.c:163
> #3 0x55eae22f6dae in cpu_map__from_range util/cpumap.c:121
> #4 0x55eae22f7278 in cpu_map__new_data util/cpumap.c:144
> #5 0x55eae2179b4c in perf_event__fprintf_event_update util/header.c:4348
> #6 0x55eae217a084 in perf_event__process_event_update util/header.c:4410
> #7 0x55eae21dcbb1 in perf_session__process_user_event util/session.c:1679
> #8 0x55eae21df1b7 in perf_session__process_event util/session.c:1867
> #9 0x55eae21e622c in process_simple util/session.c:2442
> #10 0x55eae21e527c in reader__read_event util/session.c:2371
> #11 0x55eae21e5bbc in reader__process_events util/session.c:2420
> #12 0x55eae21e69e5 in __perf_session__process_events util/session.c:2467
> #13 0x55eae21e991d in perf_session__process_events util/session.c:2633
> #14 0x55eae1d248dc in __cmd_report /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/builtin-report.c:989
> #15 0x55eae1d30f76 in cmd_report /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/builtin-report.c:1709
> #16 0x55eae200824f in run_builtin /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:323
> #17 0x55eae2008ad1 in handle_internal_command /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:377
> #18 0x55eae2009003 in run_argv /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:421
> #19 0x55eae200972f in main /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:537
> #20 0x7f77a1854d09 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x23d09)
>
> Direct leak of 64 byte(s) in 2 object(s) allocated from: <----- also happens on parent
> #0 0x7f77a26ace8f in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
> #1 0x55eae21c15b1 in __maps__insert util/maps.c:43
> #2 0x55eae21c1a2a in maps__insert util/maps.c:70
> #3 0x55eae22038ba in thread__insert_map util/thread.c:355
> #4 0x55eae21a9bed in machine__process_mmap2_event util/machine.c:1959
> #5 0x55eae2069f70 in perf_event__process_mmap2 util/event.c:379
> #6 0x55eae21dac1e in machines__deliver_event util/session.c:1569
> #7 0x55eae21dc2f5 in perf_session__deliver_event util/session.c:1645
> #8 0x55eae21c7f35 in ordered_events__deliver_event util/session.c:188
> #9 0x55eae21f7824 in do_flush util/ordered-events.c:245
> #10 0x55eae21f863f in __ordered_events__flush util/ordered-events.c:324
> #11 0x55eae21f8b1a in ordered_events__flush util/ordered-events.c:342
> #12 0x55eae21e6a08 in __perf_session__process_events util/session.c:2471
> #13 0x55eae21e991d in perf_session__process_events util/session.c:2633
> #14 0x55eae1d248dc in __cmd_report /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/builtin-report.c:989
> #15 0x55eae1d30f76 in cmd_report /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/builtin-report.c:1709
> #16 0x55eae200824f in run_builtin /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:323
> #17 0x55eae2008ad1 in handle_internal_command /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:377
> #18 0x55eae2009003 in run_argv /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:421
> #19 0x55eae200972f in main /usr/src/perf_selftests-x86_64-rhel-8.3-bpf-a0c41caebab2fa224454d50dd4e29ae008ead25f/tools/perf/perf.c:537
> #20 0x7f77a1854d09 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x23d09)
>
>
>
> To reproduce:
>
> git clone https://github.com/intel/lkp-tests.git
> cd lkp-tests
> sudo bin/lkp install job.yaml # job file is attached in this email
> bin/lkp split-job --compatible job.yaml # generate the yaml file for lkp run
> sudo bin/lkp run generated-yaml-file
>
> # if come across any failure that blocks the test,
> # please remove ~/.lkp and /lkp dir to run from a clean state.
>
>
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>
>