Files
MINGW-packages/mingw-w64-python-installer/004-zero-reservered-fields-in-startupinfo.patch
Joel Holdsworth a9b746da71 python-installer: Zero lpReserved2 and cbReserved2 fields in simple_launcher STARTUPINFOW
simple_launcher currently copies the values of lpReserved2 and cbReserved2 from
the parent process to the child. In some cases, these fields are used to pass
information. For example, the MSVC C runtime uses the fields as part of its
_spawn implementation to pass file descriptor information to the child. However,
this information is invalid in the grand-child proces.

This issue is a cause of a bug when CMake attempts to launch a python-installer
child process:

  * https://gitlab.kitware.com/cmake/cmake/-/issues/25996

This patch corrects the issue by applying a patch to zero the fields.
2024-07-18 01:00:25 +05:30

38 lines
1.2 KiB
Diff

From 63deda9f0a881c7577a70744fbd19e73f7a6dcdb Mon Sep 17 00:00:00 2001
From: Joel Holdsworth <jholdsworth@nvidia.com>
Date: Wed, 17 Jul 2024 11:35:16 -0700
Subject: [PATCH] Zero lpReserved2 and cbReserved2 fields in STARTUPINFOW
simple_launcher currently copies the values of lpReserved2 and cbReserved2 from
the parent process to the child. In some cases, these fields are used to pass
information. For example, the MSVC C runtime uses the fields as part of its
_spawn implementation to pass file descriptor information to the child. However,
this information is invalid in the grand-child proces.
This issue is a cause of a bug when CMake attempts to launch a python-installer
child process:
* https://gitlab.kitware.com/cmake/cmake/-/issues/25996
This patch corrects the issue by zeroing the fields.
---
launcher.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/launcher.c b/launcher.c
index c965d19..d15ab91 100644
--- a/launcher.c
+++ b/launcher.c
@@ -519,6 +519,8 @@ run_child(wchar_t * cmdline)
assert(ok, "Job information setting failed");
memset(&si, 0, sizeof(si));
GetStartupInfoW(&si);
+ si.lpReserved2 = NULL;
+ si.cbReserved2 = 0;
/*
* See https://github.com/pypa/pip/issues/10444#issuecomment-973396812
*/
--
2.45.1