On Wed, Oct 11, 2017 at 03:36:40PM +0200, Martin Liška wrote: > > std::swap(addr1, addr2); ? I don't see it used in any of libsanitizer > > though, so not sure if the corresponding STL header is included. > > They don't use it anywhere and I had some #include issues. That's why I did > it manually.
Ok. > > There are many kinds of shadow memory markings. My thought was that it > > would start with a quick check, perhaps vectorized by hand (depending on if > > the arch has unaligned loads maybe without or with a short loop for > > Did that, but I have no experience how to make decision about prologue that > will > align the pointer? Any examples? First of all, why are you aligning anything? > + uptr aligned_addr1 = addr1 & ~(SANITIZER_WORDSIZE/8 - 1); // align addr. > + uptr aligned_addr2 = addr2 & ~(SANITIZER_WORDSIZE/8 - 1); // align addr. You want to compare what the pointers point to, not what the aligned pointer points to. Actually, looking around, there already is __sanitizer::mem_is_zero which does what we want. Or even __asan_region_is_poisoned(addr1, addr2 - addr1). Jakub