[eigen] Eigen and clang address sanitizer

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

Hi all!

I compile an application using Eigen with clang address sanitizer, and run this application but hit a SEGV.

I see there was a bug "GCC address sanitizer breaks 16-byte alignment of glibc malloc" (https://eigen.tuxfamily.org/bz/show_bug.cgi?id=552). It seems this is a same issue with the gcc one.

In https://gitlab.com/libeigen/eigen/-/commit/b6dc2613acbb4659988eb3237225bb0974d85d52
we use macro __SANITIZE_ADDRESS__ to detect if Eigen is compiled with address sanitizer, but clang do not recognize this macro, clang use __has_feature(address_sanitizer).

To verify, I'm manually define EIGEN_MALLOC_ALREADY_ALIGNED to 0 and build with clang address sanitizer again. However, this time address sanitizer reports SEGV again.

The SEGV is caused by Eigen::internal::pstore(double* to, double vector[4] const& from), when we call _mm256_store_pd(to, from), the address of to is not aligned to 32.

Is there anyone hit a similar issue or is there anyone tried building and running an application using Eigen with clang address sanitizer instrumented ?

Xu Mingjie

Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/