Ubuntu-focal-kernel/tools
Jiri Olsa 1206a1f90d perf test: Fix the "signal" test inline assembly
BugLink: https://bugs.launchpad.net/bugs/1896828

[ Upstream commit 8a39e8c4d9 ]

When compiling with DEBUG=1 on Fedora 32 I'm getting crash for 'perf
test signal':

  Program received signal SIGSEGV, Segmentation fault.
  0x0000000000c68548 in __test_function ()
  (gdb) bt
  #0  0x0000000000c68548 in __test_function ()
  #1  0x00000000004d62e9 in test_function () at tests/bp_signal.c:61
  #2  0x00000000004d689a in test__bp_signal (test=0xa8e280 <generic_ ...
  #3  0x00000000004b7d49 in run_test (test=0xa8e280 <generic_tests+1 ...
  #4  0x00000000004b7e7f in test_and_print (t=0xa8e280 <generic_test ...
  #5  0x00000000004b8927 in __cmd_test (argc=1, argv=0x7fffffffdce0, ...
  ...

It's caused by the symbol __test_function being in the ".bss" section:

  $ readelf -a ./perf | less
    [Nr] Name              Type             Address           Offset
         Size              EntSize          Flags  Link  Info  Align
    ...
    [28] .bss              NOBITS           0000000000c356a0  008346a0
         00000000000511f8  0000000000000000  WA       0     0     32

  $ nm perf | grep __test_function
  0000000000c68548 B __test_function

I guess most of the time we're just lucky the inline asm ended up in the
".text" section, so making it specific explicit with push and pop
section clauses.

  $ readelf -a ./perf | less
    [Nr] Name              Type             Address           Offset
         Size              EntSize          Flags  Link  Info  Align
    ...
    [13] .text             PROGBITS         0000000000431240  00031240
         0000000000306faa  0000000000000000  AX       0     0     16

  $ nm perf | grep __test_function
  00000000004d62c8 T __test_function

Committer testing:

  $ readelf -wi ~/bin/perf | grep producer -m1
    <c>   DW_AT_producer    : (indirect string, offset: 0x254a): GNU C99 10.2.1 20200723 (Red Hat 10.2.1-1) -mtune=generic -march=x86-64 -ggdb3 -std=gnu99 -fno-omit-frame-pointer -funwind-tables -fstack-protector-all
                                                                                                                                         ^^^^^
                                                                                                                                         ^^^^^
                                                                                                                                         ^^^^^
  $

Before:

  $ perf test signal
  20: Breakpoint overflow signal handler                    : FAILED!
  $

After:

  $ perf test signal
  20: Breakpoint overflow signal handler                    : Ok
  $

Fixes: 8fd34e1cce ("perf test: Improve bp_signal")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lore.kernel.org/lkml/20200911130005.1842138-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: William Breathitt Gray <william.gray@canonical.com>
2020-11-09 14:46:56 +01:00
..
accounting tools/accounting/getdelays.c: fix netlink attribute length 2020-05-05 12:32:22 +02:00
arch x86/syscalls: Revert "x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long" 2020-06-22 17:23:35 -03:00
bpf tools, bpftool: Fix wrong return value in do_dump() 2020-09-04 16:29:21 -03:00
build tools build feature: Quote CC and CXX for their arguments 2020-09-04 16:30:11 -03:00
cgroup iocost_monitor: drop string wrap around numbers when outputting json 2020-08-08 01:53:12 -04:00
debugging
firewire
firmware
gpio tools: gpio: Fix out-of-tree build regression 2020-05-05 12:32:22 +02:00
hv UBUNTU: SAUCE: tools: hv: Update shebang to use python3 instead of python 2020-01-08 08:45:12 -06:00
iio
include perf tools: Correct SNOOPX field offset 2020-09-17 00:47:05 -06:00
io_uring
kvm/kvm_stat tools/kvm_stat: Fix kvm_exit filter name 2020-02-17 11:10:45 +01:00
laptop
leds
lib tools lib traceevent: Fix memory leak in process_dynamic_array_len 2020-09-04 16:28:45 -03:00
memory-model tools/memory-model: Fix data race detection for unordered store and load 2020-01-06 08:15:00 -06:00
nfsd
objtool kbuild: support LLVM=1 to switch the default tools to Clang/LLVM 2020-09-16 05:13:26 -04:00
pci tools: PCI: Fix fd leakage 2020-01-30 16:25:07 +01:00
pcmcia
perf perf test: Fix the "signal" test inline assembly 2020-11-09 14:46:56 +01:00
power tools/power turbostat: Fix 32-bit capabilities warning 2020-05-05 12:32:22 +02:00
scripts tools: Let O= makes handle a relative path with -C option 2020-04-03 15:17:23 +02:00
spi
testing selftests/bpf: Fix massive output from test_maps 2020-09-17 00:47:05 -06:00
thermal/tmon
time
usb usbip: Fix unsafe unaligned pointer usage 2020-02-24 16:19:52 +01:00
virtio tools/virtio: xen stub 2019-10-13 09:38:27 -04:00
vm tools/vm: fix cross-compile build 2020-05-25 10:41:49 +02:00
wmi
Makefile