boostorg / lockfree

Boost.Lockfree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

boost.lockfree tagged_ptr conflict with Hardware-assisted AddressSanitizer(HWASan) from LLVM project

lbtrace opened this issue · comments

As we know, boost using tagged_ptr avoid CAS ABA issue. But in aarch64, tagged_ptr_ptrcompression using top bits of pointer, but HWASan also using top bits of pointer, so conflict.
HWASan help detect memory bugs in LLVM project, so should boost lockfree compat HWASan ?

do aarch64 have any form of double-width compare and swap? disabling the ptrcompression would probably result in using 128bit atomics, which would have to be emulated by using locks (with all the side effects that one could not use the data structures in shared memory for example).

would it be possible to simply exclude the ptrcompression code from hwasan via compiler attributes?

@timblechmann thanks your reply.

Actually, in Aarch64 from armv8.1 "CASP" instruction can support 128 bits CAS operation

interesting. i don't have access to any armv8.1 (just a rpi4, which seems to be armv8.0). could you try to change https://github.com/boostorg/lockfree/blob/develop/include/boost/lockfree/detail/prefix.hpp#L26 to disable pointer compression for arm 8.1.0 and check it the atomics are lockfree? also i wonder if there are any performance implications that may favour pointer compression with 64bit cas over 128 cas ...

@timblechmann I can't identify minor version "x" of armv8.x, maybe I only disable pointer compression for hwasan test