|
75 | 75 |
|
76 | 76 | int trace_added(struct pt_regs *ctx) { |
77 | 77 | struct added_event added = {}; |
78 | | -
|
79 | | - bpf_usdt_readarg_p(1, ctx, &added.hash, HASH_LENGTH); |
| 78 | + void *phash = NULL; |
| 79 | + bpf_usdt_readarg(1, ctx, &phash); |
| 80 | + bpf_probe_read_user(&added.hash, sizeof(added.hash), phash); |
80 | 81 | bpf_usdt_readarg(2, ctx, &added.vsize); |
81 | 82 | bpf_usdt_readarg(3, ctx, &added.fee); |
82 | 83 |
|
|
86 | 87 |
|
87 | 88 | int trace_removed(struct pt_regs *ctx) { |
88 | 89 | struct removed_event removed = {}; |
89 | | -
|
90 | | - bpf_usdt_readarg_p(1, ctx, &removed.hash, HASH_LENGTH); |
91 | | - bpf_usdt_readarg_p(2, ctx, &removed.reason, MAX_REMOVAL_REASON_LENGTH); |
| 90 | + void *phash = NULL, *preason = NULL; |
| 91 | + bpf_usdt_readarg(1, ctx, &phash); |
| 92 | + bpf_probe_read_user(&removed.hash, sizeof(removed.hash), phash); |
| 93 | + bpf_usdt_readarg(2, ctx, &preason); |
| 94 | + bpf_probe_read_user_str(&removed.reason, sizeof(removed.reason), preason); |
92 | 95 | bpf_usdt_readarg(3, ctx, &removed.vsize); |
93 | 96 | bpf_usdt_readarg(4, ctx, &removed.fee); |
94 | 97 | bpf_usdt_readarg(5, ctx, &removed.entry_time); |
|
99 | 102 |
|
100 | 103 | int trace_rejected(struct pt_regs *ctx) { |
101 | 104 | struct rejected_event rejected = {}; |
102 | | -
|
103 | | - bpf_usdt_readarg_p(1, ctx, &rejected.hash, HASH_LENGTH); |
104 | | - bpf_usdt_readarg_p(2, ctx, &rejected.reason, MAX_REJECT_REASON_LENGTH); |
105 | | -
|
| 105 | + void *phash = NULL, *preason = NULL; |
| 106 | + bpf_usdt_readarg(1, ctx, &phash); |
| 107 | + bpf_probe_read_user(&rejected.hash, sizeof(rejected.hash), phash); |
| 108 | + bpf_usdt_readarg(2, ctx, &preason); |
| 109 | + bpf_probe_read_user_str(&rejected.reason, sizeof(rejected.reason), preason); |
106 | 110 | rejected_events.perf_submit(ctx, &rejected, sizeof(rejected)); |
107 | 111 | return 0; |
108 | 112 | } |
109 | 113 |
|
110 | 114 | int trace_replaced(struct pt_regs *ctx) { |
111 | 115 | struct replaced_event replaced = {}; |
112 | | -
|
113 | | - bpf_usdt_readarg_p(1, ctx, &replaced.replaced_hash, HASH_LENGTH); |
| 116 | + void *preplaced_hash = NULL, *preplacement_hash = NULL; |
| 117 | + bpf_usdt_readarg(1, ctx, &preplaced_hash); |
| 118 | + bpf_probe_read_user(&replaced.replaced_hash, sizeof(replaced.replaced_hash), preplaced_hash); |
114 | 119 | bpf_usdt_readarg(2, ctx, &replaced.replaced_vsize); |
115 | 120 | bpf_usdt_readarg(3, ctx, &replaced.replaced_fee); |
116 | 121 | bpf_usdt_readarg(4, ctx, &replaced.replaced_entry_time); |
117 | | - bpf_usdt_readarg_p(5, ctx, &replaced.replacement_hash, HASH_LENGTH); |
| 122 | + bpf_usdt_readarg(5, ctx, &preplacement_hash); |
| 123 | + bpf_probe_read_user(&replaced.replacement_hash, sizeof(replaced.replacement_hash), preplacement_hash); |
118 | 124 | bpf_usdt_readarg(6, ctx, &replaced.replacement_vsize); |
119 | 125 | bpf_usdt_readarg(7, ctx, &replaced.replacement_fee); |
120 | 126 | bpf_usdt_readarg(8, ctx, &replaced.replaced_by_transaction); |
@@ -314,10 +320,7 @@ def handle_rejected_event(_, data, __): |
314 | 320 | assert_equal(1, len(events)) |
315 | 321 | event = events[0] |
316 | 322 | assert_equal(bytes(event.hash)[::-1].hex(), tx["tx"].hash) |
317 | | - # The next test is already known to fail, so disable it to avoid |
318 | | - # wasting CPU time and developer time. See |
319 | | - # https://github.com/bitcoin/bitcoin/issues/27380 |
320 | | - #assert_equal(event.reason.decode("UTF-8"), "min relay fee not met") |
| 323 | + assert_equal(event.reason.decode("UTF-8"), "min relay fee not met") |
321 | 324 |
|
322 | 325 | bpf.cleanup() |
323 | 326 | self.generate(self.wallet, 1) |
|
0 commit comments