Skip to content

Commit 8a92661

Browse files
committed
.
1 parent 39ca5b5 commit 8a92661

6 files changed

Lines changed: 26 additions & 2 deletions

File tree

support/ebpf/tracemgmt.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ static inline EBPF_INLINE bool pid_information_exists(int pid)
9898
#define RATELIMIT_ACTION_DEFAULT 1
9999
// Set PID to fast timer mode
100100
#define RATELIMIT_ACTION_FAST 2
101+
// Skip rate limiting
102+
#define RATELIMIT_ACTION_NONE 3
101103

102104
// pid_event_ratelimit determines if the PID event should be inhibited or not
103105
// based on rate limiting rules.
@@ -111,7 +113,7 @@ static inline EBPF_INLINE bool pid_event_ratelimit(u32 pid, int ratelimit_action
111113
u8 attempt = 0;
112114
u8 fast_timer = (ratelimit_action == RATELIMIT_ACTION_FAST) ? fast_timer_flag : 0;
113115

114-
if (ratelimit_action == RATELIMIT_ACTION_RESET) {
116+
if (ratelimit_action == RATELIMIT_ACTION_RESET || ratelimit_action == RATELIMIT_ACTION_NONE) {
115117
return false;
116118
}
117119

support/ebpf/tracer.ebpf.amd64

4.98 KB
Binary file not shown.

support/ebpf/tracer.ebpf.arm64

5.25 KB
Binary file not shown.

support/ebpf/types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ enum {
351351
// number of failures to read Go custom labels
352352
metricID_UnwindGoLabelsFailures,
353353

354+
// number of times dlopen uprobe was fired
355+
metricID_DlopenUprobeHits,
356+
354357
//
355358
// Metric IDs above are for counters (cumulative values)
356359
//

support/ebpf/uprobe.ebpf.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,22 @@ int uprobe__generic(void *ctx)
1818

1919
return collect_trace(ctx, TRACE_UPROBE, pid, tid, ts, 0, 0);
2020
}
21+
22+
SEC("uprobe/dlopen")
23+
int uprobe_dlopen(struct pt_regs *ctx)
24+
{
25+
u64 pid_tgid = bpf_get_current_pid_tgid();
26+
u32 pid = pid_tgid >> 32;
27+
u32 tid = pid_tgid & 0xFFFFFFFF;
28+
29+
DEBUG_PRINT("uprobe_dlopen fired: PID=%u TID=%u", pid, tid);
30+
31+
// Increment the metric for dlopen uprobe hits
32+
increment_metric(metricID_DlopenUprobeHits);
33+
34+
if (report_pid(ctx, pid_tgid, RATELIMIT_ACTION_NONE)) {
35+
DEBUG_PRINT("Reported PID %u from uprobe_dlopen", pid);
36+
}
37+
38+
return 0;
39+
}

support/types.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)