DynamoRIO / DynamoRIO/dynamorio

APP CRASH on AMD Zen5 with vcruntime140.dll version 14.51.36247.0 in memcpy

Open
#7,957 3 comments 0 reactions 0 assignees View on GitHub
OpSys-Windows
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 15h
Merged PRs (30d)
31

Description

When executing a C++ program built with Visual Studio and running with vcruntime140.dll version 14.51.36247.0, memcpy (and probably memmove and other code copying regions of memory) uses a specially handcrafted implementation from memcpy_avx_ermsb_aligned_amd.asm

When this code is executed under drrun.exe, sometimes the memory is not copied correctly. A sequence of 24 or 32 zeroes appears at a distance of 32 bytes from the start of the destination address. I have been unable to construct a small reproducible example, as the effect is not always present and moves to other source code locations when changing the source code. Copying a lot of strings and checking the string content for contained zeroes should trigger the error.

I suspect the state necessary for correctly executing the new ERMSB (Enhanced REP MOVSB) instructions is not saved and restored across context switches.

I have seen the errors only on AMD Zen5, namely AMD Ryzen Threadripper 9960X processors. The executables run fine under drrun.exe with the vcruntime140 version given above on not Zen5-compatible AMD machines.

The errors started to appear after a Windows update middle of May which upgraded vcruntime140.dll
Running the application under drrun while using an older version of vcruntime140.dll, everything works as expected.

The errors persist even when running without any client in drrun. I have tried different flags but none did alter the behaviour:
-opt_cleancall 0
-max_bb_instrs 1
-debug

I have tried the latest release 11.3.0 and the latest cronbuild-11.91.20615

I run under Windows 11 Enterprise 25H2, Build 26200.8655
My application is x64.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the corruption with drrun.exe on the listed Windows 11 AMD Zen5 system, comparing the newer and older vcruntime140.dll versions and the tested DynamoRIO builds. Investigate how drrun.exe handles context switches around the memcpy_avx_ermsb_aligned_amd.asm path and whether the reported copy errors can be made reproducible. Done means the affected memcpy workload copies correctly under drrun.exe.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp
Domain
devtools, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.