fix: relayd: unaligned access in trace_chunk_registry_ht_key_hash
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 30 Apr 2024 19:17:52 +0000 (15:17 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 1 May 2024 14:56:42 +0000 (10:56 -0400)
commit6dee08cf205eb0c5f9edc37eeb5d10ad61abd0e1
treeda91d83e974d8d452b368c07417f664626d81b52
parentb9984811575702dea69108d180f5e90098709d13
fix: relayd: unaligned access in trace_chunk_registry_ht_key_hash

In 328c2fe7297c941aa9cbcfa4ce944fca1bd7300f, the type of 'lttng_uuid'
was changed from a C array of 16 'uint8_t' to a C++ std::array of the
same type and length.

In 'trace_chunk_registry_ht_key_hash()' we access these 16 bytes as 2
'uint64_t', to do so we used to cast the array to '(uint64_t *)' and
then access index 0 and 1.

When it was converted to C++, an error was introduced where instead we
reinterpret_cast to 'const uint64_t *' the index 0 and 1 of the array
which results in a 'uint64_t' pointer to the first and second bytes of
the array. These values overlap but since they are used as keys for an
hash table it still works. However, on platforms that don't allow
unaligned access, the second pointer being only offset by one byte
results in a 'Bus error'.

Reintroduce the old behavior by applying the index 0 and 1 to the
pointer resulting from the reinterpret_cast.

Change-Id: I2bc287edbe6864a2a870f9de1f3b4dd8f8a90ace
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/sessiond-trace-chunks.cpp
This page took 0.026875 seconds and 4 git commands to generate.