Fix: urcu-bp: misaligned reader accesses
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 29 Sep 2023 19:16:48 +0000 (15:16 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 30 Sep 2023 15:31:50 +0000 (11:31 -0400)
commit965e60edf1aad42f8981887d5fc50e29380c37e4
tree5fa1c77d228241ce907876de02593ec4637053cc
parentdad4e6b76774924762a4eb56def7fbaee38d7653
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 <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I89ea1c32ca3c5c45621b562ab68f47a8428d3574
src/urcu-bp.c
This page took 0.025955 seconds and 4 git commands to generate.