eBPF: Correlating rustls Plaintext to TCP Connections Without a File Descriptor
Blog post from Speedscale
Investigating eBPF-based plaintext capture for rustls revealed that correctly captured HTTP data could still be attributed to the wrong TCP connection because rustls deliberately separates TLS state from transport I/O and Tokio tasks share and migrate across worker threads. Thread-local tracking of the most recently read socket therefore produced convincing but incorrect associations when pooled connections or multiple GraphQL subgraphs were active, while an attempted Tokio task-ID probe failed because the relevant generic async code paths had inlined the target function, leaving only unused-for-this-workload out-of-line symbols. Further debugging showed that a kernel probe’s early return for TLS flows had prevented the socket-to-thread correlation map from being populated at all, demonstrating the value of counters for producer updates, lookups, and bindings rather than relying on payload dumps. The eventual approach recorded TCP flow activity after successful reads and bound that flow to rustls’s ConnectionCore during tokio-rustls’s immediate read-and-process-packets sequence, when the thread-local socket evidence was still fresh; subsequent plaintext operations used the durable connection-to-flow binding. In testing against Apollo Router with two TLS backend services, correct plaintext-chunk attribution improved from 10 of 36 chunks to 94 of 96, with the remaining misses explained by connections established before probes attached. The investigation emphasizes testing with multiple connections, verifying that instrumentation points execute at runtime, separating cache liveness from correctness, and recognizing that sans-io TLS libraries do not inherently expose socket identities.
| Trend | Post Mentions | Total Month Mentions | Posts | Companies | MoM |
|---|---|---|---|---|---|
| Kubernetes | 1 | 956 | 75 | 30 | -73% |
Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.