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:33 +0000 (14:08 -0400)
commit434897eecad53ba1c16b8f7881d18ba187a49163
tree1d8096e4a16bd9e2ed11fa4ec2a4aa678212076d
parent577f6dfc5dc2cbd4d6d82b453dabca36c4b78d1d
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.026217 seconds and 4 git commands to generate.