The vulnerability lies in the handling of a fallback mechanism within the eBPF-based tracing functions of OpenTelemetry. Specifically, when a CPU mismatch is detected between the context that writes to a per-CPU buffer and the one that reads from it, the code switches to a fixed-size 256-byte fallback buffer. However, the logic for determining the size of the data to be read from this buffer did not account for this switch. It continued to use the original data size (real_size), which could be as large as 8KB. This discrepancy between the buffer size (256 bytes) and the read size (up to 8KB) creates an out-of-bounds read vulnerability, potentially leaking sensitive kernel memory into the telemetry data.
The analysis of the provided patch commit 5d375cbc8d5f5187c5f8bf78e4f78265c0a262d5 clearly shows the vulnerable code and the subsequent fix. The changes are located in the bpf/generictracer/k_tracer.c file, within the obi_kprobe_tcp_sendmsg and obi_kprobe_tcp_rate_check_app_limited functions. In both functions, the patch introduces a conditional check (use_fallback) and uses the min() macro to clamp the read size to k_kprobes_http2_buf_size (the size of the fallback buffer) when the fallback path is taken. This directly addresses the root cause of the vulnerability. Therefore, these two functions are identified as the vulnerable functions that would be active during the exploitation of this vulnerability.