public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] aarch64: kernel defines __NR_compat_[exit|read|write] since 3.19
@ 2018-07-31 17:49 Victor Kamensky
  0 siblings, 0 replies; only message in thread
From: Victor Kamensky @ 2018-07-31 17:49 UTC (permalink / raw)
  To: systemtap, Jafeer Uddin

On aarch64 Linux system calls related SystemTap scripts
compilation fail with "__NR_compat_[exit|read|write] redefined"
errors after following two commits:

 7abf0aee9 PR23160,PR14690: remove references to ia32 and x86 to make sysc_* files as arch-independent as possible
 cd84aedca PR23160,PR14690: adapt 13 more syscalls for 4.17 __ARCH_sys_FOO and sys_enter/exit

aarch64 kernel defines __NR_compat_[exit|read|write] after
 a1ae65b21941 arm64: add seccomp support

Fix by adding proper conditional compilation based on current
architecture and kernel version.

Signed-off-by: Victor Kamensky <kamensky@cisco.com>
---
Here is more details about the problem. Please consider applying
suggested diff, if it is not fixed already.

The following two commits broke aarch64 compilation on quite a
few system call related SystemTap scripts on aarch64 CPU
architecture:

commit 7abf0aee98042c585e055635eebacde5b31bab69
Author: Jafeer Uddin <juddin@redhat.com>
Date:   Fri Jul 13 10:21:51 2018 -0400

    PR23160,PR14690: remove references to ia32 and x86 to make sysc_* files as arch-independent as possible

commit cd84aedcaffbda31041da6226a13918af7e132f7
Author: Jafeer Uddin <juddin@redhat.com>
Date:   Tue Jul 17 10:30:28 2018 -0400

    PR23160,PR14690: adapt 13 more syscalls for 4.17 __ARCH_sys_FOO and sys_enter/exit

/wd10/systemtap/20170730/packages/bin/stap -p4 -m nfs_detailed -a arm64 -B CROSS_COMPILE=/wd10/oe/20180718/build/tmp-glibc/work/qemuarm64-oe-linux/linux-yocto/4.15.18+gitAUTOINC+d35642f0b6_3373c0cf71-r0/recipe-sysroot-native/usr/bin/aarch64-oe-linux/aarch64-oe-linux- -r /wd10/oe/20180718/build/tmp-glibc/work/qemuarm64-oe-linux/linux-yocto/4.15.18+gitAUTOINC+d35642f0b6_3373c0cf71-r0/linux-qemuarm64-standard-build -I /wd10/systemtap/20170730/packages/share/systemtap/tapset -R /wd10/systemtap/20170730/packages/share/systemtap/runtime --sysroot /wd10/oe/20180718/build/tmp-glibc/work/qemuarm64-oe-linux/core-image-minimal/1.0-r0/rootfs-dbg --sysenv=PATH=/usr/sbin:/usr/bin:/sbin:/bin --sysenv=LD_LIBRARY_PATH=/usr/lib:/lib nfs-detailed.stp
In file included from /tmp/stapsJBXBc/nfs_detailed_src.c:55:
/wd10/systemtap/20170730/packages//share/systemtap/runtime/linux/compat_unistd.h:492: error: "__NR_compat_exit" redefined [-Werror]
 #define __NR_compat_exit  __NR_exit
 
In file included from /tmp/stapsJBXBc/nfs_detailed_src.c:54:
/wd10/oe/20180718/build/tmp-glibc/work-shared/qemuarm64/kernel-source/arch/arm64/include/asm/unistd.h:33: note: this is the location of the previous definition
 #define __NR_compat_exit  1
 
In file included from /tmp/stapsJBXBc/nfs_detailed_src.c:55:
/wd10/systemtap/20170730/packages//share/systemtap/runtime/linux/compat_unistd.h:529: error: "__NR_compat_read" redefined [-Werror]
 #define __NR_compat_read  __NR_read
 
In file included from /tmp/stapsJBXBc/nfs_detailed_src.c:54:
/wd10/oe/20180718/build/tmp-glibc/work-shared/qemuarm64/kernel-source/arch/arm64/include/asm/unistd.h:34: note: this is the location of the previous definition
 #define __NR_compat_read  3
 
In file included from /tmp/stapsJBXBc/nfs_detailed_src.c:55:
/wd10/systemtap/20170730/packages//share/systemtap/runtime/linux/compat_unistd.h:544: error: "__NR_compat_write" redefined [-Werror]
 #define __NR_compat_write  __NR_write
 
In file included from /tmp/stapsJBXBc/nfs_detailed_src.c:54:
/wd10/oe/20180718/build/tmp-glibc/work-shared/qemuarm64/kernel-source/arch/arm64/include/asm/unistd.h:35: note: this is the location of the previous definition
 #define __NR_compat_write  4
 
cc1: all warnings being treated as errors
make[3]: *** [/wd10/oe/20180718/build/tmp-glibc/work-shared/qemuarm64/kernel-source/scripts/Makefile.build:324: /tmp/stapsJBXBc/nfs_detailed_src.o] Error 1
make[2]: *** [/wd10/oe/20180718/build/tmp-glibc/work-shared/qemuarm64/kernel-source/Makefile:1523: _module_/tmp/stapsJBXBc] Error 2
make[1]: *** [Makefile:146: sub-make] Error 2
make: *** [Makefile:24: __sub-make] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compilation failed.  [man error::pass4]

on aarch64 __NR_compat_exit, __NR_compat_read, __NR_compat_write were added
by:

commit a1ae65b219416a72c15577bd4c8c11174fffbb8b
Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
Date:   Fri Nov 28 05:26:39 2014 +0000

    arm64: add seccomp support
    
    secure_computing() is called first in syscall_trace_enter() so that
    a system call will be aborted quickly without doing succeeding syscall
    tracing if seccomp rules want to deny that system call.
    
    On compat task, syscall numbers for system calls allowed in seccomp mode 1
    are different from those on normal tasks, and so _NR_seccomp_xxx_32's need
    to be redefined.
    
    Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
    Signed-off-by: Will Deacon <will.deacon@arm.com>

 runtime/linux/compat_unistd.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/runtime/linux/compat_unistd.h b/runtime/linux/compat_unistd.h
index 961db273e..8116b05d2 100644
--- a/runtime/linux/compat_unistd.h
+++ b/runtime/linux/compat_unistd.h
@@ -489,7 +489,9 @@
 #define __NR_compat_dup3		__NR_dup3
 #define __NR_compat_epoll_wait		__NR_epoll_wait
 #define __NR_compat_eventfd2		__NR_eventfd2
+#if !(defined(__aarch64__) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
 #define __NR_compat_exit		__NR_exit
+#endif
 #define __NR_compat_exit_group		__NR_exit_group
 #define __NR_compat_faccessat		__NR_faccessat
 #define __NR_compat_fchdir		__NR_fchdir
@@ -526,7 +528,9 @@
 #define __NR_compat_openat		__NR_openat
 #define __NR_compat_pipe2		__NR_pipe2
 #define __NR_compat_pselect7		__NR_pselect7
+#if !(defined(__aarch64__) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
 #define __NR_compat_read		__NR_read
+#endif
 #define __NR_compat_readlink		__NR_readlink
 #define __NR_compat_readlinkat		__NR_readlinkat
 #define __NR_compat_renameat		__NR_renameat
@@ -541,7 +545,9 @@
 #define __NR_compat_truncate		__NR_truncate
 #define __NR_compat_umount2		__NR_umount2
 #define __NR_compat_wait4		__NR_wait4
+#if !(defined(__aarch64__) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
 #define __NR_compat_write		__NR_write
+#endif
 
 #endif	/* __powerpc64__ || __s390x__ || __aarch64__ */
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-31 17:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31 17:49 [PATCH] aarch64: kernel defines __NR_compat_[exit|read|write] since 3.19 Victor Kamensky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).