Freezing because cwdstuff::set has excessive release_write

tryandbuy tryandbuy@proton.me
Tue Oct 10 19:22:03 GMT 2023


I think that there is an excessive release_write() in cwdstuff::set.
A link to the call:
https://github.com/cygwin/cygwin/blob/fe5886a500e66cddf0f57eea3049d25d5f8765e9/winsup/cygwin/path.cc#L4871C13-L4871C13

This call leads to a double release of SRW lock which causes deadlocks in some cases.

Test cases to this issue:
1) using Cygwin terminal
  1.  open Cygwin terminal
  2.  mkdir test; cd test; echo 123 > 1.txt
  3.  chmod -x .
  4.  strace cat 1.txt  # <-- freeze
      # cd ..; strace cat test/1.txt  # <-- no freeze

2) using windows console
  1. open cmd.exe
  2. cd <path to the previously created test directory>
  3. C:\cygwin64\bin\cat.exe 1.txt  & rem <-- freeze
     rem cd ..; C:\cygwin64\bin\cat.exe test\1.txt <-- no freeze



More information about the Cygwin mailing list