public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: drop Vista WOW64 specific child process handle bug
@ 2021-10-29 19:03 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2021-10-29 19:03 UTC (permalink / raw)
  To: cygwin-cvs

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

commit e36811afb4d86dc70aa3c8c06dafbc3f9782f456
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Fri Oct 29 14:52:58 2021 +0200

    Cygwin: drop Vista WOW64 specific child process handle bug
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/child_info.h |  2 +-
 winsup/cygwin/sigproc.cc   | 28 ++++------------------------
 winsup/cygwin/wincap.cc    | 12 ------------
 winsup/cygwin/wincap.h     |  2 --
 4 files changed, 5 insertions(+), 39 deletions(-)

diff --git a/winsup/cygwin/child_info.h b/winsup/cygwin/child_info.h
index 505eaef23..7a67a1b51 100644
--- a/winsup/cygwin/child_info.h
+++ b/winsup/cygwin/child_info.h
@@ -52,7 +52,7 @@ struct cchildren
 class child_info
 {
 public:
-  DWORD msv_count;	// set to pseudo-count on Vista WOW64, zeroed otherwise
+  DWORD msv_count;	// set to 0
   DWORD cb;		// size of this record
   DWORD intro;		// improbable string
   DWORD magic;		// magic number unique to child_info
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 47352c213..8e70a9329 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -809,31 +809,11 @@ int child_info::retry_count = 0;
    by fork/spawn/exec. */
 child_info::child_info (unsigned in_cb, child_info_types chtype,
 			bool need_subproc_ready):
-  cb (in_cb), intro (PROC_MAGIC_GENERIC), magic (CHILD_INFO_MAGIC),
-  type (chtype), cygheap (::cygheap), cygheap_max (::cygheap_max),
-  flag (0), retry (child_info::retry_count), rd_proc_pipe (NULL),
-  wr_proc_pipe (NULL)
+  msv_count (0), cb (in_cb), intro (PROC_MAGIC_GENERIC),
+  magic (CHILD_INFO_MAGIC), type (chtype), cygheap (::cygheap),
+  cygheap_max (::cygheap_max), flag (0), retry (child_info::retry_count),
+  rd_proc_pipe (NULL), wr_proc_pipe (NULL)
 {
-  /* It appears that when running under WOW64 on Vista 64, the first DWORD
-     value in the datastructure lpReserved2 is pointing to (msv_count in
-     Cygwin), has to reflect the size of that datastructure as used in the
-     Microsoft C runtime (a count value, counting the number of elements in
-     two subsequent arrays, BYTE[count and HANDLE[count]), even though the C
-     runtime isn't used.  Otherwise, if msv_count is 0 or too small, the
-     datastructure gets overwritten.
-
-     This seems to be a bug in Vista's WOW64, which apparently copies the
-     lpReserved2 datastructure not using the cbReserved2 size information,
-     but using the information given in the first DWORD within lpReserved2
-     instead.  However, it's not clear if a non-0 count doesn't result in
-     trying to evaluate the content, so we do this really only for Vista 64.
-
-     The value is sizeof (child_info_*) / 5 which results in a count which
-     covers the full datastructure, plus not more than 4 extra bytes.  This
-     is ok as long as the child_info structure is cosily stored within a bigger
-     datastructure. */
-  msv_count = wincap.needs_count_in_si_lpres2 () ? in_cb / 5 : 0;
-
   fhandler_union_cb = sizeof (fhandler_union);
   user_h = cygwin_user_h;
   if (strace.active ())
diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc
index 6c79d8710..dbf36272b 100644
--- a/winsup/cygwin/wincap.cc
+++ b/winsup/cygwin/wincap.cc
@@ -23,7 +23,6 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
   mmap_storage_high:0x070000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:true,
     needs_query_information:true,
     has_gaa_largeaddress_bug:true,
     has_broken_alloc_console:false,
@@ -59,7 +58,6 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
   mmap_storage_high:0x070000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:true,
     has_gaa_largeaddress_bug:true,
     has_broken_alloc_console:true,
@@ -95,7 +93,6 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
   mmap_storage_high:0x070000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:true,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -131,7 +128,6 @@ wincaps wincap_8_1 __attribute__((section (".cygwin_dll_common"), shared)) = {
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -167,7 +163,6 @@ wincaps  wincap_10_1507 __attribute__((section (".cygwin_dll_common"), shared))
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -203,7 +198,6 @@ wincaps  wincap_10_1607 __attribute__((section (".cygwin_dll_common"), shared))
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -239,7 +233,6 @@ wincaps wincap_10_1703 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -275,7 +268,6 @@ wincaps wincap_10_1709 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -311,7 +303,6 @@ wincaps wincap_10_1803 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -347,7 +338,6 @@ wincaps wincap_10_1809 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -383,7 +373,6 @@ wincaps wincap_10_1903 __attribute__((section (".cygwin_dll_common"), shared)) =
   mmap_storage_high:0x700000000000LL,
   {
     is_server:false,
-    needs_count_in_si_lpres2:false,
     needs_query_information:false,
     has_gaa_largeaddress_bug:false,
     has_broken_alloc_console:true,
@@ -482,7 +471,6 @@ wincapc::init ()
       && !wow64)
 #endif
     {
-      ((wincaps *)caps)->needs_count_in_si_lpres2 = false;
       ((wincaps *)caps)->has_gaa_largeaddress_bug = false;
       ((wincaps *)caps)->has_broken_prefetchvm = false;
       ((wincaps *)caps)->no_msv1_0_s4u_logon_in_wow64 = false;
diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h
index 7249b9518..150ad253b 100644
--- a/winsup/cygwin/wincap.h
+++ b/winsup/cygwin/wincap.h
@@ -17,7 +17,6 @@ struct wincaps
      ops generated by gcc are off by 4 bytes. */
   struct  __attribute__ ((aligned (8))) {
     unsigned is_server						: 1;
-    unsigned needs_count_in_si_lpres2				: 1;
     unsigned needs_query_information				: 1;
     unsigned has_gaa_largeaddress_bug				: 1;
     unsigned has_broken_alloc_console				: 1;
@@ -85,7 +84,6 @@ public:
   intptr_t IMPLEMENT (mmap_storage_high)
 #endif
   bool  IMPLEMENT (is_server)
-  bool	IMPLEMENT (needs_count_in_si_lpres2)
   bool	IMPLEMENT (needs_query_information)
   bool	IMPLEMENT (has_gaa_largeaddress_bug)
   bool	IMPLEMENT (has_broken_alloc_console)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-29 19:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-29 19:03 [newlib-cygwin] Cygwin: drop Vista WOW64 specific child process handle bug Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).