payload: use fd_handle instead of raw file descriptors
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 22 Jul 2020 20:15:44 +0000 (16:15 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 27 Jul 2020 20:31:58 +0000 (16:31 -0400)
commitfe489250ce102edf511e99669025934ec9587c63
tree3bd6d8a4f0d94bae315e6139e3e379fc3ecf6760
parentdd1bac00c933616842aaf51ad4c4240ccee98838
payload: use fd_handle instead of raw file descriptors

Using raw file descriptors with lttng_payloads introduces scary file
descriptor corner-cases when mixing with asynchroneous communication and
lttng_payloads.

Since an lttng_payload doesn't own its file descriptors, attempting it
is easy to fall into a situation where a file descriptor is referenced
by an lttng_payload while the owner is destroyed.

For instance, a userspace probe could be destroyed while its description
is waiting to be sent to a client.

The various use sites of the payload/payload_view APIs are adjusted.

Utilities to send/recv fds through unix sockets using the payload and
payload view interfaces are added as part of this commit as they use
the payload's fd_handles.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I44073f1b683af6c475e8e93c25a76910acf955e4
13 files changed:
include/lttng/userspace-probe-internal.h
include/lttng/userspace-probe.h
src/bin/lttng-sessiond/client.c
src/common/fd-handle.c
src/common/payload-view.c
src/common/payload-view.h
src/common/payload.c
src/common/payload.h
src/common/unix.c
src/common/unix.h
src/common/userspace-probe.c
src/lib/lttng-ctl/lttng-ctl.c
tests/unit/test_payload.c
This page took 0.02646 seconds and 4 git commands to generate.