mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-19 19:29:45 +02:00
test: don't use bpf_usdt_readarg_p
Instead of using the undocumented bcc helper bpf_usdt_readarg_p(),
use bpf_usdt_readarg() [1] and bpf_probe_read_user{_str}() [2, 3] as
documented in the bcc USDT reference guide [1].
Note that the bpf_probe_read_user() documentation says the following:
> For safety, all user address space memory reads must pass through bpf_probe_read_user().
It's assumed that using bpf_usdt_readarg_p() caused a lifetime issue.
See https://github.com/bitcoin/bitcoin/issues/27380#issuecomment-2286505348
With bpf_usdt_readarg() and bpf_probe_read_user(), this doesn't seem
to be a problem anymore. See https://github.com/bitcoin/bitcoin/issues/27380#issuecomment-2528671656
[1]: https://github.com/iovisor/bcc/blob/master/docs/reference_guide.md#6-usdt-probes
[2]: https://github.com/iovisor/bcc/blob/master/docs/reference_guide.md#10-bpf_probe_read_user
[3]: https://github.com/iovisor/bcc/blob/master/docs/reference_guide.md#11-bpf_probe_read_user_str
This commit is contained in:
@@ -39,7 +39,9 @@ struct connected_block
|
||||
BPF_PERF_OUTPUT(block_connected);
|
||||
int trace_block_connected(struct pt_regs *ctx) {
|
||||
struct connected_block block = {};
|
||||
bpf_usdt_readarg_p(1, ctx, &block.hash, 32);
|
||||
void *phash = NULL;
|
||||
bpf_usdt_readarg(1, ctx, &phash);
|
||||
bpf_probe_read_user(&block.hash, sizeof(block.hash), phash);
|
||||
bpf_usdt_readarg(2, ctx, &block.height);
|
||||
bpf_usdt_readarg(3, ctx, &block.transactions);
|
||||
bpf_usdt_readarg(4, ctx, &block.inputs);
|
||||
|
||||
Reference in New Issue
Block a user