From 0ce041ea88dbea2bdfaf21fd0e60a86012498f0a Mon Sep 17 00:00:00 2001 From: deadmanoz Date: Tue, 29 Jul 2025 07:22:11 +0000 Subject: [PATCH] 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 ec47ba349d where bpf_usdt_readarg_p was replaced with bpf_usdt_readarg but the calling convention wasn't properly updated for pointer arguments. --- contrib/tracing/mempool_monitor.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/tracing/mempool_monitor.py b/contrib/tracing/mempool_monitor.py index 22efa91783f..eb29b374158 100755 --- a/contrib/tracing/mempool_monitor.py +++ b/contrib/tracing/mempool_monitor.py @@ -66,7 +66,7 @@ BPF_PERF_OUTPUT(replaced_events); int trace_added(struct pt_regs *ctx) { struct added_event added = {}; void *phash = NULL; - bpf_usdt_readarg(1, ctx, phash); + bpf_usdt_readarg(1, ctx, &phash); bpf_probe_read_user(&added.hash, sizeof(added.hash), phash); bpf_usdt_readarg(2, ctx, &added.vsize); bpf_usdt_readarg(3, ctx, &added.fee); @@ -78,9 +78,9 @@ int trace_added(struct pt_regs *ctx) { int trace_removed(struct pt_regs *ctx) { struct removed_event removed = {}; void *phash = NULL, *preason = NULL; - bpf_usdt_readarg(1, ctx, phash); + bpf_usdt_readarg(1, ctx, &phash); bpf_probe_read_user(&removed.hash, sizeof(removed.hash), phash); - bpf_usdt_readarg(2, ctx, preason); + bpf_usdt_readarg(2, ctx, &preason); bpf_probe_read_user_str(&removed.reason, sizeof(removed.reason), preason); bpf_usdt_readarg(3, ctx, &removed.vsize); bpf_usdt_readarg(4, ctx, &removed.fee); @@ -93,9 +93,9 @@ int trace_removed(struct pt_regs *ctx) { int trace_rejected(struct pt_regs *ctx) { struct rejected_event rejected = {}; void *phash = NULL, *preason = NULL; - bpf_usdt_readarg(1, ctx, phash); + bpf_usdt_readarg(1, ctx, &phash); bpf_probe_read_user(&rejected.hash, sizeof(rejected.hash), phash); - bpf_usdt_readarg(2, ctx, preason); + bpf_usdt_readarg(2, ctx, &preason); bpf_probe_read_user_str(&rejected.reason, sizeof(rejected.reason), preason); rejected_events.perf_submit(ctx, &rejected, sizeof(rejected)); return 0; @@ -104,12 +104,12 @@ int trace_rejected(struct pt_regs *ctx) { int trace_replaced(struct pt_regs *ctx) { struct replaced_event replaced = {}; void *phash_replaced = NULL, *phash_replacement = NULL; - bpf_usdt_readarg(1, ctx, phash_replaced); + bpf_usdt_readarg(1, ctx, &phash_replaced); bpf_probe_read_user(&replaced.replaced_hash, sizeof(replaced.replaced_hash), phash_replaced); bpf_usdt_readarg(2, ctx, &replaced.replaced_vsize); bpf_usdt_readarg(3, ctx, &replaced.replaced_fee); bpf_usdt_readarg(4, ctx, &replaced.replaced_entry_time); - bpf_usdt_readarg(5, ctx, phash_replacement); + bpf_usdt_readarg(5, ctx, &phash_replacement); bpf_probe_read_user(&replaced.replacement_hash, sizeof(replaced.replacement_hash), phash_replacement); bpf_usdt_readarg(6, ctx, &replaced.replacement_vsize); bpf_usdt_readarg(7, ctx, &replaced.replacement_fee);