Skip to content

Commit 2783b8a

Browse files
committed
cleanup: rename some methods/maps
Signed-off-by: Andrea Terzolo <[email protected]>
1 parent 07e5ada commit 2783b8a

File tree

12 files changed

+39
-44
lines changed

12 files changed

+39
-44
lines changed

driver/modern_bpf/maps/maps.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,17 @@ struct {
117117
} syscall_exit_tail_table __weak SEC(".maps");
118118

119119
/**
120-
* @brief This tail table is used when a bpf program needs another program
121-
* to complete its execution flow. This table could be used both by
122-
* programs directly attached in the kernel (like page_faults,
123-
* context_switch, ...) and by syscall_events (like
124-
* ppme_syscall_execveat_x, ...).
125-
* Given a predefined tail-code (`extra_syscall_codes`), it calls
120+
* @brief This tail table is used when a sys exit bpf program needs another program
121+
* to complete its execution flow.
122+
* Given a predefined tail-code (`sys_exit_extra_code`), it calls
126123
* the right bpf program.
127124
*/
128125
struct {
129126
__uint(type, BPF_MAP_TYPE_PROG_ARRAY);
130-
__uint(max_entries, TAIL_EXTRA_EVENT_PROG_MAX);
127+
__uint(max_entries, SYS_EXIT_EXTRA_CODE_MAX);
131128
__type(key, uint32_t);
132129
__type(value, uint32_t);
133-
} extra_syscall_calls __weak SEC(".maps");
130+
} syscall_exit_extra_tail_table __weak SEC(".maps");
134131

135132
/*=============================== BPF_MAP_TYPE_PROG_ARRAY ===============================*/
136133

driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/clone.bpf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ int BPF_PROG(clone_x, struct pt_regs *regs, long ret) {
150150
/* We have to split here the bpf program, otherwise, it is too large
151151
* for the verifier (limit 1000000 instructions).
152152
*/
153-
bpf_tail_call(ctx, &extra_syscall_calls, T1_CLONE_X);
153+
bpf_tail_call(ctx, &syscall_exit_extra_tail_table, T1_CLONE_X);
154154
return 0;
155155
}
156156

@@ -206,7 +206,7 @@ int BPF_PROG(t1_clone_x, struct pt_regs *regs, long ret) {
206206
/* We have to split here the bpf program, otherwise, it is too large
207207
* for the verifier (limit 1000000 instructions).
208208
*/
209-
bpf_tail_call(ctx, &extra_syscall_calls, T2_CLONE_X);
209+
bpf_tail_call(ctx, &syscall_exit_extra_tail_table, T2_CLONE_X);
210210
return 0;
211211
}
212212

driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/clone3.bpf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ int BPF_PROG(clone3_x, struct pt_regs *regs, long ret) {
150150
/* We have to split here the bpf program, otherwise, it is too large
151151
* for the verifier (limit 1000000 instructions).
152152
*/
153-
bpf_tail_call(ctx, &extra_syscall_calls, T1_CLONE3_X);
153+
bpf_tail_call(ctx, &syscall_exit_extra_tail_table, T1_CLONE3_X);
154154
return 0;
155155
}
156156

@@ -204,7 +204,7 @@ int BPF_PROG(t1_clone3_x, struct pt_regs *regs, long ret) {
204204
/* We have to split here the bpf program, otherwise, it is too large
205205
* for the verifier (limit 1000000 instructions).
206206
*/
207-
bpf_tail_call(ctx, &extra_syscall_calls, T2_CLONE3_X);
207+
bpf_tail_call(ctx, &syscall_exit_extra_tail_table, T2_CLONE3_X);
208208
return 0;
209209
}
210210

driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/execve.bpf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ int BPF_PROG(execve_x, struct pt_regs *regs, long ret) {
155155
/* We have to split here the bpf program, otherwise, it is too large
156156
* for the verifier (limit 1000000 instructions).
157157
*/
158-
bpf_tail_call(ctx, &extra_syscall_calls, T1_EXECVE_X);
158+
bpf_tail_call(ctx, &syscall_exit_extra_tail_table, T1_EXECVE_X);
159159
return 0;
160160
}
161161

@@ -284,7 +284,7 @@ int BPF_PROG(t1_execve_x, struct pt_regs *regs, long ret) {
284284

285285
/*=============================== COLLECT PARAMETERS ===========================*/
286286

287-
bpf_tail_call(ctx, &extra_syscall_calls, T2_EXECVE_X);
287+
bpf_tail_call(ctx, &syscall_exit_extra_tail_table, T2_EXECVE_X);
288288
return 0;
289289
}
290290

driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/execveat.bpf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ int BPF_PROG(execveat_x, struct pt_regs *regs, long ret) {
168168
/* We have to split here the bpf program, otherwise it is too large
169169
* for the verifier (limit 1000000 instructions).
170170
*/
171-
bpf_tail_call(ctx, &extra_syscall_calls, T1_EXECVEAT_X);
171+
bpf_tail_call(ctx, &syscall_exit_extra_tail_table, T1_EXECVEAT_X);
172172
return 0;
173173
}
174174

@@ -296,7 +296,7 @@ int BPF_PROG(t1_execveat_x, struct pt_regs *regs, long ret) {
296296

297297
/*=============================== COLLECT PARAMETERS ===========================*/
298298

299-
bpf_tail_call(ctx, &extra_syscall_calls, T2_EXECVEAT_X);
299+
bpf_tail_call(ctx, &syscall_exit_extra_tail_table, T2_EXECVEAT_X);
300300
return 0;
301301
}
302302

driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/fork.bpf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ int BPF_PROG(fork_x, struct pt_regs *regs, long ret) {
152152
/* We have to split here the bpf program, otherwise, it is too large
153153
* for the verifier (limit 1000000 instructions).
154154
*/
155-
bpf_tail_call(ctx, &extra_syscall_calls, T1_FORK_X);
155+
bpf_tail_call(ctx, &syscall_exit_extra_tail_table, T1_FORK_X);
156156
return 0;
157157
}
158158

@@ -198,7 +198,7 @@ int BPF_PROG(t1_fork_x, struct pt_regs *regs, long ret) {
198198
/* We have to split here the bpf program, otherwise, it is too large
199199
* for the verifier (limit 1000000 instructions).
200200
*/
201-
bpf_tail_call(ctx, &extra_syscall_calls, T2_FORK_X);
201+
bpf_tail_call(ctx, &syscall_exit_extra_tail_table, T2_FORK_X);
202202
return 0;
203203
}
204204

driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/open_by_handle_at.bpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ int BPF_PROG(open_by_handle_at_x, struct pt_regs *regs, long ret) {
6060

6161
/*=============================== COLLECT PARAMETERS ===========================*/
6262

63-
bpf_tail_call(ctx, &extra_syscall_calls, T1_OPEN_BY_HANDLE_AT_X);
63+
bpf_tail_call(ctx, &syscall_exit_extra_tail_table, T1_OPEN_BY_HANDLE_AT_X);
6464
return 0;
6565
}
6666

driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/vfork.bpf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ int BPF_PROG(vfork_x, struct pt_regs *regs, long ret) {
150150
/* We have to split here the bpf program, otherwise, it is too large
151151
* for the verifier (limit 1000000 instructions).
152152
*/
153-
bpf_tail_call(ctx, &extra_syscall_calls, T1_VFORK_X);
153+
bpf_tail_call(ctx, &syscall_exit_extra_tail_table, T1_VFORK_X);
154154
return 0;
155155
}
156156

@@ -196,7 +196,7 @@ int BPF_PROG(t1_vfork_x, struct pt_regs *regs, long ret) {
196196
/* We have to split here the bpf program, otherwise, it is too large
197197
* for the verifier (limit 1000000 instructions).
198198
*/
199-
bpf_tail_call(ctx, &extra_syscall_calls, T2_VFORK_X);
199+
bpf_tail_call(ctx, &syscall_exit_extra_tail_table, T2_VFORK_X);
200200
return 0;
201201
}
202202

driver/ppm_events_public.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,11 +1521,9 @@ typedef enum {
15211521
* "Tx_" stands for "extra tail call number x for the event after '_'".
15221522
* For example "T1_EXECVE_X" stands for:
15231523
* - `T1` = extra tail call number 1.
1524-
* - `EXECVE` = name of the syscall for which we need an extra tail call.
1525-
* - `X` = means that we need this extra tail call for the exit event, `E` means enter the event.
1526-
*
1524+
* - `EXECVE_X` = name of the syscall for which we need an extra tail call.
15271525
*/
1528-
enum extra_syscall_codes {
1526+
enum sys_exit_extra_code {
15291527
T1_EXECVE_X,
15301528
T1_EXECVEAT_X,
15311529
T1_CLONE_X,
@@ -1540,7 +1538,7 @@ enum extra_syscall_codes {
15401538
T2_EXECVE_X,
15411539
T2_EXECVEAT_X,
15421540
// Add new codes here...
1543-
TAIL_EXTRA_EVENT_PROG_MAX,
1541+
SYS_EXIT_EXTRA_CODE_MAX,
15441542
};
15451543

15461544
/*

userspace/libpman/include/libpman.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,19 +396,18 @@ uint64_t pman_get_probe_api_ver(void);
396396
uint64_t pman_get_probe_schema_ver(void);
397397

398398
/**
399-
* @brief Some bpf programs exceed the maximum complexity
399+
* @brief Some sys exit bpf programs exceed the maximum complexity
400400
* so they have to tail-call other programs. To do that, they
401-
* need a particular tail table that we call `extra_syscall_calls`.
401+
* need a particular tail table that we call `syscall_exit_extra_tail_table`.
402402
*
403-
* -> EXTRA EVENT PROG TAIL TABLE
404-
* extra_syscall_calls(extra_syscall_codes, program_fd).
403+
* syscall_exit_extra_tail_table(sys_exit_extra_code, program_fd).
405404
*
406-
* `extra_syscall_codes` is an enum defined in
405+
* `sys_exit_extra_code` is an enum defined in
407406
* `/driver/ppm_events_public.h`
408407
*
409408
* @return `0` on success, `errno` in case of error.
410409
*/
411-
int pman_fill_extra_syscall_calls_table(void);
410+
int pman_fill_syscall_exit_extra_tail_table(void);
412411

413412
/**
414413
* @brief The syscall dispatchers will look into these tables

0 commit comments

Comments
 (0)