Skip to content

Commit 0ce041e

Browse files
deadmanozdeadmanoz
authored andcommitted
tracing: fix pointer argument handling in mempool_monitor.py
The BPF code was incorrectly passing pointer variables by value to bpf_usdt_readarg(), causing the function to fail silently and resulting in transaction hashes and reason strings displaying as zeros or garbage. This fix adds the missing reference operator (&) when passing pointer variables to bpf_usdt_readarg(), allowing the function to properly write the pointer values and enabling correct display of transaction hashes and removal/rejection reasons. Fixes the regression introduced in ec47ba3 where bpf_usdt_readarg_p was replaced with bpf_usdt_readarg but the calling convention wasn't properly updated for pointer arguments.
1 parent 3219847 commit 0ce041e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

contrib/tracing/mempool_monitor.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
int trace_added(struct pt_regs *ctx) {
6767
struct added_event added = {};
6868
void *phash = NULL;
69-
bpf_usdt_readarg(1, ctx, phash);
69+
bpf_usdt_readarg(1, ctx, &phash);
7070
bpf_probe_read_user(&added.hash, sizeof(added.hash), phash);
7171
bpf_usdt_readarg(2, ctx, &added.vsize);
7272
bpf_usdt_readarg(3, ctx, &added.fee);
@@ -78,9 +78,9 @@
7878
int trace_removed(struct pt_regs *ctx) {
7979
struct removed_event removed = {};
8080
void *phash = NULL, *preason = NULL;
81-
bpf_usdt_readarg(1, ctx, phash);
81+
bpf_usdt_readarg(1, ctx, &phash);
8282
bpf_probe_read_user(&removed.hash, sizeof(removed.hash), phash);
83-
bpf_usdt_readarg(2, ctx, preason);
83+
bpf_usdt_readarg(2, ctx, &preason);
8484
bpf_probe_read_user_str(&removed.reason, sizeof(removed.reason), preason);
8585
bpf_usdt_readarg(3, ctx, &removed.vsize);
8686
bpf_usdt_readarg(4, ctx, &removed.fee);
@@ -93,9 +93,9 @@
9393
int trace_rejected(struct pt_regs *ctx) {
9494
struct rejected_event rejected = {};
9595
void *phash = NULL, *preason = NULL;
96-
bpf_usdt_readarg(1, ctx, phash);
96+
bpf_usdt_readarg(1, ctx, &phash);
9797
bpf_probe_read_user(&rejected.hash, sizeof(rejected.hash), phash);
98-
bpf_usdt_readarg(2, ctx, preason);
98+
bpf_usdt_readarg(2, ctx, &preason);
9999
bpf_probe_read_user_str(&rejected.reason, sizeof(rejected.reason), preason);
100100
rejected_events.perf_submit(ctx, &rejected, sizeof(rejected));
101101
return 0;
@@ -104,12 +104,12 @@
104104
int trace_replaced(struct pt_regs *ctx) {
105105
struct replaced_event replaced = {};
106106
void *phash_replaced = NULL, *phash_replacement = NULL;
107-
bpf_usdt_readarg(1, ctx, phash_replaced);
107+
bpf_usdt_readarg(1, ctx, &phash_replaced);
108108
bpf_probe_read_user(&replaced.replaced_hash, sizeof(replaced.replaced_hash), phash_replaced);
109109
bpf_usdt_readarg(2, ctx, &replaced.replaced_vsize);
110110
bpf_usdt_readarg(3, ctx, &replaced.replaced_fee);
111111
bpf_usdt_readarg(4, ctx, &replaced.replaced_entry_time);
112-
bpf_usdt_readarg(5, ctx, phash_replacement);
112+
bpf_usdt_readarg(5, ctx, &phash_replacement);
113113
bpf_probe_read_user(&replaced.replacement_hash, sizeof(replaced.replacement_hash), phash_replacement);
114114
bpf_usdt_readarg(6, ctx, &replaced.replacement_vsize);
115115
bpf_usdt_readarg(7, ctx, &replaced.replacement_fee);

0 commit comments

Comments
 (0)