Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lbtrace opened this issue Jul 13, 2021 · 4 comments

Comments

@lbtrace
Copy link

lbtrace commented Jul 13, 2021

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 ?

@lbtrace lbtrace changed the title boost.lockfree tagged_ptr conflict with HWASan (From LLVM clang) boost.lockfree tagged_ptr conflict with HWASan (From LLVM project) Jul 13, 2021
@lbtrace lbtrace changed the title boost.lockfree tagged_ptr conflict with HWASan (From LLVM project) boost.lockfree tagged_ptr conflict with Hardware-assisted AddressSanitizer(HWASan) from LLVM project Jul 13, 2021
@timblechmann
Copy link
Collaborator

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?

@lbtrace
Copy link
Author

lbtrace commented Jul 14, 2021

@timblechmann thanks your reply.

@timblechmann
Copy link
Collaborator

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 ...

@lbtrace
Copy link
Author

lbtrace commented Jul 16, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants