aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-trace.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 6485576f3337..0c8bcb94934e 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -40,6 +40,10 @@
40#include <sys/mman.h> 40#include <sys/mman.h>
41#include <linux/futex.h> 41#include <linux/futex.h>
42#include <linux/err.h> 42#include <linux/err.h>
43#include <linux/seccomp.h>
44#include <linux/filter.h>
45#include <linux/audit.h>
46#include <sys/ptrace.h>
43 47
44/* For older distros: */ 48/* For older distros: */
45#ifndef MAP_STACK 49#ifndef MAP_STACK
@@ -1001,6 +1005,46 @@ static const char *tioctls[] = {
1001static DEFINE_STRARRAY_OFFSET(tioctls, 0x5401); 1005static DEFINE_STRARRAY_OFFSET(tioctls, 0x5401);
1002#endif /* defined(__i386__) || defined(__x86_64__) */ 1006#endif /* defined(__i386__) || defined(__x86_64__) */
1003 1007
1008static size_t syscall_arg__scnprintf_seccomp_op(char *bf, size_t size, struct syscall_arg *arg)
1009{
1010 int op = arg->val;
1011 size_t printed = 0;
1012
1013 switch (op) {
1014#define P_SECCOMP_SET_MODE_OP(n) case SECCOMP_SET_MODE_##n: printed = scnprintf(bf, size, #n); break
1015 P_SECCOMP_SET_MODE_OP(STRICT);
1016 P_SECCOMP_SET_MODE_OP(FILTER);
1017#undef P_SECCOMP_SET_MODE_OP
1018 default: printed = scnprintf(bf, size, "%#x", op); break;
1019 }
1020
1021 return printed;
1022}
1023
1024#define SCA_SECCOMP_OP syscall_arg__scnprintf_seccomp_op
1025
1026static size_t syscall_arg__scnprintf_seccomp_flags(char *bf, size_t size,
1027 struct syscall_arg *arg)
1028{
1029 int printed = 0, flags = arg->val;
1030
1031#define P_FLAG(n) \
1032 if (flags & SECCOMP_FILTER_FLAG_##n) { \
1033 printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
1034 flags &= ~SECCOMP_FILTER_FLAG_##n; \
1035 }
1036
1037 P_FLAG(TSYNC);
1038#undef P_FLAG
1039
1040 if (flags)
1041 printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags);
1042
1043 return printed;
1044}
1045
1046#define SCA_SECCOMP_FLAGS syscall_arg__scnprintf_seccomp_flags
1047
1004#define STRARRAY(arg, name, array) \ 1048#define STRARRAY(arg, name, array) \
1005 .arg_scnprintf = { [arg] = SCA_STRARRAY, }, \ 1049 .arg_scnprintf = { [arg] = SCA_STRARRAY, }, \
1006 .arg_parm = { [arg] = &strarray__##array, } 1050 .arg_parm = { [arg] = &strarray__##array, }
@@ -1234,6 +1278,9 @@ static struct syscall_fmt {
1234 .arg_scnprintf = { [1] = SCA_SIGNUM, /* sig */ }, }, 1278 .arg_scnprintf = { [1] = SCA_SIGNUM, /* sig */ }, },
1235 { .name = "rt_tgsigqueueinfo", .errmsg = true, 1279 { .name = "rt_tgsigqueueinfo", .errmsg = true,
1236 .arg_scnprintf = { [2] = SCA_SIGNUM, /* sig */ }, }, 1280 .arg_scnprintf = { [2] = SCA_SIGNUM, /* sig */ }, },
1281 { .name = "seccomp", .errmsg = true,
1282 .arg_scnprintf = { [0] = SCA_SECCOMP_OP, /* op */
1283 [1] = SCA_SECCOMP_FLAGS, /* flags */ }, },
1237 { .name = "select", .errmsg = true, .timeout = true, }, 1284 { .name = "select", .errmsg = true, .timeout = true, },
1238 { .name = "sendmmsg", .errmsg = true, 1285 { .name = "sendmmsg", .errmsg = true,
1239 .arg_scnprintf = { [0] = SCA_FD, /* fd */ 1286 .arg_scnprintf = { [0] = SCA_FD, /* fd */