This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/2] powerpc64: add missing system call defines


A set of system call defines like __NR_pkey_alloc, __NR_pkey_free
__NR_pkey_mprotect are missing in powerpc64 kernel as of 4.14 kernel
version.

Add corresponding definitions so system call related probes
would compile. Tested with nd_syscalls-all-probes.stp.

Signed-off-by: Victor Kamensky <kamensky@cisco.com>
---
Here is error that I get with latest systemtap on nxp p5020
powerpc64 machine. But I think the error is common for all
older kernels that would not have those system calls yet:

root@p5020ds-64b:~# stap -v nd_syscalls-all-probes.stp
Pass 1: parsed user script and 495 library scripts using 89036virt/73708res/9256shr/64004data kb, in 710usr/70sys/783real ms.
WARNING: never-assigned local variable 'retstr' (similar: argstr, buf, flags_str, count, name): identifier 'retstr' at nd_syscalls-all-probes.stp:10:17
 source: 	printf("%s\n", retstr)
         	               ^
Pass 2: analyzed script: 1075 probes, 199 functions, 102 embeds, 104 globals using 221080virt/207548res/11068shr/196048data kb, in 498110usr/19270sys/463469real ms.
Pass 3: translated to C into "/tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.c" using 221080virt/207548res/11068shr/196048data kb, in 42980usr/70sys/43071real ms.
In file included from /tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.c:35:
/tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.c: In function 'probe_7220':
/home/root/systemtap/20181030/packages/share/systemtap/runtime/linux/compat_unistd.h:1921:33: error: '__NR_pkey_alloc' undeclared (first use in this function); did you mean '__pte_alloc'?
 #define __NR_compat_pkey_alloc  __NR_pkey_alloc
                                 ^~~~~~~~~~~~~~~
/tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.c:79572:85: note: in expansion of macro '__NR_compat_pkey_alloc'
       if ((((l->l___nr) != ((((int64_t) (/* pure */ /* unprivileged */ /* stable */ __NR_compat_pkey_alloc))))))) {
                                                                                     ^~~~~~~~~~~~~~~~~~~~~~
/home/root/systemtap/20181030/packages/share/systemtap/runtime/linux/compat_unistd.h:1921:33: note: each undeclared identifier is reported only once for each function it appears in
 #define __NR_compat_pkey_alloc  __NR_pkey_alloc
                                 ^~~~~~~~~~~~~~~
/tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.c:79572:85: note: in expansion of macro '__NR_compat_pkey_alloc'
       if ((((l->l___nr) != ((((int64_t) (/* pure */ /* unprivileged */ /* stable */ __NR_compat_pkey_alloc))))))) {
                                                                                     ^~~~~~~~~~~~~~~~~~~~~~
/tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.c: In function 'probe_7225':
/home/root/systemtap/20181030/packages/share/systemtap/runtime/linux/compat_unistd.h:1922:32: error: '__NR_pkey_free' undeclared (first use in this function); did you mean '__stp_get_freq'?
 #define __NR_compat_pkey_free  __NR_pkey_free
                                ^~~~~~~~~~~~~~
/tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.c:79731:85: note: in expansion of macro '__NR_compat_pkey_free'
       if ((((l->l___nr) != ((((int64_t) (/* pure */ /* unprivileged */ /* stable */ __NR_compat_pkey_free))))))) {
                                                                                     ^~~~~~~~~~~~~~~~~~~~~
/tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.c: In function 'probe_7230':
/home/root/systemtap/20181030/packages/share/systemtap/runtime/linux/compat_unistd.h:1923:35: error: '__NR_pkey_mprotect' undeclared (first use in this function); did you mean 'pudp_set_wrprotect'?
 #define __NR_compat_pkey_mprotect __NR_pkey_mprotect
                                   ^~~~~~~~~~~~~~~~~~
/tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.c:79864:85: note: in expansion of macro '__NR_compat_pkey_mprotect'
       if ((((l->l___nr) != ((((int64_t) (/* pure */ /* unprivileged */ /* stable */ __NR_compat_pkey_mprotect))))))) {
                                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.c: In function 'probe_8761':
/home/root/systemtap/20181030/packages/share/systemtap/runtime/linux/compat_unistd.h:1921:33: error: '__NR_pkey_alloc' undeclared (first use in this function); did you mean '__pte_alloc'?
 #define __NR_compat_pkey_alloc  __NR_pkey_alloc
                                 ^~~~~~~~~~~~~~~
/tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.c:122651:85: note: in expansion of macro '__NR_compat_pkey_alloc'
       if ((((l->l___nr) != ((((int64_t) (/* pure */ /* unprivileged */ /* stable */ __NR_compat_pkey_alloc))))))) {
                                                                                     ^~~~~~~~~~~~~~~~~~~~~~
/tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.c: In function 'probe_8766':
/home/root/systemtap/20181030/packages/share/systemtap/runtime/linux/compat_unistd.h:1922:32: error: '__NR_pkey_free' undeclared (first use in this function); did you mean '__stp_get_freq'?
 #define __NR_compat_pkey_free  __NR_pkey_free
                                ^~~~~~~~~~~~~~
/tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.c:122752:85: note: in expansion of macro '__NR_compat_pkey_free'
       if ((((l->l___nr) != ((((int64_t) (/* pure */ /* unprivileged */ /* stable */ __NR_compat_pkey_free))))))) {
                                                                                     ^~~~~~~~~~~~~~~~~~~~~
/tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.c: In function 'probe_8771':
/home/root/systemtap/20181030/packages/share/systemtap/runtime/linux/compat_unistd.h:1923:35: error: '__NR_pkey_mprotect' undeclared (first use in this function); did you mean 'pudp_set_wrprotect'?
 #define __NR_compat_pkey_mprotect __NR_pkey_mprotect
                                   ^~~~~~~~~~~~~~~~~~
/tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.c:122853:85: note: in expansion of macro '__NR_compat_pkey_mprotect'
       if ((((l->l___nr) != ((((int64_t) (/* pure */ /* unprivileged */ /* stable */ __NR_compat_pkey_mprotect))))))) {
                                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [scripts/Makefile.build:328: /tmp/stapSrqSJF/stap_5d936e2fa4c3279e32799d9e5510d43d_974050_src.o] Error 1
make: *** [Makefile:1525: _module_/tmp/stapSrqSJF] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compiled C into "stap_5d936e2fa4c3279e32799d9e5510d43d_974050.ko" in 112140usr/4170sys/114904real ms.
Pass 4: compilation failed.  [man error::pass4]

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

diff --git a/runtime/linux/compat_unistd.h b/runtime/linux/compat_unistd.h
index 6f7e8adec..13f98a424 100644
--- a/runtime/linux/compat_unistd.h
+++ b/runtime/linux/compat_unistd.h
@@ -364,6 +364,15 @@
 #ifndef __NR_utime
 #define __NR_utime (__NR_syscall_max + 1)
 #endif
+#ifndef __NR_pkey_alloc
+#define __NR_pkey_alloc (__NR_syscall_max + 1)
+#endif
+#ifndef __NR_pkey_free
+#define __NR_pkey_free (__NR_syscall_max + 1)
+#endif
+#ifndef __NR_pkey_mprotect
+#define __NR_pkey_mprotect (__NR_syscall_max + 1)
+#endif
 
 #if defined(__x86_64__)
 
-- 
2.18.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]