DynamoRIO / DynamoRIO/dynamorio
Signal delivery to windows application not working in Powershell
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 31
Description
When running a windows application in Powershell with DynamoRIO + client, signals like "Ctrl-c" (issued from the terminal) are not delivered to the application.
However, when running without a client (just DR), the signal handling works as expected. In other shells like MinGW bash, the signal delivery works as expected.
I tested with:
**DynamoRIO**: 7.91.18137
**Windows: Version** 10.0.17134 Build 17134
**Client**: bbcount (applies to all other tested clients as well)
**Shell**: PowerShell
As recommended on the mailing-list, I also run with -loglevel 2. There the shutdown thread bb's are not visible. In a pure DR run, I see lines like the following. In a DR+client run, they do not appear:
```
d_r_dispatch: target = 0x00007ffc7c803683
Fragment 2, tag 0x00007ffc7c803683, flags 0x1000630, shared, size 70:
[ntdll.dll~RtlUserThreadStart+0x13,~RtlExitUserThread-0x3d]
Entry into F2(0x00007ffc7c803683).0x00007ff705b51034 (shared)
Exit from sourceless ibl: bb call* []
(target 0x00007ffc7c82e350 not in cache)
```
In both executions, two threads are detected by DR.
Sample test code:
```cpp
#include
#include
#include
#include
#include
std::atomic running{ true };
void sig_handler(int signal)
{
if (signal == SIGINT) {
running.store(false, std::memory_order_relaxed);
}
std::cout << "Got signal" << std::endl;
}
int main(int argc, char ** argv) {
std::cout << "Start application, hit ctrl-c to quit" << std::endl;
std::signal(SIGINT, sig_handler);
while (running.load(std::memory_order_relaxed))
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
std::cout << "quit!" << std::endl;
}
```
Contributor guide
Assessment
This issue has not been assessed yet.