DynamoRIO / DynamoRIO/dynamorio
fpstate save not working in thread_init_event
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 31
Description
The following minimal reproducer crashes in the current (and past) DynamoRIO versions, running in non-debug mode. In `-debug` mode, everything works as expected.
```c
DR_EXPORT void dr_client_main(client_id_t id, int argc, const char *argv[]){
if (!drmgr_init()) DR_ASSERT(false);
drmgr_register_thread_init_event(event_thread_init);
}
static void event_thread_init(void *drcontext)
{
byte fp_raw[512 + 16];
byte *fp_align = (byte *)((((ptr_uint_t)fp_raw) + 16) & ((ptr_uint_t)-16));
proc_save_fpstate(fp_align);
dr_printf("TEST %f\n", 0.2f);
proc_restore_fpstate(fp_align);
}
```
**Command + Output:**
```
drrun.exe -c drace-client/drace-client.dll -- /c/Program\ Files/7-Zip/7zFM.exe
TEST 0.200000
TEST 0.200000
```
**Environment**
```
DR: drrun version 7.0.17744 -- build 0
OS: Windows 10, Version 1703, Build 15063.1206
```
Contributor guide
Assessment
This issue has not been assessed yet.