liblttng-ust-ctl: Implement SIGBUS handling
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 8 Oct 2020 15:08:59 +0000 (11:08 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 14 May 2021 18:08:02 +0000 (14:08 -0400)
commit63b3205fe76018eb5d7656b94b54c9b662ae208f
tree1d8096e4a16bd9e2ed11fa4ec2a4aa678212076d
parenta5d437c5f61a1b089e3ea76e4d124683b3aa456e
liblttng-ust-ctl: Implement SIGBUS handling

There is an issue with the security model of lib ring buffer (lttng-ust)
vs SIGBUS handling by consumer daemon. We do not handle SIGBUS in the
consumer daemon. An application using ftruncate on a ring buffer shm
could cause the consumer to be killed with SIGBUS.

Expose the relevant APIs to allow consumer daemon to handle SIGBUS.

It requires the user application (consumerd) to define the TLS sigbus
state with DEFINE_LTTNG_UST_SIGBUS_STATE(), and to invoke
lttng_ust_ctl_sigbus_handle() when a SIGBUS is received, passing the
address causing the SIGBUS (siginfo->si_addr) as parameter.

Internally, liblttng-ust-ctl uses sigsetjmp and siglongjmp to recover
from SIGBUS, and track all accesses to shared memory ranges within the
library.

This modifies the API of liblttng-ust-ctl, and requires the user
application to define the TLS sigbus state with
DEFINE_LTTNG_UST_SIGBUS_STATE(). It therefore needs to be introduced in
locked-step between lttng-ust and lttng-tools.

It requires a major version bump of liblttng-ust-ctl soname.

Fixes: #1284
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7ade988e3e68a87930fbcee3e14e59c3fb66e755
include/Makefile.am
include/lttng/ust-ctl.h
include/lttng/ust-sigbus.h [new file with mode: 0644]
src/common/ringbuffer-clients/metadata-template.h
src/common/ringbuffer-clients/template.h
src/common/ringbuffer/frontend.h
src/common/ringbuffer/ring_buffer_frontend.c
src/lib/lttng-ust-ctl/ustctl.c
This page took 0.02466 seconds and 4 git commands to generate.