Em Thu, Jun 06, 2019 at 05:48:44PM +0800, Leo Yan escreveu: > This patch adds support for arm64 raw syscall numbers so that we can use > it on arm64 platform. > > After applied this patch, we need to specify macro -D__aarch64__ or > -D__x86_64__ in compilation option so Clang can use the corresponding > syscall numbers for arm64 or x86_64 respectively, other architectures > will report failure when compilation. So, please check what I have in my perf/core branch, I've completely removed arch specific stuff from augmented_raw_syscalls.c. What is done now is use a map to specify what to copy, that same map that is used to state which syscalls should be traced. It uses that tools/perf/arch/arm64/entry/syscalls/mksyscalltbl to figure out the mapping of syscall names to ids, just like is done for x86_64 and other arches, falling back to audit-libs when that syscalltbl thing is not present. - Arnaldo > Signed-off-by: Leo Yan <leo.yan@xxxxxxxxxx> > --- > .../examples/bpf/augmented_raw_syscalls.c | 81 +++++++++++++++++++ > 1 file changed, 81 insertions(+) > > diff --git a/tools/perf/examples/bpf/augmented_raw_syscalls.c b/tools/perf/examples/bpf/augmented_raw_syscalls.c > index 5c4a4e715ae6..a3701a4daf2e 100644 > --- a/tools/perf/examples/bpf/augmented_raw_syscalls.c > +++ b/tools/perf/examples/bpf/augmented_raw_syscalls.c > @@ -45,6 +45,83 @@ struct augmented_filename { > char value[PATH_MAX]; > }; > > +#if defined(__aarch64__) > + > +/* syscalls where the first arg is a string */ > +#define SYS_OPEN 1024 > +#define SYS_STAT 1038 > +#define SYS_LSTAT 1039 > +#define SYS_ACCESS 1033 > +#define SYS_EXECVE 221 > +#define SYS_TRUNCATE 45 > +#define SYS_CHDIR 49 > +#define SYS_RENAME 1034 > +#define SYS_MKDIR 1030 > +#define SYS_RMDIR 1031 > +#define SYS_CREAT 1064 > +#define SYS_LINK 1025 > +#define SYS_UNLINK 1026 > +#define SYS_SYMLINK 1036 > +#define SYS_READLINK 1035 > +#define SYS_CHMOD 1028 > +#define SYS_CHOWN 1029 > +#define SYS_LCHOWN 1032 > +#define SYS_MKNOD 1027 > +#define SYS_STATFS 1056 > +#define SYS_PIVOT_ROOT 41 > +#define SYS_CHROOT 51 > +#define SYS_ACCT 89 > +#define SYS_SWAPON 224 > +#define SYS_SWAPOFF 225 > +#define SYS_DELETE_MODULE 106 > +#define SYS_SETXATTR 5 > +#define SYS_LSETXATTR 6 > +#define SYS_GETXATTR 8 > +#define SYS_LGETXATTR 9 > +#define SYS_LISTXATTR 11 > +#define SYS_LLISTXATTR 12 > +#define SYS_REMOVEXATTR 14 > +#define SYS_LREMOVEXATTR 15 > +#define SYS_MQ_OPEN 180 > +#define SYS_MQ_UNLINK 181 > +#define SYS_ADD_KEY 217 > +#define SYS_REQUEST_KEY 218 > +#define SYS_SYMLINKAT 36 > +#define SYS_MEMFD_CREATE 279 > + > +/* syscalls where the second arg is a string */ > +#define SYS_PWRITE64 68 > +#define SYS_RENAME 1034 > +#define SYS_QUOTACTL 60 > +#define SYS_FSETXATTR 7 > +#define SYS_FGETXATTR 10 > +#define SYS_FREMOVEXATTR 16 > +#define SYS_MQ_TIMEDSEND 182 > +#define SYS_REQUEST_KEY 218 > +#define SYS_INOTIFY_ADD_WATCH 27 > +#define SYS_OPENAT 56 > +#define SYS_MKDIRAT 34 > +#define SYS_MKNODAT 33 > +#define SYS_FCHOWNAT 54 > +#define SYS_FUTIMESAT 1066 > +#define SYS_NEWFSTATAT 1054 > +#define SYS_UNLINKAT 35 > +#define SYS_RENAMEAT 38 > +#define SYS_LINKAT 37 > +#define SYS_READLINKAT 78 > +#define SYS_FCHMODAT 53 > +#define SYS_FACCESSAT 48 > +#define SYS_UTIMENSAT 88 > +#define SYS_NAME_TO_HANDLE_AT 264 > +#define SYS_FINIT_MODULE 273 > +#define SYS_RENAMEAT2 276 > +#define SYS_EXECVEAT 281 > +#define SYS_STATX 291 > +#define SYS_MOVE_MOUNT 429 > +#define SYS_FSPICK 433 > + > +#elif defined(__x86_64__) > + > /* syscalls where the first arg is a string */ > #define SYS_OPEN 2 > #define SYS_STAT 4 > @@ -119,6 +196,10 @@ struct augmented_filename { > #define SYS_MOVE_MOUNT 429 > #define SYS_FSPICK 433 > > +#else > +#error "unsupported architecture" > +#endif > + > pid_filter(pids_filtered); > > struct augmented_args_filename { > -- > 2.17.1 -- - Arnaldo