DynamoRIO / DynamoRIO/dynamorio

CRASH: using drsym_init causes DR assert+crash when running windows 32-bit program

Open
#5,966 10 comments 0 reactions 0 assignees View on GitHub
Bug-Assert Bug-DRCrash Component-Extension help wanted OpSys-Windows
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 15h
Merged PRs (30d)
31

Description

**Describe the bug**
Using drsym_init causes application crash when running windows 32-bit program as shown below.
![image](https://user-images.githubusercontent.com/43752155/230898962-ffd2041c-9446-42ab-b878-1b48e1917055.png)
The "a.exe" is a 32-bit program that prints out "hello world". **The crash occurs only when drsym_init is used.**

**To Reproduce**
Steps to reproduce the behavior:
1. Pointer to a minimized application (ideally the source code for it and instructions on which toolchain it was built with).
2. Precise command line for running the application.
3. Exact output or incorrect behavior.

application source code
```
#include

#include "dr_api.h"
#include "drmgr.h"
#include "drx.h"
#include "drreg.h"
#include "drsyms.h"

DR_EXPORT void dr_client_main(client_id_t id, int argc, const char *argv[])
{
dr_set_client_name("test", "test");
drsym_init(0);
}
```

CMakeLists.txt
```
cmake_minimum_required(VERSION 3.12.1)
project(CoverageMonitor)

find_package(DynamoRIO)
if (NOT DynamoRIO_FOUND)
message(FATAL_ERROR "DynamoRIO package required to build")
endif(NOT DynamoRIO_FOUND)

set(srcs
test.c
)

add_library(test SHARED ${srcs})

configure_DynamoRIO_client(test)
use_DynamoRIO_extension(test drmgr)
use_DynamoRIO_extension(test drx)
use_DynamoRIO_extension(test drcontainers)
use_DynamoRIO_extension(test drreg)
use_DynamoRIO_extension(test drwrap)
use_DynamoRIO_extension(test drsyms)
```

commands used to build
```
cmake -A Win32 -DDynamoRIO_DIR=C:\Users\19730\projects\tools\DynamoRIO-Windows-9.92.19454\DynamoRIO-Windows-9.92.19454\cmake ..
cmake --build . --config Debug
```

run
```
C:\Users\19730\projects\tools\DynamoRIO-Windows-9.92.19454\DynamoRIO-Windows-9.92.19454\bin32\drrun.exe -c .\Debug\test.dll -- C:\Users\19730\projects\tools\dynamorio_issue_env\hello_word_32\a.exe
```

crash log
```

```

Please also answer these questions:
- What happens when you run without any client?
Running without any client is just fine.

- What happens when you run with debug build ("-debug" flag to drrun/drconfig/drinject)?
![image](https://user-images.githubusercontent.com/43752155/230899772-f719a715-fb47-4e3a-949d-c6200e36e393.png)

**Expected behavior**
The console prints out "hello world"

**Versions**
- What version of DynamoRIO are you using?
DynamoRIO-Windows-9.92.19454

- Does the latest build from https://github.com/DynamoRIO/dynamorio/releases solve the problem?
No

- What operating system version are you running on? ("Windows 10" is *not* sufficient: give the release number.)
Windows 10 19045.2728

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.