Commit Graph
4 Commits
Author SHA1 Message Date
Alban Crequy d715ccc391 ebpf: handle fd_install events from tcptracer-bpf
Since https://github.com/weaveworks/tcptracer-bpf/pull/39, tcptracer-bpf
can generate "fd_install" events when a process installs a new file
descriptor in its fd table. Those events must be requested explicitely
on a per-pid basis with tracer.AddFdInstallWatcher(pid).

This is useful to know about "accept" events that would otherwise be
missed because kretprobes are not triggered for functions that were
called before the installation of the kretprobe.

This patch find all the processes that are currently blocked on an
accept() syscall during the EbpfTracker initialization.
feedInitialConnections() will use tracer.AddFdInstallWatcher() to
subscribe to fd_install  events. When a fd_install event is received,
synthesise an accept event with the connection tuple and the network
namespace (from /proc).
2017-05-19 14:49:38 +02:00
Alfonso Acosta 89a0ab6799 Fix test data and improve /proc/net/tcp header parsing
The header checking code was unsafe because:

1. It was accessing the byteslice at [2] without ensuring a length >= 3
2. It was assuming that the indentation of the 'sl' header is always 2 (which seems to be the case in recent kernels https://github.com/torvalds/linux/blob/8f18e4d03ed8fa5e4a300c94550533bd8ce4ff9a/net/ipv4/tcp_ipv4.c#L2304 and https://github.com/torvalds/linux/blob/8f18e4d03ed8fa5e4a300c94550533bd8ce4ff9a/net/ipv6/tcp_ipv6.c#L1831 ) but it's more robust to simply trim the byteslice.
2017-01-04 00:27:16 +00:00
Alfonso Acosta 99a7dc3b9a Fix tests 2017-01-03 23:34:32 +00:00
Tom Wilkie b94751ac10 Move procspy out of vendor into probe/endpoint. 2015-12-09 11:06:04 +00:00