Attention is currently required from: pespin.
fixeria has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/libosmocore/+/43150?usp=email )
Change subject: linuxlist: fix false-positive UBSan misaligned-access reports ......................................................................
linuxlist: fix false-positive UBSan misaligned-access reports
llist_for_each_entry() and its variants terminate by comparing &pos->member against head. Once a full traversal reaches the end of a non-empty list (or the list is empty to begin with), pos becomes a pure container_of()-computed sentinel address that was never a real object of typeof(*pos), only ever the plain 'struct llist_head *' passed in as head. Forming 'pos->member' on that address requires pos to satisfy the alignment of typeof(*pos), which the sentinel does not necessarily provide (e.g. embedded struct osmo_timer_list/gprs_nsvc on 32-bit ARM with a 64-bit time_t need 8-byte alignment, while head itself is only pointer-aligned) - tripping -fsanitize=alignment even though no real object is ever misaligned or dereferenced.
Add __llist_member(), computing the same address via 'char *' pointer arithmetic and an explicit cast to 'struct llist_head *', which carries no alignment requirement of its own. Use it for the loop termination check, the "next" pointer computation, and the prefetch() calls (dereferencing the returned struct llist_head * still only requires pointer alignment, so prefetch() keeps working exactly as before without reintroducing the false positive).
Change-Id: I0424e76e76d8aa9402bd1a5aefe789de16e72fae Related: OS#7036, OS#6858 --- M include/osmocom/core/linuxlist.h 1 file changed, 33 insertions(+), 19 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/50/43150/2