Fix: missing include can cause structures to not be packed
A number of files declaring "packed" structures (using the LTTNG_PACKED
macro) do not include common/macros.h, which defines this macro.
This results in structures being used in their "unpacked" form, or
under both packed and unpacked forms, depending on the other files
included at the point of definition and use of these structures.
It is unclear which of the users of these structures were actually
affected by the bug. Most of these structures are used for IPC
over a UNIX socket. In these cases, it is reasonable to assume that
lttng-tools will be rebuilt completely to take this change into
account.
However, the structures declared in common/sessiond-comm/relayd.h are
more worrying as they are part of the relay daemon's network protocol.
Fortunately, adding the following directive to
common/sessiond-comm/relayd.h confirms that the header is included
transitively where those structures are used.
> #ifndef LTTNG_PACKED
> #error Not defined!
> #endif
Instances of this issue were found using the following script.
for file in $(ag -l LTTNG_PACKED); do
ag "#include \<common/macros\.h\>" -l ${file} > /dev/null
if [ $? -ne 0 ]; then
echo "Missing include in" $file
fi
done
Running this script produces the following output (annotated):
Missing include in include/lttng/channel-internal.h
Missing include in include/lttng/condition/buffer-usage-internal.h
Missing include in include/lttng/condition/session-consumed-size-internal.h
Missing include in include/lttng/condition/session-rotation-internal.h
Missing include in src/common/sessiond-comm/sessiond-comm.h
Missing include in src/common/sessiond-comm/relayd.h
Missing include in src/common/sessiond-comm/agent.h
> LTTNG_PACKED mentioned in comments
Missing include in src/common/optional.h
> Unneeded.
Missing include in src/common/macros.h
> lttng-ust-abi.h defines its own version of LTTNG_PACKED
> and is included by lttng-ust-ctl.h
Missing include in src/bin/lttng-sessiond/lttng-ust-ctl.h
Missing include in src/bin/lttng-sessiond/lttng-ust-abi.h
Missing include in src/lib/lttng-ctl/filter/filter-bytecode.h
> False positives (not source files)
Missing include in packed.sh
Missing include in ChangeLog
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.026568 seconds and 4 git commands to generate.