Skip to contentSkip to conversation

perf test case 'perf kwork record' fails due to abortion

DISCUSSION Thomas Richter 2 participants 3 messages May 20

lore
Share & tools
lore
#0 lore raw

The test case

# perf kwork record -- sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.280 MB perf.data (568 samples) ]
double free or corruption (!prev)
Aborted                    perf kwork record -- sleep 1
# echo $?
134
# 

The perf kwork record is kill with signal 6 (SIGABRT) and the test fails on x86_64 and s390, probably on other platforms as well.

Is this a known issue?

Thanks

Signature · 9 lines
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
IBM Deutschland Research & Development GmbH

Vorsitzender des Aufsichtsrats: Wolfgang Wendt

Geschäftsführung: David Faller

Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
#1 lore raw
Quoted 11 lines · Thomas Richter

The test case

# perf kwork record -- sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.280 MB perf.data (568 samples) ]
double free or corruption (!prev)
Aborted                    perf kwork record -- sleep 1
# echo $?
134
#
Quoted 4 lines

The perf kwork record is kill with signal 6 (SIGABRT) and the test fails on x86_64 and s390, probably on other platforms as well.

Is this a known issue?

I can reproduce this with an asan run:

```
--- start ---
test child forked, pid 4058074
Kwork record
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 4.949 MB
/tmp/__perf_test_kwork.perf.data.fyllr (17753 samples) ]
=================================================================
==4058078==ERROR: AddressSanitizer: attempting double-free on
0x7b2caa3e6a10 in thread T0:
   #0 0x7f0cb8318d6b in free
../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:51
   #1 0x563b32733077 in perf_kwork__record
/usr/local/google/home/irogers/repos/linux4/tools/perf/builtin-kwo
rk.c:2335
   #2 0x563b327363ad in cmd_kwork
/usr/local/google/home/irogers/repos/linux4/tools/perf/builtin-kwork.c:2494
   #3 0x563b327dfffa in run_builtin
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:348
   #4 0x563b327e0498 in handle_internal_command
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c
:398
   #5 0x563b327e0866 in run_argv
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:442
   #6 0x563b327e0dbd in main
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:549
   #7 0x7f0cae029f76 in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
   #8 0x7f0cae02a026 in __libc_start_main_impl ../csu/libc-start.c:360
   #9 0x563b3261a3b0 in _start (/tmp/perf4/perf+0x2243b0) (BuildId:
c542d90b5244b118cf9b3a20501260c659421a94)

0x7b2caa3e6a10 is located 0 bytes inside of 6-byte region
[0x7b2caa3e6a10,0x7b2caa3e6a16)
freed by thread T0 here:
   #0 0x7f0cb8318d6b in free
../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:51
   #1 0x563b32733077 in perf_kwork__record
/usr/local/google/home/irogers/repos/linux4/tools/perf/builtin-kwo
rk.c:2335
   #2 0x563b327363ad in cmd_kwork
/usr/local/google/home/irogers/repos/linux4/tools/perf/builtin-kwork.c:2494
   #3 0x563b327dfffa in run_builtin
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:348
   #4 0x563b327e0498 in handle_internal_command
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c
:398
   #5 0x563b327e0866 in run_argv
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:442
   #6 0x563b327e0dbd in main
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:549
   #7 0x7f0cae029f76 in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
   #8 0x7ffda79dc4ee  ([stack]+0x204ee)

previously allocated by thread T0 here:
   #0 0x7f0cb8313e20 in strdup
../../../../src/libsanitizer/asan/asan_interceptors.cpp:593
   #1 0x563b32732ddb in perf_kwork__record
/usr/local/google/home/irogers/repos/linux4/tools/perf/builtin-kwo
rk.c:2322
   #2 0x563b327363ad in cmd_kwork
/usr/local/google/home/irogers/repos/linux4/tools/perf/builtin-kwork.c:2494
   #3 0x563b327dfffa in run_builtin
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:348
   #4 0x563b327e0498 in handle_internal_command
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c
:398
   #5 0x563b327e0866 in run_argv
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:442
   #6 0x563b327e0dbd in main
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:549
   #7 0x7f0cae029f76 in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
   #8 0x7ffda79dc4ee  ([stack]+0x204ee)

SUMMARY: AddressSanitizer: double-free
/usr/local/google/home/irogers/repos/linux4/tools/perf/builtin-kwork.c:
2335 in perf_kwork__record
==4058078==ABORTING
Unexpected signal in test_kwork_record
---- end(-1) ----
93: perf kwork tests                                                : FAILED!
```

And it looks like I sent the fix a while ago:
https://lore.kernel.org/linux-perf-users/[email protected]/
I plan to rebase and resend that series today.

Thanks,
Ian

Quoted 13 lines

Thanks
--
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany --
IBM Deutschland Research & Development GmbH

Vorsitzender des Aufsichtsrats: Wolfgang Wendt

Geschäftsführung: David Faller

Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

#2 lore raw
Quoted 103 lines · Ian Rogers
Quoted 11 lines · Thomas Richter

The test case

# perf kwork record -- sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.280 MB perf.data (568 samples) ]
double free or corruption (!prev)
Aborted                    perf kwork record -- sleep 1
# echo $?
134
#
Quoted 4 lines

The perf kwork record is kill with signal 6 (SIGABRT) and the test fails on x86_64 and s390, probably on other platforms as well.

Is this a known issue?

I can reproduce this with an asan run:

```
--- start ---
test child forked, pid 4058074
Kwork record
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 4.949 MB
/tmp/__perf_test_kwork.perf.data.fyllr (17753 samples) ]
=================================================================
==4058078==ERROR: AddressSanitizer: attempting double-free on
0x7b2caa3e6a10 in thread T0:
   #0 0x7f0cb8318d6b in free
../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:51
   #1 0x563b32733077 in perf_kwork__record
/usr/local/google/home/irogers/repos/linux4/tools/perf/builtin-kwo
rk.c:2335
   #2 0x563b327363ad in cmd_kwork
/usr/local/google/home/irogers/repos/linux4/tools/perf/builtin-kwork.c:2494
   #3 0x563b327dfffa in run_builtin
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:348
   #4 0x563b327e0498 in handle_internal_command
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c
:398
   #5 0x563b327e0866 in run_argv
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:442
   #6 0x563b327e0dbd in main
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:549
   #7 0x7f0cae029f76 in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
   #8 0x7f0cae02a026 in __libc_start_main_impl ../csu/libc-start.c:360
   #9 0x563b3261a3b0 in _start (/tmp/perf4/perf+0x2243b0) (BuildId:
c542d90b5244b118cf9b3a20501260c659421a94)

0x7b2caa3e6a10 is located 0 bytes inside of 6-byte region
[0x7b2caa3e6a10,0x7b2caa3e6a16)
freed by thread T0 here:
   #0 0x7f0cb8318d6b in free
../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:51
   #1 0x563b32733077 in perf_kwork__record
/usr/local/google/home/irogers/repos/linux4/tools/perf/builtin-kwo
rk.c:2335
   #2 0x563b327363ad in cmd_kwork
/usr/local/google/home/irogers/repos/linux4/tools/perf/builtin-kwork.c:2494
   #3 0x563b327dfffa in run_builtin
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:348
   #4 0x563b327e0498 in handle_internal_command
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c
:398
   #5 0x563b327e0866 in run_argv
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:442
   #6 0x563b327e0dbd in main
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:549
   #7 0x7f0cae029f76 in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
   #8 0x7ffda79dc4ee  ([stack]+0x204ee)

previously allocated by thread T0 here:
   #0 0x7f0cb8313e20 in strdup
../../../../src/libsanitizer/asan/asan_interceptors.cpp:593
   #1 0x563b32732ddb in perf_kwork__record
/usr/local/google/home/irogers/repos/linux4/tools/perf/builtin-kwo
rk.c:2322
   #2 0x563b327363ad in cmd_kwork
/usr/local/google/home/irogers/repos/linux4/tools/perf/builtin-kwork.c:2494
   #3 0x563b327dfffa in run_builtin
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:348
   #4 0x563b327e0498 in handle_internal_command
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c
:398
   #5 0x563b327e0866 in run_argv
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:442
   #6 0x563b327e0dbd in main
/usr/local/google/home/irogers/repos/linux4/tools/perf/perf.c:549
   #7 0x7f0cae029f76 in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
   #8 0x7ffda79dc4ee  ([stack]+0x204ee)

SUMMARY: AddressSanitizer: double-free
/usr/local/google/home/irogers/repos/linux4/tools/perf/builtin-kwork.c:
2335 in perf_kwork__record
==4058078==ABORTING
Unexpected signal in test_kwork_record
---- end(-1) ----
93: perf kwork tests                                                : FAILED!
```
Quoted 3 lines

And it looks like I sent the fix a while ago:
https://lore.kernel.org/linux-perf-users/[email protected]/
I plan to rebase and resend that series today.

I just resent the series and confirmed it fixes the issue for me:
https://lore.kernel.org/linux-perf-users/[email protected]/

Thanks,
Ian

Quoted 17 lines

Thanks,
Ian

Quoted 13 lines

Thanks
--
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany --
IBM Deutschland Research & Development GmbH

Vorsitzender des Aufsichtsrats: Wolfgang Wendt

Geschäftsführung: David Faller

Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294