Skip to content

Commit c66095f

Browse files
committed
api: Remove deprecated FD-tracking actions from KprobeAction enum
The FollowFD, UnfollowFD, and CopyFD actions (values 2, 4, and 6) were deprecated and have been removed from the API and BPF implementation. Updated proto definitions, generated code, documentation, and removed all related BPF map structures and helper functions. Signed-off-by: ariosmon <ariosmon@cisco.com>
1 parent 031ee31 commit c66095f

File tree

45 files changed

+798
-3025
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+798
-3025
lines changed

api/v1/README.md

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1/tetragon/tetragon.pb.go

Lines changed: 61 additions & 74 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1/tetragon/tetragon.proto

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -496,17 +496,13 @@ enum KprobeAction {
496496
KPROBE_ACTION_UNKNOWN = 0;
497497
// Post action creates an event (default action).
498498
KPROBE_ACTION_POST = 1;
499-
// Post action creates a mapping between file descriptors and file names.
500-
KPROBE_ACTION_FOLLOWFD = 2;
499+
// Reserve deprecated FD-tracking actions removed in v1.5
500+
reserved 2, 4, 6;
501+
reserved "KPROBE_ACTION_FOLLOWFD", "KPROBE_ACTION_UNFOLLOWFD", "KPROBE_ACTION_COPYFD";
501502
// Sigkill action synchronously terminates the process.
502503
KPROBE_ACTION_SIGKILL = 3;
503-
// Post action removes a mapping between file descriptors and file names.
504-
KPROBE_ACTION_UNFOLLOWFD = 4;
505504
// Override action modifies the return value of the call.
506505
KPROBE_ACTION_OVERRIDE = 5;
507-
// Post action dupplicates a mapping between file descriptors and file
508-
// names.
509-
KPROBE_ACTION_COPYFD = 6;
510506
// GetURL action issue an HTTP Get request against an URL from userspace.
511507
KPROBE_ACTION_GETURL = 7;
512508
// GetURL action issue a DNS lookup against an URL from userspace.

bpf/process/generic_calls.h

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -250,37 +250,10 @@ __read_arg_1(void *ctx, int type, long orig_off, unsigned long arg, int argm, ch
250250
size = copy_iov_iter(ctx, orig_off, arg, argm, e);
251251
break;
252252
case fd_ty: {
253-
struct fdinstall_key key = { 0 };
254-
struct fdinstall_value *val;
255-
__u32 fd;
256-
257-
key.tid = get_current_pid_tgid() >> 32;
258-
probe_read(&fd, sizeof(__u32), &arg);
259-
key.fd = fd;
260-
261-
val = map_lookup_elem(&fdinstall_map, &key);
262-
if (val) {
263-
__u32 bytes = *((__u32 *)&val->file[0]);
264-
265-
probe_read(&args[0], sizeof(__u32), &fd);
266-
asm volatile("%[bytes] &= 0xfff;\n"
267-
: [bytes] "+r"(bytes)
268-
:);
269-
probe_read(&args[4], bytes + 4, (char *)&val->file[0]);
270-
size = bytes + 4 + 4;
271-
272-
// flags
273-
probe_read(&args[size], 4,
274-
(char *)&val->file[size - 4]);
275-
size += 4;
276-
} else {
277-
/* If filter specification is fd type then we
278-
* expect the fd has been previously followed
279-
* otherwise drop the event.
280-
*/
281-
return -1;
282-
}
283-
} break;
253+
/* Legacy FD-tracking functionality removed */
254+
size = 0;
255+
break;
256+
}
284257
case filename_ty: {
285258
struct filename *file;
286259

@@ -907,8 +880,6 @@ do_action(void *ctx, __u32 i, struct selector_action *actions, bool *post, bool
907880
int action = actions->act[i];
908881
struct msg_generic_kprobe *e;
909882
__s32 error __maybe_unused;
910-
int fdi, namei;
911-
int newfdi, oldfdi;
912883
int socki;
913884
int argi __maybe_unused;
914885
int err = 0;
@@ -960,17 +931,6 @@ do_action(void *ctx, __u32 i, struct selector_action *actions, bool *post, bool
960931
break;
961932
}
962933

963-
case ACTION_UNFOLLOWFD:
964-
case ACTION_FOLLOWFD:
965-
fdi = actions->act[++i];
966-
namei = actions->act[++i];
967-
err = installfd(e, fdi, namei, action == ACTION_FOLLOWFD);
968-
break;
969-
case ACTION_COPYFD:
970-
oldfdi = actions->act[++i];
971-
newfdi = actions->act[++i];
972-
err = copyfd(e, oldfdi, newfdi);
973-
break;
974934
case ACTION_SIGNAL:
975935
signal = actions->act[++i];
976936
fallthrough;

bpf/process/heap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct {
2222

2323
struct heap_value {
2424
union {
25-
char fdinstall[4104]; /* 4096B paths + 4B length + 4B flags */
25+
char _unused[1];
2626
};
2727
};
2828

0 commit comments

Comments
 (0)