Skip to content

Commit

Permalink
Backport 1305 (#1366)
Browse files Browse the repository at this point in the history
  • Loading branch information
grcevski authored Nov 18, 2024
1 parent 6141fa6 commit 9791155
Show file tree
Hide file tree
Showing 66 changed files with 6 additions and 32 deletions.
24 changes: 6 additions & 18 deletions bpf/nodejs.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ volatile const s32 async_wrap_trigger_async_id_off = 0;

struct {
__uint(type, BPF_MAP_TYPE_LRU_HASH);
__type(key, u64); // the pid_tid
__type(value, u64); // the last AsyncWrap *
__type(key, u64); // the pid_tid
__type(value, u64); // the last AsyncWrap *
__uint(max_entries, 1000); // 1000 nodejs services, small number, nodejs is single threaded
__uint(pinning, LIBBPF_PIN_BY_NAME);
} async_reset_args SEC(".maps");
Expand All @@ -34,20 +34,6 @@ int async_reset(struct pt_regs *ctx) {
return 0;
}

SEC("uretprobe/node:AsyncReset")
int async_reset_ret(struct pt_regs *ctx) {
u64 id = bpf_get_current_pid_tgid();

if (!valid_pid(id)) {
return 0;
}

bpf_dbg_printk("=== uprobe AsyncReset returns id=%d ===", id);
bpf_map_delete_elem(&async_reset_args, &id);

return 0;
}

SEC("uprobe/node:EmitAsyncInit")
int emit_async_init(struct pt_regs *ctx) {
u64 id = bpf_get_current_pid_tgid();
Expand All @@ -69,13 +55,15 @@ int emit_async_init(struct pt_regs *ctx) {
u64 trigger_async_id = 0;

bpf_probe_read_user(&async_id, sizeof(u64), ((void *)wrap) + async_wrap_async_id_off);
bpf_probe_read_user(&trigger_async_id, sizeof(u64), ((void *)wrap) + async_wrap_trigger_async_id_off);
bpf_probe_read_user(
&trigger_async_id, sizeof(u64), ((void *)wrap) + async_wrap_trigger_async_id_off);

if (async_id) {
bpf_map_update_elem(&active_nodejs_ids, &id, &async_id, BPF_ANY);
if (trigger_async_id) {
bpf_map_update_elem(&nodejs_parent_map, &async_id, &trigger_async_id, BPF_ANY);
bpf_dbg_printk("async_id = %llx, trigger_async_id = %llx", async_id, trigger_async_id);
bpf_dbg_printk(
"async_id = %llx, trigger_async_id = %llx", async_id, trigger_async_id);
} else {
bpf_dbg_printk("No trigger async id");
}
Expand Down
Binary file modified pkg/internal/ebpf/goredis/bpf_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/goredis/bpf_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/goredis/bpf_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/goredis/bpf_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/goruntime/bpf_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/goruntime/bpf_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/goruntime/bpf_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/goruntime/bpf_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/grpc/bpf_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/grpc/bpf_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/grpc/bpf_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/grpc/bpf_tp_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/grpc/bpf_tp_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/grpc/bpf_tp_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/grpc/bpf_tp_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/grpc/bpf_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpfltr/bpf_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpfltr/bpf_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpfltr/bpf_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpfltr/bpf_tp_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpfltr/bpf_tp_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpfltr/bpf_tp_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpfltr/bpf_tp_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpfltr/bpf_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpssl/bpf_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpssl/bpf_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpssl/bpf_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpssl/bpf_tp_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpssl/bpf_tp_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpssl/bpf_tp_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpssl/bpf_tp_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/httpssl/bpf_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/kafkago/bpf_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/kafkago/bpf_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/kafkago/bpf_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/kafkago/bpf_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/nethttp/bpf_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/nethttp/bpf_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/nethttp/bpf_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/nethttp/bpf_tp_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/nethttp/bpf_tp_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/nethttp/bpf_tp_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/nethttp/bpf_tp_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/nethttp/bpf_x86_bpfel.o
Binary file not shown.
3 changes: 0 additions & 3 deletions pkg/internal/ebpf/nodejs/bpf_arm64_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/nodejs/bpf_arm64_bpfel.o
Binary file not shown.
3 changes: 0 additions & 3 deletions pkg/internal/ebpf/nodejs/bpf_debug_arm64_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/nodejs/bpf_debug_arm64_bpfel.o
Binary file not shown.
3 changes: 0 additions & 3 deletions pkg/internal/ebpf/nodejs/bpf_debug_x86_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/nodejs/bpf_debug_x86_bpfel.o
Binary file not shown.
3 changes: 0 additions & 3 deletions pkg/internal/ebpf/nodejs/bpf_x86_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified pkg/internal/ebpf/nodejs/bpf_x86_bpfel.o
Binary file not shown.
2 changes: 0 additions & 2 deletions pkg/internal/ebpf/nodejs/nodejs.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,10 @@ func (p *Tracer) UProbes() map[string]map[string]ebpfcommon.FunctionPrograms {
"_ZN4node9AsyncWrap10AsyncResetEN2v85LocalINS1_6ObjectEEEdb": {
Required: false,
Start: p.bpfObjects.AsyncReset,
End: p.bpfObjects.AsyncResetRet,
},
"_ZN4node9AsyncWrap10AsyncResetERKN2v820FunctionCallbackInfoINS1_5ValueEEE": {
Required: false,
Start: p.bpfObjects.AsyncReset,
End: p.bpfObjects.AsyncResetRet,
},
},
}
Expand Down
Binary file modified pkg/internal/ebpf/sarama/bpf_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/sarama/bpf_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/sarama/bpf_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/sarama/bpf_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/watcher/bpf_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/watcher/bpf_debug_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/watcher/bpf_debug_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/ebpf/watcher/bpf_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/netolly/ebpf/net_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/netolly/ebpf/net_x86_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/netolly/ebpf/netsk_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/internal/netolly/ebpf/netsk_x86_bpfel.o
Binary file not shown.

0 comments on commit 9791155

Please sign in to comment.