efficient / libcuckoo

A high-performance, concurrent hash table
Other
1.62k stars 275 forks source link

spinlock instances call on misaligned address #97

Closed w41ter closed 5 years ago

w41ter commented 6 years ago
$ uname -a
Linux Desktop 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux
$ clang++ --version
clang version 5.0.0-3~16.04.1 (tags/RELEASE_500/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

when compile with -fsanitize=undefined to check undefined behaviour, throws:

include/libcuckoo/cuckoohash_map.hh:762:5: runtime error: constructor call on misaligned address 0x7f3776070010 for type 'cuckoohash_map<std::__1::basic_string<char>, std::__1::basic_string<char>, std::__1::hash<std::__1::basic_string<char> >, std::__1::equal_to<std::__1::basic_string<char> >, std::__1::allocator<std::__1::pair<const std::__1::basic_string<char>, std::__1::basic_string<char> > >, 4>::spinlock *', which requires 64 byte alignment
0x7f3776070010: note: pointer points here
 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 00 00
manugoyal-nuro commented 6 years ago

Thanks for investigating! I think this is a duplicate of #53. The fix would be to use an aligned allocator for spinlocks.

manugoyal commented 5 years ago

Closing as this is a duplicate of #53.