ust-ctl: allow runtime version checks
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 29 Jul 2022 21:40:45 +0000 (17:40 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 13 Jan 2023 14:46:52 +0000 (09:46 -0500)
commit9c96e34c54f6e2beda872953c4d5955967c9fef4
tree8371252edc5fcc96c0427a8fb39e8049487d4dd6
parentf63969cc383c919fdad975497d668605783c6c3a
ust-ctl: allow runtime version checks

Officially, building (and dynamically linking) mismatching LTTng-UST
and LTTng-tools versions is unsupported.

At build time, LTTng-tools ensures that both versions match. However, it
remains possible for a user to mistakenly deploy LTTng-tools built
againt liblttng-ust-ctl v2.x and liblttng-ust-ctl.so from a different
LTTng-UST release. Since the soname major version of liblttng-ust-ctl is
not bumped at every release, this would allow LTTng-tools binary to
load.

In practice, this is unlikely to work since new symbols are introduced
at almost every release cycle. However, it isn't guaranteed.

In the case of a recent change -- removing the underscore prefix of
enumeration mappings used by a variant -- we don't change the ABI, but
we rely on the LTTNG_UST_ABI_MAJOR_VERSION to indicate whether or not
the fix is present to change the interpretation of existing fields.

Adding lttng_ust_ctl_get_version() provides an additional safety net
to check, at runtime, that the version of liblttng-ust-ctl.so that
is loaded matches that of LTTng-tools.

Technically, only major and minor versions are necessary. I propose
including the patchlevel version for future-proofing should we want to
work around known bugs in the future.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I14bee30bb5d2109be0c8c015ed845d70df16630b
include/lttng/ust-ctl.h
src/lib/lttng-ust-ctl/ustctl.c
This page took 0.025169 seconds and 4 git commands to generate.