DynamoRIO / DynamoRIO/drmemory

False reports when setting thread names on Windows

Open
#48 1 comment 0 reactions 0 assignees View on GitHub
Bug-FalsePositive Migrated OpSys-Windows Priority-Low
Dominant language
C
Stars
2.7k
Forks
290
PR merge metrics
No merged PRs in 30d

Description

_From [timurrrr@google.com](https://code.google.com/u/timurrrr@google.com/) on September 07, 2010 09:21:52_

On Windows, as of r46 :
===test.cpp===
#include

DWORD WINAPI foo(void_) {
// See http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx #pragma pack(push,8)
typedef struct tagTHREADNAME_INFO
{
DWORD dwType; // Must be 0x1000.
LPCSTR szName; // Pointer to name (in user addr space).
DWORD dwThreadID; // Thread ID (-1=caller thread).
DWORD dwFlags; // Reserved for future use, must be zero.
} THREADNAME_INFO;
#pragma pack(pop)
THREADNAME_INFO info = { 0x1000, "My Thread Name", GetCurrentThreadId(), 0};
__try {
RaiseException(0x406D1388, 0, sizeof(info)/sizeof(DWORD), (DWORD_)&info );
}
__except(EXCEPTION_CONTINUE_EXECUTION) { }
return 0;
}

int main() {
DWORD id = 0;l
HANDLE thr = CreateThread(NULL, 0, foo, NULL, 0, &id);
WaitForSingleObject(thr, INFINITE);
return 0;
}
#

cl /Zi /nologo && drmemory.exe test.exe
->
Error `#1`: UNINITIALIZED READ: reading 0x008cfc44-0x008cfc48 4 byte(s) within 0x008cfc44-0x008cfc48
@0:00:01.641 in thread 4256
system call NtContinue

0x0040108b test.exe!foo
z:\dr-sandbox\issues\threadname\test.cpp:16
0x7c80b729 KERNEL32.dll!GetModuleFileNameA
??:0

_Original issue: http://code.google.com/p/drmemory/issues/detail?id=48_

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.