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.
38 lines
1.2 KiB
Diff
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
|
|
|