From 881fc67f7002469477a5ad00e67a8077db6c0514 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 7 Oct 2020 16:42:05 -0400 Subject: [PATCH] Fix: Handle SIGBUS in sessiond and consumerd MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. Wire up SIGBUS handling in the session daemon as well given that it also uses liblttng-ust-ctl. This depends on "liblttng-ust-ctl: Implement SIGBUS handling" in lttng-ust, which extends the API of liblttng-ust-ctl, which 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. Considering that this change in liblttng-ust-ctl modifies the ABI, it is done with a major soname version bump of the library, so it is allowed to break the API. Depends-on: lttng-ust: I7ade988e3e68a87930fbcee3e14e59c3fb66e755 Fixes: #1284 Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau Change-Id: I76a91616bd35b21c5e891c8306c73ed5e8725ebb --- include/lttng/lttng-error.h | 1 + src/bin/lttng-consumerd/lttng-consumerd.c | 31 +++++++++++-- src/bin/lttng-sessiond/Makefile.am | 5 ++- src/bin/lttng-sessiond/main.c | 32 ++++++++++++-- src/bin/lttng-sessiond/ust-ctl-internal.h | 6 ++- src/bin/lttng-sessiond/ust-sigbus.c | 17 ++++++++ src/bin/lttng-sessiond/ust-sigbus.h | 24 ++++++++++ src/common/consumer/consumer-stream.c | 2 +- src/common/consumer/consumer-timer.c | 6 ++- src/common/consumer/consumer.c | 11 ++++- src/common/consumer/consumer.h | 1 + src/common/error.c | 1 + src/common/ust-consumer/ust-consumer.c | 53 +++++++++++++++++------ src/common/ust-consumer/ust-consumer.h | 26 +++++++---- tests/unit/Makefile.am | 1 + tests/unit/test_ust_data.c | 4 ++ tests/unit/ust-sigbus.c | 10 +++++ 17 files changed, 194 insertions(+), 37 deletions(-) create mode 100644 src/bin/lttng-sessiond/ust-sigbus.c create mode 100644 src/bin/lttng-sessiond/ust-sigbus.h create mode 100644 tests/unit/ust-sigbus.c diff --git a/include/lttng/lttng-error.h b/include/lttng/lttng-error.h index d955e143a..aadf2f45b 100644 --- a/include/lttng/lttng-error.h +++ b/include/lttng/lttng-error.h @@ -180,6 +180,7 @@ enum lttng_error_code { LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING = 167, /* Error initializing event notifier error accounting. */ LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING_FULL = 168, /* Error event notifier error accounting full. */ LTTNG_ERR_INVALID_ERROR_QUERY_TARGET = 169, /* Invalid error query target. */ + LTTNG_ERR_BUFFER_FLUSH_FAILED = 170, /* Buffer flush failed */ /* MUST be last element of the manually-assigned section of the enum */ LTTNG_ERR_NR, diff --git a/src/bin/lttng-consumerd/lttng-consumerd.c b/src/bin/lttng-consumerd/lttng-consumerd.c index bd53db589..5fffa20e9 100644 --- a/src/bin/lttng-consumerd/lttng-consumerd.c +++ b/src/bin/lttng-consumerd/lttng-consumerd.c @@ -83,13 +83,30 @@ enum lttng_consumer_type lttng_consumer_get_type(void) /* * Signal handler for the daemon */ -static void sighandler(int sig) +static void sighandler(int sig, siginfo_t *siginfo, void *arg) { if (sig == SIGINT && sigintcount++ == 0) { DBG("ignoring first SIGINT"); return; } + if (sig == SIGBUS) { + int write_ret; + const char msg[] = "Received SIGBUS, aborting program.\n"; + + lttng_consumer_sigbus_handle(siginfo->si_addr); + /* + * If ustctl did not catch this signal (triggering a + * siglongjmp), abort the program. Otherwise, the execution + * will resume from the ust-ctl call which caused this error. + * + * The return value is ignored since the program aborts anyhow. + */ + write_ret = write(STDERR_FILENO, msg, sizeof(msg)); + (void) write_ret; + abort(); + } + if (ctx) { lttng_consumer_should_exit(ctx); } @@ -97,7 +114,7 @@ static void sighandler(int sig) /* * Setup signal handler for : - * SIGINT, SIGTERM, SIGPIPE + * SIGINT, SIGTERM, SIGPIPE, SIGBUS */ static int set_signal_handler(void) { @@ -111,9 +128,9 @@ static int set_signal_handler(void) } sa.sa_mask = sigset; - sa.sa_flags = 0; + sa.sa_flags = SA_SIGINFO; - sa.sa_handler = sighandler; + sa.sa_sigaction = sighandler; if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) { PERROR("sigaction"); return ret; @@ -124,6 +141,12 @@ static int set_signal_handler(void) return ret; } + if ((ret = sigaction(SIGBUS, &sa, NULL)) < 0) { + PERROR("sigaction"); + return ret; + } + + sa.sa_flags = 0; sa.sa_handler = SIG_IGN; if ((ret = sigaction(SIGPIPE, &sa, NULL)) < 0) { PERROR("sigaction"); diff --git a/src/bin/lttng-sessiond/Makefile.am b/src/bin/lttng-sessiond/Makefile.am index 07aaa821c..d0033a019 100644 --- a/src/bin/lttng-sessiond/Makefile.am +++ b/src/bin/lttng-sessiond/Makefile.am @@ -12,7 +12,7 @@ bin_PROGRAMS = lttng-sessiond lttng_sessiond_SOURCES = utils.c utils.h \ trace-kernel.c trace-kernel.h \ kernel.c kernel.h \ - ust-app.h trace-ust.h notify-apps.h \ + ust-app.h ust-sigbus.h trace-ust.h notify-apps.h \ lttng-ust-ctl.h lttng-ust-abi.h lttng-ust-error.h \ ust-ctl-internal.h ust-abi-internal.h ust-error-internal.h \ ust-registry.h \ @@ -65,7 +65,8 @@ if HAVE_LIBLTTNG_UST_CTL lttng_sessiond_SOURCES += trace-ust.c ust-registry.c ust-app.c \ ust-consumer.c ust-consumer.h notify-apps.c \ ust-metadata.c ust-clock.h agent-thread.c agent-thread.h \ - ust-field-utils.h ust-field-utils.c + ust-field-utils.h ust-field-utils.c \ + ust-sigbus.c endif # Add main.c at the end for compile order diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 1174162aa..ee4d0c78e 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -75,6 +75,7 @@ #include "manage-apps.h" #include "manage-kernel.h" #include "modprobe.h" +#include "ust-sigbus.h" static const char *help_msg = #ifdef LTTNG_EMBED_HELP @@ -1170,7 +1171,7 @@ error: * Simply stop all worker threads, leaving main() return gracefully after * joining all threads and calling cleanup(). */ -static void sighandler(int sig) +static void sighandler(int sig, siginfo_t *siginfo, void *arg) { switch (sig) { case SIGINT: @@ -1184,6 +1185,23 @@ static void sighandler(int sig) case SIGUSR1: CMM_STORE_SHARED(recv_child_signal, 1); break; + case SIGBUS: + { + int write_ret; + const char msg[] = "Received SIGBUS, aborting program.\n"; + + lttng_ust_handle_sigbus(siginfo->si_addr); + /* + * If ustctl did not catch this signal (triggering a + * siglongjmp), abort the program. Otherwise, the execution + * will resume from the ust-ctl call which caused this error. + * + * The return value is ignored since the program aborts anyhow. + */ + write_ret = write(STDERR_FILENO, msg, sizeof(msg)); + (void) write_ret; + abort(); + } default: break; } @@ -1205,9 +1223,9 @@ static int set_signal_handler(void) } sa.sa_mask = sigset; - sa.sa_flags = 0; + sa.sa_flags = SA_SIGINFO; - sa.sa_handler = sighandler; + sa.sa_sigaction = sighandler; if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) { PERROR("sigaction"); return ret; @@ -1223,13 +1241,19 @@ static int set_signal_handler(void) return ret; } + if ((ret = sigaction(SIGBUS, &sa, NULL)) < 0) { + PERROR("sigaction"); + return ret; + } + + sa.sa_flags = 0; sa.sa_handler = SIG_IGN; if ((ret = sigaction(SIGPIPE, &sa, NULL)) < 0) { PERROR("sigaction"); return ret; } - DBG("Signal handler set for SIGTERM, SIGUSR1, SIGPIPE and SIGINT"); + DBG("Signal handler set for SIGTERM, SIGUSR1, SIGPIPE, SIGINT, and SIGBUS"); return ret; } diff --git a/src/bin/lttng-sessiond/ust-ctl-internal.h b/src/bin/lttng-sessiond/ust-ctl-internal.h index 96cbf79bc..ff3023380 100644 --- a/src/bin/lttng-sessiond/ust-ctl-internal.h +++ b/src/bin/lttng-sessiond/ust-ctl-internal.h @@ -251,9 +251,9 @@ int lttng_ust_ctl_get_subbuf(struct lttng_ust_ctl_consumer_stream *stream, unsigned long *pos); int lttng_ust_ctl_put_subbuf(struct lttng_ust_ctl_consumer_stream *stream); -void lttng_ust_ctl_flush_buffer(struct lttng_ust_ctl_consumer_stream *stream, +int lttng_ust_ctl_flush_buffer(struct lttng_ust_ctl_consumer_stream *stream, int producer_active); -void lttng_ust_ctl_clear_buffer(struct lttng_ust_ctl_consumer_stream *stream); +int lttng_ust_ctl_clear_buffer(struct lttng_ust_ctl_consumer_stream *stream); /* index */ @@ -653,4 +653,6 @@ int lttng_ust_ctl_counter_aggregate(struct lttng_ust_ctl_daemon_counter *counter int lttng_ust_ctl_counter_clear(struct lttng_ust_ctl_daemon_counter *counter, const size_t *dimension_indexes); +void ustctl_sigbus_handle(void *addr); + #endif /* LTTNG_UST_CTL_INTERNAL_H */ diff --git a/src/bin/lttng-sessiond/ust-sigbus.c b/src/bin/lttng-sessiond/ust-sigbus.c new file mode 100644 index 000000000..52a7ac270 --- /dev/null +++ b/src/bin/lttng-sessiond/ust-sigbus.c @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2021 Mathieu Desnoyers + * + * SPDX-License-Identifier: GPL-2.0-only + * + */ + +#include +#include +#include "ust-sigbus.h" + +DEFINE_LTTNG_UST_SIGBUS_STATE(); + +void lttng_ust_handle_sigbus(void *address) +{ + lttng_ust_ctl_sigbus_handle(address); +} diff --git a/src/bin/lttng-sessiond/ust-sigbus.h b/src/bin/lttng-sessiond/ust-sigbus.h new file mode 100644 index 000000000..110ef7f75 --- /dev/null +++ b/src/bin/lttng-sessiond/ust-sigbus.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2021 Mathieu Desnoyers + * + * SPDX-License-Identifier: GPL-2.0-only + * + */ + +#ifndef LTTNG_UST_SIGBUS_H +#define LTTNG_UST_SIGBUS_H + +#ifdef HAVE_LIBLTTNG_UST_CTL + +void lttng_ust_handle_sigbus(void *address); + +#else /* HAVE_LIBLTTNG_UST_CTL */ + +static inline +void lttng_ust_handle_sigbus(void *address) +{ +} + +#endif /* HAVE_LIBLTTNG_UST_CTL */ + +#endif /* LTTNG_UST_SIGBUS_H */ diff --git a/src/common/consumer/consumer-stream.c b/src/common/consumer/consumer-stream.c index d68077855..37b2d5050 100644 --- a/src/common/consumer/consumer-stream.c +++ b/src/common/consumer/consumer-stream.c @@ -1317,7 +1317,7 @@ int consumer_stream_flush_buffer(struct lttng_consumer_stream *stream, break; case LTTNG_CONSUMER32_UST: case LTTNG_CONSUMER64_UST: - lttng_ustconsumer_flush_buffer(stream, (int) producer_active); + ret = lttng_ustconsumer_flush_buffer(stream, (int) producer_active); break; default: ERR("Unknown consumer_data type"); diff --git a/src/common/consumer/consumer-timer.c b/src/common/consumer/consumer-timer.c index cbb006278..d0cf170da 100644 --- a/src/common/consumer/consumer-timer.c +++ b/src/common/consumer/consumer-timer.c @@ -237,7 +237,11 @@ int consumer_flush_ust_index(struct lttng_consumer_stream *stream) ERR("Failed to get the current timestamp"); goto end; } - lttng_ustconsumer_flush_buffer(stream, 1); + ret = lttng_ustconsumer_flush_buffer(stream, 1); + if (ret < 0) { + ERR("Failed to flush buffer while flushing index"); + goto end; + } ret = lttng_ustconsumer_take_snapshot(stream); if (ret < 0) { if (ret != -EAGAIN) { diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c index 4519944e8..a903ff9d2 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -4399,7 +4399,11 @@ int consumer_clear_buffer(struct lttng_consumer_stream *stream) break; case LTTNG_CONSUMER32_UST: case LTTNG_CONSUMER64_UST: - lttng_ustconsumer_clear_buffer(stream); + ret = lttng_ustconsumer_clear_buffer(stream); + if (ret < 0) { + ERR("Failed to clear ust stream (ret = %d)", ret); + goto end; + } break; default: ERR("Unknown consumer_data type"); @@ -5249,3 +5253,8 @@ error_unlock: pthread_mutex_unlock(&stream->lock); goto end_rcu_unlock; } + +void lttng_consumer_sigbus_handle(void *addr) +{ + lttng_ustconsumer_sigbus_handle(addr); +} diff --git a/src/common/consumer/consumer.h b/src/common/consumer/consumer.h index 5fb812c08..0c83baa8c 100644 --- a/src/common/consumer/consumer.h +++ b/src/common/consumer/consumer.h @@ -1059,5 +1059,6 @@ int lttng_consumer_clear_channel(struct lttng_consumer_channel *channel); enum lttcomm_return_code lttng_consumer_open_channel_packets( struct lttng_consumer_channel *channel); int consumer_metadata_wakeup_pipe(const struct lttng_consumer_channel *channel); +void lttng_consumer_sigbus_handle(void *addr); #endif /* LIB_CONSUMER_H */ diff --git a/src/common/error.c b/src/common/error.c index 907013163..611967b86 100644 --- a/src/common/error.c +++ b/src/common/error.c @@ -244,6 +244,7 @@ static const char *error_string_array[] = { [ ERROR_INDEX(LTTNG_ERR_EVENT_NOTIFIER_REGISTRATION) ] = "Failed to create event notifier", [ ERROR_INDEX(LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING) ] = "Failed to initialize event notifier error accounting", [ ERROR_INDEX(LTTNG_ERR_EVENT_NOTIFIER_ERROR_ACCOUNTING_FULL) ] = "No index available in event notifier error accounting", + [ ERROR_INDEX(LTTNG_ERR_BUFFER_FLUSH_FAILED) ] = "Failed to flush stream buffer", /* Last element */ [ ERROR_INDEX(LTTNG_ERR_NR) ] = "Unknown error code" diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 87ca31927..2948fda50 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -10,6 +10,7 @@ #define _LGPL_SOURCE #include #include +#include #include #include #include @@ -47,6 +48,8 @@ extern struct lttng_consumer_global_data the_consumer_data; extern int consumer_poll_timeout; +DEFINE_LTTNG_UST_SIGBUS_STATE(); + /* * Free channel object and all streams associated with it. This MUST be used * only and only if the channel has _NEVER_ been added to the global channel @@ -727,7 +730,14 @@ static int flush_channel(uint64_t chan_key) } if (!stream->quiescent) { - lttng_ust_ctl_flush_buffer(stream->ustream, 0); + ret = lttng_ust_ctl_flush_buffer(stream->ustream, 0); + if (ret) { + ERR("Failed to flush buffer while flushing channel: channel key = %" PRIu64 ", channel name = '%s'", + chan_key, channel->name); + ret = LTTNG_ERR_BUFFER_FLUSH_FAILED; + pthread_mutex_unlock(&stream->lock); + goto error; + } stream->quiescent = true; } next: @@ -1128,7 +1138,12 @@ static int snapshot_channel(struct lttng_consumer_channel *channel, * Else, if quiescent, it has already been done by the prior stop. */ if (!stream->quiescent) { - lttng_ust_ctl_flush_buffer(stream->ustream, 0); + ret = lttng_ust_ctl_flush_buffer(stream->ustream, 0); + if (ret < 0) { + ERR("Failed to flush buffer during snapshot of channel: channel key = %" PRIu64 ", channel name = '%s'", + channel->key, channel->name); + goto error_unlock; + } } ret = lttng_ustconsumer_take_snapshot(stream); @@ -2314,13 +2329,13 @@ end: return ret_func; } -void lttng_ust_flush_buffer( - struct lttng_consumer_stream *stream, int producer_active) +int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream, + int producer_active) { assert(stream); assert(stream->ustream); - lttng_ust_ctl_flush_buffer(stream->ustream, producer_active); + return lttng_ust_ctl_flush_buffer(stream->ustream, producer_active); } /* @@ -2380,21 +2395,21 @@ int lttng_ustconsumer_get_consumed_snapshot( return lttng_ust_ctl_snapshot_get_consumed(stream->ustream, pos); } -void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, +int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, int producer) { assert(stream); assert(stream->ustream); - lttng_ust_ctl_flush_buffer(stream->ustream, producer); + return lttng_ust_ctl_flush_buffer(stream->ustream, producer); } -void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream) +int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream) { assert(stream); assert(stream->ustream); - lttng_ust_ctl_clear_buffer(stream->ustream); + return lttng_ust_ctl_clear_buffer(stream->ustream); } int lttng_ustconsumer_get_current_timestamp( @@ -2427,8 +2442,11 @@ void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream) pthread_mutex_lock(&stream->lock); if (!stream->quiescent) { - lttng_ust_ctl_flush_buffer(stream->ustream, 0); - stream->quiescent = true; + if (lttng_ust_ctl_flush_buffer(stream->ustream, 0) < 0) { + ERR("Failed to flush buffer on stream hang-up"); + } else { + stream->quiescent = true; + } } pthread_mutex_unlock(&stream->lock); stream->hangup_flush_done = 1; @@ -2589,8 +2607,12 @@ int commit_one_metadata_packet(struct lttng_consumer_stream *stream) * a metadata packet. Since the subbuffer is fully filled (with padding, * if needed), the stream is "quiescent" after this commit. */ - lttng_ust_ctl_flush_buffer(stream->ustream, 1); - stream->quiescent = true; + if (lttng_ust_ctl_flush_buffer(stream->ustream, 1)) { + ERR("Failed to flush buffer while commiting one metadata packet"); + ret = -EIO; + } else { + stream->quiescent = true; + } end: pthread_mutex_unlock(&stream->chan->metadata_cache->lock); return ret; @@ -3410,3 +3432,8 @@ int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream, return lttng_ust_ctl_get_stream_id(stream->ustream, stream_id); } + +void lttng_ustconsumer_sigbus_handle(void *addr) +{ + lttng_ust_ctl_sigbus_handle(addr); +} diff --git a/src/common/ust-consumer/ust-consumer.h b/src/common/ust-consumer/ust-consumer.h index 7ddcb112a..e2507a7f4 100644 --- a/src/common/ust-consumer/ust-consumer.h +++ b/src/common/ust-consumer/ust-consumer.h @@ -39,10 +39,10 @@ int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream); void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream); -void lttng_ust_flush_buffer( - struct lttng_consumer_stream *stream, int producer_active); -int lttng_ustconsumer_get_stream_id( - struct lttng_consumer_stream *stream, uint64_t *stream_id); +int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream, + int producer_active); +int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream, + uint64_t *stream_id); int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream); void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht); void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata); @@ -55,13 +55,14 @@ int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx, enum sync_metadata_status lttng_ustconsumer_sync_metadata( struct lttng_consumer_local_data *ctx, struct lttng_consumer_stream *metadata); -void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, +int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, int producer); -void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream); +int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream); int lttng_ustconsumer_get_current_timestamp( struct lttng_consumer_stream *stream, uint64_t *ts); int lttng_ustconsumer_get_sequence_number( struct lttng_consumer_stream *stream, uint64_t *seq); +void lttng_ustconsumer_sigbus_handle(void *addr); #else /* HAVE_LIBLTTNG_UST_CTL */ @@ -168,9 +169,10 @@ int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream) return -ENOSYS; } static inline -void lttng_ust_flush_buffer(struct lttng_consumer_stream *stream, +int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream, int producer_active) { + return -ENOSYS; } static inline void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht) @@ -204,13 +206,15 @@ enum sync_metadata_status lttng_ustconsumer_sync_metadata(struct lttng_consumer_ return SYNC_METADATA_STATUS_ERROR; } static inline -void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, +int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, int producer) { + return -ENOSYS; } static inline -void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream) +int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream) { + return -ENOSYS; } static inline int lttng_ustconsumer_get_current_timestamp( @@ -230,6 +234,10 @@ int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream, { return -ENOSYS; } +static inline +void lttng_ustconsumer_sigbus_handle(void *addr) +{ +} #endif /* HAVE_LIBLTTNG_UST_CTL */ #endif /* _LTTNG_USTCONSUMER_H */ diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 401e89f25..ff49a56e4 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -149,6 +149,7 @@ test_session_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM) \ test_session_LDADD += $(SESSIOND_OBJS) if HAVE_LIBLTTNG_UST_CTL +test_session_SOURCES += ust-sigbus.c test_session_LDADD += $(UST_CTL_LIBS) endif diff --git a/tests/unit/test_ust_data.c b/tests/unit/test_ust_data.c index f92b1f802..87da5b4b6 100644 --- a/tests/unit/test_ust_data.c +++ b/tests/unit/test_ust_data.c @@ -21,6 +21,8 @@ #include #include +#include + #include /* This path will NEVER be created in this test */ @@ -31,6 +33,8 @@ /* Number of TAP tests in this file */ #define NUM_TESTS 16 +DEFINE_LTTNG_UST_SIGBUS_STATE(); + /* For error.h */ int lttng_opt_quiet = 1; int lttng_opt_verbose; diff --git a/tests/unit/ust-sigbus.c b/tests/unit/ust-sigbus.c new file mode 100644 index 000000000..4dbdddefa --- /dev/null +++ b/tests/unit/ust-sigbus.c @@ -0,0 +1,10 @@ +/* + * Copyright (C) 2021 Mathieu Desnoyers + * + * SPDX-License-Identifier: GPL-2.0-only + * + */ + +#include + +DEFINE_LTTNG_UST_SIGBUS_STATE(); -- 2.34.1