https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=cae4c32e1b7da82e8af6dfa715f4011e504595ac

commit cae4c32e1b7da82e8af6dfa715f4011e504595ac
Author:     Igor Podgainoi <[email protected]>
AuthorDate: Thu Feb 12 16:57:48 2026 +0000
Commit:     Corinna Vinschen <[email protected]>
CommitDate: Thu Feb 12 21:11:10 2026 +0100

    Cygwin: hookapi.cc: Fix some handles not being inherited when spawning
    
    Under Windows on Arm (AArch64), the function hook_or_detect_cygwin will
    return NULL early, which will cause the call to real_path.set_cygexec
    in av::setup to accept false as a parameter instead of true.
    
    Afterwards, in child_info_spawn::worker the call to
    child_info_spawn::set would eventually pass that false result of
    real_path.iscygexec() to the child_info constructor as the boolean
    variable need_subproc_ready, where the flag _CI_ISCYGWIN will be
    erroneously not set.
    
    Later in child_info_spawn::worker the failed iscygwin() flag check will
    cause the "parent" process handle to become non-inheritable. This patch
    fixes the non-inheritability issue by introducing a new check for the
    IMAGE_FILE_MACHINE_ARM64 constant in the function PEHeaderFromHModule.
    
    Tests fixed on AArch64:
    winsup.api/signal-into-win32-api.exe
    winsup.api/ltp/fcntl07.exe
    winsup.api/ltp/fcntl07B.exe
    winsup.api/posix_spawn/chdir.exe
    winsup.api/posix_spawn/fds.exe
    winsup.api/posix_spawn/signals.exe
    
    Signed-off-by: Igor Podgainoi <[email protected]>

Diff:
---
 winsup/cygwin/hookapi.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/winsup/cygwin/hookapi.cc b/winsup/cygwin/hookapi.cc
index ee2edbafeef6..b0126ac04e3e 100644
--- a/winsup/cygwin/hookapi.cc
+++ b/winsup/cygwin/hookapi.cc
@@ -45,6 +45,8 @@ PEHeaderFromHModule (HMODULE hModule)
     {
     case IMAGE_FILE_MACHINE_AMD64:
       break;
+    case IMAGE_FILE_MACHINE_ARM64:
+      break;
     default:
       return NULL;
     }

Reply via email to