lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 28 Nov 2017 11:46:11 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Heiko Carstens <heiko.carstens@...ibm.com>
Cc:     Ingo Molnar <mingo@...nel.org>,
        Hendrik Brueckner <brueckner@...ux.vnet.ibm.com>,
        Thomas Richter <tmricht@...ux.vnet.ibm.com>,
        Martin Schwidefsky <schwidefsky@...ibm.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        David Ahern <dsahern@...il.com>, Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Wang Nan <wangnan0@...wei.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [FIX] perf tools broken for s/390

Hi,

	While preparing a pull request to Ingo for this merge window, I
noticed a regression in one of my cross build containers, specifically:

  ubuntu:16.04-x-s390: FAIL

  LINK     /tmp/build/perf/plugin_jbd2.so
In file included from util/perf_regs.h:27:0,
                 from util/event.h:11,
                 from util/symbol.h:16,
                 from util/block-range.h:5,
                 from util/block-range.c:2:
/git/linux/tools/perf/arch/s390/include/perf_regs.h:6:62: fatal error: ../../../../arch/s390/include/uapi/asm/perf_regs.h: No such file or directory
compilation terminated.
In file included from util/perf_regs.h:27:0,
                 from util/event.h:11,
                 from util/symbol.h:16,
                 from util/sort.h:12,
                 from util/annotate.c:14:
/git/linux/tools/perf/arch/s390/include/perf_regs.h:6:62: fatal error: ../../../../arch/s390/include/uapi/asm/perf_regs.h: No such file or directory
compilation terminated.
  LINK     /tmp/build/perf/plugin_hrtimer.so
mv: cannot stat '/tmp/build/perf/util/.annotate.o.tmp': No such file or directory
mv: cannot stat '/tmp/build/perf/util/.block-range.o.tmp': No such file or directory
/git/linux/tools/build/Makefile.build:96: recipe for target '/tmp/build/perf/util/block-range.o' failed
make[4]: *** [/tmp/build/perf/util/block-range.o] Error 1
make[4]: *** Waiting for unfinished jobs....
/git/linux/tools/build/Makefile.build:96: recipe for target '/tmp/build/perf/util/annotate.o' failed
make[4]: *** [/tmp/build/perf/util/annotate.o] Error 1
/git/linux/tools/build/Makefile.build:139: recipe for target 'util' failed
make[3]: *** [util] Error 2
Makefile.perf:619: recipe for target '/tmp/build/perf/libperf-in.o' failed
make[2]: *** [/tmp/build/perf/libperf-in.o] Error 2
make[2]: *** Waiting for unfinished jobs....

I bisected it to the following commit:

commit f704ef44602fbf403e6722c7ed13f62d17e8cb20
Author:     Heiko Carstens <heiko.carstens@...ibm.com>
AuthorDate: Tue Jan 19 11:23:38 2016 +0100
Commit:     Martin Schwidefsky <schwidefsky@...ibm.com>
CommitDate: Thu Nov 16 15:06:12 2017 +0100

    s390/perf: add support for perf_regs and libdw
    
    With support for perf_regs and libdw, you can record and report
    call graphs for user space programs. Simply invoke perf with
    the --call-graph=dwarf command line option.
    
    Signed-off-by: Heiko Carstens <heiko.carstens@...ibm.com>
    [brueckner: added dwfl_thread_state_register_pc() call]
    Signed-off-by: Hendrik Brueckner <brueckner@...ux.vnet.ibm.com>
    Reviewed-and-tested-by: Thomas Richter <tmricht@...ux.vnet.ibm.com>
    Signed-off-by: Martin Schwidefsky <schwidefsky@...ibm.com>

----------------------

It adds this new file:

diff --git a/tools/perf/arch/s390/include/perf_regs.h b/tools/perf/arch/s390/include/perf_regs.h
new file mode 100644
index 000000000000..ac4b8c8c49e2
--- /dev/null
+++ b/tools/perf/arch/s390/include/perf_regs.h
@@ -0,0 +1,63 @@
+#ifndef ARCH_PERF_REGS_H
+#define ARCH_PERF_REGS_H
+
+#include <stdlib.h>
+#include <linux/types.h>
+#include <../../../../arch/s390/include/uapi/asm/perf_regs.h>

------------------------------------------

That will try to include a file from the kernel sources, directly,
something we long decided to be verbotten to avoid disturbing kernel
development (and perf's and other tools/) when, say, a kernel hacker
adds something, tests everything but tools/ and have tools/ build
broken.

So, in this case:

[acme@...et linux]$ find tools/arch/ -name perf_regs.h
tools/arch/arm/include/uapi/asm/perf_regs.h
tools/arch/powerpc/include/uapi/asm/perf_regs.h
tools/arch/x86/include/uapi/asm/perf_regs.h
tools/arch/arm64/include/uapi/asm/perf_regs.h
[acme@...et linux]$

probably its just a matter of doing the usual copy from arch/ to
tools/arch/ and add a line to tools/perf/check_headers.sh to make sure
we notice when the kernel original changes, possibly meaning needed
changes in tooling, but not necessarily.

[acme@...et linux]$ diff -u arch/arm64/include/uapi/asm/perf_regs.h tools/arch/arm64/include/uapi/asm/perf_regs.h
[acme@...et linux]$ diff -u arch/x86/include/uapi/asm/perf_regs.h tools/arch/x86/include/uapi/asm/perf_regs.h
[acme@...et linux]$ diff -u arch/powerpc/include/uapi/asm/perf_regs.h tools/arch/powerpc/include/uapi/asm/perf_regs.h
[acme@...et linux]$ diff -u arch/arm/include/uapi/asm/perf_regs.h tools/arch/arm/include/uapi/asm/perf_regs.h
[acme@...et linux]$

[acme@...et linux]$ cp arch/s390/include/uapi/asm/perf_regs.h tools/arch/s390/include/uapi/asm/perf_regs.h
[acme@...et linux]$ ls -la tools/arch/s390/include/uapi/asm/
total 44
drwxrwxr-x. 2 acme acme 4096 Nov 28 11:01 .
drwxrwxr-x. 3 acme acme 4096 Nov 23 15:29 ..
-rw-rw-r--. 1 acme acme  292 Nov 28 10:50 bitsperlong.h
-rw-rw-r--. 1 acme acme 7747 Nov 28 10:50 kvm.h
-rw-rw-r--. 1 acme acme  671 Nov 28 10:50 kvm_perf.h
-rw-rw-r--. 1 acme acme  267 Nov 28 10:50 mman.h
-rw-rw-r--. 1 acme acme  824 Nov 28 11:01 perf_regs.h
-rw-rw-r--. 1 acme acme 9470 Nov 28 10:50 sie.h
[acme@...et linux]$ 

And:

[acme@...et linux]$ grep perf_regs\.h tools/perf/arch/*/include/perf_regs.h
tools/perf/arch/arm64/include/perf_regs.h:#include <asm/perf_regs.h>
tools/perf/arch/arm/include/perf_regs.h:#include <asm/perf_regs.h>
tools/perf/arch/powerpc/include/perf_regs.h:#include <asm/perf_regs.h>
tools/perf/arch/s390/include/perf_regs.h:#include <../../../../arch/s390/include/uapi/asm/perf_regs.h>
tools/perf/arch/x86/include/perf_regs.h:#include <asm/perf_regs.h>
[acme@...et linux]$ 

Fixing the s390 case we get:

[acme@...et linux]$ git diff
diff --git a/tools/perf/arch/s390/include/perf_regs.h b/tools/perf/arch/s390/include/perf_regs.h
index d2df54a6bc5a..bcfbaed78cc2 100644
--- a/tools/perf/arch/s390/include/perf_regs.h
+++ b/tools/perf/arch/s390/include/perf_regs.h
@@ -3,7 +3,7 @@
 
 #include <stdlib.h>
 #include <linux/types.h>
-#include <../../../../arch/s390/include/uapi/asm/perf_regs.h>
+#include <asm/perf_regs.h>
 
 void perf_regs_load(u64 *regs);
 
[acme@...et linux]$ 

And the container builds ok again:

../tmp/perf: ELF 64-bit MSB shared object, IBM S/390, version 1 (SYSV), dynamically linked, interpreter /lib/ld64.so.1, for GNU/Linux 3.2.0, BuildID[sha1]=640f0477b0df899497855430154ad63d666cbc9d, with debug_info, not stripped

# dm ubuntu:16.04-x-s390
   1 ubuntu:16.04-x-s390: Ok   s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
#

In the future, please send patches that touch tools/perf/ to me,

The resulting patch is at:

https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/urgent&id=12507d0fc07ce2fa6ccdcdde819f26c4acb0d839

Best regards,

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ