DynamoRIO / DynamoRIO/dynamorio
[CRASH] Failure on some functions of the standard library on new Windows 10
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 31
Description
**Describe the bug**
When DR client invokes some standard library functions (for example, `localtime_s` or `std::mutex`), execution suddenly hangs for a second, then just stops - it finishes silently, without any error messages (neither GUI nor command-line). I would call it a silent crash (hence the category of this issue). It happens with any application under new DynamoRIO on new Windows 10. It seems that the process just exits (but with a strange exit code: `echo %errorlevel%` shows `-529697949`).
**To Reproduce**
It's pretty simple to reproduce the bug: we need to write a tiny client invoking a problematic function, compile it using standard cmake way for DR, and run with any application (some "HelloWorld").
Example 1 - `std::mutex`
The client (include headers omitted):
```
void dr_client_main(client_id_t id, int argc, const char *argv[]) {
dr_printf("dr_client_main\n");
std::mutex mtx;
mtx.lock();
mtx.unlock();
dr_printf("OK\n");
}
```
Run:
```
dr\bin64\drrun.exe -c client.dll -- prog.exe
```
Output:
```
dr_client_main
```
Example 2 - `localtime_s`
The client:
```
void dr_client_main(client_id_t id, int argc, const char *argv[]) {
dr_printf("dr_client_main\n");
struct tm stm;
time_t t = time(NULL);
dr_printf("localtime_s\n");
localtime_s(&stm, &t);
dr_printf("OK\n");
}
```
Output:
```
dr_client_main
localtime_s
```
**Expected behavior**
Standard library functions should work properly (I have faced only these two cases, maybe other examples exist).
**Versions**
DynamoRIO - version 8.0.0-1 (downloaded from the official website)
OS Windows 10 - version 2004 (build 19041.508)
This is a VirtualBox machine by Microsoft:
https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/
64-bit
**Additional context**
When the target application uses the aforementioned functions - it works OK; the problem is only when the client does.
These examples work normally on Linux.
I can use DR API analogues instead of these functions, of course, but it doesn't allow me to use some third-party libraries (for example, spdlog) which can invoke various standard library functions.
I have tried to perform a debug run (`dr\bin64\drrun.exe -debug -c client.dll -- prog.exe`). However, it always fails, even with client/application which work properly without debug. The output:
```
```
Contributor guide
Assessment
This issue has not been assessed yet.