Closed tsint closed 2 weeks ago
I'm a bit confused about this part of the code(https://github.com/open-telemetry/opentelemetry-ebpf-profiler/blob/main/support/ebpf/dotnet_tracer.ebpf.c#L65-L76). If
pc_delta = DOTNET_CODE_BYTES_PER_ENTRY
, thenoffs = map_elements - 2
. Wouldn't this cause a buffer overflow inbpf_probe_read_user(&scratch->map[offs], sizeof(scratch->map), (void*) map_start)
?
This is explained in the commet of the map
definition at: https://github.com/open-telemetry/opentelemetry-ebpf-profiler/blob/main/support/ebpf/types.h#L615-L620
Does commit 8254100 fix the issue at hand?
@fabled Thank you for your answer. I just tested this patch, and it successfully loaded the BPF code.
My application runtime environment is Mint 21.3 (equivalent to Ubuntu 22.04). Below is the output when running opentelemetry-ebpf-profiler after compiling the BPF code using
make debug
.After disassembling
tracer.ebpf.amd64
withllvm-objdump
, it can be seen that the error occurred at line 74 ofdotnet_tracer.ebpf.c
, where the code did not pass the verifier check.I'm a bit confused about this part of the code(https://github.com/open-telemetry/opentelemetry-ebpf-profiler/blob/main/support/ebpf/dotnet_tracer.ebpf.c#L65-L76). If
pc_delta = DOTNET_CODE_BYTES_PER_ENTRY
, thenoffs = map_elements - 2
. Wouldn't this cause a buffer overflow inbpf_probe_read_user(&scratch->map[offs], sizeof(scratch->map), (void*) map_start)
?Thanks for any answers.