File perf-augmented_raw_syscalls-rename-augmented_args_filename-to-augmented_args_payload.patch of Package perf
xxxxxxxxxx
1
From: Arnaldo Carvalho de Melo <acme@redhat.com>
2
Date: Tue, 16 Jul 2019 15:33:20 -0300
3
Subject: perf augmented_raw_syscalls: Rename augmented_args_filename to
4
augmented_args_payload
5
MIME-Version: 1.0
6
Content-Type: text/plain; charset=UTF-8
7
Content-Transfer-Encoding: 8bit
8
Git-commit: 6f563674935e6dc9e2190ce798c1917f51af6eed
9
Patch-mainline: v5.4-rc1
10
References: jsc#SLE-13661
11
12
It'll get other stuff in there than just filenames, starting with
13
sockaddr for 'connect' and 'bind'.
14
15
Cc: Adrian Hunter <adrian.hunter@intel.com>
16
Cc: Jiri Olsa <jolsa@kernel.org>
17
Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
18
Cc: Namhyung Kim <namhyung@kernel.org>
19
Link: https://lkml.kernel.org/n/tip-bsexidtsn91ehdpzcd6n5fm9@git.kernel.org
20
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
21
Signed-off-by: Tony Jones <tonyj@suse.de>
22
---
23
tools/perf/examples/bpf/augmented_raw_syscalls.c | 22 ++++++++++++----------
24
1 file changed, 12 insertions(+), 10 deletions(-)
25
26
diff --git a/tools/perf/examples/bpf/augmented_raw_syscalls.c b/tools/perf/examples/bpf/augmented_raw_syscalls.c
27
index df52d92e1c69..77bb6a0edce3 100644
28
--- a/tools/perf/examples/bpf/augmented_raw_syscalls.c
29
+++ b/tools/perf/examples/bpf/augmented_raw_syscalls.c
30
31
32
pid_filter(pids_filtered);
33
34
-struct augmented_args_filename {
35
+struct augmented_args_payload {
36
struct syscall_enter_args args;
37
- struct augmented_filename filename;
38
- struct augmented_filename filename2;
39
+ struct {
40
+ struct augmented_filename filename;
41
+ struct augmented_filename filename2;
42
+ };
43
};
44
45
-bpf_map(augmented_filename_map, PERCPU_ARRAY, int, struct augmented_args_filename, 1);
46
+bpf_map(augmented_args_tmp, PERCPU_ARRAY, int, struct augmented_args_payload, 1);
47
48
static inline
49
unsigned int augmented_filename__read(struct augmented_filename *augmented_filename,
50
51
52
/*
53
* This will be tail_called from SEC("raw_syscalls:sys_enter"), so will find in
54
- * augmented_filename_map what was read by that raw_syscalls:sys_enter and go
55
+ * augmented_args_tmp what was read by that raw_syscalls:sys_enter and go
56
* on from there, reading the first syscall arg as a string, i.e. open's
57
* filename.
58
*/
59
60
int sys_enter_open(struct syscall_enter_args *args)
61
{
62
int key = 0;
63
- struct augmented_args_filename *augmented_args = bpf_map_lookup_elem(&augmented_filename_map, &key);
64
+ struct augmented_args_payload *augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key);
65
const void *filename_arg = (const void *)args->args[0];
66
unsigned int len = sizeof(augmented_args->args);
67
68
69
int sys_enter_openat(struct syscall_enter_args *args)
70
{
71
int key = 0;
72
- struct augmented_args_filename *augmented_args = bpf_map_lookup_elem(&augmented_filename_map, &key);
73
+ struct augmented_args_payload *augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key);
74
const void *filename_arg = (const void *)args->args[1];
75
unsigned int len = sizeof(augmented_args->args);
76
77
78
int sys_enter_renameat(struct syscall_enter_args *args)
79
{
80
int key = 0;
81
- struct augmented_args_filename *augmented_args = bpf_map_lookup_elem(&augmented_filename_map, &key);
82
+ struct augmented_args_payload *augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key);
83
const void *oldpath_arg = (const void *)args->args[1],
84
*newpath_arg = (const void *)args->args[3];
85
unsigned int len = sizeof(augmented_args->args), oldpath_len;
86
87
SEC("raw_syscalls:sys_enter")
88
int sys_enter(struct syscall_enter_args *args)
89
{
90
- struct augmented_args_filename *augmented_args;
91
+ struct augmented_args_payload *augmented_args;
92
/*
93
* We start len, the amount of data that will be in the perf ring
94
* buffer, if this is not filtered out by one of pid_filter__has(),
95
96
struct syscall *syscall;
97
int key = 0;
98
99
- augmented_args = bpf_map_lookup_elem(&augmented_filename_map, &key);
100
+ augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key);
101
if (augmented_args == NULL)
102
return 1;
103
104
105