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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180723185905.GA13220@kernel.org>
Date:   Mon, 23 Jul 2018 15:59:05 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Kim Phillips <kim.phillips@....com>
Cc:     Arnaldo Carvalho de Melo <acme@...hat.com>,
        Ravi Bangoria <ravi.bangoria@...ux.vnet.ibm.com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Hendrik Brueckner <brueckner@...ux.vnet.ibm.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Michael Ellerman <mpe@...erman.id.au>,
        Namhyung Kim <namhyung@...nel.org>,
        Thomas Richter <tmricht@...ux.vnet.ibm.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/3] perf arm64: Generate system call table from
 asm/unistd.h

Em Fri, Jul 20, 2018 at 12:06:53PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Jul 18, 2018 at 12:57:52PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Fri, Jul 06, 2018 at 04:34:43PM -0500, Kim Phillips escreveu:
> > > This should speed up accessing new system calls introduced with the
> > > kernel rather than waiting for libaudit updates to include them.
> > > 
> > > Using the existing other arch scripts resulted in this error:
> > > 
> > > tools/perf/arch/arm64/entry/syscalls//mksyscalltbl: 25: printf: __NR3264_ftruncate: expected numeric value
> > > 
> > > because, unlike other arches, asm-generic's unistd.h does things like:
> > > 
> > >  #define __NR_ftruncate __NR3264_ftruncate
> > > 
> > > Turning the scripts printf's %d into a %s resulted in this in the
> > > generated syscalls.c file:
> > > 
> > >     static const char *syscalltbl_arm64[] = {
> > >             [__NR3264_ftruncate] = "ftruncate",
> > > 
> > > So we use the host C compiler to fold the macros, and print them out
> > > from within a temporary C program, in order to get the correct output:
> > > 
> > >     static const char *syscalltbl_arm64[] = {
> > >             [46] = "ftruncate",
> > > 
> > 
> > One of my containers, ubuntu:14.04.4-x-linaro-arm64, that build perf in
> > a cross-build env, failed to build, please take a look if what is in the
> > output below is enough for you to find the problem, perhaps you forgot
> > to add the new files grabbed from the kernel sources to the
> > tools/perf/MANIFEST file that is used to create the tarball that is then
> > used to test build it? I'll check that later, in a hurry right now.
> 

So it fails with:

perfbuilder@...fe2fe9bef:/git/perf$ tools/perf/arch/arm64/entry/syscalls/mksyscalltbl /gcc-linaro-5.4.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc gcc tools/arch/arm64/include/uapi/asm/unistd.h
static const char *syscalltbl_arm64[] = {
<stdin>: In function 'main':
<stdin>:257:38: error: '__NR_getrandom' undeclared (first use in this function)
<stdin>:257:38: note: each undeclared identifier is reported only once for each function it appears in
<stdin>:258:41: error: '__NR_memfd_create' undeclared (first use in this function)
<stdin>:259:32: error: '__NR_bpf' undeclared (first use in this function)
<stdin>:260:37: error: '__NR_execveat' undeclared (first use in this function)
tools/perf/arch/arm64/entry/syscalls/mksyscalltbl: 47: tools/perf/arch/arm64/entry/syscalls/mksyscalltbl: /tmp/create-table-60liya: Permission denied

Because it uses as input this file
tools/arch/arm64/include/uapi/asm/unistd.h, that basically just does:

perfbuilder@...5f8b85ded:/git/perf$ cat tools/arch/arm64/include/uapi/asm/unistd.h
#define __ARCH_WANT_RENAMEAT

#include <asm-generic/unistd.h>
perfbuilder@...5f8b85ded:/git/perf$

And this ends up getting the system's asm-generic/unistd.h file, not the one
shipped in tools/, so:

perfbuilder@...5f8b85ded:/git/perf$ grep bpf /usr/include/asm-generic/unistd.h 
perfbuilder@...5f8b85ded:/git/perf$ grep _NR_ /usr/include/asm-generic/unistd.h  | tail -4
#define __NR_mmap2 __NR3264_mmap
#define __NR_fadvise64_64 __NR3264_fadvise64
#define __NR_stat64 __NR3264_stat
#define __NR_lstat64 __NR3264_lstat
perfbuilder@...5f8b85ded:/git/perf$ 

A quick hack is to do this instead:

diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile
index 85fdf4949db3..f013b115dc86 100644
--- a/tools/perf/arch/arm64/Makefile
+++ b/tools/perf/arch/arm64/Makefile
@@ -11,7 +11,7 @@ PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
 
 out    := $(OUTPUT)arch/arm64/include/generated/asm
 header := $(out)/syscalls.c
-sysdef := $(srctree)/tools/arch/arm64/include/uapi/asm/unistd.h
+sysdef := $(srctree)/tools/include/uapi/asm-generic/unistd.h
 sysprf := $(srctree)/tools/perf/arch/arm64/entry/syscalls/
 systbl := $(sysprf)/mksyscalltbl
 
diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
index c21023509960..52e197317d3e 100755
--- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
+++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
@@ -28,6 +28,7 @@ create_table_from_c()
 
 	cat <<-_EoHEADER
 		#include <stdio.h>
+		#define __ARCH_WANT_RENAMEAT
 		#include "$input"
 		int main(int argc, char *argv[])
 		{

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ