msys2 / msys2/msys2-runtime

bash.exe、mintty.exe hung, hacking way cause app hung in msys-2.0.dll

Open
#324 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
240
Forks
60
Avg merge
2d 3h
Merged PRs (30d)
1

Description

msys-2.0.dll which from cygwin project that using a hacking way to find the current dir path.

see,

https://github.com/msys2/msys2-runtime/blob/0eeda3e131b580df38367f3c71df2cea2c18ee50/winsup/cygwin/path.cc#L4859

the app hung when RtlGetCurrentDirectory_U is already hooked by other dll, and the opcode operator has an 0xE8,

that make this func find_fast_cwd_pointer get wrong lock pointer from PEB.

after that. when access the wrong pointer cause app hung or acccess violation.

this bug was fixed since April 2025 in cygwin project, see below

https://github.com/cygwin/cygwin/blob/b41e3b652c4215556a62a2f47e8f8f11553fa550/winsup/cygwin/x86_64/fastcwd.cc#L40

Image

It would be greate to merge this fix;

this effect a lot of sofware which dependence on msys-2.0.dll

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare winsup/cygwin/path.cc, especially find_fast_cwd_pointer, with the referenced upstream winsup/cygwin/x86_64/fastcwd.cc fix. First inspect how the hooked RtlGetCurrentDirectory_U opcode is handled; done means the corresponding upstream fix is integrated and the reported hang or access violation no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.