From: Jérémie Galarneau Date: Fri, 29 Sep 2023 19:16:48 +0000 (-0400) Subject: Fix: urcu-bp: misaligned reader accesses X-Git-Url: http://git.liburcu.org/?a=commitdiff_plain;h=e9b7cb520e0dd1f3591697bb62b6683f01ad6ca5;hp=e9b7cb520e0dd1f3591697bb62b6683f01ad6ca5;p=urcu.git Fix: urcu-bp: misaligned reader accesses This is a port from a fix in LTTng-UST's embedded urcu (d1a0fad8). The original message follows: Running the LTTng-tools tests (test_valid_filter, for example) under address sanitizer results in the following warning: /usr/include/lttng/urcu/static/urcu-ust.h:155:6: runtime error: member access within misaligned address 0x7fc45db3a020 for type 'struct lttng_ust_urcu_reader', which requires 128 byte alignment 0x7fc45db3a020: note: pointer points here c4 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ While the node member of lttng_ust_urcu_reader has an "aligned" attribute of CAA_CACHE_LINE_SIZE, the compiler can't ensure the alignment of members for dynamically allocated instances. The `data` pointer is changed from char* to struct lttng_ust_urcu_reader*, allowing the compiler to enforce the expected alignment constraints. Since `data` was addressed in bytes, the code using this field is adapted to use element counts. As the chunks are only used to allocate reader instances (and not other types), it makes the code a bit easier to read. Signed-off-by: Jérémie Galarneau Signed-off-by: Mathieu Desnoyers Change-Id: I89ea1c32ca3c5c45621b562ab68f47a8428d3574 ---