New issue
Advanced search Search tips

Issue 596208 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 595158
Owner: ----
Closed: Mar 2016
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

AVX vectorization in UCRT causes DrMemory warnings

Project Member Reported by brucedaw...@chromium.org, Mar 18 2016

Issue description

If a compatible CPU is found then wcslen and other Windows 10 Universal CRT functions will use AVX instructions. These may cause reads beyond the end of objects. As a comment in common_strlen_simd says:

// Note that in phase [2] we may read bytes beyond the terminator (and thus
// beyond the end of the string).  This is okay, because we are reading
// aligned chunks, so a chunk will never straddle a page boundary and if we
// can read any byte from the chunk we can read all bytes from the chunk.

These reads are safe for the CRT to do, but they are illegal according to the C/C++ standard (other code would not be allowed such liberties).

This behavior causes warnings in DrMemory. The warnings do not indicate a bug in DrMemory, and they do not indicate a bug in the CRT, so they should be dealt with by careful suppressions.

 
Mergedinto: 595158
Status: Duplicate (was: Untriaged)
Optimized string routines have always had such behavior: there is nothing there that is specific to AVX or UCRT.

Optimized string routines have been dealt with in tools like Dr. Memory and Memcheck by replacing the optimized routines with simpler versions.  The only issue here is that wcsnlen was not being replaced (all other str* and wcs* were replaced) which is https://github.com/DynamoRIO/drmemory/issues/350 and https://github.com/DynamoRIO/drmemory/issues/1869.

Sign in to add a comment